Initialize other pheripherals
This commit is contained in:
parent
ec4df11c61
commit
ffec0e2b57
69 changed files with 25802 additions and 620 deletions
|
@ -16,7 +16,6 @@
|
|||
// 1 2 2 7
|
||||
// 2 1 5 6
|
||||
// 3 1 1 3
|
||||
// 5 1 0 7
|
||||
// 6 2 1 6
|
||||
// console UART
|
||||
// 4 1 2 4
|
||||
|
@ -36,7 +35,6 @@ void MainLoop()
|
|||
{ USART1, DMA2, LL_DMA_STREAM_2, LL_DMA_STREAM_7 },
|
||||
{ USART2, DMA1, LL_DMA_STREAM_5, LL_DMA_STREAM_6 },
|
||||
{ USART3, DMA1, LL_DMA_STREAM_1, LL_DMA_STREAM_3 },
|
||||
{ UART5, DMA1, LL_DMA_STREAM_0, LL_DMA_STREAM_7 },
|
||||
{ USART6, DMA2, LL_DMA_STREAM_1, LL_DMA_STREAM_6 },
|
||||
};
|
||||
|
||||
|
@ -79,12 +77,16 @@ void MainLoop()
|
|||
|
||||
for(uint16_t idx = 0; idx < sizeof(g_uartStatuses) / sizeof(g_uartStatuses[0]); ++idx) {
|
||||
if(!g_uartStatuses[idx].txBuffer.busy && send) {
|
||||
DIAG_ENTER_BUSY();
|
||||
PostPacket(&g_uartStatuses[idx], text2Send, sizeof(text2Send) - 1 - (rand() & randmask), &g_crcStatus);
|
||||
DIAG_EXIT_BUSY();
|
||||
}
|
||||
for(uint16_t rIdx = 0; rIdx < 2; ++rIdx)
|
||||
if(g_uartStatuses[idx].rxBuffers[rIdx].busy || g_uartStatuses[idx].rxBuffers[rIdx].error)
|
||||
if(g_uartStatuses[idx].rxBuffers[rIdx].busy || g_uartStatuses[idx].rxBuffers[rIdx].error) {
|
||||
DIAG_ENTER_BUSY();
|
||||
ConsumePacket(&g_uartStatuses[idx], rIdx, &g_crcStatus);
|
||||
|
||||
DIAG_EXIT_BUSY();
|
||||
}
|
||||
}
|
||||
if(tick - lastStatsTick > STATS_DELAY_MS) {
|
||||
PrintStats((char*)g_statsBuf, statId, &g_uartStatuses[statId].stats, UART4, &g_ConsoleTxDmaInfo);
|
||||
|
@ -93,5 +95,10 @@ void MainLoop()
|
|||
if(statId >= UARTCOUNT)
|
||||
statId = 0;
|
||||
}
|
||||
uint32_t ein = LL_GPIO_ReadInputPort(KEY1_GPIO_Port);
|
||||
if(!(ein & KEY1_Pin)) {
|
||||
void (*fptr)(void) = (void*)0xa0000000;
|
||||
fptr();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,13 +8,12 @@
|
|||
#ifndef CONFIG_H_
|
||||
#define CONFIG_H_
|
||||
|
||||
#define UARTCOUNT 5
|
||||
#define UARTCOUNT 4
|
||||
#define CRCTASKCOUNT (UARTCOUNT * 2)
|
||||
#define USART1_OFFSET 0
|
||||
#define USART2_OFFSET 1
|
||||
#define USART3_OFFSET 2
|
||||
#define USART5_OFFSET 3
|
||||
#define USART6_OFFSET 4
|
||||
#define USART6_OFFSET 3
|
||||
|
||||
#define CONSOLE_DMA_ENGINE DMA1
|
||||
#define CONSOLE_TX_DMA_STREAM LL_DMA_STREAM_4
|
||||
|
@ -23,6 +22,6 @@
|
|||
#define CRC_DMA_STREAM LL_DMA_STREAM_4
|
||||
|
||||
#define MEMCPY_DMA_ENGINE DMA2
|
||||
#define MEMCPY_DMA_STREAM LL_DMA_STREAM_0
|
||||
#define MEMCPY_DMA_STREAM LL_DMA_STREAM_3
|
||||
|
||||
#endif /* CONFIG_H_ */
|
||||
|
|
23
app/diag.h
23
app/diag.h
|
@ -17,13 +17,16 @@ if(x) { \
|
|||
LL_GPIO_ResetOutputPin(LED0_GPIO_Port, LED0_Pin); \
|
||||
LL_GPIO_SetOutputPin(LED1_GPIO_Port, LED1_Pin); \
|
||||
}
|
||||
#define DIAG_CRC_CALC_START() LL_GPIO_SetOutputPin(DIAG0_GPIO_Port, DIAG0_Pin)
|
||||
#define DIAG_CRC_CALC_END() LL_GPIO_ResetOutputPin(DIAG0_GPIO_Port, DIAG0_Pin)//; LL_GPIO_TogglePin(DIAG3_GPIO_Port, DIAG3_Pin)
|
||||
#define DIAG_INTERRUPT_IN() LL_GPIO_SetOutputPin(DIAG1_GPIO_Port, DIAG1_Pin)
|
||||
#define DIAG_INTERRUPT_OUT() LL_GPIO_ResetOutputPin(DIAG1_GPIO_Port, DIAG1_Pin)
|
||||
#define DIAG_ERROR_EVENT() LL_GPIO_TogglePin(DIAG2_GPIO_Port, DIAG2_Pin)
|
||||
|
||||
#else // _ENABLE_DIAG
|
||||
#define DIAG_INTERRUPT_IN() LL_GPIO_SetOutputPin(DEBUG0_GPIO_Port, DEBUG0_Pin)
|
||||
#define DIAG_INTERRUPT_OUT() LL_GPIO_ResetOutputPin(DEBUG0_GPIO_Port, DEBUG0_Pin)
|
||||
#define DIAG_CRC_CALC_START() LL_GPIO_SetOutputPin(DEBUG1_GPIO_Port, DEBUG1_Pin)
|
||||
#define DIAG_CRC_CALC_END() LL_GPIO_ResetOutputPin(DEBUG1_GPIO_Port, DEBUG1_Pin)
|
||||
//#define DIAG_ERROR_EVENT() LL_GPIO_TogglePin(DEBUG2_GPIO_Port, DEBUG2_Pin)
|
||||
#define DIAG_ENTER_BUSY() LL_GPIO_SetOutputPin(DEBUG2_GPIO_Port, DEBUG2_Pin)
|
||||
#define DIAG_EXIT_BUSY() LL_GPIO_ResetOutputPin(DEBUG2_GPIO_Port, DEBUG2_Pin)
|
||||
|
||||
#endif // _ENABLE_DIAG
|
||||
|
||||
#ifndef DIAG_RX_BUFFER_SWITCH
|
||||
# define DIAG_RX_BUFFER_SWITCH(x)
|
||||
|
@ -49,6 +52,12 @@ if(x) { \
|
|||
# define DIAG_ERROR_EVENT()
|
||||
#endif
|
||||
|
||||
#endif // _ENABLE_DIAG
|
||||
#ifndef DIAG_ENTER_BUSY
|
||||
# define DIAG_ENTER_BUSY()
|
||||
#endif
|
||||
|
||||
#ifndef DIAG_EXIT_BUSY
|
||||
# define DIAG_EXIT_BUSY()
|
||||
#endif
|
||||
|
||||
#endif /* DIAG_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue