diff --git a/arch/arm/src/bcm2708/bcm_lowputc.c b/arch/arm/src/bcm2708/bcm_lowputc.c index 29e638bdc6..5ae8663729 100644 --- a/arch/arm/src/bcm2708/bcm_lowputc.c +++ b/arch/arm/src/bcm2708/bcm_lowputc.c @@ -41,11 +41,13 @@ #include #include +#include #include "up_arch.h" #include "chip/bcm2708_aux.h" #include "bcm_config.h" +#include "bcm_aux.h" #include "bcm_lowputc.h" #include "up_internal.h" @@ -154,10 +156,54 @@ void bcm_lowsetup(void) #ifdef CONFIG_BCM2708_MINI_UART int bcm_miniuart_configure(FAR const struct uart_config_s *config) { + DEBUGASSERT(config != NULL); + + /* Enable the Mini-UART */ + + bcm_aux_enable(BCM_AUX_MINI_UART, NULL); + #ifndef CONFIG_SUPPRESS_UART_CONFIG -# warning Missing logic + /* Set up BAUD Divisor */ +#warning Missing logic + + /* Setup parity -- Mini-UART does not support parity. */ + + if (config->parity != 0) + { + return -EINVAL; + } + + /* Setup number of bits */ + + if (config->bits == 7) + { + putreg8(0, BCM_AUX_MU_LCR); + } + else if (config->bits == 8) + { + putreg8(BCM_AUX_MU_LCR_DATA8BIT, BCM_AUX_MU_LCR); + } + else + { + return -EINVAL; + } + + /* Configure Stop bits: Only 1 STOP bit supported */ + + if (config->stopbits2) + { + return -EINVAL; + } + + /* Configure flow control */ +#warning Missing logic #endif + /* Configure FIFOS: Always enabled */ + + /* Enable receiver and tranmsmitter */ + + putreg8(BCM_AUX_MU_CNTL_RXEN | BCM_AUX_MU_CNTL_TXEN, BCM_AUX_MU_CNTL); return OK; } #endif @@ -165,10 +211,25 @@ int bcm_miniuart_configure(FAR const struct uart_config_s *config) #ifdef CONFIG_BCM2708_PL011_UART int bcm_pl011uart_configure(FAR const struct uart_config_s *config) { + DEBUGASSERT(config != NULL); + #ifndef CONFIG_SUPPRESS_UART_CONFIG -# warning Missing logic + /* Set up BAUD Divisor */ +#warning Missing logic + + /* Setup parity */ + + /* Setup number of bits */ + + /* Configure Stop bits */ + + /* Configure flow control */ #endif + /* Configure FIFOS */ + + /* Enable receiver and tranmsmitter */ + return OK; } #endif diff --git a/arch/arm/src/bcm2708/bcm_miniuart.c b/arch/arm/src/bcm2708/bcm_miniuart.c index ecd1750cbe..d91400d17b 100644 --- a/arch/arm/src/bcm2708/bcm_miniuart.c +++ b/arch/arm/src/bcm2708/bcm_miniuart.c @@ -294,6 +294,10 @@ static void bcm_shutdown(struct uart_dev_s *dev) bcm_restoreuartint(priv, 0); + /* Disable receiver and tranmsmitter */ + + putreg8(0, BCM_AUX_MU_CNTL); + /* Disable the Mini-UART */ bcm_aux_disable(BCM_AUX_MINI_UART); @@ -527,8 +531,6 @@ static int bcm_ioctl(struct file *filep, int cmd, unsigned long arg) static int bcm_receive(struct uart_dev_s *dev, uint32_t *status) { - struct bcm_dev_s *priv = (struct bcm_dev_s *)dev->priv; - /* Revisit... RX status not returned */ *status = 0; @@ -582,8 +584,6 @@ static void bcm_rxint(struct uart_dev_s *dev, bool enable) static bool bcm_rxavailable(struct uart_dev_s *dev) { - struct bcm_dev_s *priv = (struct bcm_dev_s *)dev->priv; - /* Return true if there is at least one more by in the RX FIFO. * NOTE: This has the side effect of clearing any RX overrun status. */ @@ -633,8 +633,6 @@ static bool bcm_rxflowcontrol(struct uart_dev_s *dev, static void bcm_send(struct uart_dev_s *dev, int ch) { - struct bcm_dev_s *priv = (struct bcm_dev_s *)dev->priv; - /* Data is sent be writing to the IO register */ putreg8((uint8_t)ch, BCM_AUX_MU_IO); @@ -690,8 +688,6 @@ static void bcm_txint(struct uart_dev_s *dev, bool enable) static bool bcm_txready(struct uart_dev_s *dev) { - struct bcm_dev_s *priv = (struct bcm_dev_s *)dev->priv; - /* Return true if the TX FIFO can accept at least one more byte. * NOTE: This has the side effect of clearing any RX overrun status. */ @@ -709,8 +705,6 @@ static bool bcm_txready(struct uart_dev_s *dev) static bool bcm_txempty(struct uart_dev_s *dev) { - struct bcm_dev_s *priv = (struct bcm_dev_s *)dev->priv; - /* Return true if the TX FIFO is empty. * NOTE: This has the side effect of clearing any RX overrun status. */