?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 Initialization
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: WF_Init.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 Updated for MRF24WB0M
48 ******************************************************************************/
49  
50 /*
51 *********************************************************************************************************
52 * INCLUDES
53 *********************************************************************************************************
54 */
55  
56 #include "TCPIP Stack/TCPIP.h"
57 #include "TCPIP Stack/WFMac.h"
58  
59 #if defined(WF_CS_TRIS)
60  
61  
62 /*
63 *********************************************************************************************************
64 * DEFINES
65 *********************************************************************************************************
66 */
67  
68 /* used for assertions */
69 #ifdef WF_DEBUG
70 #define WF_MODULE_NUMBER WF_MODULE_WF_INIT
71 #endif
72  
73 #define EXPECTED_MRF24WB0M_VERSION_NUMBER (2)
74  
75 /* This MAC address is the default MAC address used in TCPIPConfig.h. If the */
76 /* user leaves this MAC address unchanged then the WiFi Driver will get the */
77 /* unique MAC address from the MRF24WB0M and have the stack use it. */
78 #define MCHP_DEFAULT_MAC_ADDRESS_BYTE_1 (0x00)
79 #define MCHP_DEFAULT_MAC_ADDRESS_BYTE_2 (0x04)
80 #define MCHP_DEFAULT_MAC_ADDRESS_BYTE_3 (0xa3)
81 #define MCHP_DEFAULT_MAC_ADDRESS_BYTE_4 (0x00)
82 #define MCHP_DEFAULT_MAC_ADDRESS_BYTE_5 (0x00)
83 #define MCHP_DEFAULT_MAC_ADDRESS_BYTE_6 (0x00)
84  
85  
86 /*
87 *********************************************************************************************************
88 * LOCAL GLOBAL VARIABLES
89 *********************************************************************************************************
90 */
91  
92 /* This MAC address is the default MAC address used in TCPIPConfig.h. If the */
93 /* user leaves this MAC address unchanged then the WiFi Driver will get the */
94 /* unique MAC address from the MRF24WB0M and have the stack use it. */
95 static const UINT8 MchpDefaultMacAddress[WF_MAC_ADDRESS_LENGTH] = {0x00u, 0x04u, 0xA3u, 0x00u, 0x00u, 0x00u};
96  
97  
98 /*
99 *********************************************************************************************************
100 * LOCAL FUNCTION PROTOTYPES
101 *********************************************************************************************************
102 */
103  
104 static void WF_LibInitialize(void);
105  
106  
107 /*****************************************************************************
108 * FUNCTION: WF_Init
109 *
110 * RETURNS: None
111 *
112 * PARAMS:
113 * N/A.
114 *
115 *
116 * NOTES: This function must be called once prior to calling any other WF...
117 * functions. This function initializes the Wifi Driver internal State.
118 * It also verifies functionality of the lower level SPI driver and
119 * connected hardware.
120 *****************************************************************************/
121 void WF_Init(void)
122 {
123 UINT8 version;
124  
125 /* initialize WiFi drivers, reset MRF24WB0M */
126 WFHardwareInit();
127  
128 RawInit();
129  
130 WFEnableMRF24WB0MMode();
131  
132 WFGetMRF24WB0MVersion(&version);
133  
134 WF_ASSERT(version == EXPECTED_MRF24WB0M_VERSION_NUMBER);
135  
136 /* send init messages to MRF24WB0M */
137 WF_LibInitialize();
138 }
139  
140  
141 extern void WFMgmtMessageTest();
142 /*****************************************************************************
143 * FUNCTION: WF_LibInitialize
144 *
145 * RETURNS: None
146 *
147 * PARAMS: None
148 *
149 * NOTES: Performs initialization which is specific to the Microchip Demo code.
150 *****************************************************************************/
151 static void WF_LibInitialize()
152 {
153  
154 /* Disable Tx Data confirms (from the MRF24WB0M) */
155 WF_SetTxDataConfirm(WF_DISABLED);
156  
157 #if defined(WF_USE_POWER_SAVE_FUNCTIONS)
158 /* Disable power management */
159 WF_PsPollDisable();
160 #endif
161  
162 /* if the user has left the default MAC address in TCPIPConfig.h unchanged then use */
163 /* the unique MRF24WB0M MAC address so prevent multiple devices from having the same */
164 /* MAC address. */
165 if ( memcmp((void *)AppConfig.MyMACAddr.v, (void *)MchpDefaultMacAddress, WF_MAC_ADDRESS_LENGTH) == 0)
166 {
167 /* get the MRF24WB0M MAC address and overwrite the MAC in AppConfig */
168 WF_GetMacAddress((UINT8 *)AppConfig.MyMACAddr.v);
169 }
170 /* else presume the user has a unique MAC address of their own that they wish to use */
171 else
172 {
173 // set MAC address with user-supplied MAC */
174 WF_SetMacAddress((UINT8 *)AppConfig.MyMACAddr.v);
175 }
176  
177 #ifdef WF_CONFIG_DHCP
178 WF_SET_DHCP_STATE(DHCP_ENABLED);
179 #endif
180 }
181  
182  
183  
184 #endif /* WF_CS_TRIS */
185  
{BLAME END}
{FOOTER START}

Powered by WebSVN v2.8.3