-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy patheth_worker.h
78 lines (65 loc) · 1.95 KB
/
eth_worker.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#pragma once
#include <stdint.h>
typedef struct EthWorker EthWorker;
typedef struct EthViewProcess EthViewProcess;
typedef enum {
EthWorkerStateNotAllocated = 0,
EthWorkerStateNotInited,
EthWorkerStateDefaultNext,
EthWorkerStateInited,
EthWorkerStateInit,
EthWorkerStateModulePowerOn,
EthWorkerStateModuleConnect,
EthWorkerStateMACInit,
EthWorkerStateStaticIp,
EthWorkerStateDHCP,
EthWorkerStateOnline,
EthWorkerStatePing,
EthWorkerStateStop,
EthWorkerStateReset,
} EthWorkerState;
typedef enum {
EthWorkerProcessInit,
EthWorkerProcessDHCP,
EthWorkerProcessStatic,
EthWorkerProcessPing,
EthWorkerProcessReset,
EthWorkerProcessActive,
EthWorkerProcessExit,
} EthWorkerProcess;
typedef enum {
EthWorkerSubstateInProcess = 0,
EthWorkerSubStateSuccess,
EthWorkerSubStateError,
} EthWorkerSubState;
typedef enum {
EthCustomEventUpdate = 0,
EthCustomEventModuleInit,
EthCustomEventModuleError,
EthCustomEventModulePowerOn,
EthCustomEventModuleConnect,
EthCustomEventMACInit,
EthCustomEventStaticIp,
EthCustomEventDHCP,
EthCustomEventPing,
EthCustomEventTCP2UART,
EthCustomEventTCP2CLI,
EthCustomEventSaved,
} EthCustomEvent;
typedef void (*EthWorkerCallback)(EthCustomEvent event, void* context);
EthWorker* eth_worker_alloc();
EthWorkerState eth_worker_get_state(EthWorker* eth_worker);
void eth_worker_set_active_process(EthWorker* eth_worker, EthWorkerProcess state);
void eth_worker_free(EthWorker* eth_worker);
void eth_worker_start(
EthWorker* eth_worker,
EthWorkerState state,
EthWorkerCallback callback,
void* context);
void eth_worker_stop(EthWorker* eth_worker);
void eth_worker_dhcp(EthWorker* eth_worker);
void eth_worker_w5500(EthWorker* eth_worker);
void eth_worker_init_process(EthWorker* eth_worker);
#define PING_SOCKET 1
uint8_t ping_auto_interface(uint8_t* adress);
void dhcp_timer_callback(void* context);