ethernet_api.h 1.6 KB

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