RTEMS 6.1-rc2
Loading...
Searching...
No Matches
stm32h7xx_hal_swpmi.h
Go to the documentation of this file.
1
19/* Define to prevent recursive inclusion -------------------------------------*/
20#ifndef STM32H7xx_HAL_SWPMI_H
21#define STM32H7xx_HAL_SWPMI_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27/* Includes ------------------------------------------------------------------*/
28#include "stm32h7xx_hal_def.h"
29
39/* Exported types ------------------------------------------------------------*/
48typedef struct
49{
50 uint32_t VoltageClass;
53 uint32_t BitRate;
59 uint32_t TxBufferingMode;
62 uint32_t RxBufferingMode;
66
67
71typedef enum
72{
82
86#if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1)
87typedef struct __SWPMI_HandleTypeDef
88#else
89typedef struct
90#endif /* USE_HAL_SWPMI_REGISTER_CALLBACKS */
91{
96 uint32_t *pTxBuffPtr;
98 uint32_t TxXferSize;
100 uint32_t TxXferCount;
102 uint32_t *pRxBuffPtr;
104 uint32_t RxXferSize;
106 uint32_t RxXferCount;
116 __IO uint32_t ErrorCode;
118#if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1)
119 void (*RxCpltCallback)(struct __SWPMI_HandleTypeDef *hswpmi);
120 void (*RxHalfCpltCallback)(struct __SWPMI_HandleTypeDef *hswpmi);
121 void (*TxCpltCallback)(struct __SWPMI_HandleTypeDef *hswpmi);
122 void (*TxHalfCpltCallback)(struct __SWPMI_HandleTypeDef *hswpmi);
123 void (*ErrorCallback)(struct __SWPMI_HandleTypeDef *hswpmi);
124 void (*MspInitCallback)(struct __SWPMI_HandleTypeDef *hswpmi);
125 void (*MspDeInitCallback)(struct __SWPMI_HandleTypeDef *hswpmi);
126#endif
127
129
130#if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1)
134typedef enum
135{
136 HAL_SWPMI_RX_COMPLETE_CB_ID = 0x00U,
137 HAL_SWPMI_RX_HALFCOMPLETE_CB_ID = 0x01U,
138 HAL_SWPMI_TX_COMPLETE_CB_ID = 0x02U,
139 HAL_SWPMI_TX_HALFCOMPLETE_CB_ID = 0x03U,
140 HAL_SWPMI_ERROR_CB_ID = 0x04U,
141 HAL_SWPMI_MSPINIT_CB_ID = 0x05U,
142 HAL_SWPMI_MSPDEINIT_CB_ID = 0x06U
143} HAL_SWPMI_CallbackIDTypeDef;
144
148typedef void (*pSWPMI_CallbackTypeDef)(SWPMI_HandleTypeDef *hswpmi);
149#endif
150
155/* Exported constants --------------------------------------------------------*/
166#define HAL_SWPMI_ERROR_NONE ((uint32_t)0x00000000)
167#define HAL_SWPMI_ERROR_CRC ((uint32_t)0x00000004)
168#define HAL_SWPMI_ERROR_OVR ((uint32_t)0x00000008)
169#define HAL_SWPMI_ERROR_UDR ((uint32_t)0x0000000C)
170#define HAL_SWPMI_ERROR_DMA ((uint32_t)0x00000010)
171#define HAL_SWPMI_ERROR_TIMEOUT ((uint32_t)0x00000020)
172#define HAL_SWPMI_ERROR_TXBEF_TIMEOUT ((uint32_t)0x00000040)
173#define HAL_SWPMI_ERROR_TRANSCEIVER_NOT_READY ((uint32_t)0x00000080)
174#if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1)
175#define HAL_SWPMI_ERROR_INVALID_CALLBACK ((uint32_t)0x00000100)
176#endif
185#define SWPMI_VOLTAGE_CLASS_C ((uint32_t)0x00000000)
186#define SWPMI_VOLTAGE_CLASS_B SWPMI_OR_CLASS
195#define SWPMI_TX_NO_SOFTWAREBUFFER ((uint32_t)0x00000000)
196#define SWPMI_TX_SINGLE_SOFTWAREBUFFER ((uint32_t)0x00000000)
197#define SWPMI_TX_MULTI_SOFTWAREBUFFER SWPMI_CR_TXMODE
206#define SWPMI_RX_NO_SOFTWAREBUFFER ((uint32_t)0x00000000)
207#define SWPMI_RX_SINGLE_SOFTWAREBUFFER ((uint32_t)0x00000000)
208#define SWPMI_RX_MULTI_SOFTWAREBUFFER SWPMI_CR_RXMODE
219#define SWPMI_FLAG_RXBFF SWPMI_ISR_RXBFF
220#define SWPMI_FLAG_TXBEF SWPMI_ISR_TXBEF
221#define SWPMI_FLAG_RXBERF SWPMI_ISR_RXBERF
222#define SWPMI_FLAG_RXOVRF SWPMI_ISR_RXOVRF
223#define SWPMI_FLAG_TXUNRF SWPMI_ISR_TXUNRF
224#define SWPMI_FLAG_RXNE SWPMI_ISR_RXNE
225#define SWPMI_FLAG_TXE SWPMI_ISR_TXE
226#define SWPMI_FLAG_TCF SWPMI_ISR_TCF
227#define SWPMI_FLAG_SRF SWPMI_ISR_SRF
228#define SWPMI_FLAG_SUSP SWPMI_ISR_SUSP
229#define SWPMI_FLAG_DEACTF SWPMI_ISR_DEACTF
230#define SWPMI_FLAG_RDYF SWPMI_ISR_RDYF
241#define SWPMI_IT_RDYIE SWPMI_IER_RDYIE
242#define SWPMI_IT_SRIE SWPMI_IER_SRIE
243#define SWPMI_IT_TCIE SWPMI_IER_TCIE
244#define SWPMI_IT_TIE SWPMI_IER_TIE
245#define SWPMI_IT_RIE SWPMI_IER_RIE
246#define SWPMI_IT_TXUNRIE SWPMI_IER_TXUNRIE
247#define SWPMI_IT_RXOVRIE SWPMI_IER_RXOVRIE
248#define SWPMI_IT_RXBERIE SWPMI_IER_RXBERIE
249#define SWPMI_IT_TXBEIE SWPMI_IER_TXBEIE
250#define SWPMI_IT_RXBFIE SWPMI_IER_RXBFIE
259/* Exported macros -----------------------------------------------------------*/
269#if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1)
270#define __HAL_SWPMI_RESET_HANDLE_STATE(__HANDLE__) do{ \
271 (__HANDLE__)->State = HAL_SWPMI_STATE_RESET; \
272 (__HANDLE__)->MspInitCallback = NULL; \
273 (__HANDLE__)->MspDeInitCallback = NULL; \
274 } while(0)
275#else
276#define __HAL_SWPMI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SWPMI_STATE_RESET)
277#endif
278
284#define __HAL_SWPMI_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT)
285
291#define __HAL_SWPMI_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPACT)
292
298#define __HAL_SWPMI_TRANSCEIVER_ENABLE(__HANDLE__) SET_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPEN)
299
305#define __HAL_SWPMI_TRANSCEIVER_DISABLE(__HANDLE__) CLEAR_BIT((__HANDLE__)->Instance->CR, SWPMI_CR_SWPEN)
306
325#define __HAL_SWPMI_GET_FLAG(__HANDLE__, __FLAG__) (READ_BIT((__HANDLE__)->Instance->ISR, (__FLAG__)) == (__FLAG__))
326
341#define __HAL_SWPMI_CLEAR_FLAG(__HANDLE__, __FLAG__) WRITE_REG((__HANDLE__)->Instance->ICR, (__FLAG__))
342
359#define __HAL_SWPMI_ENABLE_IT(__HANDLE__, __INTERRUPT__) SET_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__))
360
377#define __HAL_SWPMI_DISABLE_IT(__HANDLE__, __INTERRUPT__) CLEAR_BIT((__HANDLE__)->Instance->IER, (__INTERRUPT__))
378
395#define __HAL_SWPMI_GET_IT(__HANDLE__, __IT__) (READ_BIT((__HANDLE__)->Instance->ISR,(__IT__)) == (__IT__))
396
413#define __HAL_SWPMI_GET_IT_SOURCE(__HANDLE__, __IT__) ((READ_BIT((__HANDLE__)->Instance->IER, (__IT__)) == (__IT__)) ? SET : RESET)
414
419/* Exported functions --------------------------------------------------------*/
424/* Initialization/de-initialization functions ********************************/
425HAL_StatusTypeDef HAL_SWPMI_Init(SWPMI_HandleTypeDef *hswpmi);
426HAL_StatusTypeDef HAL_SWPMI_DeInit(SWPMI_HandleTypeDef *hswpmi);
427void HAL_SWPMI_MspInit(SWPMI_HandleTypeDef *hswpmi);
428void HAL_SWPMI_MspDeInit(SWPMI_HandleTypeDef *hswpmi);
429
430#if (USE_HAL_SWPMI_REGISTER_CALLBACKS == 1)
431/* SWPMI callbacks register/unregister functions ********************************/
432HAL_StatusTypeDef HAL_SWPMI_RegisterCallback(SWPMI_HandleTypeDef *hswpmi,
433 HAL_SWPMI_CallbackIDTypeDef CallbackID,
434 pSWPMI_CallbackTypeDef pCallback);
435HAL_StatusTypeDef HAL_SWPMI_UnRegisterCallback(SWPMI_HandleTypeDef *hswpmi,
436 HAL_SWPMI_CallbackIDTypeDef CallbackID);
437#endif
438
439/* IO operation functions *****************************************************/
440HAL_StatusTypeDef HAL_SWPMI_Transmit(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout);
441HAL_StatusTypeDef HAL_SWPMI_Receive(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size, uint32_t Timeout);
442HAL_StatusTypeDef HAL_SWPMI_Transmit_IT(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
443HAL_StatusTypeDef HAL_SWPMI_Receive_IT(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
444HAL_StatusTypeDef HAL_SWPMI_Transmit_DMA(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
445HAL_StatusTypeDef HAL_SWPMI_Receive_DMA(SWPMI_HandleTypeDef *hswpmi, uint32_t *pData, uint16_t Size);
446HAL_StatusTypeDef HAL_SWPMI_DMAStop(SWPMI_HandleTypeDef *hswpmi);
447HAL_StatusTypeDef HAL_SWPMI_EnableLoopback(SWPMI_HandleTypeDef *hswpmi);
448HAL_StatusTypeDef HAL_SWPMI_DisableLoopback(SWPMI_HandleTypeDef *hswpmi);
449void HAL_SWPMI_IRQHandler(SWPMI_HandleTypeDef *hswpmi);
450void HAL_SWPMI_TxCpltCallback(SWPMI_HandleTypeDef *hswpmi);
451void HAL_SWPMI_TxHalfCpltCallback(SWPMI_HandleTypeDef *hswpmi);
452void HAL_SWPMI_RxCpltCallback(SWPMI_HandleTypeDef *hswpmi);
453void HAL_SWPMI_RxHalfCpltCallback(SWPMI_HandleTypeDef *hswpmi);
454void HAL_SWPMI_ErrorCallback(SWPMI_HandleTypeDef *hswpmi);
455
456/* Peripheral Control and State functions ************************************/
457HAL_SWPMI_StateTypeDef HAL_SWPMI_GetState(SWPMI_HandleTypeDef *hswpmi);
458uint32_t HAL_SWPMI_GetError(SWPMI_HandleTypeDef *hswpmi);
459
464/* Private types -------------------------------------------------------------*/
474/* Private variables ---------------------------------------------------------*/
484/* Private constants ---------------------------------------------------------*/
494/* Private macros ------------------------------------------------------------*/
501#define IS_SWPMI_VOLTAGE_CLASS(__CLASS__) (((__CLASS__) == SWPMI_VOLTAGE_CLASS_C) || \
502 ((__CLASS__) == SWPMI_VOLTAGE_CLASS_B))
503
504#define IS_SWPMI_BITRATE_VALUE(__VALUE__) (((__VALUE__) <= 255U))
505
506
507#define IS_SWPMI_TX_BUFFERING_MODE(__MODE__) (((__MODE__) == SWPMI_TX_NO_SOFTWAREBUFFER) || \
508 ((__MODE__) == SWPMI_TX_MULTI_SOFTWAREBUFFER))
509
510
511#define IS_SWPMI_RX_BUFFERING_MODE(__MODE__) (((__MODE__) == SWPMI_RX_NO_SOFTWAREBUFFER) || \
512 ((__MODE__) == SWPMI_RX_MULTI_SOFTWAREBUFFER))
513
527#ifdef __cplusplus
528}
529#endif
530
531#endif /* STM32H7xx_HAL_SWPMI_H */
#define __IO
Definition: core_cm4.h:239
HAL_SWPMI_StateTypeDef
HAL SWPMI State structures definition.
Definition: stm32h7xx_hal_swpmi.h:72
@ HAL_SWPMI_STATE_BUSY
Definition: stm32h7xx_hal_swpmi.h:75
@ HAL_SWPMI_STATE_RESET
Definition: stm32h7xx_hal_swpmi.h:73
@ HAL_SWPMI_STATE_ERROR
Definition: stm32h7xx_hal_swpmi.h:80
@ HAL_SWPMI_STATE_TIMEOUT
Definition: stm32h7xx_hal_swpmi.h:79
@ HAL_SWPMI_STATE_BUSY_TX
Definition: stm32h7xx_hal_swpmi.h:76
@ HAL_SWPMI_STATE_BUSY_TX_RX
Definition: stm32h7xx_hal_swpmi.h:78
@ HAL_SWPMI_STATE_BUSY_RX
Definition: stm32h7xx_hal_swpmi.h:77
@ HAL_SWPMI_STATE_READY
Definition: stm32h7xx_hal_swpmi.h:74
This file contains HAL common defines, enumeration, macros and structures definitions.
HAL_StatusTypeDef
HAL Status structures definition.
Definition: stm32h7xx_hal_def.h:47
HAL_LockTypeDef
HAL Lock structures definition.
Definition: stm32h7xx_hal_def.h:58
SWPMI handle Structure definition.
Definition: stm32h7xx_hal_swpmi.h:91
uint32_t * pTxBuffPtr
Definition: stm32h7xx_hal_swpmi.h:96
uint32_t TxXferSize
Definition: stm32h7xx_hal_swpmi.h:98
DMA_HandleTypeDef * hdmatx
Definition: stm32h7xx_hal_swpmi.h:108
SWPMI_TypeDef * Instance
Definition: stm32h7xx_hal_swpmi.h:92
__IO HAL_SWPMI_StateTypeDef State
Definition: stm32h7xx_hal_swpmi.h:114
uint32_t RxXferSize
Definition: stm32h7xx_hal_swpmi.h:104
SWPMI_InitTypeDef Init
Definition: stm32h7xx_hal_swpmi.h:94
uint32_t TxXferCount
Definition: stm32h7xx_hal_swpmi.h:100
uint32_t * pRxBuffPtr
Definition: stm32h7xx_hal_swpmi.h:102
uint32_t RxXferCount
Definition: stm32h7xx_hal_swpmi.h:106
HAL_LockTypeDef Lock
Definition: stm32h7xx_hal_swpmi.h:112
__IO uint32_t ErrorCode
Definition: stm32h7xx_hal_swpmi.h:116
DMA_HandleTypeDef * hdmarx
Definition: stm32h7xx_hal_swpmi.h:110
SWPMI Init Structure definition.
Definition: stm32h7xx_hal_swpmi.h:49
uint32_t TxBufferingMode
Definition: stm32h7xx_hal_swpmi.h:59
uint32_t BitRate
Definition: stm32h7xx_hal_swpmi.h:53
uint32_t RxBufferingMode
Definition: stm32h7xx_hal_swpmi.h:62
uint32_t VoltageClass
Definition: stm32h7xx_hal_swpmi.h:50
Single Wire Protocol Master Interface SPWMI.
Definition: stm32h723xx.h:1615
DMA handle Structure definition.
Definition: stm32h7xx_hal_dma.h:138