Contiki 3.x
|
Provide common UART routines for MK60DZ10.More...
Go to the source code of this file.
Macros | |
#define | UART_SBR(f, b) ((f) / (b * 16)) |
UART module SBR parameter based on module frequency f and desired baud rate b. | |
#define | UART_BRFA(f, b) ((((4 * (f)) / (b) + 1) / 2) % 32) |
UART module fine adjust parameter based on module frequency f and desired baud rate b. More... | |
Functions | |
void | uart_module_enable (const unsigned int uart_num) |
Enable the clock gate to an UART module. More... | |
void | uart_init (const unsigned int uart_num, uint32_t module_clk_hz, const uint32_t baud) |
Initialize UART. More... | |
Provide common UART routines for MK60DZ10.
Definition in file uart.h.
#define UART_BRFA | ( | f, | |
b | |||
) | ((((4 * (f)) / (b) + 1) / 2) % 32) |
UART module fine adjust parameter based on module frequency f and desired baud rate b.
Definition at line 98 of file uart.h.
Referenced by uart_init().
void uart_init | ( | const unsigned int | uart_num, |
uint32_t | module_clk_hz, | ||
const uint32_t | baud | ||
) |
Initialize UART.
This is based on the example found in the CodeWarrior samples provided by Freescale.
uart_num | UART module number |
module_clk_hz | Module clock (in Hz) of the given UART, if zero: Use current module frequency. |
baud | Desired target baud rate of the UART. |
Definition at line 154 of file uart.c.
References UART_Type::BDH, UART_Type::BDL, UART_Type::C1, UART_Type::C2, UART_Type::C4, DEBUGGER_BREAK, NVIC_EnableIRQ(), ringbuf_init(), SystemBusClock, SystemSysClock, UART0_RX_TX_IRQn, UART1_RX_TX_IRQn, UART2_RX_TX_IRQn, UART3_RX_TX_IRQn, UART4_RX_TX_IRQn, UART5_RX_TX_IRQn, UART_BRFA, uart_module_enable(), and UART_SBR.
Referenced by dbg_uart_init(), main(), and menu_run_sleep().
void uart_module_enable | ( | const unsigned int | uart_num | ) |
Enable the clock gate to an UART module.
This is a convenience function mapping UART module number to SIM_SCG register.
uart_num | UART module number |
Definition at line 115 of file uart.c.
References BITBAND_REG, DEBUGGER_BREAK, and SIM.
Referenced by ow_init(), and uart_init().