Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
hal/ethernet_api.h@2:4364577b5ad8, 2020-11-09 (annotated)
- Committer:
- elijahsj
- Date:
- Mon Nov 09 00:33:19 2020 -0500
- Revision:
- 2:4364577b5ad8
- Parent:
- 1:8a094db1347f
copied mbed library
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| elijahsj | 1:8a094db1347f | 1 | |
| elijahsj | 1:8a094db1347f | 2 | /** \addtogroup hal */ |
| elijahsj | 1:8a094db1347f | 3 | /** @{*/ |
| elijahsj | 1:8a094db1347f | 4 | /* mbed Microcontroller Library |
| elijahsj | 1:8a094db1347f | 5 | * Copyright (c) 2006-2013 ARM Limited |
| elijahsj | 1:8a094db1347f | 6 | * |
| elijahsj | 1:8a094db1347f | 7 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| elijahsj | 1:8a094db1347f | 8 | * you may not use this file except in compliance with the License. |
| elijahsj | 1:8a094db1347f | 9 | * You may obtain a copy of the License at |
| elijahsj | 1:8a094db1347f | 10 | * |
| elijahsj | 1:8a094db1347f | 11 | * http://www.apache.org/licenses/LICENSE-2.0 |
| elijahsj | 1:8a094db1347f | 12 | * |
| elijahsj | 1:8a094db1347f | 13 | * Unless required by applicable law or agreed to in writing, software |
| elijahsj | 1:8a094db1347f | 14 | * distributed under the License is distributed on an "AS IS" BASIS, |
| elijahsj | 1:8a094db1347f | 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| elijahsj | 1:8a094db1347f | 16 | * See the License for the specific language governing permissions and |
| elijahsj | 1:8a094db1347f | 17 | * limitations under the License. |
| elijahsj | 1:8a094db1347f | 18 | */ |
| elijahsj | 1:8a094db1347f | 19 | #ifndef MBED_ETHERNET_API_H |
| elijahsj | 1:8a094db1347f | 20 | #define MBED_ETHERNET_API_H |
| elijahsj | 1:8a094db1347f | 21 | |
| elijahsj | 1:8a094db1347f | 22 | #include "device.h" |
| elijahsj | 1:8a094db1347f | 23 | |
| elijahsj | 1:8a094db1347f | 24 | #if DEVICE_ETHERNET |
| elijahsj | 1:8a094db1347f | 25 | |
| elijahsj | 1:8a094db1347f | 26 | #ifdef __cplusplus |
| elijahsj | 1:8a094db1347f | 27 | extern "C" { |
| elijahsj | 1:8a094db1347f | 28 | #endif |
| elijahsj | 1:8a094db1347f | 29 | |
| elijahsj | 1:8a094db1347f | 30 | // Connection constants |
| elijahsj | 1:8a094db1347f | 31 | |
| elijahsj | 1:8a094db1347f | 32 | int ethernet_init(void); |
| elijahsj | 1:8a094db1347f | 33 | void ethernet_free(void); |
| elijahsj | 1:8a094db1347f | 34 | |
| elijahsj | 1:8a094db1347f | 35 | // write size bytes from data to ethernet buffer |
| elijahsj | 1:8a094db1347f | 36 | // return num bytes written |
| elijahsj | 1:8a094db1347f | 37 | // or -1 if size is too big |
| elijahsj | 1:8a094db1347f | 38 | int ethernet_write(const char *data, int size); |
| elijahsj | 1:8a094db1347f | 39 | |
| elijahsj | 1:8a094db1347f | 40 | // send ethernet write buffer, returning the packet size sent |
| elijahsj | 1:8a094db1347f | 41 | int ethernet_send(void); |
| elijahsj | 1:8a094db1347f | 42 | |
| elijahsj | 1:8a094db1347f | 43 | // recieve from ethernet buffer, returning packet size, or 0 if no packet |
| elijahsj | 1:8a094db1347f | 44 | int ethernet_receive(void); |
| elijahsj | 1:8a094db1347f | 45 | |
| elijahsj | 1:8a094db1347f | 46 | // read size bytes in to data, return actual num bytes read (0..size) |
| elijahsj | 1:8a094db1347f | 47 | // if data == NULL, throw the bytes away |
| elijahsj | 1:8a094db1347f | 48 | int ethernet_read(char *data, int size); |
| elijahsj | 1:8a094db1347f | 49 | |
| elijahsj | 1:8a094db1347f | 50 | // get the ethernet address |
| elijahsj | 1:8a094db1347f | 51 | void ethernet_address(char *mac); |
| elijahsj | 1:8a094db1347f | 52 | |
| elijahsj | 1:8a094db1347f | 53 | // see if the link is up |
| elijahsj | 1:8a094db1347f | 54 | int ethernet_link(void); |
| elijahsj | 1:8a094db1347f | 55 | |
| elijahsj | 1:8a094db1347f | 56 | // force link settings |
| elijahsj | 1:8a094db1347f | 57 | void ethernet_set_link(int speed, int duplex); |
| elijahsj | 1:8a094db1347f | 58 | |
| elijahsj | 1:8a094db1347f | 59 | #ifdef __cplusplus |
| elijahsj | 1:8a094db1347f | 60 | } |
| elijahsj | 1:8a094db1347f | 61 | #endif |
| elijahsj | 1:8a094db1347f | 62 | |
| elijahsj | 1:8a094db1347f | 63 | #endif |
| elijahsj | 1:8a094db1347f | 64 | |
| elijahsj | 1:8a094db1347f | 65 | #endif |
| elijahsj | 1:8a094db1347f | 66 | |
| elijahsj | 1:8a094db1347f | 67 | |
| elijahsj | 1:8a094db1347f | 68 | /** @}*/ |