openMMC
Open Source Modular MMC for AMCs
Loading...
Searching...
No Matches
lpc17_uartrb.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 "semphr.h"
31#include "string.h"
32#include "stdio.h"
33
34typedef struct lpc_uart_cfg {
35 LPC_USART_T * ptr;
38
40
41RINGBUFF_T rxring, txring;
42
43#define uart_set_baud( id, baud ) Chip_UART_SetBaud( usart_cfg[id].ptr, baud )
44#define uart_config_data( id, cfg ) Chip_UART_ConfigData( usart_cfg[id].ptr, cfg )
45#define uart_tx_enable( id ) Chip_UART_TXEnable( usart_cfg[id].ptr )
46#define uart_tx_disable( id ) Chip_UART_TXDisable( usart_cfg[id].ptr )
47#define uart_int_enable( id, mask ) Chip_UART_IntEnable( usart_cfg[id].ptr, mask )
48#define uart_int_disable( id, mask ) Chip_UART_IntDisable( usart_cfg[id].ptr, mask )
49#define uart_send_char( id, ch ) Chip_UART_SendByte( usart_cfg[id].ptr, ch )
50#define uart_read_char( id ) Chip_UART_ReadByte( usart_cfg[id].ptr )
51#define uart_send( id, msg, len ) Chip_UART_SendRB( usart_cfg[id].ptr, &txring, msg, len )
52#define uart_read( id, buf, len ) Chip_UART_ReadRB( usart_cfg[id].ptr, &rxring, buf, len )
53void uart_init( uint8_t id );
54
55#endif
IRQn_Type
Definition LPC176x5x.h:56
RINGBUFF_T rxring
Definition lpc17_uartrb.h:41
struct lpc_uart_cfg lpc_uart_cfg_t
RINGBUFF_T txring
Definition lpc17_uartrb.h:41
volatile lpc_uart_cfg_t usart_cfg[4]
Definition lpc17_uartrb.h:39
void uart_init(uint8_t id)
Definition lpc17_uart.c:37
Definition lpc17_uart.h:33
IRQn_Type irq
Definition lpc17_uart.h:35
LPC_USART_T * ptr
Definition lpc17_uart.h:34