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