VSF Documented
uart.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __OSA_HAL_X86_WIN_USART_H__
19#define __OSA_HAL_X86_WIN_USART_H__
20
21/*============================ INCLUDES ======================================*/
22
23#include "hal/vsf_hal_cfg.h"
24
25#if VSF_HAL_USE_USART == ENABLED
26
27#include "../device.h"
29
30/*============================ MACROS ========================================*/
31
32#define VSF_USART_CFG_REIMPLEMENT_TYPE_MODE ENABLED
33#define VSF_USART_CFG_REIMPLEMENT_TYPE_IRQ_MASK ENABLED
34
35/*============================ MACROFIED FUNCTIONS ===========================*/
36/*============================ TYPES =========================================*/
37
38typedef enum vsf_usart_mode_t {
39 VSF_USART_8_BIT_LENGTH = (0x00ul << 0),
40 VSF_USART_9_BIT_LENGTH = (0x01ul << 0),
41
42 VSF_USART_1_STOPBIT = (0x00ul << 1),
43 VSF_USART_1_5_STOPBIT = (0x01ul << 1),
44 VSF_USART_2_STOPBIT = (0x02ul << 1),
45
46 VSF_USART_NO_PARITY = (0x00ul << 3),
47 VSF_USART_EVEN_PARITY = (0x01ul << 3),
48 VSF_USART_ODD_PARITY = (0x02ul << 3),
49
50 VSF_USART_NO_HWCONTROL = (0x00ul << 5),
51 VSF_USART_RTS_HWCONTROL = (0x01ul << 5),
52 VSF_USART_CTS_HWCONTROL = (0x02ul << 5),
54
55 // unsupported for win
56 VSF_USART_6_BIT_LENGTH = (0x01ul << 7),
57 VSF_USART_7_BIT_LENGTH = (0x02ul << 7),
58 VSF_USART_5_BIT_LENGTH = (0x03ul << 7),
59 VSF_USART_10_BIT_LENGTH = (0x04ul << 7),
60
61 VSF_USART_FORCE_0_PARITY = (0x01ul << 10),
62 VSF_USART_FORCE_1_PARITY = (0x02ul << 10),
63
64 VSF_USART_0_5_STOPBIT = (0x01ul << 12),
65
66 VSF_USART_TX_ENABLE = (0x01ul << 13),
67 VSF_USART_TX_DISABLE = (0x00ul << 13),
68
69 VSF_USART_RX_ENABLE = (0x01ul << 14),
70 VSF_USART_RX_DISABLE = (0x00ul << 14),
71
74
77
81
85
90
91 VSF_USART_IRDA_ENABLE = (0x01ul << 23),
92 VSF_USART_IRDA_DISABLE = (0x01ul << 23),
93
106
112
117
118 // optional
121
127
129
133
134/*============================ INCLUDES ======================================*/
135/*============================ TYPES =========================================*/
136
138
143
144/*============================ GLOBAL VARIABLES ==============================*/
145/*============================ PROTOTYPES ====================================*/
146
148
149#endif
150#endif // __OSA_HAL_X86_WIN_USART_H__
#define VSF_BIT(__N)
Definition __type.h:188
vsf_usart_mode_t
Definition uart.h:32
@ VSF_USART_TX_FIFO_THRESH_HALF_FULL
Definition uart.h:76
@ VSF_USART_HALF_DUPLEX_DISABLE
Definition uart.h:72
@ VSF_USART_SYNC_CLOCK_ENABLE
Definition uart.h:69
@ VSF_USART_SYNC_CLOCK_PHASE_1_EDGE
Definition uart.h:85
@ VSF_USART_10_BIT_LENGTH
Definition uart.h:50
@ VSF_USART_RX_FIFO_THRESH_FULL
Definition uart.h:81
@ VSF_USART_RX_FIFO_THRESH_ONE
Definition uart.h:79
@ VSF_USART_TX_FIFO_THRESH_ONE
Definition uart.h:75
@ VSF_USART_SYNC_CLOCK_POLARITY_HIGH
Definition uart.h:84
@ VSF_USART_SYNC_CLOCK_POLARITY_LOW
Definition uart.h:83
@ VSF_USART_RX_FIFO_THRESH_HALF_FULL
Definition uart.h:80
@ VSF_USART_SYNC_CLOCK_DISABLE
Definition uart.h:70
@ VSF_USART_IRDA_DISABLE
Definition uart.h:89
@ VSF_USART_SYNC_CLOCK_PHASE_2_EDGE
Definition uart.h:86
@ VSF_USART_HALF_DUPLEX_ENABLE
Definition uart.h:73
@ VSF_USART_IRDA_ENABLE
Definition uart.h:88
@ VSF_USART_TX_FIFO_THRESH_FULL
Definition uart.h:77
@ VSF_USART_0_5_STOPBIT
Definition uart.h:56
vsf_usart_irq_mask_t
Definition uart.h:105
@ VSF_USART_IRQ_MASK_CTS
Definition uart.h:118
@ VSF_USART_EVEN_PARITY
Definition uart.h:42
vsf_usart_mode_t
Definition uart.h:36
@ VSF_USART_8_BIT_LENGTH
Definition uart.h:38
@ VSF_USART_ODD_PARITY
Definition uart.h:50
@ VSF_USART_NO_PARITY
Definition uart.h:49
@ VSF_USART_RTS_HWCONTROL
Definition uart.h:60
@ VSF_USART_RX_ENABLE
Definition uart.h:67
@ VSF_USART_FORCE_0_PARITY
Definition uart.h:56
@ VSF_USART_TX_ENABLE
Definition uart.h:64
@ VSF_USART_9_BIT_LENGTH
Definition uart.h:54
@ VSF_USART_7_BIT_LENGTH
Definition uart.h:39
@ VSF_USART_1_STOPBIT
Definition uart.h:44
@ VSF_USART_FORCE_1_PARITY
Definition uart.h:57
@ VSF_USART_RX_DISABLE
Definition uart.h:68
@ VSF_USART_2_STOPBIT
Definition uart.h:45
@ VSF_USART_CTS_HWCONTROL
Definition uart.h:61
@ VSF_USART_5_BIT_LENGTH
Definition uart.h:41
@ VSF_USART_RTS_CTS_HWCONTROL
Definition uart.h:62
@ VSF_USART_TX_DISABLE
Definition uart.h:65
@ VSF_USART_6_BIT_LENGTH
Definition uart.h:40
@ VSF_USART_NO_HWCONTROL
Definition uart.h:59
@ VSF_USART_1_5_STOPBIT
Definition uart.h:46
vsf_usart_irq_mask_t
Definition uart.h:84
@ VSF_USART_IRQ_MASK_OVERFLOW_ERR
Definition uart.h:101
@ VSF_USART_IRQ_MASK_TX
Definition uart.h:87
@ VSF_USART_IRQ_MASK_BREAK_ERR
Definition uart.h:100
@ VSF_USART_IRQ_MASK_RX
Definition uart.h:86
@ VSF_USART_IRQ_MASK_RX_TIMEOUT
Definition uart.h:91
@ VSF_USART_IRQ_MASK_PARITY_ERR
Definition uart.h:99
@ VSF_USART_IRQ_MASK_FRAME_ERR
Definition uart.h:98
@ VSF_USART_IRQ_MASK_TX_CPL
Definition uart.h:35
@ VSF_USART_IRQ_MASK_RX_CPL
Definition uart.h:36
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_template_usart.h:661
Definition uart.h:139
uint8_t port
Definition uart.h:141
vsf_usart_t * instance
Definition uart.h:140
@ WIN_USART_MODE_ALL_BITS_MASK
Definition uart.h:107
@ WIN_USART_BIT_LENGTH_MASK
Definition uart.h:94
@ WIN_USART_PARITY_MASK
Definition uart.h:99
@ WIN_USART_STOPBIT_MASK
Definition uart.h:96
@ WIN_USART_HWCONTROL_MASK
Definition uart.h:102
@ VSF_USART_IRQ_MASK_TX_ERR
Definition uart.h:126
@ WIN_USART_IRQ_ALL_BITS_MASK
Definition uart.h:130
uint8_t vsf_win_usart_scan_devices(vsf_usart_win_device_t *devices, uint8_t device_num)
Definition uart.c:141