18
18
#include " AppConfig.h"
19
19
#include " matter_shell.h"
20
20
#include < cmsis_os2.h>
21
+ #include < lib/shell/Engine.h>
21
22
#include < platform/CHIPDeviceLayer.h>
22
23
#include < sl_cmsis_os2_common.h>
23
- #include < lib/shell/Engine.h>
24
24
25
25
#ifdef __cplusplus
26
26
extern " C" {
@@ -35,11 +35,11 @@ extern "C" {
35
35
#define MAX_DMA_BUFFER_SIZE (MAX_BUFFER_SIZE / 2 )
36
36
37
37
#if SLI_SI91X_MCU_INTERFACE
38
+ #include " USART.h"
38
39
#include " rsi_board.h"
39
40
#include " rsi_debug.h"
40
41
#include " rsi_rom_egpio.h"
41
42
#include " sl_si91x_usart.h"
42
- #include " USART.h"
43
43
#else // For EFR32
44
44
#include " em_core.h"
45
45
#include " em_usart.h"
@@ -96,10 +96,10 @@ extern "C" {
96
96
namespace {
97
97
// In order to reduce the probability of data loss during the dmaFull callback handler we use
98
98
// two duplicate receive buffers so we can always have one "active" receive queue.
99
- uint8_t sRxDmaBuffer [MAX_DMA_BUFFER_SIZE] = { 0 };
99
+ uint8_t sRxDmaBuffer [MAX_DMA_BUFFER_SIZE] = { 0 };
100
100
uint8_t sRxDmaBuffer2 [MAX_DMA_BUFFER_SIZE] = { 0 };
101
- uint16_t lastCount = 0 ; // Nb of bytes already processed from the active dmaBuffer
102
- }
101
+ uint16_t lastCount = 0 ; // Nb of bytes already processed from the active dmaBuffer
102
+ } // namespace
103
103
104
104
#endif // SLI_SI91X_MCU_INTERFACE
105
105
@@ -282,7 +282,7 @@ void uartConsoleInit(void)
282
282
283
283
sUartTxQueue = osMessageQueueNew (UART_MAX_QUEUE_SIZE, sizeof (UartTxStruct_t), &kUartTxQueueAttr );
284
284
sUartTaskHandle = osThreadNew (uartMainLoop, nullptr , &kUartTaskAttr );
285
-
285
+
286
286
// Init a fifo for the data received on the uart
287
287
InitFifo (&sReceiveFifo , sRxFifoBuffer , MAX_BUFFER_SIZE);
288
288
@@ -298,7 +298,6 @@ void uartConsoleInit(void)
298
298
UARTDRV_Receive (vcom_handle, sRxDmaBuffer , MAX_DMA_BUFFER_SIZE, UART_rx_callback);
299
299
UARTDRV_Receive (vcom_handle, sRxDmaBuffer2 , MAX_DMA_BUFFER_SIZE, UART_rx_callback);
300
300
301
-
302
301
// Enable USART0/EUSART0 interrupt to wake OT task when data arrives
303
302
NVIC_ClearPendingIRQ (USART_IRQ);
304
303
NVIC_EnableIRQ (USART_IRQ);
@@ -319,10 +318,11 @@ void uartConsoleInit(void)
319
318
}
320
319
321
320
#if SLI_SI91X_MCU_INTERFACE
322
- void cache_uart_rx_data (char character) {
321
+ void cache_uart_rx_data (char character)
322
+ {
323
323
if (RemainingSpace (&sReceiveFifo ) >= 1 )
324
324
{
325
- WriteToFifo (&sReceiveFifo ,(uint8_t *) &character, 1 );
325
+ WriteToFifo (&sReceiveFifo , (uint8_t *) &character, 1 );
326
326
}
327
327
#ifdef ENABLE_CHIP_SHELL
328
328
chip::NotifyShellProcess ();
@@ -464,7 +464,7 @@ int16_t uartConsoleRead(char * Buf, uint16_t NbBytesToRead)
464
464
#if SLI_SI91X_MCU_INTERFACE == 0
465
465
if (NbBytesToRead > AvailableDataCount (&sReceiveFifo ))
466
466
{
467
- UARTDRV_Count_t count, remaining;
467
+ UARTDRV_Count_t count, remaining;
468
468
// Not enough data available in the fifo for the read size request
469
469
// If there is data available in dma buffer, get it now.
470
470
CORE_ATOMIC_SECTION (UARTDRV_GetReceiveStatus (vcom_handle, &data, &count, &remaining); if (count > lastCount) {
@@ -503,7 +503,7 @@ void uartSendBytes(uint8_t * buffer, uint16_t nbOfBytes)
503
503
{
504
504
#if SLI_SI91X_MCU_INTERFACE
505
505
// ensuring null termination of buffer
506
- if ( nbOfBytes != CHIP_SHELL_MAX_LINE_SIZE && buffer[nbOfBytes - 1 ] != ' \0 ' )
506
+ if ( nbOfBytes != CHIP_SHELL_MAX_LINE_SIZE && buffer[nbOfBytes - 1 ] != ' \0 ' )
507
507
{
508
508
buffer[nbOfBytes] = ' \0 ' ;
509
509
}
0 commit comments