@@ -96,12 +96,16 @@ static uint8_t DHCP_Started_by_user = 0;
96
96
/* Ethernet link status periodic timer */
97
97
static uint32_t gEhtLinkTickStart = 0 ;
98
98
99
+ #if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION <= 0x01060100)
100
+ /* Handler for stimer */
101
+ static stimer_t TimHandle;
102
+ #endif
103
+
99
104
/* ************************** Function prototype *******************************/
100
105
static void Netif_Config (void );
101
106
static err_t tcp_recv_callback (void *arg, struct tcp_pcb *tpcb, struct pbuf *p, err_t err);
102
107
static err_t tcp_sent_callback (void *arg, struct tcp_pcb *tpcb, u16_t len);
103
108
static void tcp_err_callback (void *arg, err_t err);
104
- static void scheduler_callback (HardwareTimer *HT);
105
109
static void TIM_scheduler_Config (void );
106
110
107
111
/* *
@@ -136,15 +140,35 @@ static void Netif_Config(void)
136
140
137
141
/* *
138
142
* @brief Scheduler callback. Call by a timer interrupt.
139
- * @param htim: pointer to HardwareTimer
143
+ * @param htim: pointer to stimer_t or Hardware Timer
140
144
* @retval None
141
145
*/
142
- static void scheduler_callback (HardwareTimer *HT)
146
+ #if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION <= 0x01060100)
147
+ static void scheduler_callback (stimer_t *htim)
148
+ #else
149
+ static void scheduler_callback (HardwareTimer *htim)
150
+ #endif
143
151
{
144
- UNUSED (HT );
152
+ UNUSED (htim );
145
153
stm32_eth_scheduler ();
146
154
}
147
155
156
+ #if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION <= 0x01060100)
157
+ /* *
158
+ * @brief Enable the timer used to call ethernet scheduler function at regular
159
+ * interval.
160
+ * @param None
161
+ * @retval None
162
+ */
163
+ static void TIM_scheduler_Config (void )
164
+ {
165
+ /* Set TIMx instance. */
166
+ TimHandle.timer = DEFAULT_ETHERNET_TIMER;
167
+ /* Timer set to 1ms */
168
+ TimerHandleInit (&TimHandle, (uint16_t )(1000 - 1 ), ((uint32_t )(getTimerClkFreq (DEFAULT_ETHERNET_TIMER) / (1000000 )) - 1 ));
169
+ attachIntHandle (&TimHandle, scheduler_callback);
170
+ }
171
+ #else
148
172
/* *
149
173
* @brief Enable the timer used to call ethernet scheduler function at regular
150
174
* interval.
@@ -162,6 +186,7 @@ static void TIM_scheduler_Config(void)
162
186
EthTim->attachInterrupt (scheduler_callback);
163
187
EthTim->resume ();
164
188
}
189
+ #endif
165
190
166
191
void stm32_eth_init (const uint8_t *mac, const uint8_t *ip, const uint8_t *gw, const uint8_t *netmask)
167
192
{
0 commit comments