mbed library sources. Supersedes mbed-src.

Dependents:   Nucleo_Hello_Encoder BLE_iBeaconScan AM1805_DEMO DISCO-F429ZI_ExportTemplate1 ... more

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers ethernet_api.h Source File

ethernet_api.h

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