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