1
0

add mac_sender structure

This commit is contained in:
Rémi Heredero 2024-04-15 16:26:40 +02:00
parent 99394684ee
commit 0837a84a62
7 changed files with 2168 additions and 5 deletions

79
.gitignore vendored Normal file
View File

@ -0,0 +1,79 @@
# A .gitignore for Keil projects.
# Taken mostly from http://www.keil.com/support/man/docs/uv4/uv4_b_filetypes.htm
# User-specific uVision files
*.opt
*.uvopt
*.uvoptx
*.uvgui
*.uvgui.*
*.uvguix.*
# Listing files
*.cod
*.htm
*.i
*.lst
*.map
*.m51
*.m66
# define exception below if needed
*.scr
# Object and HEX files
*.axf
*.b[0-3][0-9]
*.hex
*.d
*.crf
*.elf
*.hex
*.h86
*.lib
*.obj
*.o
*.sbr
# Build files
# define exception below if needed
*.bat
*._ia
*.__i
*._ii
# Generated output files
/Listings/*
/Objects/*
# Debugger files
# define exception below if needed
*.ini
# Other files
*.build_log.htm
*.cdb
*.dep
*.ic
*.lin
*.lnp
*.orc
# define exception below if needed
*.pack
# define exception below if needed
*.pdsc
*.plg
# define exception below if needed
*.sct
*.sfd
*.sfr
# Miscellaneous
*.tra
*.bin
*.fed
*.l1p
*.l2p
*.iex
# To explicitly override the above, define any exceptions here; e.g.:
# !my_customized_scatter_file.sct

View File

@ -0,0 +1,76 @@
// File: STM32F74x_75x.dbgconf
// Version: 1.0.0
// Note: refer to STM32F75xxx STM32F74xxx reference manual (RM0385)
// refer to STM32F75xxx STM32F74xxx datasheets
// <<< Use Configuration Wizard in Context Menu >>>
// <h> Debug MCU configuration register (DBGMCU_CR)
// <o.2> DBG_STANDBY <i> Debug standby mode
// <o.1> DBG_STOP <i> Debug stop mode
// <o.0> DBG_SLEEP <i> Debug sleep mode
// </h>
DbgMCU_CR = 0x00000007;
// <h> Debug MCU APB1 freeze register (DBGMCU_APB1_FZ)
// <i> Reserved bits must be kept at reset value
// <o.26> DBG_CAN2_STOP <i> Debug CAN2 stopped when core is halted
// <o.25> DBG_CAN1_STOP <i> Debug CAN1 stopped when core is halted
// <o.24> DBG_I2C4_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.23> DBG_I2C3_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.22> DBG_I2C2_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.21> DBG_I2C1_SMBUS_TIMEOUT <i> SMBUS timeout mode stopped when core is halted
// <o.12> DBG_IWDG_STOP <i> Debug independent watchdog stopped when core is halted
// <o.11> DBG_WWDG_STOP <i> Debug window watchdog stopped when core is halted
// <o.10> DBG_RTC_STOP <i> RTC stopped when core is halted
// <o.9> DBG_LPTIM1_STOP <i> LPTMI1 counter stopped when core is halted
// <o.8> DBG_TIM14_STOP <i> TIM14 counter stopped when core is halted
// <o.7> DBG_TIM13_STOP <i> TIM13 counter stopped when core is halted
// <o.6> DBG_TIM12_STOP <i> TIM12 counter stopped when core is halted
// <o.5> DBG_TIM7_STOP <i> TIM7 counter stopped when core is halted
// <o.4> DBG_TIM6_STOP <i> TIM6 counter stopped when core is halted
// <o.3> DBG_TIM5_STOP <i> TIM5 counter stopped when core is halted
// <o.2> DBG_TIM4_STOP <i> TIM4 counter stopped when core is halted
// <o.1> DBG_TIM3_STOP <i> TIM3 counter stopped when core is halted
// <o.0> DBG_TIM2_STOP <i> TIM2 counter stopped when core is halted
// </h>
DbgMCU_APB1_Fz = 0x00000000;
// <h> Debug MCU APB2 freeze register (DBGMCU_APB2_FZ)
// <i> Reserved bits must be kept at reset value
// <o.18> DBG_TIM11_STOP <i> TIM11 counter stopped when core is halted
// <o.17> DBG_TIM10_STOP <i> TIM10 counter stopped when core is halted
// <o.16> DBG_TIM9_STOP <i> TIM9 counter stopped when core is halted
// <o.1> DBG_TIM8_STOP <i> TIM8 counter stopped when core is halted
// <o.0> DBG_TIM1_STOP <i> TIM1 counter stopped when core is halted
// </h>
DbgMCU_APB2_Fz = 0x00000000;
// <h> TPIU Pin Routing (TRACECLK fixed on Pin PE2)
// <i> TRACECLK: Pin PE2
// <o1> TRACED0
// <i> ETM Trace Data 0
// <0x00040003=> Pin PE3
// <0x00020001=> Pin PC1
// <0x0006000D=> Pin PG13
// <o2> TRACED1
// <i> ETM Trace Data 1
// <0x00040004=> Pin PE4
// <0x00020008=> Pin PC8
// <0x0006000E=> Pin PG14
// <o3> TRACED2
// <i> ETM Trace Data 2
// <0x00040005=> Pin PE5
// <0x00030002=> Pin PD2
// <o4> TRACED3
// <i> ETM Trace Data 3
// <0x00040006=> Pin PE6
// <0x0002000C=> Pin PC12
// </h>
TraceClk_Pin = 0x00040002;
TraceD0_Pin = 0x00040003;
TraceD1_Pin = 0x00040004;
TraceD2_Pin = 0x00040005;
TraceD3_Pin = 0x00040006;
// <<< end of configuration section >>>

View File

@ -1,5 +1,68 @@
#include "main.h"
void MacSender(void *argument) void MacSender(void *argument)
{ {
// TODO // TODO
struct queueMsg_t queueMsg; // queue message
char* msg;
char msgToSend[255];
uint8_t msgToSendPtr=0;
osStatus_t retCode; // return error code
for(;;) {
//----------------------------------------------------------------------------
// QUEUE READ
//----------------------------------------------------------------------------
retCode = osMessageQueueGet(
queue_macS_id,
&queueMsg,
NULL,
osWaitForever);
CheckRetCode(retCode, __LINE__, __FILE__, CONTINUE);
switch(queueMsg.type) {
case TOKEN:
break;
case DATABACK:
break;
case NEW_TOKEN:
for(uint8_t i = 0; i < 15; i++) {
if(i == gTokenInterface.myAddress) {
gTokenInterface.station_list[i] = (0x1 << TIME_SAPI) & (gTokenInterface.connected << CHAT_SAPI);
} else {
gTokenInterface.station_list[i] = 0;
}
}
msg = osMemoryPollAlloc(memPool, osWaitForever);
queueMsg.type = TO_PHY;
break;
case START:
break;
case STOP:
break;
case DATA_IND:
break;
default:
break;
}
}
} }

4
main.c
View File

@ -34,9 +34,9 @@ osMessageQueueId_t queue_phyS_id;
osMessageQueueId_t queue_dbg_id; osMessageQueueId_t queue_dbg_id;
osMessageQueueId_t queue_macS_id; osMessageQueueId_t queue_macS_id;
osMessageQueueId_t queue_chatR_id; osMessageQueueId_t queue_chatR_id;
osMessageQueueId_t queue_chatS_id; osMessageQueueId_t queue_chatS_id; // unused ?!
osMessageQueueId_t queue_timeR_id; osMessageQueueId_t queue_timeR_id;
osMessageQueueId_t queue_timeS_id; osMessageQueueId_t queue_timeS_id; // unused ?!
osMessageQueueId_t queue_lcd_id; osMessageQueueId_t queue_lcd_id;
osMessageQueueId_t queue_keyboard_id; osMessageQueueId_t queue_keyboard_id;
osMessageQueueId_t queue_usartR_id; osMessageQueueId_t queue_usartR_id;

2
main.h
View File

@ -73,7 +73,7 @@ struct TOKENINTERFACE
uint32_t debugAddress; ///< current debug address uint32_t debugAddress; ///< current debug address
bool_t debugMsgToSend; ///< did debug have to send a message bool_t debugMsgToSend; ///< did debug have to send a message
uint32_t destinationAddress; ///< current destination address uint32_t destinationAddress; ///< current destination address
uint8_t station_list[15]; ///< 0 to 15 uint8_t station_list[15]; ///< 0 to 14
}; };
extern struct TOKENINTERFACE gTokenInterface; extern struct TOKENINTERFACE gTokenInterface;

File diff suppressed because one or more lines are too long

View File

@ -241,7 +241,7 @@
<Group> <Group>
<GroupName>Source Group 1</GroupName> <GroupName>Source Group 1</GroupName>
<tvExp>0</tvExp> <tvExp>1</tvExp>
<tvExpOptDlg>0</tvExpOptDlg> <tvExpOptDlg>0</tvExpOptDlg>
<cbSel>0</cbSel> <cbSel>0</cbSel>
<RteFlg>0</RteFlg> <RteFlg>0</RteFlg>