SHIO

Fork of mbed-stm32l0/l1-src by lzbp li

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ethernet_api.h Source File

ethernet_api.h

00001 /* mbed Microcontroller Library
00002  * Copyright (c) 2006-2013 ARM Limited
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #ifndef MBED_ETHERNET_API_H
00017 #define MBED_ETHERNET_API_H
00018 
00019 #include "device.h"
00020 
00021 #if DEVICE_ETHERNET
00022 
00023 #ifdef __cplusplus
00024 extern "C" {
00025 #endif
00026 
00027 // Connection constants
00028 
00029 int ethernet_init(void);
00030 void ethernet_free(void);
00031 
00032 // write size bytes from data to ethernet buffer
00033 // return num bytes written
00034 // or -1 if size is too big
00035 int ethernet_write(const char *data, int size);
00036 
00037 // send ethernet write buffer, returning the packet size sent
00038 int ethernet_send(void);
00039 
00040 // recieve from ethernet buffer, returning packet size, or 0 if no packet
00041 int ethernet_receive(void);
00042 
00043 // read size bytes in to data, return actual num bytes read (0..size)
00044 // if data == NULL, throw the bytes away
00045 int ethernet_read(char *data, int size);
00046 
00047 // get the ethernet address
00048 void ethernet_address(char *mac);
00049 
00050 // see if the link is up
00051 int ethernet_link(void);
00052 
00053 // force link settings
00054 void ethernet_set_link(int speed, int duplex);
00055 
00056 #ifdef __cplusplus
00057 }
00058 #endif
00059 
00060 #endif
00061 
00062 #endif
00063