00001 00017 /* 00018 * INCLUDE FILES 00019 **************************************************************************************** 00020 */ 00021 00022 #include "co_int.h" 00023 #include "co_bool.h" 00024 #include "me.h" 00025 #include "sm.h" 00026 #include "mm.h" 00027 #if NX_BEACONING 00028 #include "apm.h" 00029 #endif 00030 #include "scanu.h" 00031 #include "bam.h" 00032 #include "vif_mgmt.h" 00033 #include "ps.h" 00034 #include "version.h" 00035 #include "reg_mac_core.h" 00036 #include "txl_frame.h" 00037 #if NX_HSU 00038 #include "hsu.h" 00039 #endif 00040 00041 /* 00042 * PRIVATE VARIABLES 00043 **************************************************************************************** 00044 */ 00045 00046 struct me_env_tag me_env; 00047 00048 /* 00049 * PRIVATE FUNCTIONS DEFINITION 00050 **************************************************************************************** 00051 */ 00052 00058 static void me_env_init(void) 00059 { 00060 // Reset the ME environment 00061 memset(&me_env, 0, sizeof(me_env)); 00062 00063 // Set the ME task state 00064 ke_state_set(TASK_ME, ME_IDLE); 00065 } 00066 00067 /* 00068 * PUBLIC FUNCTIONS DEFINITION 00069 **************************************************************************************** 00070 */ 00071 00072 void me_init(void) 00073 { 00074 // Initialize the environment 00075 me_env_init(); 00076 00077 // Initialize scan module 00078 scanu_init(); 00079 00080 // initialize all ME components modules and environment 00081 #if NX_BEACONING 00082 // reset AP manager 00083 apm_init(); 00084 #endif 00085 00086 // reset STA manager 00087 sm_init(); 00088 00089 // Reset the Block ACK manager 00090 bam_init(); 00091 00092 #if RW_MESH_EN 00093 mesh_init(); 00094 #endif //RW_MESH_EN 00095 00096 #if NX_HSU 00097 hsu_init(); 00098 #endif 00099 } 00100 00101 struct mac_chan_def *me_freq_to_chan_ptr(uint8_t band, uint16_t freq) 00102 { 00103 int i, chan_cnt; 00104 struct mac_chan_def *chan; 00105 00106 // Get the correct channel table 00107 chan = (band == PHY_BAND_2G4) ? me_env.chan.chan2G4 : me_env.chan.chan5G; 00108 chan_cnt = (band == PHY_BAND_2G4) ? me_env.chan.chan2G4_cnt : me_env.chan.chan5G_cnt; 00109 00110 for (i = 0; i < chan_cnt; i++) 00111 { 00112 if (chan[i].freq == freq) 00113 return &chan[i]; 00114 } 00115 00116 return NULL; 00117 } 00118 00119 void me_init_chan(struct mac_chan_op *chan) 00120 { 00121 struct mac_chan_def *chan_def = me_freq_to_chan_ptr(chan->band, chan->prim20_freq); 00122 00123 if (chan == NULL) 00124 { 00125 ASSERT_WARN(0); 00126 chan->tx_power = MM_DEFAULT_TX_POWER; 00127 chan->flags = 0; 00128 } 00129 00130 chan->tx_power = chan_def->tx_power; 00131 chan->flags = chan_def->flags; 00132 } 00133 00135
1.6.1