From 4722d34312a42cc3fca0fb7f6f37168d39a7c2e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Fri, 24 Mar 2017 12:16:51 +0000 Subject: [PATCH 1/3] Rename ReplyCommand in WireProtocol C implementation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - in preparation for connecting the debugger to WireProtocol in C version Signed-off-by: José Simões --- src/CLR/Include/WireProtocol_Message.h | 2 +- src/CLR/WireProtocol/WireProtocol_Message.c | 2 +- .../nanoBooter/WireProtocol_App_Interface.c | 4 ++-- .../nanoBooter/WireProtocol_MonitorCommands.c | 20 +++++++++---------- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/CLR/Include/WireProtocol_Message.h b/src/CLR/Include/WireProtocol_Message.h index bbe260e7ae..e9796da0a7 100644 --- a/src/CLR/Include/WireProtocol_Message.h +++ b/src/CLR/Include/WireProtocol_Message.h @@ -27,6 +27,6 @@ bool WP_Message_Process(WP_Message* message); ////////////////////////////////////////// // helper functions -void ReplyToCommand(WP_Message* message, bool fSuccess, bool fCritical, void* ptr, int size); +void WP_ReplyToCommand(WP_Message* message, bool fSuccess, bool fCritical, void* ptr, int size); #endif // _WIREPROTOCOL_MESSAGE_H_ diff --git a/src/CLR/WireProtocol/WireProtocol_Message.c b/src/CLR/WireProtocol/WireProtocol_Message.c index a787ec9e05..5df91e5156 100644 --- a/src/CLR/WireProtocol/WireProtocol_Message.c +++ b/src/CLR/WireProtocol/WireProtocol_Message.c @@ -16,7 +16,7 @@ static uint8_t* marker; ////////////////////////////////////////// // helper functions -void ReplyToCommand(WP_Message* message, bool fSuccess, bool fCritical, void* ptr, int size) +void WP_ReplyToCommand(WP_Message* message, bool fSuccess, bool fCritical, void* ptr, int size) { WP_Message msgReply; uint32_t flags = 0; diff --git a/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_App_Interface.c b/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_App_Interface.c index ffdfa17788..34c86c5404 100644 --- a/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_App_Interface.c +++ b/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_App_Interface.c @@ -102,14 +102,14 @@ bool WP_App_ProcessPayload(WP_Message* message) // execute command handler and save the result bool commandHandlerExecuteResult = ((bool* (*)(WP_Message*))cmd->handler)(message); - ReplyToCommand(message, commandHandlerExecuteResult, false, NULL, 0); + WP_ReplyToCommand(message, commandHandlerExecuteResult, false, NULL, 0); return true; } cmd++; } - ReplyToCommand(message, false, false, NULL, 0); + WP_ReplyToCommand(message, false, false, NULL, 0); return true; } diff --git a/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_MonitorCommands.c b/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_MonitorCommands.c index cb46d03117..9acd99a300 100644 --- a/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_MonitorCommands.c +++ b/targets/CMSIS-OS/ChibiOS/nanoBooter/WireProtocol_MonitorCommands.c @@ -63,7 +63,7 @@ bool Monitor_Ping(WP_Message* message) Monitor_Ping_Reply cmdReply; cmdReply.m_source = Monitor_Ping_c_Ping_Source_NanoBooter; - ReplyToCommand(message, true, false, &cmdReply, sizeof(cmdReply)); + WP_ReplyToCommand(message, true, false, &cmdReply, sizeof(cmdReply)); } return true; @@ -77,7 +77,7 @@ bool Monitor_OemInfo(WP_Message* message) bool fOK = NanoBooter_GetReleaseInfo(&cmdReply.m_releaseInfo) == true; - ReplyToCommand(message, fOK, false, &cmdReply, sizeof(cmdReply)); + WP_ReplyToCommand(message, fOK, false, &cmdReply, sizeof(cmdReply)); } return true; @@ -103,7 +103,7 @@ bool Monitor_WriteMemory(WP_Message* message) // assume at RAM, directly use the original address ret = AccessMemory(cmd->address, cmd->length, cmd->data, AccessMemory_Write); - ReplyToCommand(message, ret, false, NULL, 0); + WP_ReplyToCommand(message, ret, false, NULL, 0); return ret; } @@ -112,7 +112,7 @@ bool Monitor_Reboot(WP_Message* message) { Monitor_Reboot_Command* cmd = (Monitor_Reboot_Command*)message->m_payload; - ReplyToCommand(message, true, false, NULL, 0); + WP_ReplyToCommand(message, true, false, NULL, 0); if(cmd != NULL) { @@ -141,7 +141,7 @@ bool Monitor_EraseMemory(WP_Message* message) ret = AccessMemory(cmd->address, cmd->length, NULL, AccessMemory_Erase); - ReplyToCommand(message, ret, false, NULL, 0); + WP_ReplyToCommand(message, ret, false, NULL, 0); return ret; } @@ -155,7 +155,7 @@ bool Monitor_CheckMemory(WP_Message* message) ret = AccessMemory(cmd->address, cmd->length, (uint8_t*)&cmdReply.crc, AccessMemory_Check); - ReplyToCommand(message, ret, false, &cmdReply, sizeof(cmdReply)); + WP_ReplyToCommand(message, ret, false, &cmdReply, sizeof(cmdReply)); return ret; } @@ -179,7 +179,7 @@ bool Monitor_MemoryMap(WP_Message* message) map[1].m_length = HalSystemConfig.FLASH1.Size; map[1].m_flags = Monitor_MemoryMap_c_FLASH; - ReplyToCommand(message, true, false, map, sizeof(map)); + WP_ReplyToCommand(message, true, false, map, sizeof(map)); return true; } @@ -203,7 +203,7 @@ bool Monitor_FlashSectorMap(WP_Message* message) // if(device == NULL) // { - ReplyToCommand(message, true, false, NULL, 0); + WP_ReplyToCommand(message, true, false, NULL, 0); return false; // } @@ -213,7 +213,7 @@ bool Monitor_FlashSectorMap(WP_Message* message) // if(pData == NULL) // { -// ReplyToCommand(message, true, false, NULL, 0); +// WP_ReplyToCommand(message, true, false, NULL, 0); // return false; // } // } @@ -246,7 +246,7 @@ bool Monitor_FlashSectorMap(WP_Message* message) // while(device = BlockStorageList_GetNextDevice( *device )); // } -// ReplyToCommand(message, true, false, (void*)pData, rangeCount * sizeof (struct Flash_Sector) ); +// WP_ReplyToCommand(message, true, false, (void*)pData, rangeCount * sizeof (struct Flash_Sector) ); // private_free(pData); From 42d0a68c0240ba06bd0c9e3256bb14ba6566ae19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Fri, 24 Mar 2017 12:32:41 +0000 Subject: [PATCH 2/3] Missed last commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Simões --- .../CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_MonitorCommands.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_MonitorCommands.c b/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_MonitorCommands.c index 879fb39887..054b70c810 100644 --- a/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_MonitorCommands.c +++ b/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_MonitorCommands.c @@ -33,7 +33,7 @@ bool Monitor_Ping(WP_Message* message) Monitor_Ping_Reply cmdReply; cmdReply.m_source = Monitor_Ping_c_Ping_Source_NanoCLR; - ReplyToCommand(message, true, false, &cmdReply, sizeof(cmdReply)); + WP_ReplyToCommand(message, true, false, &cmdReply, sizeof(cmdReply)); } return true; @@ -47,9 +47,8 @@ bool Monitor_OemInfo(WP_Message* message) bool fOK = NanoCLR_GetReleaseInfo(&cmdReply.m_releaseInfo) == true; - ReplyToCommand(message, fOK, false, &cmdReply, sizeof(cmdReply)); + WP_ReplyToCommand(message, fOK, false, &cmdReply, sizeof(cmdReply)); } return true; } - From b8927182603ef62d8fbe3619f7a5425ed818526d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Fri, 24 Mar 2017 12:39:14 +0000 Subject: [PATCH 3/3] Missed last commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Simões --- targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_App_Interface.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_App_Interface.c b/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_App_Interface.c index e4489f8b54..b391ce07a1 100644 --- a/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_App_Interface.c +++ b/targets/CMSIS-OS/ChibiOS/nanoCLR/WireProtocol_App_Interface.c @@ -101,14 +101,14 @@ bool WP_App_ProcessPayload(WP_Message* message) // execute command handler and save the result bool commandHandlerExecuteResult = ((bool* (*)(WP_Message*))cmd->handler)(message); - ReplyToCommand(message, commandHandlerExecuteResult, false, NULL, 0); + WP_ReplyToCommand(message, commandHandlerExecuteResult, false, NULL, 0); return true; } cmd++; } - ReplyToCommand(message, false, false, NULL, 0); + WP_ReplyToCommand(message, false, false, NULL, 0); return true; }