aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/templates
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-11-02 10:41:41 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2014-11-02 10:41:41 +0000
commit359413415a20db40244a23794b8aef2d979254fc (patch)
treea825f6f5b57d7094738c8ed0e969a15e3963433c /os/hal/templates
parentc4642d4164a060a53886edd4706ab18c256a329c (diff)
downloadChibiOS-359413415a20db40244a23794b8aef2d979254fc.tar.gz
ChibiOS-359413415a20db40244a23794b8aef2d979254fc.tar.bz2
ChibiOS-359413415a20db40244a23794b8aef2d979254fc.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@7460 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/templates')
-rw-r--r--os/hal/templates/serial_lld.c33
-rw-r--r--os/hal/templates/serial_lld.h32
2 files changed, 30 insertions, 35 deletions
diff --git a/os/hal/templates/serial_lld.c b/os/hal/templates/serial_lld.c
index d6b861c12..8747e4452 100644
--- a/os/hal/templates/serial_lld.c
+++ b/os/hal/templates/serial_lld.c
@@ -1,5 +1,5 @@
/*
- ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
+ ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,14 +15,13 @@
*/
/**
- * @file templates/serial_lld.c
- * @brief Serial Driver subsystem low level driver source template.
+ * @file PLATFORM/USARTv2/serial_lld.c
+ * @brief PLATFORM low level serial driver code.
*
* @addtogroup SERIAL
* @{
*/
-#include "ch.h"
#include "hal.h"
#if HAL_USE_SERIAL || defined(__DOXYGEN__)
@@ -35,10 +34,8 @@
/* Driver exported variables. */
/*===========================================================================*/
-/**
- * @brief SD1 driver identifier.
- */
-#if PLATFORM_SERIAL_USE_SD1 || defined(__DOXYGEN__)
+/** @brief USART1 serial driver identifier.*/
+#if PLATFORM_SERIAL_USE_USART1 || defined(__DOXYGEN__)
SerialDriver SD1;
#endif
@@ -72,10 +69,9 @@ static const SerialConfig default_config = {
*/
void sd_lld_init(void) {
-#if PLATFORM_SERIAL_USE_SD1
- /* Driver initialization.*/
- sdObjectInit(&SD1);
-#endif /* PLATFORM_SERIAL_USE_SD1 */
+#if PLATFORM_SERIAL_USE_USART1
+ sdObjectInit(&SD1, NULL, notify1);
+#endif
}
/**
@@ -94,12 +90,11 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
config = &default_config;
if (sdp->state == SD_STOP) {
- /* Enables the peripheral.*/
-#if PLATFORM_SERIAL_USE_SD1
+#if PLATFORM_SERIAL_USE_USART1
if (&SD1 == sdp) {
}
-#endif /* PLATFORM_SD_USE_SD1 */
+#endif
}
/* Configures the peripheral.*/
@@ -117,14 +112,12 @@ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
void sd_lld_stop(SerialDriver *sdp) {
if (sdp->state == SD_READY) {
- /* Resets the peripheral.*/
-
- /* Disables the peripheral.*/
-#if PLATFORM_SERIAL_USE_SD1
+ usart_deinit(sdp->usart);
+#if PLATFORM_SERIAL_USE_USART1
if (&SD1 == sdp) {
}
-#endif /* PLATFORM_SERIAL_USE_SD1 */
+#endif
}
}
diff --git a/os/hal/templates/serial_lld.h b/os/hal/templates/serial_lld.h
index 0e019948d..62121eb96 100644
--- a/os/hal/templates/serial_lld.h
+++ b/os/hal/templates/serial_lld.h
@@ -1,5 +1,5 @@
/*
- ChibiOS/RT - Copyright (C) 2006-2013 Giovanni Di Sirio
+ ChibiOS/HAL - Copyright (C) 2006-2014 Giovanni Di Sirio
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
*/
/**
- * @file templates/serial_lld.h
- * @brief Serial Driver subsystem low level driver header template.
+ * @file PLATFORM/serial_lld.h
+ * @brief PLATFORM low level serial driver header.
*
* @addtogroup SERIAL
* @{
@@ -40,11 +40,12 @@
* @{
*/
/**
- * @brief SD1 driver enable switch.
- * @details If set to @p TRUE the support for SD1 is included.
+ * @brief USART1 driver enable switch.
+ * @details If set to @p TRUE the support for USART1 is included.
+ * @note The default is @p TRUE.
*/
-#if !defined(PLATFORM_SERIAL_USE_SD1) || defined(__DOXYGEN__)
-#define PLATFORM_SERIAL_USE_SD1 FALSE
+#if !defined(PLATFORM_SERIAL_USE_USART1) || defined(__DOXYGEN__)
+#define PLATFORM_SERIAL_USE_USART1 FALSE
#endif
/** @} */
@@ -57,31 +58,32 @@
/*===========================================================================*/
/**
- * @brief Generic Serial Driver configuration structure.
+ * @brief PLATFORM 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.
- * @note Implementations may extend this structure to contain more,
- * architecture dependent, fields.
+ * @note This structure content is architecture dependent, each driver
+ * implementation defines its own version and the custom static
+ * initializers.
*/
typedef struct {
/**
* @brief Bit rate.
*/
- uint32_t sc_speed;
+ uint32_t speed;
/* End of the mandatory fields.*/
} SerialConfig;
/**
- * @brief @p SerialDriver specific data.
+ * @brief @p SerialDriver specific data.
*/
#define _serial_driver_data \
_base_asynchronous_channel_data \
/* Driver state.*/ \
sdstate_t state; \
/* Input queue.*/ \
- InputQueue iqueue; \
+ input_queue_t iqueue; \
/* Output queue.*/ \
- OutputQueue oqueue; \
+ output_queue_t oqueue; \
/* Input circular buffer.*/ \
uint8_t ib[SERIAL_BUFFERS_SIZE]; \
/* Output circular buffer.*/ \
@@ -96,7 +98,7 @@ typedef struct {
/* External declarations. */
/*===========================================================================*/
-#if PLATFORM_SERIAL_USE_SD1 && !defined(__DOXYGEN__)
+#if PLATFORM_SERIAL_USE_USART1 && !defined(__DOXYGEN__)
extern SerialDriver SD1;
#endif