stm32f7xx_hal_smartcard.h
Go to the documentation of this file.
1 
20 /* Define to prevent recursive inclusion -------------------------------------*/
21 #ifndef STM32F7xx_HAL_SMARTCARD_H
22 #define STM32F7xx_HAL_SMARTCARD_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 /* Includes ------------------------------------------------------------------*/
29 #include "stm32f7xx_hal_def.h"
30 
39 /* Exported types ------------------------------------------------------------*/
47 typedef struct
48 {
49  uint32_t BaudRate;
54  uint32_t WordLength;
57  uint32_t StopBits;
60  uint16_t Parity;
66  uint16_t Mode;
69  uint16_t CLKPolarity;
72  uint16_t CLKPhase;
75  uint16_t CLKLastBit;
79  uint16_t OneBitSampling;
83  uint8_t Prescaler;
87  uint8_t GuardTime;
89  uint16_t NACKEnable;
93  uint32_t TimeOutEnable;
96  uint32_t TimeOutValue;
100  uint8_t BlockLength;
103  uint8_t AutoRetryCount;
109 
113 typedef struct
114 {
115  uint32_t AdvFeatureInit;
119  uint32_t TxPinLevelInvert;
122  uint32_t RxPinLevelInvert;
125  uint32_t DataInvert;
129  uint32_t Swap;
132  uint32_t OverrunDisable;
138  uint32_t MSBFirst;
145 
185 typedef uint32_t HAL_SMARTCARD_StateTypeDef;
186 
190 typedef struct __SMARTCARD_HandleTypeDef
191 {
198  uint8_t *pTxBuffPtr;
200  uint16_t TxXferSize;
202  __IO uint16_t TxXferCount;
204  uint8_t *pRxBuffPtr;
206  uint16_t RxXferSize;
208  __IO uint16_t RxXferCount;
228  __IO uint32_t ErrorCode;
230 #if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
231  void (* TxCpltCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
233  void (* RxCpltCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
235  void (* ErrorCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
237  void (* AbortCpltCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
239  void (* AbortTransmitCpltCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
241  void (* AbortReceiveCpltCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
243  void (* MspInitCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
245  void (* MspDeInitCallback)(struct __SMARTCARD_HandleTypeDef *hsmartcard);
246 #endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
247 
249 
250 #if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
251 
254 typedef enum
255 {
256  HAL_SMARTCARD_TX_COMPLETE_CB_ID = 0x00U,
257  HAL_SMARTCARD_RX_COMPLETE_CB_ID = 0x01U,
258  HAL_SMARTCARD_ERROR_CB_ID = 0x02U,
259  HAL_SMARTCARD_ABORT_COMPLETE_CB_ID = 0x03U,
260  HAL_SMARTCARD_ABORT_TRANSMIT_COMPLETE_CB_ID = 0x04U,
261  HAL_SMARTCARD_ABORT_RECEIVE_COMPLETE_CB_ID = 0x05U,
263  HAL_SMARTCARD_MSPINIT_CB_ID = 0x08U,
264  HAL_SMARTCARD_MSPDEINIT_CB_ID = 0x09U
266 } HAL_SMARTCARD_CallbackIDTypeDef;
267 
271 typedef void (*pSMARTCARD_CallbackTypeDef)(SMARTCARD_HandleTypeDef *hsmartcard);
273 #endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
274 
278 typedef enum
279 {
287 
292 /* Exported constants --------------------------------------------------------*/
300 #define HAL_SMARTCARD_STATE_RESET 0x00000000U
302 #define HAL_SMARTCARD_STATE_READY 0x00000020U
304 #define HAL_SMARTCARD_STATE_BUSY 0x00000024U
306 #define HAL_SMARTCARD_STATE_BUSY_TX 0x00000021U
308 #define HAL_SMARTCARD_STATE_BUSY_RX 0x00000022U
310 #define HAL_SMARTCARD_STATE_BUSY_TX_RX 0x00000023U
313 #define HAL_SMARTCARD_STATE_TIMEOUT 0x000000A0U
315 #define HAL_SMARTCARD_STATE_ERROR 0x000000E0U
324 #define HAL_SMARTCARD_ERROR_NONE ((uint32_t)0x00000000U)
325 #define HAL_SMARTCARD_ERROR_PE ((uint32_t)0x00000001U)
326 #define HAL_SMARTCARD_ERROR_NE ((uint32_t)0x00000002U)
327 #define HAL_SMARTCARD_ERROR_FE ((uint32_t)0x00000004U)
328 #define HAL_SMARTCARD_ERROR_ORE ((uint32_t)0x00000008U)
329 #define HAL_SMARTCARD_ERROR_DMA ((uint32_t)0x00000010U)
330 #define HAL_SMARTCARD_ERROR_RTO ((uint32_t)0x00000020U)
331 #if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
332 #define HAL_SMARTCARD_ERROR_INVALID_CALLBACK ((uint32_t)0x00000040U)
333 #endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
334 
341 #define SMARTCARD_WORDLENGTH_9B USART_CR1_M0
349 #define SMARTCARD_STOPBITS_0_5 USART_CR2_STOP_0
350 #define SMARTCARD_STOPBITS_1_5 USART_CR2_STOP
358 #define SMARTCARD_PARITY_EVEN USART_CR1_PCE
359 #define SMARTCARD_PARITY_ODD (USART_CR1_PCE | USART_CR1_PS)
367 #define SMARTCARD_MODE_RX USART_CR1_RE
368 #define SMARTCARD_MODE_TX USART_CR1_TE
369 #define SMARTCARD_MODE_TX_RX (USART_CR1_TE |USART_CR1_RE)
377 #define SMARTCARD_POLARITY_LOW 0x00000000U
378 #define SMARTCARD_POLARITY_HIGH USART_CR2_CPOL
386 #define SMARTCARD_PHASE_1EDGE 0x00000000U
387 #define SMARTCARD_PHASE_2EDGE USART_CR2_CPHA
395 #define SMARTCARD_LASTBIT_DISABLE 0x00000000U
396 #define SMARTCARD_LASTBIT_ENABLE USART_CR2_LBCL
404 #define SMARTCARD_ONE_BIT_SAMPLE_DISABLE 0x00000000U
405 #define SMARTCARD_ONE_BIT_SAMPLE_ENABLE USART_CR3_ONEBIT
413 #define SMARTCARD_NACK_DISABLE 0x00000000U
414 #define SMARTCARD_NACK_ENABLE USART_CR3_NACK
422 #define SMARTCARD_TIMEOUT_DISABLE 0x00000000U
423 #define SMARTCARD_TIMEOUT_ENABLE USART_CR2_RTOEN
431 #define SMARTCARD_ADVFEATURE_TXINV_DISABLE 0x00000000U
432 #define SMARTCARD_ADVFEATURE_TXINV_ENABLE USART_CR2_TXINV
440 #define SMARTCARD_ADVFEATURE_RXINV_DISABLE 0x00000000U
441 #define SMARTCARD_ADVFEATURE_RXINV_ENABLE USART_CR2_RXINV
449 #define SMARTCARD_ADVFEATURE_DATAINV_DISABLE 0x00000000U
450 #define SMARTCARD_ADVFEATURE_DATAINV_ENABLE USART_CR2_DATAINV
458 #define SMARTCARD_ADVFEATURE_SWAP_DISABLE 0x00000000U
459 #define SMARTCARD_ADVFEATURE_SWAP_ENABLE USART_CR2_SWAP
467 #define SMARTCARD_ADVFEATURE_OVERRUN_ENABLE 0x00000000U
468 #define SMARTCARD_ADVFEATURE_OVERRUN_DISABLE USART_CR3_OVRDIS
476 #define SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR 0x00000000U
477 #define SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR USART_CR3_DDRE
485 #define SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE 0x00000000U
486 #define SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE USART_CR2_MSBFIRST
494 #define SMARTCARD_RXDATA_FLUSH_REQUEST USART_RQR_RXFRQ
495 #define SMARTCARD_TXDATA_FLUSH_REQUEST USART_RQR_TXFRQ
503 #define SMARTCARD_IT_MASK 0x001FU
504 #define SMARTCARD_CR_MASK 0x00E0U
505 #define SMARTCARD_CR_POS 5U
506 #define SMARTCARD_ISR_MASK 0x1F00U
507 #define SMARTCARD_ISR_POS 8U
516 /* Exported macros -----------------------------------------------------------*/
517 
525 #if USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1
526 #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) do{ \
527  (__HANDLE__)->gState = HAL_SMARTCARD_STATE_RESET; \
528  (__HANDLE__)->RxState = HAL_SMARTCARD_STATE_RESET; \
529  (__HANDLE__)->MspInitCallback = NULL; \
530  (__HANDLE__)->MspDeInitCallback = NULL; \
531  } while(0U)
532 #else
533 #define __HAL_SMARTCARD_RESET_HANDLE_STATE(__HANDLE__) do{ \
534  (__HANDLE__)->gState = HAL_SMARTCARD_STATE_RESET; \
535  (__HANDLE__)->RxState = HAL_SMARTCARD_STATE_RESET; \
536  } while(0U)
537 #endif /*USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
538 
543 #define __HAL_SMARTCARD_FLUSH_DRREGISTER(__HANDLE__) \
544  do{ \
545  SET_BIT((__HANDLE__)->Instance->RQR, SMARTCARD_RXDATA_FLUSH_REQUEST); \
546  SET_BIT((__HANDLE__)->Instance->RQR, SMARTCARD_TXDATA_FLUSH_REQUEST); \
547  } while(0U)
548 
564 #define __HAL_SMARTCARD_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
565 
570 #define __HAL_SMARTCARD_CLEAR_PEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_PEF)
571 
576 #define __HAL_SMARTCARD_CLEAR_FEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_FEF)
577 
582 #define __HAL_SMARTCARD_CLEAR_NEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_NEF)
583 
588 #define __HAL_SMARTCARD_CLEAR_OREFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_OREF)
589 
594 #define __HAL_SMARTCARD_CLEAR_IDLEFLAG(__HANDLE__) __HAL_SMARTCARD_CLEAR_FLAG((__HANDLE__), SMARTCARD_CLEAR_IDLEF)
595 
615 #define __HAL_SMARTCARD_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->ISR & (__FLAG__)) == (__FLAG__))
616 
632 #define __HAL_SMARTCARD_ENABLE_IT(__HANDLE__, __INTERRUPT__) (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 |= ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
633  ((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 |= ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
634  ((__HANDLE__)->Instance->CR3 |= ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
635 
651 #define __HAL_SMARTCARD_DISABLE_IT(__HANDLE__, __INTERRUPT__) (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 1U)? ((__HANDLE__)->Instance->CR1 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
652  ((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 2U)? ((__HANDLE__)->Instance->CR2 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))): \
653  ((__HANDLE__)->Instance->CR3 &= ~ ((uint32_t)1U << ((__INTERRUPT__) & SMARTCARD_IT_MASK))))
654 
670 #define __HAL_SMARTCARD_GET_IT(__HANDLE__, __INTERRUPT__) ((((__HANDLE__)->Instance->ISR\
671  & ((uint32_t)0x01U << (((__INTERRUPT__) & SMARTCARD_ISR_MASK)>> SMARTCARD_ISR_POS))) != 0U) ? SET : RESET)
672 
688 #define __HAL_SMARTCARD_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((((((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 0x01U)? (__HANDLE__)->Instance->CR1 : \
689  (((((__INTERRUPT__) & SMARTCARD_CR_MASK) >> SMARTCARD_CR_POS) == 0x02U)? (__HANDLE__)->Instance->CR2 : \
690  (__HANDLE__)->Instance->CR3)) & ((uint32_t)0x01U << (((uint16_t)(__INTERRUPT__)) & SMARTCARD_IT_MASK))) != 0U) ? SET : RESET)
691 
708 #define __HAL_SMARTCARD_CLEAR_IT(__HANDLE__, __IT_CLEAR__) ((__HANDLE__)->Instance->ICR |= (uint32_t)(__IT_CLEAR__))
709 
718 #define __HAL_SMARTCARD_SEND_REQ(__HANDLE__, __REQ__) ((__HANDLE__)->Instance->RQR |= (uint16_t)(__REQ__))
719 
724 #define __HAL_SMARTCARD_ONE_BIT_SAMPLE_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3|= USART_CR3_ONEBIT)
725 
730 #define __HAL_SMARTCARD_ONE_BIT_SAMPLE_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR3\
731  &= (uint32_t)~((uint32_t)USART_CR3_ONEBIT))
732 
737 #define __HAL_SMARTCARD_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 |= USART_CR1_UE)
738 
743 #define __HAL_SMARTCARD_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR1 &= ~USART_CR1_UE)
744 
749 /* Private macros -------------------------------------------------------------*/
759 #define SMARTCARD_GETCLOCKSOURCE(__HANDLE__, __CLOCKSOURCE__) \
760  do { \
761  if((__HANDLE__)->Instance == USART1) \
762  { \
763  switch(__HAL_RCC_GET_USART1_SOURCE()) \
764  { \
765  case RCC_USART1CLKSOURCE_PCLK2: \
766  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2; \
767  break; \
768  case RCC_USART1CLKSOURCE_HSI: \
769  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
770  break; \
771  case RCC_USART1CLKSOURCE_SYSCLK: \
772  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
773  break; \
774  case RCC_USART1CLKSOURCE_LSE: \
775  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
776  break; \
777  default: \
778  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
779  break; \
780  } \
781  } \
782  else if((__HANDLE__)->Instance == USART2) \
783  { \
784  switch(__HAL_RCC_GET_USART2_SOURCE()) \
785  { \
786  case RCC_USART2CLKSOURCE_PCLK1: \
787  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
788  break; \
789  case RCC_USART2CLKSOURCE_HSI: \
790  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
791  break; \
792  case RCC_USART2CLKSOURCE_SYSCLK: \
793  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
794  break; \
795  case RCC_USART2CLKSOURCE_LSE: \
796  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
797  break; \
798  default: \
799  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
800  break; \
801  } \
802  } \
803  else if((__HANDLE__)->Instance == USART3) \
804  { \
805  switch(__HAL_RCC_GET_USART3_SOURCE()) \
806  { \
807  case RCC_USART3CLKSOURCE_PCLK1: \
808  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK1; \
809  break; \
810  case RCC_USART3CLKSOURCE_HSI: \
811  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
812  break; \
813  case RCC_USART3CLKSOURCE_SYSCLK: \
814  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
815  break; \
816  case RCC_USART3CLKSOURCE_LSE: \
817  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
818  break; \
819  default: \
820  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
821  break; \
822  } \
823  } \
824  else if((__HANDLE__)->Instance == USART6) \
825  { \
826  switch(__HAL_RCC_GET_USART6_SOURCE()) \
827  { \
828  case RCC_USART6CLKSOURCE_PCLK2: \
829  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_PCLK2; \
830  break; \
831  case RCC_USART6CLKSOURCE_HSI: \
832  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_HSI; \
833  break; \
834  case RCC_USART6CLKSOURCE_SYSCLK: \
835  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_SYSCLK; \
836  break; \
837  case RCC_USART6CLKSOURCE_LSE: \
838  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_LSE; \
839  break; \
840  default: \
841  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
842  break; \
843  } \
844  } \
845  else \
846  { \
847  (__CLOCKSOURCE__) = SMARTCARD_CLOCKSOURCE_UNDEFINED; \
848  } \
849  } while(0U)
850 
857 #define IS_SMARTCARD_BAUDRATE(__BAUDRATE__) ((__BAUDRATE__) < 13500001U)
858 
864 #define IS_SMARTCARD_BLOCKLENGTH(__LENGTH__) ((__LENGTH__) <= 0xFFU)
865 
871 #define IS_SMARTCARD_TIMEOUT_VALUE(__TIMEOUTVALUE__) ((__TIMEOUTVALUE__) <= 0xFFFFFFU)
872 
878 #define IS_SMARTCARD_AUTORETRY_COUNT(__COUNT__) ((__COUNT__) <= 0x7U)
879 
884 #define IS_SMARTCARD_WORD_LENGTH(__LENGTH__) ((__LENGTH__) == SMARTCARD_WORDLENGTH_9B)
885 
890 #define IS_SMARTCARD_STOPBITS(__STOPBITS__) (((__STOPBITS__) == SMARTCARD_STOPBITS_0_5) ||\
891  ((__STOPBITS__) == SMARTCARD_STOPBITS_1_5))
892 
897 #define IS_SMARTCARD_PARITY(__PARITY__) (((__PARITY__) == SMARTCARD_PARITY_EVEN) || \
898  ((__PARITY__) == SMARTCARD_PARITY_ODD))
899 
904 #define IS_SMARTCARD_MODE(__MODE__) ((((__MODE__) & 0xFFF3U) == 0x00U) && ((__MODE__) != 0x00U))
905 
910 #define IS_SMARTCARD_POLARITY(__CPOL__) (((__CPOL__) == SMARTCARD_POLARITY_LOW)\
911  || ((__CPOL__) == SMARTCARD_POLARITY_HIGH))
912 
917 #define IS_SMARTCARD_PHASE(__CPHA__) (((__CPHA__) == SMARTCARD_PHASE_1EDGE) || ((__CPHA__) == SMARTCARD_PHASE_2EDGE))
918 
923 #define IS_SMARTCARD_LASTBIT(__LASTBIT__) (((__LASTBIT__) == SMARTCARD_LASTBIT_DISABLE) || \
924  ((__LASTBIT__) == SMARTCARD_LASTBIT_ENABLE))
925 
930 #define IS_SMARTCARD_ONE_BIT_SAMPLE(__ONEBIT__) (((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_DISABLE) || \
931  ((__ONEBIT__) == SMARTCARD_ONE_BIT_SAMPLE_ENABLE))
932 
937 #define IS_SMARTCARD_NACK(__NACK__) (((__NACK__) == SMARTCARD_NACK_ENABLE) || \
938  ((__NACK__) == SMARTCARD_NACK_DISABLE))
939 
944 #define IS_SMARTCARD_TIMEOUT(__TIMEOUT__) (((__TIMEOUT__) == SMARTCARD_TIMEOUT_DISABLE) || \
945  ((__TIMEOUT__) == SMARTCARD_TIMEOUT_ENABLE))
946 
951 #define IS_SMARTCARD_ADVFEATURE_INIT(__INIT__) ((__INIT__) <= (SMARTCARD_ADVFEATURE_NO_INIT | \
952  SMARTCARD_ADVFEATURE_TXINVERT_INIT | \
953  SMARTCARD_ADVFEATURE_RXINVERT_INIT | \
954  SMARTCARD_ADVFEATURE_DATAINVERT_INIT | \
955  SMARTCARD_ADVFEATURE_SWAP_INIT | \
956  SMARTCARD_ADVFEATURE_RXOVERRUNDISABLE_INIT | \
957  SMARTCARD_ADVFEATURE_DMADISABLEONERROR_INIT | \
958  SMARTCARD_ADVFEATURE_MSBFIRST_INIT))
959 
964 #define IS_SMARTCARD_ADVFEATURE_TXINV(__TXINV__) (((__TXINV__) == SMARTCARD_ADVFEATURE_TXINV_DISABLE) || \
965  ((__TXINV__) == SMARTCARD_ADVFEATURE_TXINV_ENABLE))
966 
971 #define IS_SMARTCARD_ADVFEATURE_RXINV(__RXINV__) (((__RXINV__) == SMARTCARD_ADVFEATURE_RXINV_DISABLE) || \
972  ((__RXINV__) == SMARTCARD_ADVFEATURE_RXINV_ENABLE))
973 
978 #define IS_SMARTCARD_ADVFEATURE_DATAINV(__DATAINV__) (((__DATAINV__) == SMARTCARD_ADVFEATURE_DATAINV_DISABLE) || \
979  ((__DATAINV__) == SMARTCARD_ADVFEATURE_DATAINV_ENABLE))
980 
985 #define IS_SMARTCARD_ADVFEATURE_SWAP(__SWAP__) (((__SWAP__) == SMARTCARD_ADVFEATURE_SWAP_DISABLE) || \
986  ((__SWAP__) == SMARTCARD_ADVFEATURE_SWAP_ENABLE))
987 
992 #define IS_SMARTCARD_OVERRUN(__OVERRUN__) (((__OVERRUN__) == SMARTCARD_ADVFEATURE_OVERRUN_ENABLE) || \
993  ((__OVERRUN__) == SMARTCARD_ADVFEATURE_OVERRUN_DISABLE))
994 
999 #define IS_SMARTCARD_ADVFEATURE_DMAONRXERROR(__DMA__) (((__DMA__) == SMARTCARD_ADVFEATURE_DMA_ENABLEONRXERROR) || \
1000  ((__DMA__) == SMARTCARD_ADVFEATURE_DMA_DISABLEONRXERROR))
1001 
1006 #define IS_SMARTCARD_ADVFEATURE_MSBFIRST(__MSBFIRST__) (((__MSBFIRST__) == SMARTCARD_ADVFEATURE_MSBFIRST_DISABLE) || \
1007  ((__MSBFIRST__) == SMARTCARD_ADVFEATURE_MSBFIRST_ENABLE))
1008 
1013 #define IS_SMARTCARD_REQUEST_PARAMETER(__PARAM__) (((__PARAM__) == SMARTCARD_RXDATA_FLUSH_REQUEST) || \
1014  ((__PARAM__) == SMARTCARD_TXDATA_FLUSH_REQUEST))
1015 
1020 /* Include SMARTCARD HAL Extended module */
1022 
1023 /* Exported functions --------------------------------------------------------*/
1028 /* Initialization and de-initialization functions ****************************/
1037 
1038 #if (USE_HAL_SMARTCARD_REGISTER_CALLBACKS == 1)
1039 /* Callbacks Register/UnRegister functions ***********************************/
1040 HAL_StatusTypeDef HAL_SMARTCARD_RegisterCallback(SMARTCARD_HandleTypeDef *hsmartcard,
1041  HAL_SMARTCARD_CallbackIDTypeDef CallbackID, pSMARTCARD_CallbackTypeDef pCallback);
1042 HAL_StatusTypeDef HAL_SMARTCARD_UnRegisterCallback(SMARTCARD_HandleTypeDef *hsmartcard,
1043  HAL_SMARTCARD_CallbackIDTypeDef CallbackID);
1044 #endif /* USE_HAL_SMARTCARD_REGISTER_CALLBACKS */
1045 
1050 /* IO operation functions *****************************************************/
1055 HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size,
1056  uint32_t Timeout);
1057 HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size,
1058  uint32_t Timeout);
1059 HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
1060 HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
1061 HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
1062 HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t *pData, uint16_t Size);
1063 /* Transfer Abort functions */
1070 
1078 
1083 /* Peripheral State and Error functions ***************************************/
1089 uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsmartcard);
1090 
1107 #ifdef __cplusplus
1108 }
1109 #endif
1110 
1111 #endif /* STM32F7xx_HAL_SMARTCARD_H */
1112 
1113 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
stm32f7xx_hal_smartcard_ex.h
Header file of SMARTCARD HAL Extended module.
__SMARTCARD_HandleTypeDef::RxXferCount
__IO uint16_t RxXferCount
Definition: stm32f4xx_hal_smartcard.h:170
__SMARTCARD_HandleTypeDef::gState
__IO HAL_SMARTCARD_StateTypeDef gState
Definition: stm32f4xx_hal_smartcard.h:178
__SMARTCARD_HandleTypeDef::pTxBuffPtr
uint8_t * pTxBuffPtr
Definition: stm32f4xx_hal_smartcard.h:160
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
HAL_StatusTypeDef
HAL_StatusTypeDef
HAL Status structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:40
SMARTCARD_InitTypeDef::GuardTime
uint8_t GuardTime
Definition: stm32f7xx_hal_smartcard.h:87
USART_TypeDef
Universal Synchronous Asynchronous Receiver Transmitter.
Definition: stm32f407xx.h:758
__SMARTCARD_HandleTypeDef::Instance
USART_TypeDef * Instance
Definition: stm32f4xx_hal_smartcard.h:156
SMARTCARD_InitTypeDef::CLKLastBit
uint16_t CLKLastBit
Definition: stm32f7xx_hal_smartcard.h:75
HAL_SMARTCARD_Transmit
HAL_StatusTypeDef HAL_SMARTCARD_Transmit(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout)
__SMARTCARD_HandleTypeDef::TxXferSize
uint16_t TxXferSize
Definition: stm32f4xx_hal_smartcard.h:162
__DMA_HandleTypeDef
DMA handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:139
SMARTCARD_InitTypeDef::NACKEnable
uint16_t NACKEnable
Definition: stm32f7xx_hal_smartcard.h:89
__SMARTCARD_HandleTypeDef::AdvancedInit
SMARTCARD_AdvFeatureInitTypeDef AdvancedInit
Definition: stm32f7xx_hal_smartcard.h:196
HAL_SMARTCARD_AbortReceiveCpltCallback
void HAL_SMARTCARD_AbortReceiveCpltCallback(SMARTCARD_HandleTypeDef *hsc)
HAL_SMARTCARD_MspDeInit
void HAL_SMARTCARD_MspDeInit(SMARTCARD_HandleTypeDef *hsc)
HAL_SMARTCARD_GetState
HAL_SMARTCARD_StateTypeDef HAL_SMARTCARD_GetState(SMARTCARD_HandleTypeDef *hsmartcard)
SMARTCARD_CLOCKSOURCE_PCLK2
@ SMARTCARD_CLOCKSOURCE_PCLK2
Definition: stm32f7xx_hal_smartcard.h:281
HAL_SMARTCARD_RxCpltCallback
void HAL_SMARTCARD_RxCpltCallback(SMARTCARD_HandleTypeDef *hsc)
huart
UART_HandleTypeDef huart
Definition: pv_stm32f469.c:31
HAL_SMARTCARD_ErrorCallback
void HAL_SMARTCARD_ErrorCallback(SMARTCARD_HandleTypeDef *hsc)
__SMARTCARD_HandleTypeDef::RxXferSize
uint16_t RxXferSize
Definition: stm32f4xx_hal_smartcard.h:168
HAL_SMARTCARD_Abort_IT
HAL_StatusTypeDef HAL_SMARTCARD_Abort_IT(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_InitTypeDef::AutoRetryCount
uint8_t AutoRetryCount
Definition: stm32f7xx_hal_smartcard.h:103
SMARTCARD_CLOCKSOURCE_HSI
@ SMARTCARD_CLOCKSOURCE_HSI
Definition: stm32f7xx_hal_smartcard.h:282
__SMARTCARD_HandleTypeDef::Lock
HAL_LockTypeDef Lock
Definition: stm32f4xx_hal_smartcard.h:176
SMARTCARD_AdvFeatureInitTypeDef
SMARTCARD advanced features initalization structure definition.
Definition: stm32f7xx_hal_smartcard.h:113
SMARTCARD_CLOCKSOURCE_UNDEFINED
@ SMARTCARD_CLOCKSOURCE_UNDEFINED
Definition: stm32f7xx_hal_smartcard.h:285
HAL_SMARTCARD_Transmit_DMA
HAL_StatusTypeDef HAL_SMARTCARD_Transmit_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size)
SMARTCARD_InitTypeDef::Mode
uint16_t Mode
Definition: stm32f7xx_hal_smartcard.h:66
HAL_LockTypeDef
HAL_LockTypeDef
HAL Lock structures definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:51
SMARTCARD_InitTypeDef::TimeOutEnable
uint32_t TimeOutEnable
Definition: stm32f7xx_hal_smartcard.h:93
SMARTCARD_AdvFeatureInitTypeDef::AdvFeatureInit
uint32_t AdvFeatureInit
Definition: stm32f7xx_hal_smartcard.h:115
__SMARTCARD_HandleTypeDef::hdmarx
DMA_HandleTypeDef * hdmarx
Definition: stm32f4xx_hal_smartcard.h:174
SMARTCARD_AdvFeatureInitTypeDef::TxPinLevelInvert
uint32_t TxPinLevelInvert
Definition: stm32f7xx_hal_smartcard.h:119
SMARTCARD_CLOCKSOURCE_PCLK1
@ SMARTCARD_CLOCKSOURCE_PCLK1
Definition: stm32f7xx_hal_smartcard.h:280
HAL_SMARTCARD_GetError
uint32_t HAL_SMARTCARD_GetError(SMARTCARD_HandleTypeDef *hsmartcard)
HAL_SMARTCARD_AbortTransmit
HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit(SMARTCARD_HandleTypeDef *hsc)
__SMARTCARD_HandleTypeDef::RxISR
void(* RxISR)(struct __SMARTCARD_HandleTypeDef *huart)
Definition: stm32f7xx_hal_smartcard.h:211
HAL_SMARTCARD_Receive_IT
HAL_StatusTypeDef HAL_SMARTCARD_Receive_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size)
SMARTCARD_CLOCKSOURCE_LSE
@ SMARTCARD_CLOCKSOURCE_LSE
Definition: stm32f7xx_hal_smartcard.h:284
SMARTCARD_AdvFeatureInitTypeDef::RxPinLevelInvert
uint32_t RxPinLevelInvert
Definition: stm32f7xx_hal_smartcard.h:122
HAL_SMARTCARD_Init
HAL_StatusTypeDef HAL_SMARTCARD_Init(SMARTCARD_HandleTypeDef *hsc)
HAL_SMARTCARD_AbortCpltCallback
void HAL_SMARTCARD_AbortCpltCallback(SMARTCARD_HandleTypeDef *hsc)
__SMARTCARD_HandleTypeDef
SMARTCARD handle Structure definition.
Definition: stm32f4xx_hal_smartcard.h:154
__SMARTCARD_HandleTypeDef::TxISR
void(* TxISR)(struct __SMARTCARD_HandleTypeDef *huart)
Definition: stm32f7xx_hal_smartcard.h:213
SMARTCARD_CLOCKSOURCE_SYSCLK
@ SMARTCARD_CLOCKSOURCE_SYSCLK
Definition: stm32f7xx_hal_smartcard.h:283
SMARTCARD_AdvFeatureInitTypeDef::MSBFirst
uint32_t MSBFirst
Definition: stm32f7xx_hal_smartcard.h:138
HAL_SMARTCARD_Abort
HAL_StatusTypeDef HAL_SMARTCARD_Abort(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_InitTypeDef::OneBitSampling
uint16_t OneBitSampling
Definition: stm32f7xx_hal_smartcard.h:79
HAL_SMARTCARD_AbortTransmitCpltCallback
void HAL_SMARTCARD_AbortTransmitCpltCallback(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_InitTypeDef
SMARTCARD Init Structure definition.
Definition: stm32f4xx_hal_smartcard.h:47
HAL_SMARTCARD_Transmit_IT
HAL_StatusTypeDef HAL_SMARTCARD_Transmit_IT(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size)
__SMARTCARD_HandleTypeDef::RxState
__IO HAL_SMARTCARD_StateTypeDef RxState
Definition: stm32f4xx_hal_smartcard.h:182
SMARTCARD_InitTypeDef::CLKPhase
uint16_t CLKPhase
Definition: stm32f7xx_hal_smartcard.h:72
HAL_SMARTCARD_AbortReceive
HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive(SMARTCARD_HandleTypeDef *hsc)
HAL_SMARTCARD_Receive_DMA
HAL_StatusTypeDef HAL_SMARTCARD_Receive_DMA(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size)
SMARTCARD_InitTypeDef::TimeOutValue
uint32_t TimeOutValue
Definition: stm32f7xx_hal_smartcard.h:96
SMARTCARD_InitTypeDef::Parity
uint16_t Parity
Definition: stm32f7xx_hal_smartcard.h:60
HAL_SMARTCARD_Receive
HAL_StatusTypeDef HAL_SMARTCARD_Receive(SMARTCARD_HandleTypeDef *hsc, uint8_t *pData, uint16_t Size, uint32_t Timeout)
HAL_SMARTCARD_StateTypeDef
HAL_SMARTCARD_StateTypeDef
HAL SMARTCARD State structures definition.
Definition: stm32f4xx_hal_smartcard.h:130
HAL_SMARTCARD_TxCpltCallback
void HAL_SMARTCARD_TxCpltCallback(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_InitTypeDef::BlockLength
uint8_t BlockLength
Definition: stm32f7xx_hal_smartcard.h:100
__SMARTCARD_HandleTypeDef::hdmatx
DMA_HandleTypeDef * hdmatx
Definition: stm32f4xx_hal_smartcard.h:172
stm32f7xx_hal_def.h
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_SMARTCARD_IRQHandler
void HAL_SMARTCARD_IRQHandler(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_AdvFeatureInitTypeDef::Swap
uint32_t Swap
Definition: stm32f7xx_hal_smartcard.h:129
HAL_SMARTCARD_AbortReceive_IT
HAL_StatusTypeDef HAL_SMARTCARD_AbortReceive_IT(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_AdvFeatureInitTypeDef::OverrunDisable
uint32_t OverrunDisable
Definition: stm32f7xx_hal_smartcard.h:132
__SMARTCARD_HandleTypeDef::pRxBuffPtr
uint8_t * pRxBuffPtr
Definition: stm32f4xx_hal_smartcard.h:166
HAL_SMARTCARD_AbortTransmit_IT
HAL_StatusTypeDef HAL_SMARTCARD_AbortTransmit_IT(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_AdvFeatureInitTypeDef::TxCompletionIndication
uint16_t TxCompletionIndication
Definition: stm32f7xx_hal_smartcard.h:141
SMARTCARD_InitTypeDef::Prescaler
uint8_t Prescaler
Definition: stm32f7xx_hal_smartcard.h:83
SMARTCARD_AdvFeatureInitTypeDef::DMADisableonRxError
uint32_t DMADisableonRxError
Definition: stm32f7xx_hal_smartcard.h:135
__SMARTCARD_HandleTypeDef::TxXferCount
__IO uint16_t TxXferCount
Definition: stm32f4xx_hal_smartcard.h:164
__SMARTCARD_HandleTypeDef::Init
SMARTCARD_InitTypeDef Init
Definition: stm32f4xx_hal_smartcard.h:158
HAL_SMARTCARD_DeInit
HAL_StatusTypeDef HAL_SMARTCARD_DeInit(SMARTCARD_HandleTypeDef *hsc)
HAL_SMARTCARD_MspInit
void HAL_SMARTCARD_MspInit(SMARTCARD_HandleTypeDef *hsc)
SMARTCARD_AdvFeatureInitTypeDef::DataInvert
uint32_t DataInvert
Definition: stm32f7xx_hal_smartcard.h:125
SMARTCARD_HandleTypeDef
struct __SMARTCARD_HandleTypeDef SMARTCARD_HandleTypeDef
SMARTCARD handle Structure definition.
HAL_SMARTCARD_StateTypeDef
uint32_t HAL_SMARTCARD_StateTypeDef
HAL SMARTCARD State definition.
Definition: stm32f7xx_hal_smartcard.h:185
__SMARTCARD_HandleTypeDef::ErrorCode
__IO uint32_t ErrorCode
Definition: stm32f4xx_hal_smartcard.h:185
SMARTCARD_InitTypeDef::CLKPolarity
uint16_t CLKPolarity
Definition: stm32f7xx_hal_smartcard.h:69
SMARTCARD_ClockSourceTypeDef
SMARTCARD_ClockSourceTypeDef
SMARTCARD clock sources.
Definition: stm32f7xx_hal_smartcard.h:278


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:53