HPM APP
HPMicro Application solution
common.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2022-2024 HPMicro
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  *
6  */
7 
8 #ifndef COMMON_LWIP_H
9 #define COMMON_LWIP_H
10 
11 /* Includes ------------------------------------------------------------------*/
12 #include <stdbool.h>
13 #include "common_cfg.h"
14 #include "lwip/netif.h"
15 #include "hpm_enet_phy_common.h"
16 
17 #if defined(NO_SYS) && !NO_SYS
18 #if defined(__ENABLE_FREERTOS) && __ENABLE_FREERTOS
19 #include "FreeRTOS.h"
20 #include "task.h"
21 #include "semphr.h"
22 #include "queue.h"
23 #include "timers.h"
24 #else
25 #include "osal.h"
26 #endif
27 #endif /* defined(NO_SYS) && !NO_SYS */
28 
29 /* Exported Macros------------------------------------------------------------*/
30 typedef enum {
36 
37 #define IS_UUID_INVALID(UUID) (UUID[0] == 0 && \
38  UUID[1] == 0 && \
39  UUID[2] == 0 && \
40  UUID[3] == 0)
41 
42 #define IS_MAC_INVALID(MAC) (MAC[0] == 0 && \
43  MAC[1] == 0 && \
44  MAC[2] == 0 && \
45  MAC[3] == 0 && \
46  MAC[4] == 0 && \
47  MAC[5] == 0)
48 
49 #ifndef LWIP_APP_TIMER_INTERVAL
50 #define LWIP_APP_TIMER_INTERVAL (2 * 1000U) /* 2 * 1000 ms */
51 #endif /* LWIP_APP_TIMER_INTERVAL */
52 
53 #define LWIP_NETIF_IDX (1)
54 
55 #if defined __cplusplus
56 extern "C" {
57 #endif /* __cplusplus */
58 
59 uint8_t enet_get_mac_address(uint8_t *mac);
60 bool enet_get_link_status(void);
62 void enet_services(struct netif *netif);
63 void enet_common_handler(struct netif *netif);
64 
65 #if defined(LWIP_DHCP) && LWIP_DHCP
66 void enet_update_dhcp_state(struct netif *netif);
68 #endif
69 
70 #if defined(NO_SYS) && !NO_SYS
71 #if defined(__ENABLE_FREERTOS) && __ENABLE_FREERTOS
72 void timer_callback(TimerHandle_t xTimer);
73 #elif defined(__ENABLE_RTTHREAD_NANO) && __ENABLE_RTTHREAD_NANO
74 void timer_callback(void *parameter);
75 #endif
76 
77 #else
78 void sys_timer_callback(void);
79 #endif /* defined(NO_SYS) && !NO_SYS */
80 
81 #if defined __cplusplus
82 }
83 #endif /* __cplusplus */
84 
85 #endif /* COMMON_LWIP_H */
uint8_t mac[ENET_MAC_SIZE]
Definition: monitor.c:41
void enet_services(struct netif *netif)
Definition: common.c:205
void enet_common_handler(struct netif *netif)
enet_mac_addr_t
Definition: common.h:30
@ ENET_MAC_ADDR_PARA_ERROR
Definition: common.h:31
@ ENET_MAC_ADDR_FROM_MACRO
Definition: common.h:34
@ ENET_MAC_ADDR_FROM_OTP_UUID
Definition: common.h:33
@ ENET_MAC_ADDR_FROM_OTP_MAC
Definition: common.h:32
uint8_t enet_get_mac_address(uint8_t i, uint8_t *mac)
Definition: common.c:107
void sys_timer_callback(void)
Definition: sys_arch.c:637
bool enet_get_link_status(uint8_t i)
Definition: common.c:156
void enet_self_adaptive_port_speed(void)
Definition: common.c:161
bool enet_get_dhcp_ready_status(void)
Definition: common.c:157