Browse Source

[serial_v2]modify the default configuration of the RT_SERIAL_CONFIG_DEFAULT structure to support parameters in the absence of DMA configuration.

wdfk-prog 2 weeks ago
parent
commit
95b1d69e8c
1 changed files with 17 additions and 1 deletions
  1. 17 1
      components/drivers/include/drivers/dev_serial_v2.h

+ 17 - 1
components/drivers/include/drivers/dev_serial_v2.h

@@ -225,6 +225,22 @@
 #define RT_SERIAL_FLOWCONTROL_NONE      0
 
 /* Default config for serial_configure structure */
+#ifdef RT_SERIAL_USING_DMA
+#define RT_SERIAL_CONFIG_DEFAULT                      \
+{                                                     \
+    BAUD_RATE_115200,           /* 115200 bits/s */   \
+    DATA_BITS_8,                /* 8 databits */      \
+    STOP_BITS_1,                /* 1 stopbit */       \
+    PARITY_NONE,                /* No parity  */      \
+    BIT_ORDER_LSB,              /* LSB first sent */  \
+    NRZ_NORMAL,                 /* Normal mode */     \
+    RT_SERIAL_RX_MINBUFSZ,      /* rxBuf size */      \
+    RT_SERIAL_TX_MINBUFSZ,      /* txBuf size */      \
+    RT_SERIAL_FLOWCONTROL_NONE, /* Off flowcontrol */ \
+    0,                          /* reserved */        \
+    RT_SERIAL_RX_MINBUFSZ / 2,  /* dma_ping_bufsz */  \
+}
+#else
 #define RT_SERIAL_CONFIG_DEFAULT                      \
 {                                                     \
     BAUD_RATE_115200,           /* 115200 bits/s */   \
@@ -237,8 +253,8 @@
     RT_SERIAL_TX_MINBUFSZ,      /* txBuf size */      \
     RT_SERIAL_FLOWCONTROL_NONE, /* Off flowcontrol */ \
     0,                          /* reserved */        \
-    0,                          /* dma_ping_bufsz */  \
 }
+#endif
 
 /**
  * @brief Serial receive indicate hook function type