source: arduino-1-6-7/trunk/fuentes/arduino-ide-amd64/hardware/arduino/avr/firmwares/wifishield/wifiHD/src/SOFTWARE_FRAMEWORK/COMPONENTS/WIFI/HD/wl_sdio.h @ 4837

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

Adding new version

File size: 5.2 KB
Line 
1/*!
2 *  \file wl_sdio.h
3 *  \brief SDIO interface for wl_api.
4 *  Copyright (C) 2010 HD Wireless AB
5 *
6 *  You should have received a copy of the license along with this library.
7 */
8
9#ifndef WL_SDIO_H
10#define WL_SDIO_H
11
12/** \defgroup wl_sdio SDIO Interface
13 *
14 * These functions implement the interface that the wl_api library
15 * needs to work with a SDIO transport layer.
16 *
17 * The functions prototyped here must be implemented when porting the
18 * wl_api library to a new platform with a different SDIO configuration
19 *
20 * On platforms supported by H&D Wireless these functions are
21 * implemented in the file avr32_sdio.c
22 *
23 *  @{
24 */
25
26/**
27 * Maximum transfer size. This will set an upper limit on the len parameter
28 * passed to owl_sdio_tx() and owl_sdio_rx().
29 *
30 */ 
31#define MAX_BLOCK_LEN 512
32
33
34/**
35 * This flag might be set when owl_sdio_cmd() is called in case the cmd will
36 * be followed by a data transfer. If the flag is set, the transfer direction is
37 * from the device to the host (read). Otherwise, the transfer direction is
38 * from the host to the device (write).
39 *
40 */
41 #define CMD_FLAG_TO_HOST (1 << 0)
42
43
44/**
45 * Indicates that the sdio driver needs to be polled in order to make
46 * forward progress, i.e. it does not support interrupts
47 *
48 * The actual polling will result in owl_sdio_cmd() being called to
49 * request status information from the device.
50 *
51 * To activate polling, this flag should be set in owl_sdio_init().
52 */
53#define SDIO_FLAG_POLL (1 << 0)
54
55/**
56 * Indicates that the sdio driver only supports 1-bit mode.
57 *
58 * To set 1-bit mode, this flag should be set in owl_sdio_init().
59 */
60#define SDIO_FLAG_1BIT_MODE (1 << 1)
61
62/**
63 * This function will be invoked when wlan initialization should be performed,
64 * this happens when the wl_fw_download() function in the transport group of
65 * wl_api is invoked.
66 *
67 * The wifi device supports sdio high speed mode and clock frequencies up to
68 * 50 MHz.
69 *
70 * The function is responsible for doing any necessary sdio initialization such
71 * as allocating gpio's, setting up the mci master, one time allocations of
72 * dma buffers etc.
73 *
74 * @param flags is an out parameter that should hold any sdio flags upon return.
75 *        The avaible flags are prefixed with SDIO_FLAG_
76 *
77 *
78 */
79void owl_sdio_init(uint8_t *flags);
80
81
82
83/**
84 * This function will be invoked when an sdio cmd should be sent to the
85 * device.
86 *
87 * @param idx is the sdio command number
88 * @param arg is the sdio command argument
89 * @param flags specifies other options, such as any transfer direction.
90 * @param rsp should hold the command response upon return. If null, the
91 *        response can be ignored.
92 * @param data holds a pointer to any data that might follow the command. This
93 *        allows the sdio driver to setup dma transfers while waiting for the
94 *        command response. NULL if no data transfer will follow. Note that
95 *        the same data pointer will be passed to owl_sdio_tx(), which should
96 *        start the actual transfer.
97 * @param len is the length of the data buffer.
98 *
99 */
100void owl_sdio_cmd(uint8_t idx, uint32_t arg, uint8_t flags, uint32_t *rsp,
101                       const uint8_t *data, uint16_t len);
102
103
104/**
105 * This function will be invoked when data should be transmitted to the device.
106 *
107 * If wl_fw_downlad() was called with the size_align parameter set to non-zero,
108 * the pad parameter should be used. If the pad parameter is not 0, additional
109 * data must be transmitted after the data buffer has be sent. Depending on
110 * how the data buffer was first allocated (probably by an TCP/IP stack), it
111 * might be safe or unsafe to continue reading beyond the data buffer to
112 * transmit the additional padding bytes.
113 *
114 * @param data holds a pointer to the data to transmit, the pointer is the
115 *            same as the one passed to wl_tx().
116 * @param len is the number of bytes that should be transmitted, including
117 *            padding.
118 * @param pad is the number of padding bytes to send.
119 *
120 */
121void owl_sdio_tx(const uint8_t *data, uint16_t len, uint8_t pad);
122
123
124/**
125 * This function will be invoked when data should be received from the device.
126 *
127 * @param data should hold the read data upon return.
128 * @param len is the number of bytes to read.
129 *
130 */
131void owl_sdio_rx(uint8_t *data, uint16_t len);
132
133
134/**
135 * Invoked when sdio rx interrupts from the device should be enabled or
136 * disabled.
137 *
138 * If SDIO_FLAG_POLL was set in wl_spi_init(), then this function can be
139 * left empty.
140 *
141 * @param enable specifies if interrupts should be enabled or disabled.
142 *
143 */
144void owl_sdio_irq(uint8_t enable);
145
146
147/**
148 * Delay executiom for the specified number of ms. This function will be called
149 * with delays in the 10-20 ms range during fw download and startup of the
150 * Wi-Fi device. This function can be implemented with a simple for-loop if
151 * desired (beware of optimization). The timing does not have to be accurate as
152 * long as the actual delay becomes at least the specified number of ms.
153 *
154 * @param ms is the minimal amount of time to wait [ms].
155 *
156 */
157void owl_sdio_mdelay(uint32_t ms);
158
159
160/**
161 * This function should be called whenever an interrupt is detected. It can
162 * be called from an interrupt context.
163 *
164 * If SDIO_FLAG_POLL was set in owl_sdio_init(), then wl_sdio_irq()
165 * should never be called.
166 *
167 */
168extern void wl_sdio_irq(void);
169
170/*!  @} */
171
172#endif
Note: See TracBrowser for help on using the repository browser.