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