37 #include "contiki-net.h"
40 #include "lib/error.h"
41 #include "net/ethernet-drv.h"
43 #include "net/ethernet.h"
51 char __fastcall__ (* init)(uint16_t reg);
53 uint16_t (* poll)(void);
55 void __fastcall__ (* send)(uint16_t len);
62 ethernet_init(
struct ethernet_config *config)
64 static const char signature[4] = {0x65, 0x74, 0x68, 0x01};
68 struct mod_ctrl module_control = {cfs_read};
72 if(module_control.callerdata < 0) {
73 log_message(config->name,
": File not found");
77 byte = mod_load(&module_control);
78 if(byte != MLOAD_OK) {
79 log_message(config->name, byte == MLOAD_ERR_MEM?
": Out of memory":
85 module = module_control.module;
87 for(byte = 0; byte < 4; ++byte) {
88 if(module->signature[byte] != signature[byte]) {
89 log_message(config->name,
": No ETH driver");
102 module->buffer = uip_buf;
104 if(module->init(config->addr)) {
105 log_message(config->name,
": No hardware");
115 return module->poll();
uip_len
The length of the packet in the uip_buf buffer.
#define uip_setethaddr(eaddr)
Specifiy the Ethernet MAC address.
int cfs_open(const char *name, int flags)
Open a file.
#define CFS_READ
Specify that cfs_open() should open a file for reading.
#define UIP_BUFSIZE
The size of the uIP packet buffer.
#define CC_FASTCALL
Configure if the C compiler supports fastcall function declarations.
void cfs_close(int fd)
Close an open file.