summaryrefslogtreecommitdiff
path: root/components/drivers/include
diff options
context:
space:
mode:
authorBernard Xiong <[email protected]>2014-02-27 18:19:59 +0800
committerBernard Xiong <[email protected]>2014-02-27 18:19:59 +0800
commit5aeedc4f3a3c3fcfffb0cd4a474f5faa75053839 (patch)
tree138fc42d0983b1e484daf440d9501d996ded1373 /components/drivers/include
parent3d80e414ff6c03ff04fecb914e7aa9b3fb535e03 (diff)
parenta4cd949519dc9d511ee9171b255e67c21128827e (diff)
Merge pull request #241 from bright-pan/master
Add RTS/CTS option in the serial framework.
Diffstat (limited to 'components/drivers/include')
-rw-r--r--components/drivers/include/drivers/serial.h33
1 files changed, 21 insertions, 12 deletions
diff --git a/components/drivers/include/drivers/serial.h b/components/drivers/include/drivers/serial.h
index 41132ed916..c966f5459b 100644
--- a/components/drivers/include/drivers/serial.h
+++ b/components/drivers/include/drivers/serial.h
@@ -29,6 +29,7 @@
#define __SERIAL_H__
#include <rtthread.h>
+#include <rtdevice.h>
#define BAUD_RATE_4800 4800
#define BAUD_RATE_9600 9600
@@ -55,6 +56,11 @@
#define NRZ_NORMAL 0 /* Non Return to Zero : normal mode */
#define NRZ_INVERTED 1 /* Non Return to Zero : inverted mode */
+#define HW_CONTROL_NONE 0
+#define HW_CONTROL_RTS 1
+#define HW_CONTROL_CTS 2
+#define HW_CONTROL_RTS_CTS 3
+
#ifndef RT_SERIAL_RB_BUFSZ
#define RT_SERIAL_RB_BUFSZ 64
#endif
@@ -75,21 +81,23 @@
#define RT_SERIAL_TX_DATAQUEUE_LWM 30
/* Default config for serial_configure structure */
-#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 */ \
- 0 \
+#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 */ \
+ HW_CONTROL_NONE, /* Hardware control */\
+ 0 \
}
struct serial_ringbuffer
{
- rt_uint8_t buffer[RT_SERIAL_RB_BUFSZ];
- rt_uint16_t put_index, get_index;
+ struct rt_ringbuffer rb;
+ rt_uint8_t *pool;
+ rt_uint16_t size;
};
struct serial_configure
@@ -100,7 +108,8 @@ struct serial_configure
rt_uint32_t parity :2;
rt_uint32_t bit_order :1;
rt_uint32_t invert :1;
- rt_uint32_t reserved :20;
+ rt_uint32_t hw_control :2;
+ rt_uint32_t reserved :18;
};
struct rt_serial_device