mbed libraries for KL25Z
ethernet_api.h@8:c14af7958ef5, 2012-11-09 (annotated)
- Committer:
- emilmont
- Date:
- Fri Nov 09 11:33:53 2012 +0000
- Revision:
- 8:c14af7958ef5
- Child:
- 9:663789d7729f
SPI driver; ADC driver; DAC driver; microlib support; general bugfixing
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
emilmont | 8:c14af7958ef5 | 1 | /* mbed Microcontroller Library - ethernet_api |
emilmont | 8:c14af7958ef5 | 2 | * Copyright (c) 2009-2011 ARM Limited. All rights reserved. |
emilmont | 8:c14af7958ef5 | 3 | */ |
emilmont | 8:c14af7958ef5 | 4 | #ifndef MBED_ETHERNET_API_H |
emilmont | 8:c14af7958ef5 | 5 | #define MBED_ETHERNET_API_H |
emilmont | 8:c14af7958ef5 | 6 | |
emilmont | 8:c14af7958ef5 | 7 | #include "device.h" |
emilmont | 8:c14af7958ef5 | 8 | |
emilmont | 8:c14af7958ef5 | 9 | #if DEVICE_ETHERNET |
emilmont | 8:c14af7958ef5 | 10 | |
emilmont | 8:c14af7958ef5 | 11 | #ifdef __cplusplus |
emilmont | 8:c14af7958ef5 | 12 | extern "C" { |
emilmont | 8:c14af7958ef5 | 13 | #endif |
emilmont | 8:c14af7958ef5 | 14 | |
emilmont | 8:c14af7958ef5 | 15 | // Connection constants |
emilmont | 8:c14af7958ef5 | 16 | |
emilmont | 8:c14af7958ef5 | 17 | int ethernet_init(void); |
emilmont | 8:c14af7958ef5 | 18 | void ethernet_free(void); |
emilmont | 8:c14af7958ef5 | 19 | |
emilmont | 8:c14af7958ef5 | 20 | // write size bytes from data to ethernet buffer |
emilmont | 8:c14af7958ef5 | 21 | // return num bytes written |
emilmont | 8:c14af7958ef5 | 22 | // or -1 if size is too big |
emilmont | 8:c14af7958ef5 | 23 | int ethernet_write(const char *data, int size); |
emilmont | 8:c14af7958ef5 | 24 | |
emilmont | 8:c14af7958ef5 | 25 | // send ethernet write buffer, returning the packet size sent |
emilmont | 8:c14af7958ef5 | 26 | int ethernet_send(void); |
emilmont | 8:c14af7958ef5 | 27 | |
emilmont | 8:c14af7958ef5 | 28 | // recieve from ethernet buffer, returning packet size, or 0 if no packet |
emilmont | 8:c14af7958ef5 | 29 | int ethernet_receive(void); |
emilmont | 8:c14af7958ef5 | 30 | |
emilmont | 8:c14af7958ef5 | 31 | // read size bytes in to data, return actual num bytes read (0..size) |
emilmont | 8:c14af7958ef5 | 32 | // if data == NULL, throw the bytes away |
emilmont | 8:c14af7958ef5 | 33 | int ethernet_read(char *data, int size); |
emilmont | 8:c14af7958ef5 | 34 | |
emilmont | 8:c14af7958ef5 | 35 | // get the ethernet address |
emilmont | 8:c14af7958ef5 | 36 | void ethernet_address(char *mac); |
emilmont | 8:c14af7958ef5 | 37 | |
emilmont | 8:c14af7958ef5 | 38 | // see if the link is up |
emilmont | 8:c14af7958ef5 | 39 | int ethernet_link(void); |
emilmont | 8:c14af7958ef5 | 40 | |
emilmont | 8:c14af7958ef5 | 41 | // force link settings |
emilmont | 8:c14af7958ef5 | 42 | void ethernet_set_link(int speed, int duplex); |
emilmont | 8:c14af7958ef5 | 43 | |
emilmont | 8:c14af7958ef5 | 44 | #ifdef __cplusplus |
emilmont | 8:c14af7958ef5 | 45 | } |
emilmont | 8:c14af7958ef5 | 46 | #endif |
emilmont | 8:c14af7958ef5 | 47 | |
emilmont | 8:c14af7958ef5 | 48 | #endif |
emilmont | 8:c14af7958ef5 | 49 | |
emilmont | 8:c14af7958ef5 | 50 | #endif |
emilmont | 8:c14af7958ef5 | 51 |