diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2018-09-05 12:50:10 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2018-09-05 12:50:10 +0300 |
| commit | fdb22013526ea2d6cbd39df77b87f25e6197e081 (patch) | |
| tree | 3ae08e7eda1e2ba798e586f442b73fc476bd1c2c /Software/Embedded_SW/Embedded/Communication | |
| parent | cbe023d4bf6a1556deee770db4f6a7d1d2fa3af4 (diff) | |
| download | Tango-fdb22013526ea2d6cbd39df77b87f25e6197e081.tar.gz Tango-fdb22013526ea2d6cbd39df77b87f25e6197e081.zip | |
streamline all job actions (end, abort) htrough the process task.
Diffstat (limited to 'Software/Embedded_SW/Embedded/Communication')
3 files changed, 30 insertions, 19 deletions
diff --git a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c index 9492876a2..f2ecb16b4 100644 --- a/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c +++ b/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c @@ -14,12 +14,12 @@ Mailbox_Handle CommunicationRxMsgQ = NULL; Mailbox_Handle CommunicationTxMsgQ = NULL; typedef struct CommRxMessage{ - uint16_t messageId; + //uint16_t messageId; uint16_t msgSize; uint32_t BuffId; }CommRxMessageStruc; typedef struct CommTxMessage{ - uint16_t messageId; + //uint16_t messageId; uint16_t msgSize; char *Buff; }CommTxMessageStruc; @@ -106,7 +106,7 @@ uint32_t CommunicationTaskMessageReceived(uint32_t buffer,uint16_t msgSize) CommRxMessageStruc Message; CommRxMsgCounter++; - Message.messageId = 1; + //Message.messageId = 1; Message.msgSize = msgSize; Message.BuffId = buffer; if (CommunicationRxMsgQ != NULL) @@ -143,9 +143,9 @@ void communicationTask(UArg arg0, UArg arg1) while(1) { Mailbox_pend(CommunicationRxMsgQ , &Message, BIOS_WAIT_FOREVER); - switch (Message.messageId) + /*switch (Message.messageId) { - case 1: + case 1:*/ //ui32RxCount += Message.msgSize; if (callback != NULL) { @@ -156,26 +156,33 @@ void communicationTask(UArg arg0, UArg arg1) } freeArray(Message.BuffId); - break; + /* break; default: break; - } + }*/ } } - +int UnSentMessages=0; bool CommunicationTaskSendMessage(char* buffer,size_t length) { CommTxMessageStruc Message; CommTxMsgCounter++; + bool retcode = true; - Message.messageId = 1; + //Message.messageId = 1; Message.msgSize = length; Message.Buff = buffer; + UnSentMessages++; if (CommunicationTxMsgQ != NULL) - return Mailbox_post(CommunicationTxMsgQ , &Message, BIOS_NO_WAIT); + retcode = Mailbox_post(CommunicationTxMsgQ , &Message, BIOS_NO_WAIT); + if (retcode == false) + { + free (buffer); + } + - return false; + return retcode; } int32_t SetCommunicationPath(bool UARTorUSB) { @@ -194,23 +201,24 @@ void communicationTxTask(UArg arg0, UArg arg1) CommTxMessageStruc Message; //initArray(1); - CommunicationTxMsgQ = Mailbox_create(sizeof(CommTxMessageStruc), 20, NULL,NULL); + CommunicationTxMsgQ = Mailbox_create(sizeof(CommTxMessageStruc), 100, NULL,NULL); while(1) { Mailbox_pend(CommunicationTxMsgQ , &Message, BIOS_WAIT_FOREVER); - switch (Message.messageId) + UnSentMessages--; + /*switch (Message.messageId) { - case 1: + case 1:*/ if (CommType == isUSB) USBCDCD_sendData(Message.Buff, Message.msgSize,10); else if (CommType == isUART) Uart_Tx(Message.Buff, Message.msgSize); free (Message.Buff); - break; + /*break; default: break; - } + }*/ } } diff --git a/Software/Embedded_SW/Embedded/Communication/Connection.c b/Software/Embedded_SW/Embedded/Communication/Connection.c index b01750529..6417d6e64 100644 --- a/Software/Embedded_SW/Embedded/Communication/Connection.c +++ b/Software/Embedded_SW/Embedded/Communication/Connection.c @@ -58,15 +58,15 @@ void ConnectionRequest(MessageContainer* requestContainer) usnprintf(Version, 20, "%d.%d.%d.%d",_gTangoVersion.m_major,_gTangoVersion.m_minor,_gTangoVersion.m_patch,_gTangoVersion.m_build); DevInfo.version = Version; - FPGA_ReadVersion(0, &Major, &Year, &Month, &Day); + FPGA_ReadVersion(1, &Major, &Year, &Month, &Day); usnprintf(FPGA1Version, 20, "%d.%d.%d.%d",Major,Year, Month, Day); DevInfo.fpga1version = FPGA1Version; - FPGA_ReadVersion(1, &Major, &Year, &Month, &Day); + FPGA_ReadVersion(2, &Major, &Year, &Month, &Day); usnprintf(FPGA2Version, 20, "%d.%d.%d.%d",Major,Year, Month, Day); DevInfo.fpga2version = FPGA2Version; - FPGA_ReadVersion(2, &Major, &Year, &Month, &Day); + FPGA_ReadVersion(3, &Major, &Year, &Month, &Day); usnprintf(FPGA3Version, 20, "%d.%d.%d.%d",Major,Year, Month, Day); DevInfo.fpga3version = FPGA3Version; diff --git a/Software/Embedded_SW/Embedded/Communication/Container.c b/Software/Embedded_SW/Embedded/Communication/Container.c index f132a6ebd..d53da6983 100644 --- a/Software/Embedded_SW/Embedded/Communication/Container.c +++ b/Software/Embedded_SW/Embedded/Communication/Container.c @@ -46,6 +46,7 @@ uint32_t TxmsgId[50] = {0}; uint32_t TxLength[50] = {0}; +uint32_t TxAddr[50] = {0}; byte Txindex = 0; uint32_t msgId[50] = {0}; uint32_t Length[50] = {0}; @@ -75,6 +76,7 @@ MessageContainer createContainer(MessageType type, char* token, protobuf_c_boole TxmsgId[Txindex] = type; TxLength[Txindex] = response_size; + TxAddr[Txindex] = response_buffer; if (Txindex++>=50) Txindex = 0; @@ -93,6 +95,7 @@ void receive_callback(char* buffer, size_t length) DataLength[index] = requestContainer->data.len; if (index++>=50) index = 0; + REPORT_MSG(requestContainer->type,"Message received"); switch(requestContainer->type) { case MESSAGE_TYPE__CalculateRequest: |
