20#ifndef STM32H7xx_HAL_PSSI_H
21#define STM32H7xx_HAL_PSSI_H
35#ifndef USE_HAL_PSSI_REGISTER_CALLBACKS
37#define USE_HAL_PSSI_REGISTER_CALLBACKS 0U
61 uint32_t ControlSignal;
63 uint32_t ClockPolarity;
65 uint32_t DataEnablePolarity;
67 uint32_t ReadyPolarity;
78 HAL_PSSI_STATE_RESET = 0x00U,
79 HAL_PSSI_STATE_READY = 0x01U,
80 HAL_PSSI_STATE_BUSY = 0x02U,
81 HAL_PSSI_STATE_BUSY_TX = 0x03U,
82 HAL_PSSI_STATE_BUSY_RX = 0x04U,
83 HAL_PSSI_STATE_TIMEOUT = 0x05U,
84 HAL_PSSI_STATE_ERROR = 0x06U,
85 HAL_PSSI_STATE_ABORT = 0x07U,
87} HAL_PSSI_StateTypeDef;
92#if (USE_HAL_PSSI_REGISTER_CALLBACKS == 1)
93typedef struct __PSSI_HandleTypeDef
99 PSSI_InitTypeDef Init;
103#if defined(HAL_DMA_MODULE_ENABLED)
108#if (USE_HAL_PSSI_REGISTER_CALLBACKS == 1)
109 void (* TxCpltCallback)(
struct __PSSI_HandleTypeDef *hpssi);
110 void (* RxCpltCallback)(
struct __PSSI_HandleTypeDef *hpssi);
111 void (* ErrorCallback)(
struct __PSSI_HandleTypeDef *hpssi);
112 void (* AbortCpltCallback)(
struct __PSSI_HandleTypeDef *hpssi);
114 void (* MspInitCallback)(
struct __PSSI_HandleTypeDef *hpssi);
115 void (* MspDeInitCallback)(
struct __PSSI_HandleTypeDef *hpssi);
119 __IO HAL_PSSI_StateTypeDef State;
120 __IO uint32_t ErrorCode;
124#if (USE_HAL_PSSI_REGISTER_CALLBACKS == 1)
128typedef void (*pPSSI_CallbackTypeDef)(PSSI_HandleTypeDef *hpssi);
135 HAL_PSSI_TX_COMPLETE_CB_ID = 0x00U,
136 HAL_PSSI_RX_COMPLETE_CB_ID = 0x01U,
137 HAL_PSSI_ERROR_CB_ID = 0x03U,
138 HAL_PSSI_ABORT_CB_ID = 0x04U,
140 HAL_PSSI_MSPINIT_CB_ID = 0x05U,
141 HAL_PSSI_MSPDEINIT_CB_ID = 0x06U
143} HAL_PSSI_CallbackIDTypeDef;
160#define HAL_PSSI_ERROR_NONE 0x00000000U
161#define HAL_PSSI_ERROR_NOT_SUPPORTED 0x00000001U
162#define HAL_PSSI_ERROR_UNDER_RUN 0x00000002U
163#define HAL_PSSI_ERROR_OVER_RUN 0x00000004U
164#define HAL_PSSI_ERROR_DMA 0x00000008U
165#define HAL_PSSI_ERROR_TIMEOUT 0x00000010U
166#if (USE_HAL_PSSI_REGISTER_CALLBACKS == 1)
167#define HAL_PSSI_ERROR_INVALID_CALLBACK 0x00000020U
179#define HAL_PSSI_8BITS 0x00000000U
180#define HAL_PSSI_16BITS 0x00000001U
181#define HAL_PSSI_32BITS 0x00000002U
191#define HAL_PSSI_8LINES 0x00000000U
192#define HAL_PSSI_16LINES PSSI_CR_EDM
200#define HAL_PSSI_UNIDIRECTIONAL 0x00000000U
201#define HAL_PSSI_BIDIRECTIONAL 0x00000001U
210#define HAL_PSSI_DE_RDY_DISABLE (0x0U << PSSI_CR_DERDYCFG_Pos)
211#define HAL_PSSI_RDY_ENABLE (0x1U << PSSI_CR_DERDYCFG_Pos)
212#define HAL_PSSI_DE_ENABLE (0x2U << PSSI_CR_DERDYCFG_Pos)
213#define HAL_PSSI_DE_RDY_ALT_ENABLE (0x3U << PSSI_CR_DERDYCFG_Pos)
214#define HAL_PSSI_MAP_RDY_BIDIR_ENABLE (0x4U << PSSI_CR_DERDYCFG_Pos)
215#define HAL_PSSI_RDY_MAP_ENABLE (0x5U << PSSI_CR_DERDYCFG_Pos)
216#define HAL_PSSI_DE_MAP_ENABLE (0x6U << PSSI_CR_DERDYCFG_Pos)
217#define HAL_PSSI_MAP_DE_BIDIR_ENABLE (0x7U << PSSI_CR_DERDYCFG_Pos)
228#define HAL_PSSI_DEPOL_ACTIVE_LOW 0x0U
229#define HAL_PSSI_DEPOL_ACTIVE_HIGH PSSI_CR_DEPOL
237#define HAL_PSSI_RDYPOL_ACTIVE_LOW 0x0U
238#define HAL_PSSI_RDYPOL_ACTIVE_HIGH PSSI_CR_RDYPOL
247#define HAL_PSSI_FALLING_EDGE 0x0U
248#define HAL_PSSI_RISING_EDGE 0x1U
259#define PSSI_MAX_NBYTE_SIZE 0x10000U
260#define PSSI_TIMEOUT_TRANSMIT 0x0000FFFFU
262#define PSSI_CR_OUTEN_INPUT 0x00000000U
263#define PSSI_CR_OUTEN_OUTPUT PSSI_CR_OUTEN
265#define PSSI_CR_DMA_ENABLE PSSI_CR_DMAEN
266#define PSSI_CR_DMA_DISABLE (~PSSI_CR_DMAEN)
268#define PSSI_CR_16BITS PSSI_CR_EDM
269#define PSSI_CR_8BITS (~PSSI_CR_EDM)
271#define PSSI_FLAG_RTT1B PSSI_SR_RTT1B
272#define PSSI_FLAG_RTT4B PSSI_SR_RTT4B
285#define PSSI_FLAG_OVR_RIS PSSI_RIS_OVR_RIS
286#define PSSI_FLAG_MASK PSSI_RIS_OVR_RIS_Msk
287#define PSSI_FLAG_OVR_MIS PSSI_MIS_OVR_MIS
307#if (USE_HAL_PSSI_REGISTER_CALLBACKS == 1)
308#define HAL_PSSI_RESET_HANDLE_STATE(__HANDLE__) do{ \
309 (__HANDLE__)->State = HAL_PSSI_STATE_RESET;\
310 (__HANDLE__)->MspInitCallback = NULL; \
311 (__HANDLE__)->MspDeInitCallback = NULL; \
314#define HAL_PSSI_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_PSSI_STATE_RESET)
323#define HAL_PSSI_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= PSSI_CR_ENABLE)
329#define HAL_PSSI_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= (~PSSI_CR_ENABLE))
342#define HAL_PSSI_GET_STATUS(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR & (__FLAG__))
355#define HAL_PSSI_GET_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->RIS & (__FLAG__))
365#define HAL_PSSI_CLEAR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->ICR = (__FLAG__))
375#define HAL_PSSI_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER |= (__INTERRUPT__))
385#define HAL_PSSI_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER &= ~(__INTERRUPT__))
395#define HAL_PSSI_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->IER & (__INTERRUPT__))
404#define IS_PSSI_CONTROL_SIGNAL(__CONTROL__) (((__CONTROL__) == HAL_PSSI_DE_RDY_DISABLE ) || \
405 ((__CONTROL__) == HAL_PSSI_RDY_ENABLE ) || \
406 ((__CONTROL__) == HAL_PSSI_DE_ENABLE ) || \
407 ((__CONTROL__) == HAL_PSSI_DE_RDY_ALT_ENABLE ) || \
408 ((__CONTROL__) == HAL_PSSI_MAP_RDY_BIDIR_ENABLE ) || \
409 ((__CONTROL__) == HAL_PSSI_RDY_MAP_ENABLE ) || \
410 ((__CONTROL__) == HAL_PSSI_DE_MAP_ENABLE ) || \
411 ((__CONTROL__) == HAL_PSSI_MAP_DE_BIDIR_ENABLE ))
421#define IS_PSSI_BUSWIDTH(__BUSWIDTH__) (((__BUSWIDTH__) == HAL_PSSI_8LINES ) || \
422 ((__BUSWIDTH__) == HAL_PSSI_16LINES ))
431#define IS_PSSI_CLOCK_POLARITY(__CLOCKPOL__) (((__CLOCKPOL__) == HAL_PSSI_FALLING_EDGE ) || \
432 ((__CLOCKPOL__) == HAL_PSSI_RISING_EDGE ))
441#define IS_PSSI_DE_POLARITY(__DEPOL__) (((__DEPOL__) == HAL_PSSI_DEPOL_ACTIVE_LOW ) || \
442 ((__DEPOL__) == HAL_PSSI_DEPOL_ACTIVE_HIGH ))
450#define IS_PSSI_RDY_POLARITY(__RDYPOL__) (((__RDYPOL__) == HAL_PSSI_RDYPOL_ACTIVE_LOW ) || \
451 ((__RDYPOL__) == HAL_PSSI_RDYPOL_ACTIVE_HIGH ))
470void HAL_PSSI_MspInit(PSSI_HandleTypeDef *hpssi);
471void HAL_PSSI_MspDeInit(PSSI_HandleTypeDef *hpssi);
473#if (USE_HAL_PSSI_REGISTER_CALLBACKS == 1)
474HAL_StatusTypeDef HAL_PSSI_RegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef CallbackID,
475 pPSSI_CallbackTypeDef pCallback);
476HAL_StatusTypeDef HAL_PSSI_UnRegisterCallback(PSSI_HandleTypeDef *hpssi, HAL_PSSI_CallbackIDTypeDef CallbackID);
489HAL_StatusTypeDef HAL_PSSI_Transmit(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint32_t Timeout);
490HAL_StatusTypeDef HAL_PSSI_Receive(PSSI_HandleTypeDef *hpssi, uint8_t *pData, uint32_t Size, uint32_t Timeout);
491#if defined(HAL_DMA_MODULE_ENABLED)
492HAL_StatusTypeDef HAL_PSSI_Transmit_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size);
493HAL_StatusTypeDef HAL_PSSI_Receive_DMA(PSSI_HandleTypeDef *hpssi, uint32_t *pData, uint32_t Size);
506HAL_PSSI_StateTypeDef HAL_PSSI_GetState(
const PSSI_HandleTypeDef *hpssi);
507uint32_t HAL_PSSI_GetError(
const PSSI_HandleTypeDef *hpssi);
517void HAL_PSSI_IRQHandler(PSSI_HandleTypeDef *hpssi);
518void HAL_PSSI_TxCpltCallback(PSSI_HandleTypeDef *hpssi);
519void HAL_PSSI_RxCpltCallback(PSSI_HandleTypeDef *hpssi);
520void HAL_PSSI_ErrorCallback(PSSI_HandleTypeDef *hpssi);
521void HAL_PSSI_AbortCpltCallback(PSSI_HandleTypeDef *hpssi);
#define __IO
Definition: core_cm4.h:239
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
PSSI.
Definition: stm32h723xx.h:580
DMA handle Structure definition.
Definition: stm32h7xx_hal_dma.h:138