rt-thread/libcpu/avr32/uc3/serial.h

51 lines
1.1 KiB
C
Raw Normal View History

2013-01-08 21:05:02 +08:00
/*
* Copyright (c) 2006-2022, RT-Thread Development Team
2013-01-08 21:05:02 +08:00
*
* SPDX-License-Identifier: Apache-2.0
2013-01-08 21:05:02 +08:00
*
* Change Logs:
* Date Author Notes
* 2009-01-05 Bernard first version
* 2010-03-29 Bernard remove interrupt tx and DMA rx mode.
* 2010-03-30 Kyle Ported from STM32 to AVR32.
*/
2013-01-08 21:05:02 +08:00
#ifndef __RT_HW_SERIAL_H__
#define __RT_HW_SERIAL_H__
#include <rthw.h>
#include <rtthread.h>
#include "compiler.h"
#include "usart.h"
2021-03-27 17:51:56 +08:00
#define UART_RX_BUFFER_SIZE 64
#define UART_TX_DMA_NODE_SIZE 4
2013-01-08 21:05:02 +08:00
/* data node for Tx Mode */
struct avr32_serial_data_node
{
2021-03-27 17:51:56 +08:00
rt_uint8_t *data_ptr;
rt_size_t data_size;
struct avr32_serial_data_node *next, *prev;
2013-01-08 21:05:02 +08:00
};
struct avr32_serial_int_rx
{
2021-03-27 17:51:56 +08:00
rt_uint8_t rx_buffer[UART_RX_BUFFER_SIZE];
rt_uint32_t read_index, save_index;
2013-01-08 21:05:02 +08:00
};
struct avr32_serial_device
{
2021-03-27 17:51:56 +08:00
avr32_usart_t *uart_device;
2013-01-08 21:05:02 +08:00
2021-03-27 17:51:56 +08:00
/* rx structure */
struct avr32_serial_int_rx* int_rx;
2013-01-08 21:05:02 +08:00
};
rt_err_t rt_hw_serial_register(rt_device_t device, const char* name, rt_uint32_t flag, struct avr32_serial_device *serial);
void rt_hw_serial_isr();
#endif