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