aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Communication/CommunicationTask.c
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-09-05 12:50:10 +0300
committerShlomo Hecht <shlomo@twine-s.com>2018-09-05 12:50:10 +0300
commitfdb22013526ea2d6cbd39df77b87f25e6197e081 (patch)
tree3ae08e7eda1e2ba798e586f442b73fc476bd1c2c /Software/Embedded_SW/Embedded/Communication/CommunicationTask.c
parentcbe023d4bf6a1556deee770db4f6a7d1d2fa3af4 (diff)
downloadTango-fdb22013526ea2d6cbd39df77b87f25e6197e081.tar.gz
Tango-fdb22013526ea2d6cbd39df77b87f25e6197e081.zip
streamline all job actions (end, abort) htrough the process task.
Diffstat (limited to 'Software/Embedded_SW/Embedded/Communication/CommunicationTask.c')
-rw-r--r--Software/Embedded_SW/Embedded/Communication/CommunicationTask.c40
1 files changed, 24 insertions, 16 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;
- }
+ }*/
}
}