BCM2708: Allow pass parameters with AUX interrupts; Add mini-UART break capability.

This commit is contained in:
Gregory Nutt
2017-10-18 13:57:54 -06:00
parent bcff0543f9
commit e18e8573d1
3 changed files with 57 additions and 3 deletions
+6
View File
@@ -91,6 +91,12 @@ config BCM2708_MINI_UART_OFLOWCONTROL
---help---
Enable BCM2708_MINI_UART CTS flow control
config BCM2708_MINI_UART_BREAKS
bool "Break support"
default n
---help---
Support BSD style BREAK IOCTL commands
endmenu # BCM2708 Mini-UART Configuration
menu "BCM2708 PL011 UART Configuration"
+11 -3
View File
@@ -49,6 +49,12 @@
#include "chip/bcm2708_aux.h"
#include "bcm_aux.h"
/****************************************************************************
* Private Data
****************************************************************************/
static FAR void *g_aux_arg[3];
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -81,21 +87,21 @@ static int bcm_aux_interrupt(int irq, FAR void *context, FAR void *arg)
#ifdef CONFIG_BCM2708_MINI_UART
if ((auxirq & BCM_AUX_IRQ_MU) != 0)
{
(void)bcm_mu_interrupt(irq, context, arg);
(void)bcm_mu_interrupt(irq, context, g_aux_arg[(int)BCM_AUX_MINI_UART]);
}
#endif
#ifdef CONFIG_BCM2708_SPI1
if ((auxirq & BCM_AUX_IRQ_SPI1) != 0)
{
(void)bcm_spi1_interrupt(irq, context, arg);
(void)bcm_spi1_interrupt(irq, context, g_aux_arg[(int)BCM_AUX_MINI_SPI1]);
}
#endif
#ifdef CONFIG_BCM2708_SPI2
if ((auxirq & BCM_AUX_IRQ_SPI2) != 0)
{
(void)bcm_spi2_interrupt(irq, context, arg);
(void)bcm_spi2_interrupt(irq, context, g_aux_arg[(int)BCM_AUX_MINI_SPI2]);
}
#endif
@@ -178,6 +184,7 @@ void bcm_aux_enable(enum bcm_aux_peripheral_e periph, FAR void *arg)
return;
}
g_aux_arg[(int)periph] = arg;
modifyreg32(BCM_AUX_ENB, 0, setbits);
}
@@ -223,5 +230,6 @@ void bcm_aux_disable(enum bcm_aux_peripheral_e periph)
return;
}
g_aux_arg[(int)periph] = NULL;
modifyreg32(BCM_AUX_ENB, clrbits, 0);
}
+40
View File
@@ -511,6 +511,46 @@ static int bcm_ioctl(struct file *filep, int cmd, unsigned long arg)
break;
#endif /* CONFIG_SERIAL_TERMIOS */
#ifdef CONFIG_BCM2708_MINI_UART_BREAKS
case TIOCSBRK:
{
irqstate_t flags;
uint8_t lcr;
/* Send a break signal */
flags = enter_critical_section();
lcr = getreg8(BCM_AUX_MU_LCR);
lcr |= BCM_AUX_MU_LCR_BREAK;
putreg8(lcd, BCM_AUX_MU_LCR);
/* Disable TX activity */
bcm_txint(dev, false);
leave_critical_section(flags);
}
break;
case TIOCCBRK:
{
irqstate_t flags;
uint8_t lcr;
/* Configure TX back to UART */
flags = enter_critical_section();
lcr = getreg8(BCM_AUX_MU_LCR);
lcr &= ~BCM_AUX_MU_LCR_BREAK;
putreg8(lcd, BCM_AUX_MU_LCR);
/* Enable further TX activity */
bcm_txint(dev, true);
leave_critical_section(flags);
}
break;
#endif /* CONFIG_BCM2708_MINI_UART_BREAKS */
default:
ret = -ENOTTY;
break;