BCM2708: Add a little more Mini-UART logic. Still missing UART configuration logic.
This commit is contained in:
parent
6235e72ce0
commit
bcff0543f9
@ -41,11 +41,13 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
#include "up_arch.h"
|
#include "up_arch.h"
|
||||||
|
|
||||||
#include "chip/bcm2708_aux.h"
|
#include "chip/bcm2708_aux.h"
|
||||||
#include "bcm_config.h"
|
#include "bcm_config.h"
|
||||||
|
#include "bcm_aux.h"
|
||||||
#include "bcm_lowputc.h"
|
#include "bcm_lowputc.h"
|
||||||
|
|
||||||
#include "up_internal.h"
|
#include "up_internal.h"
|
||||||
@ -154,10 +156,54 @@ void bcm_lowsetup(void)
|
|||||||
#ifdef CONFIG_BCM2708_MINI_UART
|
#ifdef CONFIG_BCM2708_MINI_UART
|
||||||
int bcm_miniuart_configure(FAR const struct uart_config_s *config)
|
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
|
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||||
|
/* 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
|
#warning Missing logic
|
||||||
#endif
|
#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;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -165,10 +211,25 @@ int bcm_miniuart_configure(FAR const struct uart_config_s *config)
|
|||||||
#ifdef CONFIG_BCM2708_PL011_UART
|
#ifdef CONFIG_BCM2708_PL011_UART
|
||||||
int bcm_pl011uart_configure(FAR const struct uart_config_s *config)
|
int bcm_pl011uart_configure(FAR const struct uart_config_s *config)
|
||||||
{
|
{
|
||||||
|
DEBUGASSERT(config != NULL);
|
||||||
|
|
||||||
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
#ifndef CONFIG_SUPPRESS_UART_CONFIG
|
||||||
|
/* Set up BAUD Divisor */
|
||||||
#warning Missing logic
|
#warning Missing logic
|
||||||
|
|
||||||
|
/* Setup parity */
|
||||||
|
|
||||||
|
/* Setup number of bits */
|
||||||
|
|
||||||
|
/* Configure Stop bits */
|
||||||
|
|
||||||
|
/* Configure flow control */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Configure FIFOS */
|
||||||
|
|
||||||
|
/* Enable receiver and tranmsmitter */
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -294,6 +294,10 @@ static void bcm_shutdown(struct uart_dev_s *dev)
|
|||||||
|
|
||||||
bcm_restoreuartint(priv, 0);
|
bcm_restoreuartint(priv, 0);
|
||||||
|
|
||||||
|
/* Disable receiver and tranmsmitter */
|
||||||
|
|
||||||
|
putreg8(0, BCM_AUX_MU_CNTL);
|
||||||
|
|
||||||
/* Disable the Mini-UART */
|
/* Disable the Mini-UART */
|
||||||
|
|
||||||
bcm_aux_disable(BCM_AUX_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)
|
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 */
|
/* Revisit... RX status not returned */
|
||||||
|
|
||||||
*status = 0;
|
*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)
|
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.
|
/* 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.
|
* 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)
|
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 */
|
/* Data is sent be writing to the IO register */
|
||||||
|
|
||||||
putreg8((uint8_t)ch, BCM_AUX_MU_IO);
|
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)
|
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.
|
/* 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.
|
* 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)
|
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.
|
/* Return true if the TX FIFO is empty.
|
||||||
* NOTE: This has the side effect of clearing any RX overrun status.
|
* NOTE: This has the side effect of clearing any RX overrun status.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user