20#ifndef STM32H7xx_HAL_MDIOS_H
21#define STM32H7xx_HAL_MDIOS_H
54 HAL_MDIOS_STATE_RESET = 0x00U,
55 HAL_MDIOS_STATE_READY = 0x01U,
56 HAL_MDIOS_STATE_BUSY = 0x02U,
57 HAL_MDIOS_STATE_ERROR = 0x04U
58}HAL_MDIOS_StateTypeDef;
73 uint32_t PreambleCheck;
86#if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
87typedef struct __MDIOS_HandleTypeDef
94 MDIOS_InitTypeDef Init;
96 __IO HAL_MDIOS_StateTypeDef State;
99 __IO uint32_t ErrorCode;
104#if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
106 void (* WriteCpltCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
107 void (* ReadCpltCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
108 void (* ErrorCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
109 void (* WakeUpCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
111 void (* MspInitCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
112 void (* MspDeInitCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
121#if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
127 HAL_MDIOS_MSPINIT_CB_ID = 0x00U,
128 HAL_MDIOS_MSPDEINIT_CB_ID = 0x01U,
130 HAL_MDIOS_WRITE_COMPLETE_CB_ID = 0x02U,
131 HAL_MDIOS_READ_COMPLETE_CB_ID = 0x03U,
132 HAL_MDIOS_ERROR_CB_ID = 0x04U,
133 HAL_MDIOS_WAKEUP_CB_ID = 0x05U
134}HAL_MDIOS_CallbackIDTypeDef;
139typedef void (*pMDIOS_CallbackTypeDef)(MDIOS_HandleTypeDef * hmdios);
157#define MDIOS_PREAMBLE_CHECK_ENABLE ((uint32_t)0x00000000U)
158#define MDIOS_PREAMBLE_CHECK_DISABLE MDIOS_CR_DPC
167#define MDIOS_REG0 ((uint32_t)0x00000000U)
168#define MDIOS_REG1 ((uint32_t)0x00000001U)
169#define MDIOS_REG2 ((uint32_t)0x00000002U)
170#define MDIOS_REG3 ((uint32_t)0x00000003U)
171#define MDIOS_REG4 ((uint32_t)0x00000004U)
172#define MDIOS_REG5 ((uint32_t)0x00000005U)
173#define MDIOS_REG6 ((uint32_t)0x00000006U)
174#define MDIOS_REG7 ((uint32_t)0x00000007U)
175#define MDIOS_REG8 ((uint32_t)0x00000008U)
176#define MDIOS_REG9 ((uint32_t)0x00000009U)
177#define MDIOS_REG10 ((uint32_t)0x0000000AU)
178#define MDIOS_REG11 ((uint32_t)0x0000000BU)
179#define MDIOS_REG12 ((uint32_t)0x0000000CU)
180#define MDIOS_REG13 ((uint32_t)0x0000000DU)
181#define MDIOS_REG14 ((uint32_t)0x0000000EU)
182#define MDIOS_REG15 ((uint32_t)0x0000000FU)
183#define MDIOS_REG16 ((uint32_t)0x00000010U)
184#define MDIOS_REG17 ((uint32_t)0x00000011U)
185#define MDIOS_REG18 ((uint32_t)0x00000012U)
186#define MDIOS_REG19 ((uint32_t)0x00000013U)
187#define MDIOS_REG20 ((uint32_t)0x00000014U)
188#define MDIOS_REG21 ((uint32_t)0x00000015U)
189#define MDIOS_REG22 ((uint32_t)0x00000016U)
190#define MDIOS_REG23 ((uint32_t)0x00000017U)
191#define MDIOS_REG24 ((uint32_t)0x00000018U)
192#define MDIOS_REG25 ((uint32_t)0x00000019U)
193#define MDIOS_REG26 ((uint32_t)0x0000001AU)
194#define MDIOS_REG27 ((uint32_t)0x0000001BU)
195#define MDIOS_REG28 ((uint32_t)0x0000001CU)
196#define MDIOS_REG29 ((uint32_t)0x0000001DU)
197#define MDIOS_REG30 ((uint32_t)0x0000001EU)
198#define MDIOS_REG31 ((uint32_t)0x0000001FU)
207#define MDIOS_REG0_FLAG ((uint32_t)0x00000001U)
208#define MDIOS_REG1_FLAG ((uint32_t)0x00000002U)
209#define MDIOS_REG2_FLAG ((uint32_t)0x00000004U)
210#define MDIOS_REG3_FLAG ((uint32_t)0x00000008U)
211#define MDIOS_REG4_FLAG ((uint32_t)0x00000010U)
212#define MDIOS_REG5_FLAG ((uint32_t)0x00000020U)
213#define MDIOS_REG6_FLAG ((uint32_t)0x00000040U)
214#define MDIOS_REG7_FLAG ((uint32_t)0x00000080U)
215#define MDIOS_REG8_FLAG ((uint32_t)0x00000100U)
216#define MDIOS_REG9_FLAG ((uint32_t)0x00000200U)
217#define MDIOS_REG10_FLAG ((uint32_t)0x00000400U)
218#define MDIOS_REG11_FLAG ((uint32_t)0x00000800U)
219#define MDIOS_REG12_FLAG ((uint32_t)0x00001000U)
220#define MDIOS_REG13_FLAG ((uint32_t)0x00002000U)
221#define MDIOS_REG14_FLAG ((uint32_t)0x00004000U)
222#define MDIOS_REG15_FLAG ((uint32_t)0x00008000U)
223#define MDIOS_REG16_FLAG ((uint32_t)0x00010000U)
224#define MDIOS_REG17_FLAG ((uint32_t)0x00020000U)
225#define MDIOS_REG18_FLAG ((uint32_t)0x00040000U)
226#define MDIOS_REG19_FLAG ((uint32_t)0x00080000U)
227#define MDIOS_REG20_FLAG ((uint32_t)0x00100000U)
228#define MDIOS_REG21_FLAG ((uint32_t)0x00200000U)
229#define MDIOS_REG22_FLAG ((uint32_t)0x00400000U)
230#define MDIOS_REG23_FLAG ((uint32_t)0x00800000U)
231#define MDIOS_REG24_FLAG ((uint32_t)0x01000000U)
232#define MDIOS_REG25_FLAG ((uint32_t)0x02000000U)
233#define MDIOS_REG26_FLAG ((uint32_t)0x04000000U)
234#define MDIOS_REG27_FLAG ((uint32_t)0x08000000U)
235#define MDIOS_REG28_FLAG ((uint32_t)0x10000000U)
236#define MDIOS_REG29_FLAG ((uint32_t)0x20000000U)
237#define MDIOS_REG30_FLAG ((uint32_t)0x40000000U)
238#define MDIOS_REG31_FLAG ((uint32_t)0x80000000U)
239#define MDIOS_ALLREG_FLAG ((uint32_t)0xFFFFFFFFU)
248#define MDIOS_IT_WRITE MDIOS_CR_WRIE
249#define MDIOS_IT_READ MDIOS_CR_RDIE
250#define MDIOS_IT_ERROR MDIOS_CR_EIE
259#define MDIOS_TURNAROUND_ERROR_FLAG MDIOS_SR_TERF
260#define MDIOS_START_ERROR_FLAG MDIOS_SR_SERF
261#define MDIOS_PREAMBLE_ERROR_FLAG MDIOS_SR_PERF
270#define HAL_MDIOS_ERROR_NONE ((uint32_t)0x00000000U)
271#define HAL_MDIOS_ERROR_PARAM ((uint32_t)0x00000001U)
272#define HAL_MDIOS_ERROR_BUSY ((uint32_t)0x00000002U)
273#define HAL_MDIOS_ERROR_TIMEOUT ((uint32_t)0x00000004U)
274#define HAL_MDIOS_ERROR_DATA ((uint32_t)0x00000010U)
275#if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
276#define HAL_MDIOS_ERROR_INVALID_CALLBACK ((uint32_t)0x00000020U)
286#define MDIOS_WAKEUP_EXTI_LINE ((uint32_t)0x00000400)
304#if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
305#define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__) do{ \
306 (__HANDLE__)->State = HAL_MDIOS_STATE_RESET; \
307 (__HANDLE__)->MspInitCallback = NULL; \
308 (__HANDLE__)->MspDeInitCallback = NULL; \
311#define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_MDIOS_STATE_RESET)
319#define __HAL_MDIOS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= MDIOS_CR_EN)
320#define __HAL_MDIOS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~MDIOS_CR_EN)
333#define __HAL_MDIOS_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
345#define __HAL_MDIOS_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
352#define __HAL_MDIOS_GET_WRITE_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->WRFR & (__FLAG__))
359#define __HAL_MDIOS_GET_READ_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->RDFR & (__FLAG__))
370#define __HAL_MDIOS_GET_ERROR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR & (__FLAG__))
381#define __HAL_MDIOS_CLEAR_ERROR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLRFR) |= (__FLAG__)
393#define __HAL_MDIOS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
402#define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_IT(__EXTI_LINE__) (EXTI->IMR2 |= (__EXTI_LINE__))
404#if defined(DUAL_CORE)
412#define __HAL_MDIOS_WAKEUP_EXTID2_ENABLE_IT(__EXTI_LINE__) (EXTI->C2IMR2 |= (__EXTI_LINE__))
422#define __HAL_MDIOS_WAKEUP_EXTI_GET_FLAG(__EXTI_LINE__) (EXTI->PR2 & (__EXTI_LINE__))
424#if defined(DUAL_CORE)
432#define __HAL_MDIOS_WAKEUP_EXTID2_GET_FLAG(__EXTI_LINE__) (EXTI->C2PR2 & (__EXTI_LINE__))
441#define __HAL_MDIOS_WAKEUP_EXTI_CLEAR_FLAG(__EXTI_LINE__) (EXTI->PR2 = (__EXTI_LINE__))
443#if defined(DUAL_CORE)
451#define __HAL_MDIOS_WAKEUP_EXTID2_CLEAR_FLAG(__EXTI_LINE__) (EXTI->C2PR2 = (__EXTI_LINE__))
461#define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_RISING_EDGE(__EXTI_LINE__) (EXTI->FTSR2 &= ~(__EXTI_LINE__)); \
462 (EXTI->RTSR2 |= (__EXTI_LINE__))
471#define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR2 &= ~(__EXTI_LINE__));\
472 (EXTI->FTSR2 |= (__EXTI_LINE__))
481#define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_RISING_FALLING_EDGE(__EXTI_LINE__) (EXTI->RTSR2 |= (__EXTI_LINE__));\
482 (EXTI->FTSR2 |= (__EXTI_LINE__))
491#define __HAL_MDIOS_WAKEUP_EXTI_GENERATE_SWIT(__EXTI_LINE__) (EXTI->SWIER2 |= (__EXTI_LINE__))
508void HAL_MDIOS_MspInit(MDIOS_HandleTypeDef *hmdios);
509void HAL_MDIOS_MspDeInit(MDIOS_HandleTypeDef *hmdios);
512#if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
513HAL_StatusTypeDef HAL_MDIOS_RegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID, pMDIOS_CallbackTypeDef pCallback);
514HAL_StatusTypeDef HAL_MDIOS_UnRegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID);
523HAL_StatusTypeDef HAL_MDIOS_WriteReg(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum, uint16_t Data);
524HAL_StatusTypeDef HAL_MDIOS_ReadReg(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum, uint16_t *pData);
526uint32_t HAL_MDIOS_GetWrittenRegAddress(MDIOS_HandleTypeDef *hmdios);
527uint32_t HAL_MDIOS_GetReadRegAddress(MDIOS_HandleTypeDef *hmdios);
528HAL_StatusTypeDef HAL_MDIOS_ClearWriteRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum);
529HAL_StatusTypeDef HAL_MDIOS_ClearReadRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum);
532void HAL_MDIOS_IRQHandler(MDIOS_HandleTypeDef *hmdios);
533void HAL_MDIOS_WriteCpltCallback(MDIOS_HandleTypeDef *hmdios);
534void HAL_MDIOS_ReadCpltCallback(MDIOS_HandleTypeDef *hmdios);
535void HAL_MDIOS_ErrorCallback(MDIOS_HandleTypeDef *hmdios);
536void HAL_MDIOS_WakeUpCallback(MDIOS_HandleTypeDef *hmdios);
544uint32_t HAL_MDIOS_GetError(MDIOS_HandleTypeDef *hmdios);
545HAL_MDIOS_StateTypeDef HAL_MDIOS_GetState(MDIOS_HandleTypeDef *hmdios);
590#define IS_MDIOS_PORTADDRESS(__ADDR__) ((__ADDR__) < 32U)
592#define IS_MDIOS_REGISTER(__REGISTER__) ((__REGISTER__) < 32U)
594#define IS_MDIOS_PREAMBLECHECK(__PREAMBLECHECK__) (((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_ENABLE) || \
595 ((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_DISABLE))
#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
MDIOS.
Definition: stm32h723xx.h:1681