openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
lpc17_uart.h
Go to the documentation of this file.
1/*
2 * openMMC --
3 *
4 * Copyright (C) 2015 Henrique Silva <henrique.silva@lnls.br>
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
27#ifndef LPC17_UART_H_
28#define LPC17_UART_H_
29
30#include "string.h"
31#include "stdio.h"
32
33typedef struct lpc_uart_cfg {
34 LPC_USART_T * ptr;
36 CHIP_SYSCTL_PCLK_T sysclk;
38
39extern const lpc_uart_cfg_t usart_cfg[4];
40
41#define uart_set_baud( id, baud ) Chip_UART_SetBaud( usart_cfg[id].ptr, baud )
42#define uart_config_data( id, cfg ) Chip_UART_ConfigData( usart_cfg[id].ptr, cfg )
43#define uart_tx_enable( id ) Chip_UART_TXEnable( usart_cfg[id].ptr )
44#define uart_tx_disable( id ) Chip_UART_TXDisable( usart_cfg[id].ptr )
45#define uart_int_enable( id, mask ) Chip_UART_IntEnable( usart_cfg[id].ptr, mask )
46#define uart_int_disable( id, mask ) Chip_UART_IntDisable( usart_cfg[id].ptr, mask )
47#define uart_send_char( id, ch ) Chip_UART_SendByte( usart_cfg[id].ptr, ch )
48#define uart_read_char( id ) Chip_UART_ReadByte( usart_cfg[id].ptr )
49#define uart_send( id, msg, len ) Chip_UART_SendBlocking( usart_cfg[id].ptr, msg, len )
50#define uart_read( id, buf, len ) Chip_UART_ReadBlocking( usart_cfg[id].ptr, buf, len )
51
52void uart_init ( uint8_t id );
53
54#endif
IRQn_Type
Definition LPC176x5x.h:56
struct lpc_uart_cfg lpc_uart_cfg_t
void uart_init(uint8_t id)
Definition lpc17_uart.c:37
const lpc_uart_cfg_t usart_cfg[4]
Definition lpc17_uart.c:30
Definition lpc17_uart.h:33
CHIP_SYSCTL_PCLK_T sysclk
Definition lpc17_uart.h:36
IRQn_Type irq
Definition lpc17_uart.h:35
LPC_USART_T * ptr
Definition lpc17_uart.h:34