1 /* mbed Microcontroller Library
2 * Copyright (c) 2006-2013 ARM Limited
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
20 #include "ethernet_api.h"
24 Ethernet::Ethernet() {
28 Ethernet::~Ethernet() {
32 int Ethernet::write(const char *data, int size) {
33 return ethernet_write(data, size);
36 int Ethernet::send() {
37 return ethernet_send();
40 int Ethernet::receive() {
41 return ethernet_receive();
44 int Ethernet::read(char *data, int size) {
45 return ethernet_read(data, size);
48 void Ethernet::address(char *mac) {
49 return ethernet_address(mac);
52 int Ethernet::link() {
53 return ethernet_link();
56 void Ethernet::set_link(Mode mode) {
61 case AutoNegotiate : speed = -1; duplex = 0; break;
62 case HalfDuplex10 : speed = 0; duplex = 0; break;
63 case FullDuplex10 : speed = 0; duplex = 1; break;
64 case HalfDuplex100 : speed = 1; duplex = 0; break;
65 case FullDuplex100 : speed = 1; duplex = 1; break;
68 ethernet_set_link(speed, duplex);