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