Skip to content

Commit 8155ff2

Browse files
authored
Merge pull request #48 from ABOSTM/HARDWARETIMER_REMOVE_OUTPUT_COMPARE
HardwareTimer: remove usage of TIMER_OUTPUT_COMPARE mode
2 parents 7907e31 + ea18d12 commit 8155ff2

File tree

5 files changed

+57
-58
lines changed

5 files changed

+57
-58
lines changed

src/lwipopts.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99

1010
/* LwIP specific configuration options. */
1111
#if __has_include("STM32lwipopts.h")
12-
#include "STM32lwipopts.h"
12+
#include "STM32lwipopts.h"
1313
#else
14-
#if __has_include("lwipopts_extra.h")
15-
#include "lwipopts_extra.h"
16-
#endif
17-
#include "lwipopts_default.h"
14+
#if __has_include("lwipopts_extra.h")
15+
#include "lwipopts_extra.h"
16+
#endif
17+
#include "lwipopts_default.h"
1818
#endif
1919

2020
#endif /* _ARDUINO_LWIPOPTS_H */

src/lwipopts_default.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -151,35 +151,35 @@ The STM32F4x7 allows computing and verifying the IP, UDP, TCP and ICMP checksums
151151

152152

153153
#ifdef CHECKSUM_BY_HARDWARE
154-
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
155-
#define CHECKSUM_GEN_IP 0
156-
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
157-
#define CHECKSUM_GEN_UDP 0
158-
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
159-
#define CHECKSUM_GEN_TCP 0
160-
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
161-
#define CHECKSUM_CHECK_IP 0
162-
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
163-
#define CHECKSUM_CHECK_UDP 0
164-
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
165-
#define CHECKSUM_CHECK_TCP 0
166-
/* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
167-
#define CHECKSUM_GEN_ICMP 0
154+
/* CHECKSUM_GEN_IP==0: Generate checksums by hardware for outgoing IP packets.*/
155+
#define CHECKSUM_GEN_IP 0
156+
/* CHECKSUM_GEN_UDP==0: Generate checksums by hardware for outgoing UDP packets.*/
157+
#define CHECKSUM_GEN_UDP 0
158+
/* CHECKSUM_GEN_TCP==0: Generate checksums by hardware for outgoing TCP packets.*/
159+
#define CHECKSUM_GEN_TCP 0
160+
/* CHECKSUM_CHECK_IP==0: Check checksums by hardware for incoming IP packets.*/
161+
#define CHECKSUM_CHECK_IP 0
162+
/* CHECKSUM_CHECK_UDP==0: Check checksums by hardware for incoming UDP packets.*/
163+
#define CHECKSUM_CHECK_UDP 0
164+
/* CHECKSUM_CHECK_TCP==0: Check checksums by hardware for incoming TCP packets.*/
165+
#define CHECKSUM_CHECK_TCP 0
166+
/* CHECKSUM_CHECK_ICMP==0: Check checksums by hardware for incoming ICMP packets.*/
167+
#define CHECKSUM_GEN_ICMP 0
168168
#else
169-
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
170-
#define CHECKSUM_GEN_IP 1
171-
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
172-
#define CHECKSUM_GEN_UDP 1
173-
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
174-
#define CHECKSUM_GEN_TCP 1
175-
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
176-
#define CHECKSUM_CHECK_IP 1
177-
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
178-
#define CHECKSUM_CHECK_UDP 1
179-
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
180-
#define CHECKSUM_CHECK_TCP 1
181-
/* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
182-
#define CHECKSUM_GEN_ICMP 1
169+
/* CHECKSUM_GEN_IP==1: Generate checksums in software for outgoing IP packets.*/
170+
#define CHECKSUM_GEN_IP 1
171+
/* CHECKSUM_GEN_UDP==1: Generate checksums in software for outgoing UDP packets.*/
172+
#define CHECKSUM_GEN_UDP 1
173+
/* CHECKSUM_GEN_TCP==1: Generate checksums in software for outgoing TCP packets.*/
174+
#define CHECKSUM_GEN_TCP 1
175+
/* CHECKSUM_CHECK_IP==1: Check checksums in software for incoming IP packets.*/
176+
#define CHECKSUM_CHECK_IP 1
177+
/* CHECKSUM_CHECK_UDP==1: Check checksums in software for incoming UDP packets.*/
178+
#define CHECKSUM_CHECK_UDP 1
179+
/* CHECKSUM_CHECK_TCP==1: Check checksums in software for incoming TCP packets.*/
180+
#define CHECKSUM_CHECK_TCP 1
181+
/* CHECKSUM_CHECK_ICMP==1: Check checksums by hardware for incoming ICMP packets.*/
182+
#define CHECKSUM_GEN_ICMP 1
183183
#endif
184184

185185

src/utility/ethernetif.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
#include "lwip/igmp.h"
5555
#include "stm32_eth.h"
5656
#if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION <= 0x01050000)
57-
#include "variant.h"
57+
#include "variant.h"
5858
#endif
5959

6060
#ifdef __cplusplus

src/utility/stm32_eth.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@
6363
* They could be used for this library when available
6464
*/
6565
#ifndef DEFAULT_ETHERNET_TIMER
66-
#define DEFAULT_ETHERNET_TIMER TIM14
67-
#warning "Default timer used to call ethernet scheduler at regular interval: TIM14"
66+
#define DEFAULT_ETHERNET_TIMER TIM14
67+
#warning "Default timer used to call ethernet scheduler at regular interval: TIM14"
6868
#endif
6969

7070
/* Ethernet configuration: user parameters */
@@ -93,8 +93,8 @@ static uint8_t DHCP_Started_by_user = 0;
9393
static uint32_t gEhtLinkTickStart = 0;
9494

9595
#if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION <= 0x01060100)
96-
/* Handler for stimer */
97-
static stimer_t TimHandle;
96+
/* Handler for stimer */
97+
static stimer_t TimHandle;
9898
#endif
9999

100100
/*************************** Function prototype *******************************/
@@ -137,11 +137,11 @@ static void Netif_Config(void)
137137
* @retval None
138138
*/
139139
#if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION <= 0x01060100)
140-
static void scheduler_callback(stimer_t *htim)
140+
static void scheduler_callback(stimer_t *htim)
141141
#elif (STM32_CORE_VERSION <= 0x01080000)
142-
static void scheduler_callback(HardwareTimer *htim)
142+
static void scheduler_callback(HardwareTimer *htim)
143143
#else
144-
static void scheduler_callback(void)
144+
static void scheduler_callback(void)
145145
#endif
146146
{
147147
#if (STM32_CORE_VERSION <= 0x01080000)
@@ -176,7 +176,6 @@ static void TIM_scheduler_Config(void)
176176
{
177177
/* Configure HardwareTimer */
178178
HardwareTimer *EthTim = new HardwareTimer(DEFAULT_ETHERNET_TIMER);
179-
EthTim->setMode(1, TIMER_OUTPUT_COMPARE);
180179

181180
/* Timer set to 1ms */
182181
EthTim->setOverflow(1000, MICROSEC_FORMAT);

src/utility/stm32_eth.h

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct tcp_struct {
112112
#define MAX_CLIENT 32
113113

114114
#ifdef ETH_INPUT_USE_IT
115-
extern struct netif gnetif;
115+
extern struct netif gnetif;
116116
#endif
117117

118118

@@ -125,22 +125,22 @@ void stm32_eth_scheduler(void);
125125
void User_notification(struct netif *netif);
126126

127127
#if LWIP_DHCP
128-
void stm32_DHCP_Process(struct netif *netif);
129-
void stm32_DHCP_Periodic_Handle(struct netif *netif);
130-
void stm32_DHCP_manual_config(void);
131-
uint8_t stm32_get_DHCP_lease_state(void);
132-
void stm32_set_DHCP_state(uint8_t state);
133-
uint8_t stm32_get_DHCP_state(void);
134-
uint8_t stm32_dhcp_started(void);
128+
void stm32_DHCP_Process(struct netif *netif);
129+
void stm32_DHCP_Periodic_Handle(struct netif *netif);
130+
void stm32_DHCP_manual_config(void);
131+
uint8_t stm32_get_DHCP_lease_state(void);
132+
void stm32_set_DHCP_state(uint8_t state);
133+
uint8_t stm32_get_DHCP_state(void);
134+
uint8_t stm32_dhcp_started(void);
135135
#else
136-
#error "LWIP_DHCP must be enabled in lwipopts.h"
136+
#error "LWIP_DHCP must be enabled in lwipopts.h"
137137
#endif
138138

139139
#if LWIP_DNS
140-
void stm32_dns_init(const uint8_t *dnsaddr);
141-
int8_t stm32_dns_gethostbyname(const char *hostname, uint32_t *ipaddr);
140+
void stm32_dns_init(const uint8_t *dnsaddr);
141+
int8_t stm32_dns_gethostbyname(const char *hostname, uint32_t *ipaddr);
142142
#else
143-
#error "LWIP_DNS must be enabled in lwipopts.h"
143+
#error "LWIP_DNS must be enabled in lwipopts.h"
144144
#endif
145145

146146
#if LWIP_UDP
@@ -164,11 +164,11 @@ ip_addr_t *u8_to_ip_addr(uint8_t *ipu8, ip_addr_t *ipaddr);
164164
uint32_t ip_addr_to_u32(ip_addr_t *ipaddr);
165165

166166
#if LWIP_TCP
167-
err_t tcp_connected_callback(void *arg, struct tcp_pcb *tpcb, err_t err);
168-
err_t tcp_accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err);
169-
void tcp_connection_close(struct tcp_pcb *tpcb, struct tcp_struct *tcp);
167+
err_t tcp_connected_callback(void *arg, struct tcp_pcb *tpcb, err_t err);
168+
err_t tcp_accept_callback(void *arg, struct tcp_pcb *newpcb, err_t err);
169+
void tcp_connection_close(struct tcp_pcb *tpcb, struct tcp_struct *tcp);
170170
#else
171-
#error "LWIP_TCP must be enabled in lwipopts.h"
171+
#error "LWIP_TCP must be enabled in lwipopts.h"
172172
#endif
173173

174174
#endif /* __STM32_ETH_H__ */

0 commit comments

Comments
 (0)