source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/SERVICES/LWIP/lwip-1.3.2/src/include/lwip/sio.h @ 4837

Last change on this file since 4837 was 4837, checked in by daduve, 2 years ago

Adding new version

File size: 4.2 KB
Line 
1/* This header file is part of the ATMEL AVR-UC3-SoftwareFramework-1.7.0 Release */
2
3/*
4 * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without modification,
8 * are permitted provided that the following conditions are met:
9 *
10 * 1. Redistributions of source code must retain the above copyright notice,
11 *    this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 *    this list of conditions and the following disclaimer in the documentation
14 *    and/or other materials provided with the distribution.
15 * 3. The name of the author may not be used to endorse or promote products
16 *    derived from this software without specific prior written permission.
17 *
18 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
21 * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
23 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
26 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
27 * OF SUCH DAMAGE.
28 *
29 * This file is part of the lwIP TCP/IP stack.
30 */
31
32/*
33 * This is the interface to the platform specific serial IO module
34 * It needs to be implemented by those platforms which need SLIP or PPP
35 */
36
37#ifndef __SIO_H__
38#define __SIO_H__
39
40#include "lwip/arch.h"
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/* If you want to define sio_fd_t elsewhere or differently,
47   define this in your cc.h file. */
48#ifndef __sio_fd_t_defined
49typedef void * sio_fd_t;
50#endif
51
52/* The following functions can be defined to something else in your cc.h file
53   or be implemented in your custom sio.c file. */
54
55#ifndef sio_open
56/**
57 * Opens a serial device for communication.
58 *
59 * @param devnum device number
60 * @return handle to serial device if successful, NULL otherwise
61 */
62sio_fd_t sio_open(u8_t devnum);
63#endif
64
65#ifndef sio_send
66/**
67 * Sends a single character to the serial device.
68 *
69 * @param c character to send
70 * @param fd serial device handle
71 *
72 * @note This function will block until the character can be sent.
73 */
74void sio_send(u8_t c, sio_fd_t fd);
75#endif
76
77#ifndef sio_recv
78/**
79 * Receives a single character from the serial device.
80 *
81 * @param fd serial device handle
82 *
83 * @note This function will block until a character is received.
84 */
85u8_t sio_recv(sio_fd_t fd);
86#endif
87
88#ifndef sio_read
89/**
90 * Reads from the serial device.
91 *
92 * @param fd serial device handle
93 * @param data pointer to data buffer for receiving
94 * @param len maximum length (in bytes) of data to receive
95 * @return number of bytes actually received - may be 0 if aborted by sio_read_abort
96 *
97 * @note This function will block until data can be received. The blocking
98 * can be cancelled by calling sio_read_abort().
99 */
100u32_t sio_read(sio_fd_t fd, u8_t *data, u32_t len);
101#endif
102
103#ifndef sio_tryread
104/**
105 * Tries to read from the serial device. Same as sio_read but returns
106 * immediately if no data is available and never blocks.
107 *
108 * @param fd serial device handle
109 * @param data pointer to data buffer for receiving
110 * @param len maximum length (in bytes) of data to receive
111 * @return number of bytes actually received
112 */
113u32_t sio_tryread(sio_fd_t fd, u8_t *data, u32_t len);
114#endif
115
116#ifndef sio_write
117/**
118 * Writes to the serial device.
119 *
120 * @param fd serial device handle
121 * @param data pointer to data to send
122 * @param len length (in bytes) of data to send
123 * @return number of bytes actually sent
124 *
125 * @note This function will block until all data can be sent.
126 */
127u32_t sio_write(sio_fd_t fd, u8_t *data, u32_t len);
128#endif
129
130#ifndef sio_read_abort
131/**
132 * Aborts a blocking sio_read() call.
133 *
134 * @param fd serial device handle
135 */
136void sio_read_abort(sio_fd_t fd);
137#endif
138
139#ifdef __cplusplus
140}
141#endif
142
143#endif /* __SIO_H__ */
Note: See TracBrowser for help on using the repository browser.