IOTIO
Dependencies: Nucleo_BLE_API_IOTIO Nucleo_BLE_BlueNRG Nucleo_BLE_DemoApp Nucleo_Sensor_Shield mbed
Dependents: Nucleo_BLE_Demo_IOTIO
Fork of Nucleo_BLE_Demo by
mbed/ethernet_api.h@1:4bdfa7d7e8bf, 2016-10-29 (annotated)
- Committer:
- 16038618
- Date:
- Sat Oct 29 15:11:28 2016 +0000
- Revision:
- 1:4bdfa7d7e8bf
IOTIO
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
16038618 | 1:4bdfa7d7e8bf | 1 | /* mbed Microcontroller Library |
16038618 | 1:4bdfa7d7e8bf | 2 | * Copyright (c) 2006-2013 ARM Limited |
16038618 | 1:4bdfa7d7e8bf | 3 | * |
16038618 | 1:4bdfa7d7e8bf | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
16038618 | 1:4bdfa7d7e8bf | 5 | * you may not use this file except in compliance with the License. |
16038618 | 1:4bdfa7d7e8bf | 6 | * You may obtain a copy of the License at |
16038618 | 1:4bdfa7d7e8bf | 7 | * |
16038618 | 1:4bdfa7d7e8bf | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
16038618 | 1:4bdfa7d7e8bf | 9 | * |
16038618 | 1:4bdfa7d7e8bf | 10 | * Unless required by applicable law or agreed to in writing, software |
16038618 | 1:4bdfa7d7e8bf | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
16038618 | 1:4bdfa7d7e8bf | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
16038618 | 1:4bdfa7d7e8bf | 13 | * See the License for the specific language governing permissions and |
16038618 | 1:4bdfa7d7e8bf | 14 | * limitations under the License. |
16038618 | 1:4bdfa7d7e8bf | 15 | */ |
16038618 | 1:4bdfa7d7e8bf | 16 | #ifndef MBED_ETHERNET_API_H |
16038618 | 1:4bdfa7d7e8bf | 17 | #define MBED_ETHERNET_API_H |
16038618 | 1:4bdfa7d7e8bf | 18 | |
16038618 | 1:4bdfa7d7e8bf | 19 | #include "device.h" |
16038618 | 1:4bdfa7d7e8bf | 20 | |
16038618 | 1:4bdfa7d7e8bf | 21 | #if DEVICE_ETHERNET |
16038618 | 1:4bdfa7d7e8bf | 22 | |
16038618 | 1:4bdfa7d7e8bf | 23 | #ifdef __cplusplus |
16038618 | 1:4bdfa7d7e8bf | 24 | extern "C" { |
16038618 | 1:4bdfa7d7e8bf | 25 | #endif |
16038618 | 1:4bdfa7d7e8bf | 26 | |
16038618 | 1:4bdfa7d7e8bf | 27 | // Connection constants |
16038618 | 1:4bdfa7d7e8bf | 28 | |
16038618 | 1:4bdfa7d7e8bf | 29 | int ethernet_init(void); |
16038618 | 1:4bdfa7d7e8bf | 30 | void ethernet_free(void); |
16038618 | 1:4bdfa7d7e8bf | 31 | |
16038618 | 1:4bdfa7d7e8bf | 32 | // write size bytes from data to ethernet buffer |
16038618 | 1:4bdfa7d7e8bf | 33 | // return num bytes written |
16038618 | 1:4bdfa7d7e8bf | 34 | // or -1 if size is too big |
16038618 | 1:4bdfa7d7e8bf | 35 | int ethernet_write(const char *data, int size); |
16038618 | 1:4bdfa7d7e8bf | 36 | |
16038618 | 1:4bdfa7d7e8bf | 37 | // send ethernet write buffer, returning the packet size sent |
16038618 | 1:4bdfa7d7e8bf | 38 | int ethernet_send(void); |
16038618 | 1:4bdfa7d7e8bf | 39 | |
16038618 | 1:4bdfa7d7e8bf | 40 | // recieve from ethernet buffer, returning packet size, or 0 if no packet |
16038618 | 1:4bdfa7d7e8bf | 41 | int ethernet_receive(void); |
16038618 | 1:4bdfa7d7e8bf | 42 | |
16038618 | 1:4bdfa7d7e8bf | 43 | // read size bytes in to data, return actual num bytes read (0..size) |
16038618 | 1:4bdfa7d7e8bf | 44 | // if data == NULL, throw the bytes away |
16038618 | 1:4bdfa7d7e8bf | 45 | int ethernet_read(char *data, int size); |
16038618 | 1:4bdfa7d7e8bf | 46 | |
16038618 | 1:4bdfa7d7e8bf | 47 | // get the ethernet address |
16038618 | 1:4bdfa7d7e8bf | 48 | void ethernet_address(char *mac); |
16038618 | 1:4bdfa7d7e8bf | 49 | |
16038618 | 1:4bdfa7d7e8bf | 50 | // see if the link is up |
16038618 | 1:4bdfa7d7e8bf | 51 | int ethernet_link(void); |
16038618 | 1:4bdfa7d7e8bf | 52 | |
16038618 | 1:4bdfa7d7e8bf | 53 | // force link settings |
16038618 | 1:4bdfa7d7e8bf | 54 | void ethernet_set_link(int speed, int duplex); |
16038618 | 1:4bdfa7d7e8bf | 55 | |
16038618 | 1:4bdfa7d7e8bf | 56 | #ifdef __cplusplus |
16038618 | 1:4bdfa7d7e8bf | 57 | } |
16038618 | 1:4bdfa7d7e8bf | 58 | #endif |
16038618 | 1:4bdfa7d7e8bf | 59 | |
16038618 | 1:4bdfa7d7e8bf | 60 | #endif |
16038618 | 1:4bdfa7d7e8bf | 61 | |
16038618 | 1:4bdfa7d7e8bf | 62 | #endif |
16038618 | 1:4bdfa7d7e8bf | 63 |