21 #ifndef __STM32F7xx_HAL_MDIOS_H
22 #define __STM32F7xx_HAL_MDIOS_H
52 HAL_MDIOS_STATE_RESET = 0x00U,
53 HAL_MDIOS_STATE_READY = 0x01U,
54 HAL_MDIOS_STATE_BUSY = 0x02U,
55 HAL_MDIOS_STATE_ERROR = 0x04U
56 }HAL_MDIOS_StateTypeDef;
70 uint32_t PreambleCheck;
82 #if ( USE_HAL_MDIOS_REGISTER_CALLBACKS == 1 )
83 typedef struct __MDIOS_HandleTypeDef
90 MDIOS_InitTypeDef
Init;
92 __IO HAL_MDIOS_StateTypeDef State;
96 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
98 void (* WriteCpltCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
99 void (* ReadCpltCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
100 void (* ErrorCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
101 void (* WakeUpCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
102 void (* MspInitCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
103 void (* MspDeInitCallback) (
struct __MDIOS_HandleTypeDef * hmdios);
107 }MDIOS_HandleTypeDef;
109 #if ( USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
115 HAL_MDIOS_MSPINIT_CB_ID = 0x00U,
116 HAL_MDIOS_MSPDEINIT_CB_ID = 0x01U,
117 HAL_MDIOS_WRITE_COMPLETE_CB_ID = 0x02U,
118 HAL_MDIOS_READ_COMPLETE_CB_ID = 0x03U,
119 HAL_MDIOS_ERROR_CB_ID = 0x04U,
120 HAL_MDIOS_WAKEUP_CB_ID = 0x05U
121 }HAL_MDIOS_CallbackIDTypeDef;
126 typedef void (*pMDIOS_CallbackTypeDef)(MDIOS_HandleTypeDef * hmdios);
146 #define MDIOS_PREAMBLE_CHECK_ENABLE ((uint32_t)0x00000000U)
147 #define MDIOS_PREAMBLE_CHECK_DISABLE MDIOS_CR_DPC
155 #define MDIOS_REG0 ((uint32_t)0x00000000U)
156 #define MDIOS_REG1 ((uint32_t)0x00000001U)
157 #define MDIOS_REG2 ((uint32_t)0x00000002U)
158 #define MDIOS_REG3 ((uint32_t)0x00000003U)
159 #define MDIOS_REG4 ((uint32_t)0x00000004U)
160 #define MDIOS_REG5 ((uint32_t)0x00000005U)
161 #define MDIOS_REG6 ((uint32_t)0x00000006U)
162 #define MDIOS_REG7 ((uint32_t)0x00000007U)
163 #define MDIOS_REG8 ((uint32_t)0x00000008U)
164 #define MDIOS_REG9 ((uint32_t)0x00000009U)
165 #define MDIOS_REG10 ((uint32_t)0x0000000AU)
166 #define MDIOS_REG11 ((uint32_t)0x0000000BU)
167 #define MDIOS_REG12 ((uint32_t)0x0000000CU)
168 #define MDIOS_REG13 ((uint32_t)0x0000000DU)
169 #define MDIOS_REG14 ((uint32_t)0x0000000EU)
170 #define MDIOS_REG15 ((uint32_t)0x0000000FU)
171 #define MDIOS_REG16 ((uint32_t)0x00000010U)
172 #define MDIOS_REG17 ((uint32_t)0x00000011U)
173 #define MDIOS_REG18 ((uint32_t)0x00000012U)
174 #define MDIOS_REG19 ((uint32_t)0x00000013U)
175 #define MDIOS_REG20 ((uint32_t)0x00000014U)
176 #define MDIOS_REG21 ((uint32_t)0x00000015U)
177 #define MDIOS_REG22 ((uint32_t)0x00000016U)
178 #define MDIOS_REG23 ((uint32_t)0x00000017U)
179 #define MDIOS_REG24 ((uint32_t)0x00000018U)
180 #define MDIOS_REG25 ((uint32_t)0x00000019U)
181 #define MDIOS_REG26 ((uint32_t)0x0000001AU)
182 #define MDIOS_REG27 ((uint32_t)0x0000001BU)
183 #define MDIOS_REG28 ((uint32_t)0x0000001CU)
184 #define MDIOS_REG29 ((uint32_t)0x0000001DU)
185 #define MDIOS_REG30 ((uint32_t)0x0000001EU)
186 #define MDIOS_REG31 ((uint32_t)0x0000001FU)
194 #define MDIOS_REG0_FLAG ((uint32_t)0x00000001U)
195 #define MDIOS_REG1_FLAG ((uint32_t)0x00000002U)
196 #define MDIOS_REG2_FLAG ((uint32_t)0x00000004U)
197 #define MDIOS_REG3_FLAG ((uint32_t)0x00000008U)
198 #define MDIOS_REG4_FLAG ((uint32_t)0x00000010U)
199 #define MDIOS_REG5_FLAG ((uint32_t)0x00000020U)
200 #define MDIOS_REG6_FLAG ((uint32_t)0x00000040U)
201 #define MDIOS_REG7_FLAG ((uint32_t)0x00000080U)
202 #define MDIOS_REG8_FLAG ((uint32_t)0x00000100U)
203 #define MDIOS_REG9_FLAG ((uint32_t)0x00000200U)
204 #define MDIOS_REG10_FLAG ((uint32_t)0x00000400U)
205 #define MDIOS_REG11_FLAG ((uint32_t)0x00000800U)
206 #define MDIOS_REG12_FLAG ((uint32_t)0x00001000U)
207 #define MDIOS_REG13_FLAG ((uint32_t)0x00002000U)
208 #define MDIOS_REG14_FLAG ((uint32_t)0x00004000U)
209 #define MDIOS_REG15_FLAG ((uint32_t)0x00008000U)
210 #define MDIOS_REG16_FLAG ((uint32_t)0x00010000U)
211 #define MDIOS_REG17_FLAG ((uint32_t)0x00020000U)
212 #define MDIOS_REG18_FLAG ((uint32_t)0x00040000U)
213 #define MDIOS_REG19_FLAG ((uint32_t)0x00080000U)
214 #define MDIOS_REG20_FLAG ((uint32_t)0x00100000U)
215 #define MDIOS_REG21_FLAG ((uint32_t)0x00200000U)
216 #define MDIOS_REG22_FLAG ((uint32_t)0x00400000U)
217 #define MDIOS_REG23_FLAG ((uint32_t)0x00800000U)
218 #define MDIOS_REG24_FLAG ((uint32_t)0x01000000U)
219 #define MDIOS_REG25_FLAG ((uint32_t)0x02000000U)
220 #define MDIOS_REG26_FLAG ((uint32_t)0x04000000U)
221 #define MDIOS_REG27_FLAG ((uint32_t)0x08000000U)
222 #define MDIOS_REG28_FLAG ((uint32_t)0x10000000U)
223 #define MDIOS_REG29_FLAG ((uint32_t)0x20000000U)
224 #define MDIOS_REG30_FLAG ((uint32_t)0x40000000U)
225 #define MDIOS_REG31_FLAG ((uint32_t)0x80000000U)
226 #define MDIOS_ALLREG_FLAG ((uint32_t)0xFFFFFFFFU)
234 #define MDIOS_IT_WRITE MDIOS_CR_WRIE
235 #define MDIOS_IT_READ MDIOS_CR_RDIE
236 #define MDIOS_IT_ERROR MDIOS_CR_EIE
244 #define MDIOS_TURNAROUND_ERROR_FLAG MDIOS_SR_TERF
245 #define MDIOS_START_ERROR_FLAG MDIOS_SR_SERF
246 #define MDIOS_PREAMBLE_ERROR_FLAG MDIOS_SR_PERF
254 #define MDIOS_WAKEUP_EXTI_LINE ((uint32_t)0x01000000)
271 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
272 #define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__) do{ \
273 (__HANDLE__)->State = HAL_MDIOS_STATE_RESET; \
274 (__HANDLE__)->MspInitCallback = NULL; \
275 (__HANDLE__)->MspDeInitCallback = NULL; \
278 #define __HAL_MDIOS_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_MDIOS_STATE_RESET)
286 #define __HAL_MDIOS_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= MDIOS_CR_EN)
287 #define __HAL_MDIOS_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~MDIOS_CR_EN)
300 #define __HAL_MDIOS_ENABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR |= (__INTERRUPT__))
312 #define __HAL_MDIOS_DISABLE_IT(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR &= ~(__INTERRUPT__))
319 #define __HAL_MDIOS_GET_WRITE_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->WRFR & (__FLAG__))
326 #define __HAL_MDIOS_GET_READ_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->RDFR & (__FLAG__))
337 #define __HAL_MDIOS_GET_ERROR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->SR & (__FLAG__))
348 #define __HAL_MDIOS_CLEAR_ERROR_FLAG(__HANDLE__, __FLAG__) ((__HANDLE__)->Instance->CLRFR) |= (__FLAG__)
360 #define __HAL_MDIOS_GET_IT_SOURCE(__HANDLE__, __INTERRUPT__) ((__HANDLE__)->Instance->CR & (__INTERRUPT__))
366 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_IT() (EXTI->IMR |= (MDIOS_WAKEUP_EXTI_LINE))
372 #define __HAL_MDIOS_WAKEUP_EXTI_DISABLE_IT() (EXTI->IMR &= ~(MDIOS_WAKEUP_EXTI_LINE))
378 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_EVENT() (EXTI->EMR |= (MDIOS_WAKEUP_EXTI_LINE))
384 #define __HAL_MDIOS_WAKEUP_EXTI_DISABLE_EVENT() (EXTI->EMR &= ~(MDIOS_WAKEUP_EXTI_LINE))
390 #define __HAL_MDIOS_WAKEUP_EXTI_GET_FLAG() (EXTI->PR & (MDIOS_WAKEUP_EXTI_LINE))
396 #define __HAL_MDIOS_WAKEUP_EXTI_CLEAR_FLAG() (EXTI->PR = (MDIOS_WAKEUP_EXTI_LINE))
402 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_RISING_EDGE_TRIGGER() EXTI->RTSR |= MDIOS_WAKEUP_EXTI_LINE
408 #define __HAL_MDIOS_WAKEUP_EXTI_DISABLE_RISING_EDGE_TRIGGER() EXTI->RTSR &= ~(MDIOS_WAKEUP_EXTI_LINE)
414 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_FALLING_EDGE_TRIGGER() EXTI->FTSR |= (MDIOS_WAKEUP_EXTI_LINE)
420 #define __HAL_MDIOS_WAKEUP_EXTI_DISABLE_FALLING_EDGE_TRIGGER() EXTI->FTSR &= ~(MDIOS_WAKEUP_EXTI_LINE)
426 #define __HAL_MDIOS_WAKEUP_EXTI_ENABLE_FALLINGRISING_TRIGGER() EXTI->RTSR |= MDIOS_WAKEUP_EXTI_LINE;\
427 EXTI->FTSR |= MDIOS_WAKEUP_EXTI_LINE
433 #define __HAL_MDIOS_WAKEUP_EXTI_DISABLE_FALLINGRISING_TRIGGER() EXTI->RTSR &= ~(MDIOS_WAKEUP_EXTI_LINE);\
434 EXTI->FTSR &= ~(MDIOS_WAKEUP_EXTI_LINE)
439 #define __HAL_MDIOS_WAKEUP_EXTI_GENERATE_SWIT() (EXTI->SWIER |= (MDIOS_WAKEUP_EXTI_LINE))
455 void HAL_MDIOS_MspInit(MDIOS_HandleTypeDef *hmdios);
456 void HAL_MDIOS_MspDeInit(MDIOS_HandleTypeDef *hmdios);
458 #if (USE_HAL_MDIOS_REGISTER_CALLBACKS == 1)
459 HAL_StatusTypeDef HAL_MDIOS_RegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID, pMDIOS_CallbackTypeDef pCallback);
460 HAL_StatusTypeDef HAL_MDIOS_UnRegisterCallback(MDIOS_HandleTypeDef *hmdios, HAL_MDIOS_CallbackIDTypeDef CallbackID);
469 HAL_StatusTypeDef HAL_MDIOS_WriteReg(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum, uint16_t Data);
470 HAL_StatusTypeDef HAL_MDIOS_ReadReg(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum, uint16_t *pData);
472 uint32_t HAL_MDIOS_GetWrittenRegAddress(MDIOS_HandleTypeDef *hmdios);
473 uint32_t HAL_MDIOS_GetReadRegAddress(MDIOS_HandleTypeDef *hmdios);
474 HAL_StatusTypeDef HAL_MDIOS_ClearWriteRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum);
475 HAL_StatusTypeDef HAL_MDIOS_ClearReadRegAddress(MDIOS_HandleTypeDef *hmdios, uint32_t RegNum);
478 void HAL_MDIOS_IRQHandler(MDIOS_HandleTypeDef *hmdios);
479 void HAL_MDIOS_WriteCpltCallback(MDIOS_HandleTypeDef *hmdios);
480 void HAL_MDIOS_ReadCpltCallback(MDIOS_HandleTypeDef *hmdios);
481 void HAL_MDIOS_ErrorCallback(MDIOS_HandleTypeDef *hmdios);
482 void HAL_MDIOS_WakeUpCallback(MDIOS_HandleTypeDef *hmdios);
490 uint32_t HAL_MDIOS_GetError(MDIOS_HandleTypeDef *hmdios);
491 HAL_MDIOS_StateTypeDef HAL_MDIOS_GetState(MDIOS_HandleTypeDef *hmdios);
532 #define IS_MDIOS_PORTADDRESS(__ADDR__) ((__ADDR__) < 32)
534 #define IS_MDIOS_REGISTER(__REGISTER__) ((__REGISTER__) < 32)
536 #define IS_MDIOS_PREAMBLECHECK(__PREAMBLECHECK__) (((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_ENABLE) || \
537 ((__PREAMBLECHECK__) == MDIOS_PREAMBLE_CHECK_DISABLE))