Add support for custom platform IOCTL on UART

Signed-off-by: Anton D. Kachalov <mouse@yandex-team.ru>
This commit is contained in:
Anton D. Kachalov 2015-08-03 15:32:51 +03:00
parent 577bae0a13
commit 1bb74504a8
3 changed files with 16 additions and 2 deletions

View File

@ -318,6 +318,10 @@ config 16550_SUPRESS_CONFIG
that configures the 16550_UART. In that case, you may want to
just leave the existing console configuration in place. Default: n
config SERIAL_UART_ARCH_IOCTL
bool "Platform has own custom IOCTL"
default n
config 16550_REGINCR
int "Address increment between 16550 registers"
default 1

View File

@ -864,7 +864,15 @@ static int u16550_ioctl(struct file *filep, int cmd, unsigned long arg)
struct inode *inode = filep->f_inode;
struct uart_dev_s *dev = inode->i_private;
struct u16550_s *priv = (struct u16550_s*)dev->priv;
int ret = OK;
#ifdef CONFIG_SERIAL_UART_ARCH_IOCTL
int ret = uart_ioctl(filep, cmd, arg);
if (ret != -ENOTTY)
{
return ret;
}
#endif
switch (cmd)
{

View File

@ -336,16 +336,18 @@ typedef uint32_t uart_addrwidth_t;
************************************************************************************/
/************************************************************************************
* Name: uart_getreg(), uart_putreg()
* Name: uart_getreg(), uart_putreg(), uart_ioctl()
*
* Description:
* These functions must be provided by the processor-specific code in order to
* correctly access 16550 registers
* uart_ioctl() is optional to provide custom IOCTLs
*
************************************************************************************/
uart_datawidth_t uart_getreg(uart_addrwidth_t base, unsigned int offset);
void uart_putreg(uart_addrwidth_t base, unsigned int offset, uart_datawidth_t value);
int uart_ioctl(struct file *filep, int cmd, unsigned long arg);
#endif /* CONFIG_16550_UART */
#endif /* __INCLUDE_NUTTX_SERIAL_UART_16550_H */