aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/platforms/LPC13xx
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-04-21 14:11:12 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2010-04-21 14:11:12 +0000
commit75792b3d6af243e043e66b1b2f7199229d430ef8 (patch)
tree8c0740a9254d7b4b8d635c6734e3fbd30dc6d30e /os/hal/platforms/LPC13xx
parent3621ac37b0cbab7737d215db0335017561856a10 (diff)
downloadChibiOS-75792b3d6af243e043e66b1b2f7199229d430ef8.tar.gz
ChibiOS-75792b3d6af243e043e66b1b2f7199229d430ef8.tar.bz2
ChibiOS-75792b3d6af243e043e66b1b2f7199229d430ef8.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1882 35acf78f-673a-0410-8e92-d51de3d6d3f4
Diffstat (limited to 'os/hal/platforms/LPC13xx')
-rw-r--r--os/hal/platforms/LPC13xx/serial_lld.c22
-rw-r--r--os/hal/platforms/LPC13xx/serial_lld.h28
2 files changed, 26 insertions, 24 deletions
diff --git a/os/hal/platforms/LPC13xx/serial_lld.c b/os/hal/platforms/LPC13xx/serial_lld.c
index 8c3e73ca1..53fd7e11e 100644
--- a/os/hal/platforms/LPC13xx/serial_lld.c
+++ b/os/hal/platforms/LPC13xx/serial_lld.c
@@ -58,16 +58,17 @@ static const SerialConfig default_config = {
* @brief UART initialization.
*
* @param[in] sdp communication channel associated to the UART
+ * @param[in] config the architecture-dependent serial driver configuration
*/
-static void uart_init(SerialDriver *sdp) {
+static void uart_init(SerialDriver *sdp, const SerialConfig *config) {
LPC_UART_TypeDef *u = sdp->uart;
- uint32_t div = LPC13xx_UART_PCLK / (sdp->config->sc_speed << 4);
- u->LCR = sdp->config->sc_lcr | LCR_DLAB;
+ uint32_t div = LPC13xx_UART_PCLK / (config->sc_speed << 4);
+ u->LCR = config->sc_lcr | LCR_DLAB;
u->DLL = div;
u->DLM = div >> 8;
- u->LCR = sdp->config->sc_lcr;
- u->FCR = FCR_ENABLE | FCR_RXRESET | FCR_TXRESET | sdp->config->sc_fcr;
+ u->LCR = config->sc_lcr;
+ u->FCR = FCR_ENABLE | FCR_RXRESET | FCR_TXRESET | config->sc_fcr;
u->ACR = 0;
u->FDR = 0x10;
u->TER = TER_ENABLE;
@@ -242,11 +243,14 @@ void sd_lld_init(void) {
* @brief Low level serial driver configuration and (re)start.
*
* @param[in] sdp pointer to a @p SerialDriver object
+ * @param[in] config the architecture-dependent serial driver configuration.
+ * If this parameter is set to @p NULL then a default
+ * configuration is used.
*/
-void sd_lld_start(SerialDriver *sdp) {
+void sd_lld_start(SerialDriver *sdp, const SerialConfig *config) {
- if (sdp->config == NULL)
- sdp->config = &default_config;
+ if (config == NULL)
+ config = &default_config;
if (sdp->state == SD_STOP) {
#if USE_LPC13xx_UART0
@@ -257,7 +261,7 @@ void sd_lld_start(SerialDriver *sdp) {
}
#endif
}
- uart_init(sdp);
+ uart_init(sdp, config);
}
/**
diff --git a/os/hal/platforms/LPC13xx/serial_lld.h b/os/hal/platforms/LPC13xx/serial_lld.h
index c6503fc08..0426c6d5f 100644
--- a/os/hal/platforms/LPC13xx/serial_lld.h
+++ b/os/hal/platforms/LPC13xx/serial_lld.h
@@ -84,29 +84,29 @@
/*===========================================================================*/
/**
- * @brief UART0 driver enable switch.
+ * @brief UART0 driver enable switch.
* @details If set to @p TRUE the support for UART0 is included.
- * @note The default is @p TRUE .
+ * @note The default is @p TRUE .
*/
#if !defined(USE_LPC13xx_UART0) || defined(__DOXYGEN__)
#define USE_LPC13xx_UART0 TRUE
#endif
/**
- * @brief FIFO preload parameter.
+ * @brief FIFO preload parameter.
* @details Configuration parameter, this values defines how many bytes are
- * preloaded in the HW transmit FIFO for each interrupt, the maximum value is
- * 16 the minimum is 1.
- * @note An high value reduces the number of interrupts generated but can
- * also increase the worst case interrupt response time because the
- * preload loops.
+ * preloaded in the HW transmit FIFO for each interrupt, the maximum
+ * value is 16 the minimum is 1.
+ * @note An high value reduces the number of interrupts generated but can
+ * also increase the worst case interrupt response time because the
+ * preload loops.
*/
#if !defined(LPC13xx_UART_FIFO_PRELOAD) || defined(__DOXYGEN__)
#define LPC13xx_UART_FIFO_PRELOAD 16
#endif
/**
- * @brief UART0 interrupt priority level setting.
+ * @brief UART0 interrupt priority level setting.
*/
#if !defined(LPC13xx_UART0_PRIORITY) || defined(__DOXYGEN__)
#define LPC13xx_UART0_PRIORITY 3
@@ -117,7 +117,7 @@
/*===========================================================================*/
#if (LPC13xx_UART_FIFO_PRELOAD < 1) || (LPC13xx_UART_FIFO_PRELOAD > 16)
-#error "invalid LPC214x_UART_FIFO_PRELOAD setting"
+#error "invalid LPC13xx_UART_FIFO_PRELOAD setting"
#endif
/*===========================================================================*/
@@ -125,12 +125,12 @@
/*===========================================================================*/
/**
- * @brief Serial Driver condition flags type.
+ * @brief Serial Driver condition flags type.
*/
typedef uint32_t sdflags_t;
/**
- * @brief LPC214x Serial Driver configuration structure.
+ * @brief LPC13xx 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.
*/
@@ -156,8 +156,6 @@ typedef struct {
_base_asynchronous_channel_data \
/* Driver state.*/ \
sdstate_t state; \
- /* Current configuration data.*/ \
- const SerialConfig *config; \
/* Input queue.*/ \
InputQueue iqueue; \
/* Output queue.*/ \
@@ -190,7 +188,7 @@ extern SerialDriver SD1;
extern "C" {
#endif
void sd_lld_init(void);
- void sd_lld_start(SerialDriver *sdp);
+ void sd_lld_start(SerialDriver *sdp, const SerialConfig *config);
void sd_lld_stop(SerialDriver *sdp);
#ifdef __cplusplus
}