1
0

fix token

This commit is contained in:
Rémi Heredero 2024-04-26 13:15:48 +02:00
parent ecf4b3617e
commit c9d34783d8
Signed by: Klagarge
GPG Key ID: 3CBAC2C6CD1E8807
5 changed files with 40 additions and 42 deletions

View File

@ -23,6 +23,8 @@ void send_DATA_IND(Adresse source, Adresse destination, uint8_t* dataFramePtr) {
}
strPtr[dataFramePtr[2]] = '\0'; // null-terminate string
queueMsg.anyPtr = strPtr;
//retCode = osMemoryPoolFree(memPool, dataFramePtr);
//CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
switch (destination.sapi) {
case TIME_SAPI:

View File

@ -15,7 +15,8 @@ const osMessageQueueAttr_t queue_macData_attr = {
void sendToken() {
struct queueMsg_t queueMsg;
queueMsg.anyPtr = lastToken;
queueMsg.anyPtr = osMemoryPoolAlloc(memPool,osWaitForever);
memcpy(queueMsg.anyPtr, lastToken, TOKENSIZE-2);
queueMsg.type = TO_PHY;
osStatus_t retCode = osMessageQueuePut(
queue_phyS_id,
@ -60,6 +61,7 @@ void MacSender(void *argument) {
//----------------------------------------------------------------------
case TOKEN: {
// Get token and save it
//lastToken = osMemoryPoolAlloc(memPool,osWaitForever);
memcpy(lastToken, msg, TOKENSIZE-2);
// update token
@ -70,7 +72,8 @@ void MacSender(void *argument) {
// send to lcd
queueMsg.type = TOKEN_LIST;
queueMsg.anyPtr = lastToken;
memcpy(queueMsg.anyPtr , lastToken, TOKENSIZE-2);
//queueMsg.anyPtr = lastToken;
retCode = osMessageQueuePut(
queue_lcd_id,
&queueMsg,
@ -91,6 +94,8 @@ void MacSender(void *argument) {
0);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
} else {
retCode = osMemoryPoolFree(memPool, queueMsg.anyPtr);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
sendToken();
}
break;
@ -196,7 +201,8 @@ void MacSender(void *argument) {
}
gTokenInterface.station_list[gTokenInterface.myAddress] = (0x1 << TIME_SAPI) + (gTokenInterface.connected << CHAT_SAPI);
lastToken[gTokenInterface.myAddress+1] = gTokenInterface.station_list[gTokenInterface.myAddress];
sendToken();
/*
queueMsg.type = TO_PHY;
queueMsg.anyPtr = lastToken;
@ -206,6 +212,7 @@ void MacSender(void *argument) {
osPriorityNormal,
osWaitForever);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
*/
break;
}

2
main.h
View File

@ -16,7 +16,7 @@
//--------------------------------------------------------------------------------
// Constants to change the system behavior
//--------------------------------------------------------------------------------
#define DEBUG_MODE 1 // mode is physical line (0) or debug (1)
#define DEBUG_MODE 0 // mode is physical line (0) or debug (1)
#define MYADDRESS 3 // your address choice (table number)
#define MAX_BLOCK_SIZE 100 // size max for a frame

View File

@ -159,7 +159,7 @@
<Type>0</Type>
<LineNumber>18</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134311450</Address>
<Address>134312290</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
@ -173,39 +173,7 @@
<Bp>
<Number>1</Number>
<Type>0</Type>
<LineNumber>264</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134256144</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_sender.c\264</Expression>
</Bp>
<Bp>
<Number>2</Number>
<Type>0</Type>
<LineNumber>86</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>134255102</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>1</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression>\\tokenring_project\mac_sender.c\86</Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>199</LineNumber>
<LineNumber>106</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
@ -219,7 +187,23 @@
<Expression></Expression>
</Bp>
<Bp>
<Number>4</Number>
<Number>2</Number>
<Type>0</Type>
<LineNumber>107</LineNumber>
<EnabledFlag>1</EnabledFlag>
<Address>0</Address>
<ByteObject>0</ByteObject>
<HtxType>0</HtxType>
<ManyObjects>0</ManyObjects>
<SizeOfObject>0</SizeOfObject>
<BreakByAccess>0</BreakByAccess>
<BreakIfRCount>0</BreakIfRCount>
<Filename>.\mac_sender.c</Filename>
<ExecCommand></ExecCommand>
<Expression></Expression>
</Bp>
<Bp>
<Number>3</Number>
<Type>0</Type>
<LineNumber>199</LineNumber>
<EnabledFlag>1</EnabledFlag>
@ -261,6 +245,11 @@
<WinNumber>1</WinNumber>
<ItemText>memPool</ItemText>
</Ww>
<Ww>
<count>5</count>
<WinNumber>1</WinNumber>
<ItemText>qPtr</ItemText>
</Ww>
</WatchWindow1>
<MemoryWindow1>
<Mm>
@ -294,7 +283,7 @@
<DebugFlag>
<trace>0</trace>
<periodic>1</periodic>
<aLwin>1</aLwin>
<aLwin>0</aLwin>
<aCover>0</aCover>
<aSer1>0</aSer1>
<aSer2>0</aSer2>
@ -569,7 +558,7 @@
<Group>
<GroupName>::CMSIS</GroupName>
<tvExp>0</tvExp>
<tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel>
<RteFlg>1</RteFlg>

View File

@ -10,7 +10,7 @@
<TargetName>Target 1</TargetName>
<ToolsetNumber>0x4</ToolsetNumber>
<ToolsetName>ARM-ADS</ToolsetName>
<pCCUsed>5060960::V5.06 update 7 (build 960)::C:\Program Files (x86)\ARM_Compiler_5.06u7</pCCUsed>
<pCCUsed>5060960::V5.06 update 7 (build 960)::..\..\Program Files (x86)\ARM_Compiler_5.06u7</pCCUsed>
<uAC6>0</uAC6>
<TargetOption>
<TargetCommonOption>