David Fletcher
/
cc3100_test
TI's CC3100 host driver and demo. Experimental and a work in progress.
Embed:
(wiki syntax)
Show/hide line numbers
cc3100_sl_common.h
00001 /* 00002 * sl_config.h - get time sample application 00003 * 00004 * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com/ 00005 * 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions 00009 * are met: 00010 * 00011 * Redistributions of source code must retain the above copyright 00012 * notice, this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the 00017 * distribution. 00018 * 00019 * Neither the name of Texas Instruments Incorporated nor the names of 00020 * its contributors may be used to endorse or promote products derived 00021 * from this software without specific prior written permission. 00022 * 00023 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 00024 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 00025 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 00026 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 00027 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 00028 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 00029 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00030 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 00031 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00032 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 00033 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00034 * 00035 */ 00036 00037 #ifndef __SL_CONFIG_H__ 00038 #define __SL_CONFIG_H__ 00039 00040 //***************************************************************************** 00041 // 00042 // If building with a C++ compiler, make all of the definitions in this header 00043 // have a C binding. 00044 // 00045 //***************************************************************************** 00046 #ifdef __cplusplus 00047 extern "C" { 00048 #endif 00049 00050 //Vars taken from main 00051 extern _u32 g_Status ; 00052 extern _u32 g_GatewayIP; 00053 extern _u32 g_StationIP; 00054 00055 /**/ 00056 #define LOOP_FOREVER() \ 00057 {\ 00058 while(1); \ 00059 } 00060 00061 #define ASSERT_ON_ERROR(error_code) \ 00062 {\ 00063 /* Handling the error-codes is specific to the application */ \ 00064 if (error_code < 0) return error_code; \ 00065 /* else, continue w/ execution */ \ 00066 } 00067 00068 #define pal_Memset(x,y,z) memset((void *)x,y,z) 00069 #define pal_Memcpy(x,y,z) memcpy((void *)x, (const void *)y, z) 00070 #define pal_Memcmp(x,y,z) memcmp((const void *)x, (const void *)y, z) 00071 #define pal_Strlen(x) strlen((const char *)x) 00072 #define pal_Strcmp(x,y) strcmp((const char *)x, (const char *)y) 00073 #define pal_Strcpy(x,y) strcpy((char *)x, (const char *)y) 00074 #define pal_Strstr(x,y) strstr((const char *)x, (const char *)y) 00075 #define pal_Strncmp(x,y,z) strncmp((const char *)x, (const char *)y, z) 00076 #define pal_Strcat(x,y) strcat((char *)x, (const char *)y) 00077 00078 /* 00079 * Values for below macros shall be modified per the access-point's (AP) properties 00080 * SimpleLink device will connect to following AP when the application is executed 00081 */ 00082 #define SSID_NAME "**********" /* Access point name to connect to. */ 00083 #define SEC_TYPE SL_SEC_TYPE_WPA_WPA2 /* Security type of the Access piont */ 00084 #define PASSKEY "**********" /* Password in case of secure AP */ 00085 #define PASSKEY_LEN pal_Strlen(PASSKEY) /* Password length in case of secure AP */ 00086 00087 /* Configuration of the device when it comes up in AP mode */ 00088 #define SSID_AP_MODE "mysimplelink" /* SSID of the CC3100 in AP mode */ 00089 #define PASSWORD_AP_MODE "" /* Password of CC3100 AP */ 00090 #define SEC_TYPE_AP_MODE SL_SEC_TYPE_OPEN /* Can take SL_SEC_TYPE_WEP or 00091 * SL_SEC_TYPE_WPA as well */ 00092 00093 /* 00094 * Values for below macros shall be modified based on current time 00095 */ 00096 #define DATE 24 /* Current Date */ 00097 #define MONTH 7 /* Month */ 00098 #define YEAR 2014 /* Current year */ 00099 #define HOUR 17 /* Time - hours */ 00100 #define MINUTE 30 /* Time - minutes */ 00101 #define SECOND 0 /* Time - seconds */ 00102 00103 #define SUCCESS 0 00104 00105 /* Status bits - These are used to set/reset the corresponding bits in a 'status_variable' */ 00106 typedef enum{ 00107 STATUS_BIT_CONNECTION = 0, /* If this bit is: 00108 * 1 in a 'status_variable', the device is connected to the AP 00109 * 0 in a 'status_variable', the device is not connected to the AP 00110 */ 00111 00112 STATUS_BIT_STA_CONNECTED, /* If this bit is: 00113 * 1 in a 'status_variable', client is connected to device 00114 * 0 in a 'status_variable', client is not connected to device 00115 */ 00116 00117 STATUS_BIT_IP_ACQUIRED, /* If this bit is: 00118 * 1 in a 'status_variable', the device has acquired an IP 00119 * 0 in a 'status_variable', the device has not acquired an IP 00120 */ 00121 00122 STATUS_BIT_IP_LEASED, /* If this bit is: 00123 * 1 in a 'status_variable', the device has leased an IP 00124 * 0 in a 'status_variable', the device has not leased an IP 00125 */ 00126 00127 STATUS_BIT_CONNECTION_FAILED, /* If this bit is: 00128 * 1 in a 'status_variable', failed to connect to device 00129 * 0 in a 'status_variable' 00130 */ 00131 00132 STATUS_BIT_P2P_NEG_REQ_RECEIVED,/* If this bit is: 00133 * 1 in a 'status_variable', connection requested by remote wifi-direct device 00134 * 0 in a 'status_variable', 00135 */ 00136 STATUS_BIT_SMARTCONFIG_DONE, /* If this bit is: 00137 * 1 in a 'status_variable', smartconfig completed 00138 * 0 in a 'status_variable', smartconfig event couldn't complete 00139 */ 00140 00141 STATUS_BIT_SMARTCONFIG_STOPPED /* If this bit is: 00142 * 1 in a 'status_variable', smartconfig process stopped 00143 * 0 in a 'status_variable', smartconfig process running 00144 */ 00145 00146 }e_StatusBits; 00147 00148 #define SET_STATUS_BIT(status_variable, bit) status_variable |= ((unsigned long)1<<(bit)) 00149 #define CLR_STATUS_BIT(status_variable, bit) status_variable &= ~((unsigned long)1<<(bit)) 00150 #define GET_STATUS_BIT(status_variable, bit) (0 != (status_variable & ((unsigned long)1<<(bit)))) 00151 00152 #define IS_CONNECTED(status_variable) GET_STATUS_BIT(status_variable, \ 00153 STATUS_BIT_CONNECTION) 00154 #define IS_STA_CONNECTED(status_variable) GET_STATUS_BIT(status_variable, \ 00155 STATUS_BIT_STA_CONNECTED) 00156 #define IS_IP_ACQUIRED(status_variable) GET_STATUS_BIT(status_variable, \ 00157 STATUS_BIT_IP_ACQUIRED) 00158 #define IS_IP_LEASED(status_variable) GET_STATUS_BIT(status_variable, \ 00159 STATUS_BIT_IP_LEASED) 00160 #define IS_CONNECTION_FAILED(status_variable) GET_STATUS_BIT(status_variable, \ 00161 STATUS_BIT_CONNECTION_FAILED) 00162 #define IS_P2P_NEG_REQ_RECEIVED(status_variable) GET_STATUS_BIT(status_variable, \ 00163 STATUS_BIT_P2P_NEG_REQ_RECEIVED) 00164 #define IS_SMARTCONFIG_DONE(status_variable) GET_STATUS_BIT(status_variable, \ 00165 STATUS_BIT_SMARTCONFIG_DONE) 00166 #define IS_SMARTCONFIG_STOPPED(status_variable) GET_STATUS_BIT(status_variable, \ 00167 STATUS_BIT_SMARTCONFIG_STOPPED) 00168 00169 #define IS_PING_DONE(status_variable) GET_STATUS_BIT(status_variable, \ 00170 STATUS_BIT_PING_DONE) 00171 00172 #define STATUS_BIT_PING_DONE 31 00173 00174 static void SimpleLinkPingReport(SlPingReport_t *pPingReport); 00175 00176 #ifdef __cplusplus 00177 } 00178 #endif /* __cplusplus */ 00179 00180 #endif /*__SL_CONFIG_H__*/ 00181
Generated on Tue Jul 12 2022 22:55:20 by 1.7.2