?lang_form? ?lang_select? ?lang_submit? ?lang_endform?
{HEADER END}
{BLAME START}

library

?curdirlinks? -

Blame information for rev 32

Line No. Rev Author Line
1 32 kaklik /******************************************************************************
2  
3 MRF24WB0M Driver Scan functions
4 Module for Microchip TCP/IP Stack
5 -Provides access to MRF24WB0M WiFi controller
6 -Reference: MRF24WB0M Data sheet, IEEE 802.11 Standard
7  
8 *******************************************************************************
9 FileName: WFScan.c
10 Dependencies: TCP/IP Stack header files
11 Processor: PIC18, PIC24F, PIC24H, dsPIC30F, dsPIC33F, PIC32
12 Compiler: Microchip C32 v1.10b or higher
13 Microchip C30 v3.22 or higher
14 Microchip C18 v3.34 or higher
15 Company: Microchip Technology, Inc.
16  
17 Software License Agreement
18  
19 Copyright (C) 2002-2010 Microchip Technology Inc. All rights reserved.
20  
21 Microchip licenses to you the right to use, modify, copy, and distribute:
22 (i) the Software when embedded on a Microchip microcontroller or digital
23 signal controller product ("Device") which is integrated into
24 Licensee's product; or
25 (ii) ONLY the Software driver source files ENC28J60.c, ENC28J60.h,
26 ENCX24J600.c and ENCX24J600.h ported to a non-Microchip device used in
27 conjunction with a Microchip ethernet controller for the sole purpose
28 of interfacing with the ethernet controller.
29  
30 You should refer to the license agreement accompanying this Software for
31 additional information regarding your rights and obligations.
32  
33 THE SOFTWARE AND DOCUMENTATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
34 KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY
35 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND
36 NON-INFRINGEMENT. IN NO EVENT SHALL MICROCHIP BE LIABLE FOR ANY INCIDENTAL,
37 SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST
38 OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY OR SERVICES, ANY CLAIMS BY
39 THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), ANY CLAIMS
40 FOR INDEMNITY OR CONTRIBUTION, OR OTHER SIMILAR COSTS, WHETHER ASSERTED ON
41 THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE), BREACH OF WARRANTY, OR
42 OTHERWISE.
43  
44  
45 Author Date Comment
46 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 KH 27 Jan 2010 Created for MRF24WB0M
48 ******************************************************************************/
49  
50 /*
51 *********************************************************************************************************
52 * INCLUDES
53 *********************************************************************************************************
54 */
55  
56 #include "TCPIP Stack/WFMac.h"
57 #if defined(WF_CS_TRIS) && defined(WF_USE_SCAN_FUNCTIONS)
58  
59  
60 /*
61 *********************************************************************************************************
62 * INCLUDES
63 *********************************************************************************************************
64 */
65  
66 /* used for assertions */
67 #ifdef WF_DEBUG
68 #define WF_MODULE_NUMBER WF_MODULE_WF_SCAN
69 #endif
70  
71  
72 /*******************************************************************************
73 Function:
74 void WF_Scan(UINT8 CpId)
75  
76 Summary:
77 Commands the MRF24WB0M to start a scan operation. This will generate the
78 WF_EVENT_SCAN_RESULTS_READY event.
79  
80 Description:
81 Directs the MRF24WB0M to initiate a scan operation utilizing the input
82 Connection Profile ID. The Host Application will be notified that the scan
83 results are ready when it receives the WF_EVENT_SCAN_RESULTS_READY event.
84 The eventInfo field for this event will contain the number of scan results.
85 Once the scan results are ready they can be retrieved with
86 WF_ScanGetResult().
87  
88 Scan results are retained on the MRF24WB0M until:
89 1. Calling WF_Scan() again (after scan results returned from previous
90 call).
91 2. MRF24WB0M reset.
92  
93 Precondition:
94 MACInit must be called first.
95  
96 Parameters:
97 CpId -- Connection Profile to use.
98 If the CpId is valid then the values from that Connection Profile
99 will be used for filtering scan results. If the CpId is set to
100 WF_SCAN_ALL (0xFF) then a default filter will be used.
101  
102 Valid CpId :
103 * If CP has a defined SSID only scan results with that SSID are
104 retained.
105 * If CP does not have a defined SSID then all scanned SSID’s will be
106 retained
107 * Only scan results from Infrastructure or AdHoc networks are
108 retained, depending on the value of networkType in the Connection Profile
109 * The channel list that is scanned will be determined from
110 channelList in the Connection Algorithm (which must be defined
111 before calling this function).
112  
113 CpId is equal to WF_SCAN_ALL:
114 * All scan results are retained (both Infrastructure and Ad Hoc
115 networks).
116 * All channels within the MRF24WB0M’s regional domain will be
117 scanned.
118 * No Connection Profiles need to be defined before calling this
119 function.
120 * The Connection Algorithm does not need to be defined before
121 calling this function.
122  
123 Returns:
124 None.
125  
126 Remarks:
127 None.
128 *****************************************************************************/
129 void WF_Scan(UINT8 CpId)
130 {
131 UINT8 hdr[4];
132  
133 hdr[0] = WF_MGMT_REQUEST_TYPE;
134 hdr[1] = WF_SCAN_START_SUBTYPE;
135 hdr[2] = CpId; /* Connection Profile ID */
136 hdr[3] = 0; /* not used */
137  
138 SendMgmtMsg(hdr, /* header */
139 sizeof(hdr), /* size of header */
140 NULL, /* no data */
141 0); /* no data */
142  
143 /* wait for mgmt response, free it after it comes in (no data needed) */
144 WaitForMgmtResponse(WF_SCAN_START_SUBTYPE, FREE_MGMT_BUFFER);
145 }
146  
147 /*******************************************************************************
148 Function:
149 void WF_ScanGetResult(UINT8 listIndex, tWFScanResult *p_scanResult)
150  
151 Summary:
152 Read scan results back from MRF24WB0M.
153  
154 Description:
155 After a scan has completed this function is used to read one or more of the
156 scan results from the MRF24WB0M. The scan results will be written
157 contiguously starting at p_scanResults (see tWFScanResult structure for
158 format of scan result).
159  
160 Precondition:
161 MACInit must be called first. WF_EVENT_SCAN_RESULTS_READY event must have
162 already occurrerd.
163  
164 Parameters:
165 listIndex -- index (0-based list) of the scan entry to retrieve.
166 p_scanResult -- pointer to location to store the scan result structure
167  
168 Returns:
169 None.
170  
171 Remarks:
172 None.
173 *****************************************************************************/
174 void WF_ScanGetResult(UINT8 listIndex,
175 tWFScanResult *p_scanResult)
176 {
177  
178 UINT8 hdr[4];
179  
180 hdr[0] = WF_MGMT_REQUEST_TYPE;
181 hdr[1] = WF_SCAN_GET_RESULTS_SUBTYPE;
182 hdr[2] = listIndex; /* scan result index to read from */
183 hdr[3] = 1; /* number of results to read */
184  
185 SendMgmtMsg(hdr, /* header */
186 sizeof(hdr), /* size of header */
187 NULL, /* no data */
188 0); /* no data */
189  
190 /* index 4 contains number of scan results returned, index 5 is first byte of first scan result */
191 WaitForMgmtResponseAndReadData(WF_SCAN_GET_RESULTS_SUBTYPE, /* expected subtype */
192 sizeof(tWFScanResult), /* num data bytes to read */
193 5, /* starting at this index */
194 (UINT8 *)p_scanResult); /* write the response data here */
195  
196  
197 /* fix up endianness on the two 16-bit values in the scan results */
198 p_scanResult->beaconPeriod = WFSTOHS(p_scanResult->beaconPeriod);
199 p_scanResult->atimWindow = WFSTOHS(p_scanResult->atimWindow);
200 }
201  
202  
203 #endif /* WF_CS_TRIS && WF_USE_SCAN_FUNCTIONS */
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3