x86: Support configurable UART baud rate
This patch extends the Intel Quark X1000 SoC UART initialization API to accept a numeric baud rate specification.
This commit is contained in:
parent
dbb82f2439
commit
31ad67abd7
|
@ -35,10 +35,10 @@
|
|||
PROT_DOMAINS_ALLOC(uart_16x50_driver_t, quarkX1000_uart0);
|
||||
PROT_DOMAINS_ALLOC(uart_16x50_driver_t, quarkX1000_uart1);
|
||||
|
||||
/* Divisor setting for 115200 baud from section 18.2.2 of Intel Quark SoC
|
||||
* X1000 Datasheet.
|
||||
/* UART base frequency from section 18.2.2 of Intel Quark SoC X1000
|
||||
* Datasheet.
|
||||
*/
|
||||
#define QUARK_X1000_UART_DL_115200 24
|
||||
#define QUARK_X1000_UART_FBASE 44236800
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
@ -46,8 +46,9 @@ PROT_DOMAINS_ALLOC(uart_16x50_driver_t, quarkX1000_uart1);
|
|||
* \param dev Device to initialize.
|
||||
*/
|
||||
void
|
||||
quarkX1000_uart_init(quarkX1000_uart_dev_t dev)
|
||||
quarkX1000_uart_init(quarkX1000_uart_dev_t dev, unsigned baud)
|
||||
{
|
||||
uint16_t dl;
|
||||
pci_config_addr_t pci_addr;
|
||||
uart_16x50_driver_t ATTR_KERN_ADDR_SPACE *drv;
|
||||
|
||||
|
@ -67,7 +68,9 @@ quarkX1000_uart_init(quarkX1000_uart_dev_t dev)
|
|||
drv = &quarkX1000_uart1;
|
||||
PROT_DOMAINS_INIT_ID(quarkX1000_uart1);
|
||||
}
|
||||
uart_16x50_init(drv, pci_addr, QUARK_X1000_UART_DL_115200);
|
||||
/* Divisor setting from section 18.2.2 of Intel Quark SoC X1000 Datasheet. */
|
||||
dl = QUARK_X1000_UART_FBASE / (16 * baud);
|
||||
uart_16x50_init(drv, pci_addr, dl);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
/**
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef enum {
|
|||
QUARK_X1000_UART_1
|
||||
} quarkX1000_uart_dev_t;
|
||||
|
||||
void quarkX1000_uart_init(quarkX1000_uart_dev_t dev);
|
||||
void quarkX1000_uart_init(quarkX1000_uart_dev_t dev, unsigned baud);
|
||||
void quarkX1000_uart_tx(quarkX1000_uart_dev_t dev, uint8_t c);
|
||||
|
||||
#endif /* CPU_X86_DRIVERS_QUARKX1000_UART_H_ */
|
||||
|
|
|
@ -86,8 +86,10 @@ main(void)
|
|||
quarkX1000_imr_conf();
|
||||
#endif
|
||||
irq_init();
|
||||
/* Initialize UART connected to Galileo Gen2 FTDI header */
|
||||
quarkX1000_uart_init(QUARK_X1000_UART_1);
|
||||
/* Initialize UART connected to Galileo Gen1 3.5mm audio-style jack or
|
||||
* Galileo Gen2 FTDI header
|
||||
*/
|
||||
quarkX1000_uart_init(QUARK_X1000_UART_1, 115200);
|
||||
clock_init();
|
||||
rtimer_init();
|
||||
|
||||
|
|
Loading…
Reference in a new issue