Mercurial > templog
annotate network/network.h @ 107:56d09a0969b5 avr-http
Import uIP and the PPP implementation from
https://code.google.com/p/avrusbmodem/
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 07 Sep 2012 23:53:53 +0800 |
parents | |
children |
rev | line source |
---|---|
107
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
1 /* |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
2 * Simple common network interface that all network drivers should implement. |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
3 */ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
4 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
5 #ifndef __NETWORK_H__ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
6 #define __NETWORK_H__ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
7 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
8 #include <avr/io.h> |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
9 #include <util/delay.h> |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
10 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
11 #include <uIP-Contiki/uip.h> |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
12 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
13 #include "USBModem.h" |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
14 #include "Lib/RingBuff.h" |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
15 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
16 /* External Variables: */ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
17 extern RingBuff_t Modem_SendBuffer; |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
18 extern RingBuff_t Modem_ReceiveBuffer; |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
19 extern bool DebugModeEnabled; |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
20 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
21 /* Enums: */ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
22 enum Packet_States_t |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
23 { |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
24 PACKET_STATE_NULL = 0, |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
25 PACKET_STATE_INHEADER = 1, |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
26 PACKET_STATE_INBODY = 2, |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
27 }; |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
28 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
29 /* Function Prototypes: */ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
30 void network_init(void); |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
31 uint16_t network_read(void); |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
32 void network_send(uint16_t protocol); |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
33 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
34 #if defined(INCLUDE_FROM_NETWORK_C) |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
35 static void DumpPacket(void); |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
36 #endif |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
37 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
38 /*Sets the MAC address of the device*/ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
39 //void network_set_MAC(uint8_t* mac); |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
40 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
41 /*Gets the MAC address of the device*/ |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
42 //void network_get_MAC(uint8_t* mac); |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
43 |
56d09a0969b5
Import uIP and the PPP implementation from
Matt Johnston <matt@ucc.asn.au>
parents:
diff
changeset
|
44 #endif /* __NETWORK_H__ */ |