1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 #ifndef MBED_ETHERNET_API_H
17 #define MBED_ETHERNET_API_H
27 // Connection constants
29 int ethernet_init(void);
30 void ethernet_free(void);
32 // write size bytes from data to ethernet buffer
33 // return num bytes written
34 // or -1 if size is too big
35 int ethernet_write(const char *data, int size);
37 // send ethernet write buffer, returning the packet size sent
38 int ethernet_send(void);
40 // recieve from ethernet buffer, returning packet size, or 0 if no packet
41 int ethernet_receive(void);
43 // read size bytes in to data, return actual num bytes read (0..size)
44 // if data == NULL, throw the bytes away
45 int ethernet_read(char *data, int size);
47 // get the ethernet address
48 void ethernet_address(char *mac);
50 // see if the link is up
51 int ethernet_link(void);
53 // force link settings
54 void ethernet_set_link(int speed, int duplex);