-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdevice.h
147 lines (123 loc) · 3.74 KB
/
device.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
#ifndef DEVICE_H_
#define DEVICE_H_
#define ONE_CHANNEL
#define SIMULATION_MODE
#define DEBUGPRINT
#include "inc/hw_types.h"
#include "utils/arp.h"
//*****************************************************************************
//
//! \defgroup sniffer_api Sniffer
//! @{
//
//*****************************************************************************
//*****************************************************************************
#define FPGA_FW_VERSION "612v01"
#define MCU_FW_VERSION "602v02"
#define BUILD_DATE "2013-Feb-22"
//#define CPU_XTAL 8000000
//---------------------------------------------------------------
// LED status
#define LED_PORT_BASE GPIO_PORTF_BASE
#define LED_PERIPHERAL SYSCTL_PERIPH_GPIOF
#define LED_GREEN GPIO_PIN_0
//---------------------------------------------------------------
// Reset button
#define BUTTON_PERIPHERAL SYSCTL_PERIPH_GPIOF
#define BUTTON_IO GPIO_PORTF_BASE, GPIO_PIN_1
//---------------------------------------------------------------
// system flags
#define SYSFLAG_TIM0INT 0x01
#define SYSFLAG_PINSTAT 0X02
//*****************************************************************************
//! \name SoftEEPROM Constants
// Defines for the SoftEEPROM area.
//@{
//*****************************************************************************
#define SOFTEEPROM_START 0x30000 //!< Start of SoftEEPROM location in flash
#define SOFTEEPROM_END 0x3F000 //!< End of SoftEEPROM location in flash
#define SOFTEEPROM_SIZE 0x1000
//#define SOFTEEPROM_START 0x00020000
//#define SOFTEEPROM_END 0x00021000
//#define SOFTEEPROM_SIZE 0x00000800
//#define SOFTEEPROM_END 0x0003FFFF //!< End of SoftEEPROM location in flash
#ifdef ONE_CHANNEL
#define CHANNELS 1
#else
#define CHANNELS 8
#endif
#define MAC_LIST_SZIZE 5
//*****************************************************************************
/**
* controlReg
* CNMF | CEF | RESET | ENABLE | BAUD | BAUD | BAUD | BAUD
*
* - CNMF - clear new message flag
* - CEF - clear error
* - RESET - reset channel
* - ENABLE - chennel enabled
* - BAUD:
* 0000 - 50 baud/s
* 0001 - 75 baud/s
* ....
* 1101 - 5760 baud/s
* >=1110 - 115200 baud/s
*
*
* frameSelReg
* DATAWIDTH(2) | STOPBIT(2) | PAR_SEL | PAR_ENABLE
*
* 00 - 5 bitu
* 01 - 6 bitu
* 10 - 7 bitu
* 11 - 8 bitu
*
* 00,01 - 1 stop bit
* 10 - 1,5 stop bitu
* 11 - 2 stop bity
*
* 1 - even parity
* 0 - odd
*
*/
typedef struct channelSettings
{
char controlReg;
char frameSelReg;
char adapterStatusReg;
} tChannelSettings;
typedef struct macList
{
struct eth_addr macaddr;
} tMacList;
typedef struct deviceSettings
{
unsigned char ipaddr[4];
unsigned short port;
unsigned char nmask[4];
unsigned char gw[4];
unsigned char macaddr[8];
char pr; //protocol : 0 - TCP, 1 - UDP
unsigned char reipaddr[4];
unsigned short report;
tChannelSettings channelSettings[CHANNELS];
tMacList macFilter[MAC_LIST_SZIZE];
char macFilterListLen;
char mfEnabled;
char dhcpOn;
short setIpConfig;
short device_id;
short serial_number;
} tDeviceSettings;
//*****************************************************************************
//
// Close the Doxygen group.
//! @}
//
//*****************************************************************************
extern unsigned long get_time(void);
extern void DebugMsg(const char *str, ...);
extern void ledgreen_pinset(int val);
extern int Settings_Write(tDeviceSettings *sett);
//*****************************************************************************
#endif /*DEVICE_H_*/