forked from renatoaloi/Enc28CoreLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenc28j60.h
84 lines (67 loc) · 2.47 KB
/
enc28j60.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
#include "enc28typedef.h"
#include <stdint.h>
#include <avr/io.h>
#define low(a) (a&0xFF)
#define high(a) ((a>>8)&0xFF)
typedef enum _BOOL { FALSE = 0, TRUE } BOOL;
typedef enum _FLOW { RX = 0, TX } FLOW;
typedef union
{
unsigned int Val;
struct
{
unsigned char LB;
unsigned char HB;
} Byte;
struct
{
unsigned char b0:1;
unsigned char b1:1;
unsigned char b2:1;
unsigned char b3:1;
unsigned char b4:1;
unsigned char b5:1;
unsigned char b6:1;
unsigned char b7:1;
unsigned char b8:1;
unsigned char b9:1;
unsigned char b10:1;
unsigned char b11:1;
unsigned char b12:1;
unsigned char b13:1;
unsigned char b14:1;
unsigned char b15:1;
} Bits;
} WORD_VAL, WORD_BITS;
/******************************************************************************
* APPLICATION LAYER METHOD DECLARATIONS
*****************************************************************************/
void MACInit(void);
void MACOpen(void);
void MACEnableRecv(void);
void MACInitMacAddr(unsigned char *_macadd);
unsigned char MACHardwareRevision(void);
void MACSendSystemReset(void);
unsigned char MACGetPacketCount(void);
void MACReadRXBuffer(unsigned char* _buf, unsigned int _size);
void MACDiscardRx(void);
void MACWriteTXBuffer(unsigned char* _buf, unsigned int _size);
void MACWriteTXBufferOffset(unsigned char* _buf, unsigned int _size, unsigned int offset_len);
void MACSendTx(void);
BOOL IsMACSendTx(void);
/******************************************************************************
* SOCKET APPLICATION LAYER METHOD DECLARATIONS
*****************************************************************************/
void SOCKETReadBuffer(unsigned char* _buf, unsigned int _size, unsigned int _start);
void SOCKETWriteBuffer(unsigned char* _buf, unsigned int _size, unsigned int _start);
unsigned int SOCKETGetRxPointer();
void SOCKETSetRxPointer(unsigned int addr);
unsigned int SOCKETGetTxPointer();
void SOCKETSetTxPointer(unsigned int addr);
/******************************************************************************
* DMA COPY LAYER METHOD DECLARATIONS
*****************************************************************************/
void DMACopyTo(FLOW flow, unsigned int destAddr, unsigned int len);
void DMACopyFrom(FLOW flow, unsigned int sourceAddr, unsigned int len);
BOOL IsDMACopyDone(void);
//