225 lines
7.4 KiB
C
225 lines
7.4 KiB
C
/* ar521xConf.c - Implements modular selection of ESS ,AP or IBSS mode for Atheros driver */
|
|
|
|
/*
|
|
* Copyright (c) 2008 Wind River Systems, Inc.
|
|
*
|
|
* The right to copy, distribute, modify or otherwise make use
|
|
* of this software may be licensed only pursuant to the terms
|
|
* of an applicable Wind River license agreement.
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INCsysDot11Endh
|
|
#define __INCsysDot11Endh
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif /* __cplusplus */
|
|
|
|
#define VXBUS
|
|
#ifdef VXBUS
|
|
#include "drv/wlan/dot11Lib.h"
|
|
#include "drv/wlan/dot11Bsp.h"
|
|
|
|
IMPORT STATUS dot11SmeEssInit(DOT11_FW *);
|
|
IMPORT STATUS dot11SmeIbssInit(DOT11_FW *);
|
|
IMPORT STATUS dot11SmeApInit(DOT11_FW *);
|
|
IMPORT STATUS dot11RsnInit(DOT11_FW *);
|
|
IMPORT DOT11_BSP_FUNCS dot11BspFuncs;
|
|
|
|
|
|
|
|
/*
|
|
* Select which wireless component(s) to include in the command line BSP
|
|
* build. Note that any component selections in the Project Facility will
|
|
* override the settings here.
|
|
*/
|
|
#ifndef PRJ_BUILD
|
|
#define INCLUDE_AR521X_END /* include core support (mandatory) */
|
|
#define INCLUDE_AR521X_END_ESS /* include ESS (Station) support */
|
|
#define INCLUDE_AR521X_END_IBSS /* include IBSS (Ad-hoc) support */
|
|
#undef INCLUDE_AR521X_END_AP /* include AP (Access Point) support */
|
|
#ifdef INCLUDE_AR521X_END_AP
|
|
#ifndef BRIDGE_PORTS /* check for Learning Bridge component */
|
|
#warning Access Point requires the Learning Bridge component.
|
|
#endif /* BRIDGE_PORTS */
|
|
#endif /* INCLUDE_AR521X_END_AP */
|
|
|
|
#undef INCLUDE_AR521X_SECPOL_TSN
|
|
#undef INCLUDE_AR521X_SECPOL_WPA
|
|
#undef INCLUDE_AR521X_SECPOL_11i
|
|
|
|
#undef INCLUDE_AR521X_AUTH_PSK
|
|
#undef INCLUDE_AR521X_AUTH_8021X
|
|
#undef INCLUDE_AR521X_AUTH_PSK_PASSPHRASE
|
|
|
|
#undef INCLUDE_AR521X_CIPH_NONE
|
|
#undef INCLUDE_AR521X_CIPH_WEP40
|
|
#undef INCLUDE_AR521X_CIPH_WEP104
|
|
#undef INCLUDE_AR521X_CIPH_TKIP
|
|
#undef INCLUDE_AR521X_CIPH_AES
|
|
#endif /* PRJ_BUILD */
|
|
|
|
/* The IDE defines PSK-passphrase as a different type. Convert it */
|
|
#ifdef INCLUDE_AR521X_AUTH_PSK_PASSPHRASE
|
|
#define INCLUDE_AR521X_AUTH_PSK
|
|
#endif
|
|
|
|
/* Enforce these dependencies on both project and non-project builds, since
|
|
there is no way to do this in the IDE */
|
|
#if ((defined(INCLUDE_AR521X_CIPH_TKIP) || defined(INCLUDE_AR521X_CIPH_AES)) && \
|
|
(!(defined(INCLUDE_AR521X_SECPOL_11i) || (defined(INCLUDE_AR521X_SECPOL_WPA)))))
|
|
#error TKIP Cipher type requires 802.11i or WPA to be allowed
|
|
#endif
|
|
|
|
#if ((defined INCLUDE_AR521X_CIPH_WEP40) || \
|
|
(defined INCLUDE_AR521X_CIPH_WEP104))&&(!defined(INCLUDE_AR521X_SECPOL_TSN))
|
|
#error Cipher types WEP40 and WEP104 require a security policy of TSN to be allowed
|
|
#endif
|
|
|
|
/* Ensure that TSN is only selected with another security poicy */
|
|
#if ((defined(INCLUDE_AR521X_SECPOL_TSN)) && \
|
|
(!(defined(INCLUDE_AR521X_SECPOL_WPA) || \
|
|
defined(INCLUDE_AR521X_SECPOL_11i))))
|
|
#error The 802.11 TSN security policy must be defined in combination with either WPA and/or 802.11i
|
|
#endif
|
|
|
|
/* Ensure that if any cipher types or authentication types are selected, at
|
|
least one security policy is selected */
|
|
#if (((defined INCLUDE_AR521X_CIPH_WEP40) || \
|
|
(defined INCLUDE_AR521X_CIPH_WEP104) || \
|
|
(defined INCLUDE_AR521X_CIPH_TKIP) || \
|
|
(defined INCLUDE_AR521X_CIPH_AES) || \
|
|
(defined INCLUDE_AR521X_AUTH_PSK) || \
|
|
(defined INCLUDE_AR521X_AUTH_8021X)) && \
|
|
(!(defined(INCLUDE_AR521X_SECPOL_WPA) || \
|
|
defined(INCLUDE_AR521X_SECPOL_11i))))
|
|
#error In order to select an 802.11 Cipher or Authentication policy, you must select an 802.11 Security Policy
|
|
#endif
|
|
|
|
/* Ensure that if any security policy or authentication types are selected, at
|
|
least one cipher policy is selected */
|
|
#if ((defined(INCLUDE_AR521X_SECPOL_WPA) || \
|
|
defined(INCLUDE_AR521X_SECPOL_11i) || \
|
|
(defined INCLUDE_AR521X_AUTH_PSK) || \
|
|
(defined INCLUDE_AR521X_AUTH_8021X)) && \
|
|
(!((defined INCLUDE_AR521X_CIPH_WEP40) || \
|
|
(defined INCLUDE_AR521X_CIPH_WEP104) || \
|
|
(defined INCLUDE_AR521X_CIPH_TKIP) || \
|
|
(defined INCLUDE_AR521X_CIPH_AES))))
|
|
#error In order to select an 802.11 Cipher Policy or Authentication policy, you must select an 802.11 Security Policy
|
|
#endif
|
|
|
|
/* Ensure that if any cipher types or security policies are selected, at
|
|
least one authentication type is selected */
|
|
#if (((defined INCLUDE_AR521X_CIPH_WEP40) || \
|
|
(defined INCLUDE_AR521X_CIPH_WEP104) || \
|
|
(defined INCLUDE_AR521X_CIPH_TKIP) || \
|
|
(defined INCLUDE_AR521X_CIPH_AES) || \
|
|
(defined INCLUDE_AR521X_SECPOL_WPA) ||\
|
|
(defined INCLUDE_AR521X_SECPOL_11i)) && \
|
|
(!((defined INCLUDE_AR521X_AUTH_PSK) || \
|
|
(defined INCLUDE_AR521X_AUTH_8021X))))
|
|
#error In order to select an 802.11 Cipher or Security Policy, you must select an 802.11 Authentication Policy
|
|
#endif
|
|
|
|
/* Default WLAN configuration parameters */
|
|
LOCAL DOT11_DEFAULT_CONFIG sysDot11WlanCfg =
|
|
{
|
|
/* Network Name (also called the SSID, BSS Name or ESS Name) */
|
|
AR521X_DEFAULT_SSID,
|
|
/* Wireless Mode - STA, IBSS or AP mode */
|
|
AR521X_DEFAULT_MODE,
|
|
/* Radio Type - 802.11a, 802.11b, 802.11g or other modes */
|
|
AR521X_DEFAULT_RADIO,
|
|
/* Default Channel - used for IBSS and AP modes only */
|
|
AR521X_DEFAULT_CHANNEL,
|
|
/* Default Country - used for IBSS and AP modes only */
|
|
AR521X_DEFAULT_COUNTRY,
|
|
0,
|
|
0,
|
|
0,
|
|
AR521X_AUTH_PSK_KEY
|
|
};
|
|
|
|
|
|
void ar52xConf(void)
|
|
{
|
|
/* Fill in the rest of sysDot11WlanCfg that couldn't be configured above */
|
|
|
|
sysDot11WlanCfg.secPol = 0;
|
|
dot11BspFuncs.rsnInit = NULL;
|
|
#ifdef INCLUDE_AR521X_SECPOL_TSN
|
|
sysDot11WlanCfg.secPol |= DOT11_SECPOL_TSN;
|
|
dot11BspFuncs.rsnInit = dot11RsnInit;
|
|
#endif
|
|
#ifdef INCLUDE_AR521X_SECPOL_WPA
|
|
sysDot11WlanCfg.secPol |= DOT11_SECPOL_WPA;
|
|
dot11BspFuncs.rsnInit = dot11RsnInit;
|
|
#endif
|
|
#ifdef INCLUDE_AR521X_SECPOL_11i
|
|
sysDot11WlanCfg.secPol |= DOT11_SECPOL_11i;
|
|
dot11BspFuncs.rsnInit = dot11RsnInit;
|
|
#endif
|
|
|
|
sysDot11WlanCfg.authPol = DOT11_AUTHPOL_NONE;
|
|
sysDot11WlanCfg.rsnPassphrase = NULL;
|
|
|
|
#ifdef INCLUDE_AR521X_AUTH_8021X
|
|
sysDot11WlanCfg.authPol |= DOT11_AUTHPOL_8021X;
|
|
#endif
|
|
#if defined(INCLUDE_AR521X_AUTH_PSK)
|
|
sysDot11WlanCfg.authPol |= DOT11_AUTHPOL_PSK;
|
|
sysDot11WlanCfg.rsnPassphrase = NULL;
|
|
#endif
|
|
#if defined(INCLUDE_AR521X_AUTH_PSK_PASSPHRASE)
|
|
sysDot11WlanCfg.authPol |= DOT11_AUTHPOL_PSK;
|
|
|
|
|
|
sysDot11WlanCfg.rsnPassphrase = AR521X_AUTH_PSK_PASSPHRASE;
|
|
#endif
|
|
|
|
sysDot11WlanCfg.ciphPol = 0;
|
|
#ifdef INCLUDE_AR521X_CIPH_WEP40
|
|
sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_WEP40;
|
|
#endif
|
|
#ifdef INCLUDE_AR521X_CIPH_WEP104
|
|
sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_WEP104;
|
|
#endif
|
|
#ifdef INCLUDE_AR521X_CIPH_TKIP
|
|
sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_TKIP;
|
|
#endif
|
|
#ifdef INCLUDE_AR521X_CIPH_AES
|
|
sysDot11WlanCfg.ciphPol |= DOT11_CIPHPOL_AES;
|
|
#endif
|
|
|
|
|
|
/* These definitions bring in the SME modules, if selected */
|
|
#ifdef INCLUDE_AR521X_END_ESS
|
|
dot11BspFuncs.essInit = dot11SmeEssInit;
|
|
#endif
|
|
|
|
#ifdef INCLUDE_AR521X_END_IBSS
|
|
dot11BspFuncs.ibssInit = dot11SmeIbssInit;
|
|
#endif
|
|
|
|
#ifdef INCLUDE_AR521X_END_AP
|
|
dot11BspFuncs.apInit = dot11SmeApInit;
|
|
#endif
|
|
|
|
dot11BspFuncs.sysDot11WlanCfg= &sysDot11WlanCfg;
|
|
|
|
|
|
/*register the device with vxBus*/
|
|
ar52Register();
|
|
}
|
|
|
|
|
|
#endif /* VXBUS */
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif /* __cplusplus */
|
|
#endif /* __INCsysDot11Endh */
|