no-OS
xilinx_uart.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * @file xilinx/xilinx_uart.h
3  * @brief Header containing types used in the uart driver.
4  * @author Cristian Pop (cristian.pop@analog.com)
5 ********************************************************************************
6  * Copyright 2019(c) Analog Devices, Inc.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are met:
10  *
11  * 1. Redistributions of source code must retain the above copyright notice,
12  * this list of conditions and the following disclaimer.
13  *
14  * 2. Redistributions in binary form must reproduce the above copyright notice,
15  * this list of conditions and the following disclaimer in the documentation
16  * and/or other materials provided with the distribution.
17  *
18  * 3. Neither the name of Analog Devices, Inc. nor the names of its
19  * contributors may be used to endorse or promote products derived from this
20  * software without specific prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES, INC. “AS IS” AND ANY EXPRESS OR
23  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
25  * EVENT SHALL ANALOG DEVICES, INC. BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
28  * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
29  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
30  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
31  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *******************************************************************************/
33 
34 #ifndef XILINX_UART_H_
35 #define XILINX_UART_H_
36 
37 /******************************************************************************/
38 /***************************** Include Files **********************************/
39 /******************************************************************************/
40 
41 /******************************************************************************/
42 /********************** Macros and Constants Definitions **********************/
43 /******************************************************************************/
44 
45 #define UART_BUFF_LENGTH 256
46 
47 /******************************************************************************/
48 /*************************** Types Declarations *******************************/
49 /******************************************************************************/
50 
60 };
61 
71  uint32_t irq_id;
74 };
75 
80 struct xil_uart_desc {
84  uint32_t irq_id;
90  uint32_t fifo_read_offset;
94  uint32_t bytes_received;
98  void *instance;
99 };
100 
104 extern const struct no_os_uart_platform_ops xil_uart_ops;
105 
106 #endif
UART_BUFF_LENGTH
#define UART_BUFF_LENGTH
Definition: xilinx_uart.h:45
xil_uart_desc::fifo
struct no_os_fifo_element * fifo
Definition: xilinx_uart.h:88
no_os_alloc.h
no_os_uart_platform_ops
Structure holding UART function pointers that point to the platform specific function.
Definition: no_os_uart.h:155
no_os_uart_init_param::extra
void * extra
Definition: no_os_uart.h:127
no_os_callback_desc
Structure describing a callback to be registered.
Definition: no_os_irq.h:142
xil_uart_desc::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: xilinx_uart.h:86
UART_PL
@ UART_PL
Definition: xilinx_uart.h:57
no_os_irq.h
Header file of IRQ interface.
xil_uart_init_param::type
enum xil_uart_type type
Definition: xilinx_uart.h:69
no_os_irq_register_callback
int32_t no_os_irq_register_callback(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id, struct no_os_callback_desc *callback_desc)
Register a callback to handle the irq events.
Definition: no_os_irq.c:92
xil_uart_desc::buff
char buff[UART_BUFF_LENGTH]
Definition: xilinx_uart.h:92
xilinx_uart.h
xil_uart_desc
Xilinx platform specific UART descriptor.
Definition: xilinx_uart.h:80
xil_uart_desc::bytes_received
uint32_t bytes_received
Definition: xilinx_uart.h:94
xil_irq_init_param::type
enum xil_irq_type type
Definition: xilinx_irq.h:66
no_os_uart_platform_ops::init
int32_t(* init)(struct no_os_uart_desc **, struct no_os_uart_init_param *)
Definition: no_os_uart.h:157
no_os_uart_desc::baud_rate
uint32_t baud_rate
Definition: no_os_uart.h:144
WRITE_SIZE
#define WRITE_SIZE
Definition: xilinx_uart.c:59
UART_PS
@ UART_PS
Definition: xilinx_uart.h:59
u8
unsigned char u8
Definition: wrapper.h:156
xil_uart_init_param::irq_id
uint32_t irq_id
Definition: xilinx_uart.h:71
xil_uart_type
xil_uart_type
Xilinx platform architecture sections.
Definition: xilinx_uart.h:55
xil_uart_desc::type
enum xil_uart_type type
Definition: xilinx_uart.h:82
no_os_calloc
void * no_os_calloc(size_t nitems, size_t size)
Allocate memory and return a pointer to it, set memory to 0.
Definition: chibios_alloc.c:54
no_os_uart_desc::device_id
uint8_t device_id
Definition: no_os_uart.h:138
no_os_fifo.h
Header file of fifo.
no_os_uart_desc
Stucture holding the UART descriptor.
Definition: no_os_uart.h:134
no_os_error.h
Error codes definition.
xil_uart_desc::total_error_count
uint32_t total_error_count
Definition: xilinx_uart.h:96
no_os_irq_global_enable
int32_t no_os_irq_global_enable(struct no_os_irq_ctrl_desc *desc)
Enable global interrupts.
Definition: no_os_irq.c:129
no_os_fifo_element::len
uint32_t len
Definition: no_os_fifo.h:56
xil_irq_ops
const struct no_os_irq_platform_ops xil_irq_ops
Xilinx platform specific IRQ platform ops structure.
Definition: xilinx_irq.c:373
no_os_uart_desc::extra
void * extra
Definition: no_os_uart.h:147
no_os_fifo_insert
int32_t no_os_fifo_insert(struct no_os_fifo_element **p_fifo, char *buff, uint32_t len)
no_os_irq_init_param::irq_ctrl_id
uint32_t irq_ctrl_id
Definition: no_os_irq.h:109
no_os_fifo_remove
struct no_os_fifo_element * no_os_fifo_remove(struct no_os_fifo_element *p_fifo)
no_os_irq_ctrl_init
int32_t no_os_irq_ctrl_init(struct no_os_irq_ctrl_desc **desc, const struct no_os_irq_init_param *param)
Initialize the IRQ interrupts.
Definition: no_os_irq.c:45
xil_uart_init_param
Structure holding the initialization parameters for Xilinx platform specific UART parameters.
Definition: xilinx_uart.h:67
IRQ_PS
@ IRQ_PS
Definition: xilinx_irq.h:56
xilinx_irq.h
xil_uart_init_param::irq_desc
struct no_os_irq_ctrl_desc * irq_desc
Definition: xilinx_uart.h:73
no_os_uart_init_param::baud_rate
uint32_t baud_rate
Definition: no_os_uart.h:118
irq_desc
Structure for Interrupt Request descriptor.
no_os_fifo_element
Structure holding the fifo element parameters.
Definition: no_os_fifo.h:50
xil_uart_desc::instance
void * instance
Definition: xilinx_uart.h:98
no_os_free
void no_os_free(void *ptr)
Deallocate memory previously allocated by a call to no_os_calloc or no_os_malloc.
Definition: chibios_alloc.c:69
xil_uart_ops
const struct no_os_uart_platform_ops xil_uart_ops
Xilinx platform specific UART platform ops structure.
Definition: xilinx_uart.c:520
NULL
#define NULL
Definition: wrapper.h:64
no_os_uart_init_param
Structure holding the parameters for UART initialization.
Definition: no_os_uart.h:110
xil_uart_ops
const struct no_os_uart_platform_ops xil_uart_ops
Xilinx platform specific UART platform ops structure.
Definition: xilinx_uart.c:520
no_os_irq_init_param
Structure holding the initial parameters for Interrupt Request.
Definition: no_os_irq.h:107
no_os_fifo_element::data
char * data
Definition: no_os_fifo.h:54
no_os_uart_init_param::device_id
uint8_t device_id
Definition: no_os_uart.h:112
xil_uart_desc::fifo_read_offset
uint32_t fifo_read_offset
Definition: xilinx_uart.h:90
no_os_irq_enable
int32_t no_os_irq_enable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Enable specific interrupt.
Definition: no_os_irq.c:181
no_os_irq_platform_ops
Structure holding IRQ function pointers that point to the platform specific function.
Definition: no_os_irq.h:160
no_os_uart.h
Header file of UART interface.
xil_uart_desc::irq_id
uint32_t irq_id
Definition: xilinx_uart.h:84
no_os_irq_disable
int32_t no_os_irq_disable(struct no_os_irq_ctrl_desc *desc, uint32_t irq_id)
Disable specific interrupt.
Definition: no_os_irq.c:198
no_os_irq_ctrl_desc
Definition: no_os_irq.h:123
xil_irq_init_param
Structure holding the initialization parameters for Xilinx platform specific IRQ parameters.
Definition: xilinx_irq.h:64