blob: 65f6fb9f5e1b428a818a1f6f78fffcddb7ce2754 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
|
/**************************************************************************//**
* @file nu_bmc.h
* @version V1.00
* @brief M460 series BMC driver header file
*
* @copyright SPDX-License-Identifier: Apache-2.0
* @copyright Copyright (C) 2021 Nuvoton Technology Corp. All rights reserved.
*****************************************************************************/
#ifndef __NU_BMC_H__
#define __NU_BMC_H__
#ifdef __cplusplus
extern "C"
{
#endif
/** @addtogroup Standard_Driver Standard Driver
@{
*/
/** @addtogroup BMC_Driver BMC Driver
@{
*/
/** @addtogroup BMC_EXPORTED_CONSTANTS BMC Exported Constants
@{
*/
#define BMC_BITWIDTH_1 (0UL) /*!< The bit time period of logic 0 is same as logic 1 \hideinitializer */
#define BMC_BITWIDTH_15 (BMC_CTL_BWADJ_Msk) /*!< The bit time period of logic 0 is 1.5 times logic 1 \hideinitializer */
#define BMC_PREAMBLE_64 (0UL) /*!< BMC preamble is 64 bits \hideinitializer */
#define BMC_PREAMBLE_32 (BMC_CTL_PREAM32_Msk) /*!< BMC preamble is 32 bits \hideinitializer */
#define BMC_DUM_LVL_LOW (0UL) /*!< BMC dummy level is low \hideinitializer */
#define BMC_DUM_LVL_HIGH (BMC_CTL_DUMLVL_Msk) /*!< BMC dummy level is high \hideinitializer */
#define BMC_GROUP_0 (0UL) /*!< BMC group 0 mask \hideinitializer */
#define BMC_GROUP_1 (4UL) /*!< BMC group 1 mask \hideinitializer */
#define BMC_GROUP_2 (8UL) /*!< BMC group 2 mask \hideinitializer */
#define BMC_GROUP_3 (12UL) /*!< BMC group 3 mask \hideinitializer */
#define BMC_GROUP_4 (16UL) /*!< BMC group 4 mask \hideinitializer */
#define BMC_GROUP_5 (20UL) /*!< BMC group 5 mask \hideinitializer */
#define BMC_GROUP_6 (24UL) /*!< BMC group 6 mask \hideinitializer */
#define BMC_GROUP_7 (28UL) /*!< BMC group 7 mask \hideinitializer */
#define BMC_CHANNEL_NUM (32UL) /*!< BMC total channel number \hideinitializer */
#define BMC_FTXD_INT_MASK (0x1UL) /*!< Frame transmit done interrupt mask \hideinitializer */
#define BMC_TXUND_INT_MASK (0x2UL) /*!< Transmit data under run interrupt mask \hideinitializer */
#define BMC_G0TXUND_MASK (0x01UL) /*!< BMC group 0 transmit data under run mask \hideinitializer */
#define BMC_G1TXUND_MASK (0x02UL) /*!< BMC group 1 transmit data under run mask \hideinitializer */
#define BMC_G2TXUND_MASK (0x04UL) /*!< BMC group 2 transmit data under run mask \hideinitializer */
#define BMC_G3TXUND_MASK (0x08UL) /*!< BMC group 3 transmit data under run mask \hideinitializer */
#define BMC_G4TXUND_MASK (0x10UL) /*!< BMC group 4 transmit data under run mask \hideinitializer */
#define BMC_G5TXUND_MASK (0x20UL) /*!< BMC group 5 transmit data under run mask \hideinitializer */
#define BMC_G6TXUND_MASK (0x40UL) /*!< BMC group 6 transmit data under run mask \hideinitializer */
#define BMC_G7TXUND_MASK (0x80UL) /*!< BMC group 7 transmit data under run mask \hideinitializer */
/*@}*/ /* end of group BMC_EXPORTED_CONSTANTS */
/** @addtogroup BMC_EXPORTED_FUNCTIONS BMC Exported Functions
@{
*/
/**
* @brief Enable BMC controller
* @return None
* @details This macro is used to enable Biphase Mask Coding function.
* \hideinitializer
*/
#define BMC_ENABLE() (BMC->CTL |= BMC_CTL_BMCEN_Msk)
/**
* @brief Disable BMC controller
* @return None
* @details This macro is used to disable Biphase Mask Coding function.
* \hideinitializer
*/
#define BMC_DISABLE() (BMC->CTL &= ~BMC_CTL_BMCEN_Msk)
/**
* @brief Set the bit width adjustment
* @param[in] u32BitAdj BMC bit time period adjustment selection, valid values are:
* - \ref BMC_BITWIDTH_1
* - \ref BMC_BITWIDTH_15
* @return None
* @details This macro is used to set bit width adjustment.
* \hideinitializer
*/
#define BMC_BITWIDTH_ADJUST(u32BitAdj) (BMC->CTL = (BMC->CTL & ~BMC_CTL_BWADJ_Msk) | (u32BitAdj))
/**
* @brief Set the bit number of preamble
* @param[in] u32PreamBit BMC preamble bit number selection, valid values are:
* - \ref BMC_PREAMBLE_64
* - \ref BMC_PREAMBLE_32
* @return None
* @details This macro is used to set the bit number of preamble.
* \hideinitializer
*/
#define BMC_PREAMBLE_BIT(u32PreamBit) (BMC->CTL = (BMC->CTL & ~BMC_CTL_PREAM32_Msk) | (u32PreamBit))
/**
* @brief Set the dummy bit level
* @param[in] u32DumLvl BMC dummy bit level selection, valid values are:
* - \ref BMC_DUM_LVL_LOW
* - \ref BMC_DUM_LVL_HIGH
* @return None
* @details This macro is used to set dummy bit level.
* \hideinitializer
*/
#define BMC_DUMMY_LEVEL(u32DumLvl) (BMC->CTL = (BMC->CTL & ~BMC_CTL_DUMLVL_Msk) | (u32DumLvl))
/**
* @brief Enable PDMA function
* @return None
* @details This macro is used to enable PDMA function.
* \hideinitializer
*/
#define BMC_ENABLE_DMA() (BMC->CTL |= BMC_CTL_DMAEN_Msk)
/**
* @brief Disable PDMA function
* @return None
* @details This macro is used to disable PDMA function.
* \hideinitializer
*/
#define BMC_DISABLE_DMA() (BMC->CTL &= ~BMC_CTL_DMAEN_Msk)
/**
* @brief Enable BMC group 0 channels
* @return None
* @details This macro is used to enable BMC channel 0~3.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP0() (BMC->CTL |= BMC_CTL_G0CHEN_Msk)
/**
* @brief Enable BMC group 1 channels
* @return None
* @details This macro is used to enable BMC channel 4~7.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP1() (BMC->CTL |= BMC_CTL_G1CHEN_Msk)
/**
* @brief Enable BMC group 2 channels
* @return None
* @details This macro is used to enable BMC channel 8~11.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP2() (BMC->CTL |= BMC_CTL_G2CHEN_Msk)
/**
* @brief Enable BMC group 3 channels
* @return None
* @details This macro is used to enable BMC channel 12~15.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP3() (BMC->CTL |= BMC_CTL_G3CHEN_Msk)
/**
* @brief Enable BMC group 4 channels
* @return None
* @details This macro is used to enable BMC channel 16~19.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP4() (BMC->CTL |= BMC_CTL_G4CHEN_Msk)
/**
* @brief Enable BMC group 5 channels
* @return None
* @details This macro is used to enable BMC channel 20~23.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP5() (BMC->CTL |= BMC_CTL_G5CHEN_Msk)
/**
* @brief Enable BMC group 6 channels
* @return None
* @details This macro is used to enable BMC channel 24~27.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP6() (BMC->CTL |= BMC_CTL_G6CHEN_Msk)
/**
* @brief Enable BMC group 7 channels
* @return None
* @details This macro is used to enable BMC channel 28~31.
* \hideinitializer
*/
#define BMC_ENABLE_GROUP7() (BMC->CTL |= BMC_CTL_G7CHEN_Msk)
/**
* @brief Get channel's FIFO empty flag
* @return Which channel's FIFO is empty
* @details This macro will return which channel's FIFO is empty.
* \hideinitializer
*/
#define BMC_GET_CH_EMPTY_FLAG() (BMC->CHEMPTY)
uint32_t BMC_SetBitClock(uint32_t u32BitClock);
uint32_t BMC_GetBitClock(void);
uint32_t BMC_SetDummyDelayPeriod(uint32_t u32ChGroup, uint32_t u32DumDelay);
void BMC_EnableInt(uint32_t u32Mask);
void BMC_DisableInt(uint32_t u32Mask);
uint32_t BMC_GetIntFlag(uint32_t u32Mask);
void BMC_ClearIntFlag(uint32_t u32Mask);
uint32_t BMC_GetStatus(uint32_t u32Mask);
void BMC_ClearStatus(uint32_t u32Mask);
/*@}*/ /* end of group BMC_EXPORTED_FUNCTIONS */
/*@}*/ /* end of group BMC_Driver */
/*@}*/ /* end of group Standard_Driver */
#ifdef __cplusplus
}
#endif
#endif /* __NU_BMC_H__ */
|