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