A31L12x F/W Packages  1.4.0
ABOV Cortex-M0+ Core based MCUs Integrated Driver
A31L12x_hal_scn.h
Go to the documentation of this file.
1 /***************************************************************************//****************************************************************************/
34 
35 #ifndef _SCn_H_
36 #define _SCn_H_
37 
38 #include "A31L12x.h"
39 #include "A31L12x_hal_aa_types.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 //******************************************************************************
46 // Constant
47 //******************************************************************************
48 
49 //------------ Convention Type Data Definition -------------
50 #define DIRECT_CONV_DATA 0x3B
51 #define INVERSE_CONV_DATA 0x3F
52 
53 //---------- SCn Mask Definition ----------------
54 #define SCn_CR1_CONTROL_BITMASK 0x0000ffffuL
55 #define SCn_CR2_CONTROL_BITMASK 0x0000ffffuL
56 #define SCn_CR3_CONTROL_BITMASK 0x00ffffffuL
57 
58 /*-------------------------------------------------------------------------*//*-------------------------------------------------------------------------*/
62 #define SCn_BLOCKING_TIMEOUT 0xffffuL // (0xFFFFFFFFuL)
63 
64 //--------------------------------------
65 // Macro defines for SCn interrupt status register
66 //--------------------------------------
67 
68 #define SCn_IFSR_RSTA ((uint32_t)(1 << 23))
69 #define SCn_IFSR_SER ((uint32_t)(1 << 22))
70 #define SCn_IFSR_SED ((uint32_t)(1 << 21))
71 #define SCn_IFSR_CONER ((uint32_t)(1 << 20))
72 #define SCn_IFSR_CONED ((uint32_t)(1 << 19))
73 #define SCn_IFSR_TRYER ((uint32_t)(1 << 18))
74 #define SCn_IFSR_SCIN ((uint32_t)(1 << 17))
75 #define SCn_IFSR_BLED ((uint32_t)(1 << 16))
76 #define SCn_IFSR_DOR ((uint32_t)(1 << 15))
77 #define SCn_IFSR_FE ((uint32_t)(1 << 14))
78 #define SCn_IFSR_PE ((uint32_t)(1 << 13))
79 #define SCn_IFSR_RXBUSY ((uint32_t)(1 << 12))
80 #define SCn_IFSR_RTO ((uint32_t)(1 << 6))
81 #define SCn_IFSR_TXC ((uint32_t)(1 << 2))
82 #define SCn_IFSR_RXC ((uint32_t)(1 << 0))
83 #define SCn_IFSR_BITMASK ((uint32_t)(0x00FFFFFF))
85 //******************************************************************************
86 // Type
87 //******************************************************************************
88 
89 //==============================================================================
90 // Enumeration
91 //==============================================================================
92 
93 typedef enum
94 {
98 
100 typedef enum
101 {
105 
107 typedef enum
108 {
112 
114 typedef enum
115 {
121 
123 typedef enum
124 {
128 
130 typedef enum
131 {
135 
137 typedef enum
138 {
145 
147 typedef enum
148 {
155 
157 typedef enum
158 {
161 } SCn_CONV_Type;
162 
164 typedef enum
165 {
169 
171 typedef enum
172 {
176 
178 typedef enum
179 {
184 
186 typedef enum
187 {
191 
193 typedef enum
194 {
210  SCn_STATUS_ALL_EXCEPT_TXC = ( 0x00ffffff & ~SCn_IFSR_TXCIFLAGn_Msk ),
211  SCn_STATUS_ALL = 0x00ffffff
213 
215 typedef enum
216 {
228 } SCn_INT_Type;
229 
230 //==============================================================================
231 // Structure
232 //==============================================================================
233 
234 typedef struct
235 {
236  uint32_t Baudrate;
238  uint32_t SCI_clock_gen;
239  uint32_t Extra_guard_time;
240  uint32_t T3_dur_time;
241  uint32_t T4_dur_time;
266 } SCn_CFG_Type;
267 
268 //******************************************************************************
269 // Function
270 //******************************************************************************
271 
272 HAL_Status_Type HAL_SC_Init( SCn_Type* SCx, SCn_CFG_Type* SCn_Config );
273 HAL_Status_Type HAL_SC_DeInit( SCn_Type* SCx );
274 
275 HAL_Status_Type HAL_SC_ConfigStructInit( SCn_CFG_Type* SCn_Config, SCn_OPMODE_Type mode, uint32_t Baudrate );
276 HAL_Status_Type HAL_SC_ConfigInterrupt( SCn_Type* SCx, SCn_INT_Type SCn_IntCfg, FunctionalState NewState );
278 HAL_Status_Type HAL_SC_Enable( SCn_Type* SCx, FunctionalState state );
279 HAL_Status_Type HAL_SC_AutoAct( SCn_Type* SCx );
280 HAL_Status_Type HAL_SC_AutoWarmRst( SCn_Type* SCx );
281 HAL_Status_Type HAL_SC_AutoDeAct( SCn_Type* SCx );
282 HAL_Status_Type HAL_SC_SetRxTimeOutData( SCn_Type* SCx, uint32_t RxTimeOutD );
283 HAL_Status_Type HAL_SC_SetExGuardTime( SCn_Type* SCx, uint32_t TxExGuardTime );
284 HAL_Status_Type HAL_SC_SetT34DR( SCn_Type* SCx, uint32_t SCnT3data, uint32_t SCnT4data );
285 HAL_Status_Type HAL_SC_SetLevel( SCn_Type* SCx, SCn_CR2_LEVEL_POS SelectPin, SetState SetLevel );
286 HAL_Status_Type HAL_SC_AutoConvDet( SCn_Type* SCx );
287 HAL_Status_Type HAL_SC_SetConv( SCn_Type* SCx, SCn_CONV_Type conv_sel );
288 HAL_Status_Type HAL_SC_ConfigRetry( SCn_Type* SCx, uint8_t retry_num, SCn_DTIME_Type retry_dly );
289 HAL_Status_Type HAL_SC_RetryEnable( SCn_Type* SCx, SCn_RETRY_EN_DISABLE retry_en );
291 HAL_Status_Type HAL_SC_RxCntEnable( SCn_Type* SCx, SCn_RXCNT_EN_DISABLE RxCnt_en );
292 HAL_Status_Type HAL_SC_SetRxBlkLen( SCn_Type* SCx, uint8_t blk_len );
294 uint32_t HAL_SC_GetStatus( SCn_Type* SCx );
295 uint8_t HAL_SC_GetRxLineBusy( SCn_Type* SCx );
296 uint8_t HAL_SC_GetSCnINST( SCn_Type* SCx );
297 FlagStatus HAL_SC_CheckBusy( SCn_Type* SCx );
298 
299 HAL_Status_Type HAL_SC_TransmitByte( SCn_Type* SCx, uint8_t Data );
300 uint8_t HAL_SC_ReceiveByte( SCn_Type* SCx );
301 uint32_t HAL_SC_Transmit( SCn_Type* SCx, uint8_t* txbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag );
302 uint32_t HAL_SC_Receive( SCn_Type* SCx, uint8_t* rxbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag );
303 
304 #ifdef __cplusplus
305 }
306 #endif
307 
308 #endif /* _SCn_H_ */
309 
SCn_OPMODE_Type Mode
uint8_t HAL_SC_GetSCnINST(SCn_Type *SCx)
Get the SCnIN Pin Status.
HAL_Status_Type HAL_SC_DeInit(SCn_Type *SCx)
Deinitialize the SCn peripheral registers to their default reset values.
HAL_Status_Type HAL_SC_SetT34DR(SCn_Type *SCx, uint32_t SCnT3data, uint32_t SCnT4data)
SCn T3DR and T4DR Registers Set.
enum FlagStatus SetState
SCn_DATA_BIT_Type Databits
uint32_t T4_dur_time
uint32_t Baudrate
Contains the ABOV typedefs for C standard types. It is intended to be used in ISO C conforming develo...
HAL_Status_Type HAL_SC_SetExGuardTime(SCn_Type *SCx, uint32_t TxExGuardTime)
SCn Transmit Extra Guard Time Register Set.
SCn_PARITY_EN_DISABLE
HAL_Status_Type HAL_SC_AutoConvDet(SCn_Type *SCx)
SCn Auto Convention Detection.
HAL_Status_Type HAL_SC_Init(SCn_Type *SCx, SCn_CFG_Type *SCn_Config)
Initialize the SCn peripheral with the specified parameters.
FlagStatus HAL_SC_CheckBusy(SCn_Type *SCx)
Check whether if SCn is busy or not.
HAL_Status_Type HAL_SC_TransmitByte(SCn_Type *SCx, uint8_t Data)
Transmit a single data through SCn peripheral.
HAL_Status_Type HAL_SC_AutoAct(SCn_Type *SCx)
SCn Auto Activation and Cold Reset.
SCn_OVR_SAMP_Type Oversampling
SCn_STATUS_Type
HAL_Status_Type HAL_SC_SetInPol(SCn_Type *SCx, SCn_INPUT_POLARITY_Type In_pol)
SCn Input Pin Polarity Set.
HAL_Status_Type
HAL_Status_Type HAL_SC_AutoWarmRst(SCn_Type *SCx)
SCn Auto Warm Reset.
uint32_t Extra_guard_time
uint32_t SCI_clock_gen
HAL_Status_Type HAL_SC_SetRxBlkLen(SCn_Type *SCx, uint8_t blk_len)
SCn Rx block length set with the specified parameters.
HAL_Status_Type HAL_SC_SetRxTimeOutData(SCn_Type *SCx, uint32_t RxTimeOutD)
SCn Receive Time Out Data Register Set.
SCn_CONV_Type
SCn_INPUT_POLARITY_Type
HAL_Status_Type HAL_SC_ConfigStructInit(SCn_CFG_Type *SCn_Config, SCn_OPMODE_Type mode, uint32_t Baudrate)
Fills each SCn_Config member with its default value:
SCn_DTIME_Type
HAL_Status_Type HAL_SC_Enable(SCn_Type *SCx, FunctionalState state)
SCn enable control.
SCn_RXCNT_EN_DISABLE
HAL_Status_Type HAL_SC_SetLevel(SCn_Type *SCx, SCn_CR2_LEVEL_POS SelectPin, SetState SetLevel)
Set Level for SCn peripheral when Smartcard Interface Mode.
uint32_t T3_dur_time
HAL_Status_Type HAL_SC_ConfigRetry(SCn_Type *SCx, uint8_t retry_num, SCn_DTIME_Type retry_dly)
SCn Retry Configuration with the specified parameters.
uint32_t Baud_rate_Compensation
HAL_Status_Type HAL_SC_ClearStatus(SCn_Type *SCx, SCn_STATUS_Type Status)
Clear Status register in SCn peripheral.
SCn_RETRY_EN_DISABLE
SCn_CR1_CONTROL_Type
SCn_INT_Type
uint32_t HAL_SC_GetStatus(SCn_Type *SCx)
Get current value of Status register in SCn peripheral.
SCn_OPMODE_Type
SCn_OVR_SAMP_Type
HAL_Status_Type HAL_SC_AutoDeAct(SCn_Type *SCx)
SCn Auto Deactivation.
uint32_t HAL_SC_Receive(SCn_Type *SCx, uint8_t *rxbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag)
Receive a block of data via SCn peripheral.
SCn_STOP_BIT_Type Stopbits
FunctionalState
uint8_t HAL_SC_GetRxLineBusy(SCn_Type *SCx)
Get the Rx Line Busy bit.
TRANSFER_BLOCK_Type
HAL_Status_Type HAL_SC_ControlConfig(SCn_Type *SCx, SCn_CR1_CONTROL_Type Mode, FunctionalState NewState)
Configure Control mode for SCn peripheral.
HAL_Status_Type HAL_SC_RxCntEnable(SCn_Type *SCx, SCn_RXCNT_EN_DISABLE RxCnt_en)
SCn Receive Byte Count Enable.
HAL_Status_Type HAL_SC_ConfigInterrupt(SCn_Type *SCx, SCn_INT_Type SCn_IntCfg, FunctionalState NewState)
Configure the interrupt source of selected SCn peripheral.
SCn_STOP_BIT_Type
SCn_CR2_LEVEL_POS
HAL_Status_Type HAL_SC_RetryEnable(SCn_Type *SCx, SCn_RETRY_EN_DISABLE retry_en)
SCn Retry Enable.
uint32_t HAL_SC_Transmit(SCn_Type *SCx, uint8_t *txbuf, uint32_t buflen, TRANSFER_BLOCK_Type flag)
Send a block of data via SCn peripheral.
SCn_PARITY_BIT_Type Parity
uint8_t HAL_SC_ReceiveByte(SCn_Type *SCx)
Receive a single data from SCn peripheral.
SCn_DATA_BIT_Type
SCn_PARITY_EN_DISABLE ParityEnDis
SCn_PARITY_BIT_Type
HAL_Status_Type HAL_SC_SetConv(SCn_Type *SCx, SCn_CONV_Type conv_sel)
SCn Convention Selection.