diff options
Diffstat (limited to 'os/hal/platforms/AT91SAM7/serial_lld.h')
-rw-r--r-- | os/hal/platforms/AT91SAM7/serial_lld.h | 81 |
1 files changed, 45 insertions, 36 deletions
diff --git a/os/hal/platforms/AT91SAM7/serial_lld.h b/os/hal/platforms/AT91SAM7/serial_lld.h index b5394aeed..7b7deba95 100644 --- a/os/hal/platforms/AT91SAM7/serial_lld.h +++ b/os/hal/platforms/AT91SAM7/serial_lld.h @@ -38,16 +38,6 @@ /*===========================================================================*/
/**
- * @brief Serial buffers size.
- * @details Configuration parameter, you can change the depth of the queue
- * buffers depending on the requirements of your application.
- * @note The default is 128 bytes for both the transmission and receive buffers.
- */
-#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
-#define SERIAL_BUFFERS_SIZE 128
-#endif
-
-/**
* @brief UART0 driver enable switch.
* @details If set to @p TRUE the support for USART1 is included.
* @note The default is @p TRUE.
@@ -93,48 +83,67 @@ typedef uint32_t sdflags_t;
/**
+ * @brief AT91SAM7 Serial Driver configuration structure.
+ * @details An instance of this structure must be passed to @p sdStart()
+ * in order to configure and start a serial driver operations.
+ */
+typedef struct {
+ /**
+ * @brief Bit rate.
+ */
+ uint32_t sc_speed;
+ /**
+ * @brief Initialization value for the MR register.
+ */
+ uint32_t sc_mr;
+} SerialConfig;
+
+/**
* @brief @p SerialDriver specific data.
*/
struct _serial_driver_data {
/**
- * Input queue, incoming data can be read from this input queue by
- * using the queues APIs.
+ * @brief Driver state.
+ */
+ sdstate_t state;
+ /**
+ * @brief Current configuration data.
+ */
+ const SerialConfig *config;
+ /**
+ * @brief Input queue, incoming data can be read from this input queue by
+ * using the queues APIs.
+ */
+ InputQueue iqueue;
+ /**
+ * @brief Output queue, outgoing data can be written to this output queue by
+ * using the queues APIs.
*/
- InputQueue iqueue;
+ OutputQueue oqueue;
/**
- * Output queue, outgoing data can be written to this output queue by
- * using the queues APIs.
+ * @brief Status Change @p EventSource. This event is generated when one or
+ * more condition flags change.
*/
- OutputQueue oqueue;
+ EventSource sevent;
/**
- * Status Change @p EventSource. This event is generated when one or more
- * condition flags change.
+ * @brief I/O driver status flags.
*/
- EventSource sevent;
+ sdflags_t flags;
/**
- * I/O driver status flags.
+ * @brief Input circular buffer.
*/
- sdflags_t flags;
+ uint8_t ib[SERIAL_BUFFERS_SIZE];
/**
- * Input circular buffer.
+ * @brief Output circular buffer.
*/
- uint8_t ib[SERIAL_BUFFERS_SIZE];
+ uint8_t ob[SERIAL_BUFFERS_SIZE];
+ /* End of the mandatory fields.*/
/**
- * Output circular buffer.
+ * @brief Pointer to the USART registers block.
*/
- uint8_t ob[SERIAL_BUFFERS_SIZE];
+ AT91PS_USART usart;
};
-/**
- * @brief AT91SAM7 Serial Driver configuration structure.
- * @details An instance of this structure must be passed to @p sdStart()
- * in order to configure and start a serial driver operations.
- */
-typedef struct {
- uint32_t speed;
- uint32_t mr;
-} SerialDriverConfig;
-
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
@@ -155,7 +164,7 @@ extern SerialDriver SD2; extern "C" {
#endif
void sd_lld_init(void);
- void sd_lld_start(SerialDriver *sdp, const SerialDriverConfig *config);
+ void sd_lld_start(SerialDriver *sdp);
void sd_lld_stop(SerialDriver *sdp);
#ifdef __cplusplus
}
|