lua_State* newstate() { putenv(("LUA_SEED=" + std::to_string(get_random_seed())).c_str()); lua_State* L = luaL_newstate(); putenv("LUA_SEED="); return L; }
int uwrapc_start(Options * opts){ if(check_options_and_load_images(opts)){ return -1; } char buffer[OPTION_STRING_SIZE*2+1]; #if defined(_MSC_VER) || defined(__MINGW32__) _mkdir(opts->work_dir); #else mkdir(opts->work_dir,0755); #endif strcpy(buffer,opts->work_dir); strcat(buffer,"/"); strcat(buffer,"uwrapc.confout"); write_options_file(buffer); srand(get_random_seed(opts)); init_reconstruction(opts); /* cleanup stuff */ if(opts->init_support){ sp_image_free(opts->init_support); } if(opts->diffraction){ sp_image_free(opts->diffraction); } if(opts->amplitudes){ sp_image_free(opts->amplitudes); } if(opts->intensities_std_dev){ sp_image_free(opts->intensities_std_dev); } #ifdef _USE_DMALLOC dmalloc_shutdown(); #endif return 0; }
population::population(int N_in, int L_in, double r_in, int seed_in, gsl_rng* rng_in, vector< vector<double> >& fit) { try { if (fit.size() != N_in || fit[0].size() != L_in) {throw "Incorrect Fitness Landscape dimensions!";} else if (r_in < 0 || r_in > 1 || N_in < 0 || L_in <0) {throw "Bad inputs. Check arguments.";} else { N = N_in; L = L_in; r = r_in; gen_pop = 0; neutral = false; avgFit = 0; selective_weight = vector<double>(N); genetic_weight = vector< vector<int> >(N,vector<int>(L)); fixations = vector< vector<fixation_event> > (N); seed = seed_in ? seed_in : get_random_seed(); rng = rng_in; gsl_rng_set(rng,seed); blockHist = gsl_histogram_alloc(L); gsl_histogram_set_ranges_uniform(blockHist,1,L+1); //Questionable range choice. As it stands now, the bins are partitioned as follows {[1,2),[2,3)......[L,L+1)}. Thus if all have length L, then average will come out to be (L+.5). Will have to rescale. map<int,double> genome_fit; for(int i=0;i<N;i++) { genome_fit = convert_vector_toMap(fit[i]); if (!genome_fit.empty()) {pop.push_back(genome(i, L, rng, genome_fit));} else {pop.push_back(genome(i,L,rng));} avgFit += pop[i].get_fit(); } avgFit/=N; update_selection_weights(); updateBlockSizes(); } } catch (const char* Message) { cout << "Error:" << Message << "\n"; } }
static int internal_init(int (*init_once)(void)) { uint32_t seed; int err; if ((err = get_random_seed(&seed))) return err; init_random_state(&random_state, seed); #if defined(GENESIS_OS_WINDOWS) unsigned __int64 frequency; if (QueryPerformanceFrequency((LARGE_INTEGER*) &frequency)) { win32_time_resolution = 1.0 / (double) frequency; } else { return GenesisErrorSystemResources; } GetSystemInfo(&win32_system_info); page_size = win32_system_info.dwAllocationGranularity; #else page_size = getpagesize(); #if defined(__MACH__) host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock); #endif #endif if (init_once && (err = init_once())) { return err; } return 0; }
// ZZZ: If not already in predictive mode, save off partial game-state for later restoration. static void enter_predictive_mode() { if(sPredictedTicks == 0) { for(short i = 0; i < dynamic_world->player_count; i++) { sSavedPlayerData[i] = *get_player_data(i); if(sSavedPlayerData[i].monster_index != NONE) { sSavedPlayerMonsterData[i] = *get_monster_data(sSavedPlayerData[i].monster_index); if(sSavedPlayerMonsterData[i].object_index != NONE) { sSavedPlayerObjectData[i] = *get_object_data(sSavedPlayerMonsterData[i].object_index); sSavedPlayerObjectNextObject[i] = sSavedPlayerObjectData[i].next_object; if(sSavedPlayerObjectData[i].parasitic_object != NONE) sSavedPlayerParasiticObjectData[i] = *get_object_data(sSavedPlayerObjectData[i].parasitic_object); } } } // Sanity checking sSavedTickCount = dynamic_world->tick_count; sSavedRandomSeed = get_random_seed(); } }
//Overloaded Constructors population::population(int N_in, int L_in, double r_in, int seed_in, gsl_rng* rng_in) { //Neutral Evolution! try { if (r_in < 0 || r_in > 1 || N_in < 0 || L_in <0) {throw "Bad inputs. Check arguments.";} else { N = N_in; L = L_in; r = r_in; gen_pop = 0; neutral = true; avgFit = 0; selective_weight = vector<double>(N); //All zeros genetic_weight = vector< vector<int> >(N,vector<int>(L)); fixations = vector< vector<fixation_event> > (N); seed = seed_in ? seed_in:get_random_seed(); rng = rng_in; gsl_rng_set(rng,seed); blockHist = gsl_histogram_alloc(L); gsl_histogram_set_ranges_uniform(blockHist,1,L+1); for(int i=0;i<N;i++) { pop.push_back(genome(i,L,rng)); } updateBlockSizes(); } } catch(const char* Message) {cout << "Error: " << Message << "\n";} }
boost::mt19937& mapgen_lua_kernel::get_default_rng() { if(!default_rng_) { default_rng_ = boost::mt19937(get_random_seed()); } return *default_rng_; }
int main (int argc, char* argv[]) { const int verbose = 0; int ii, jj, nrows, ncols; int err = 0; init_random_bit (get_random_seed ()); if (argc != 3) { fprintf (stderr, "Incorrect number of command-line arguments!\n"); print_usage (argv[0]); exit (EXIT_FAILURE); } err = to_int (&nrows, argv[1]); if (err != 0) { fprintf (stderr, "Command-line argument %s is not an integer!\n", argv[1]); print_usage (argv[0]); exit (EXIT_FAILURE); } else if (nrows < 1) { fprintf (stderr, "Command-line argument nrows = %d should be a positive integer!\n", nrows); print_usage (argv[0]); exit (EXIT_FAILURE); } err = to_int (&ncols, argv[2]); if (err != 0) { fprintf (stderr, "Command-line argument %s is not an integer!\n", argv[2]); print_usage (argv[0]); exit (EXIT_FAILURE); } else if (nrows < 1) { fprintf (stderr, "Command-line argument ncols = %d should be a positive integer!\n", ncols); print_usage (argv[0]); exit (EXIT_FAILURE); } if (verbose) printf ("Number of rows: %d\n" "Number of cols: %d\n", nrows, ncols); printf ("P1\n%d %d\n", nrows, ncols); for (ii = 0; ii < nrows; ii++) for (jj = 0; jj < ncols; jj++) printf ("%c\n", '0' + random_bit ()); return 0; }
static void init_sgf(Gameinfo *ginfo) { if (sgf_initialized) return; sgf_initialized = 1; sgf_write_header(sgftree.root, 1, get_random_seed(), komi, ginfo->handicap, get_level(), chinese_rules); if (ginfo->handicap > 0) sgffile_recordboard(sgftree.root); }
void test_main (void) { const char *nettle_test_seed; gmp_randstate_t rands; unsigned count = COUNT; unsigned i; gmp_randinit_default (rands); test_fixed (); for (i = 0; ecc_curves[i]; i++) { test_patterns ("p", &ecc_curves[i]->p); test_patterns ("q", &ecc_curves[i]->p); } #if !NETTLE_USE_MINI_GMP nettle_test_seed = getenv ("NETTLE_TEST_SEED"); if (nettle_test_seed && *nettle_test_seed) { mpz_t seed; mpz_init (seed); if (mpz_set_str (seed, nettle_test_seed, 0) < 0 || mpz_sgn (seed) < 0) die ("Invalid NETTLE_TEST_SEED: %s\n", nettle_test_seed); if (mpz_sgn (seed) == 0) get_random_seed (seed); fprintf (stderr, "Using NETTLE_TEST_SEED="); mpz_out_str (stderr, 10, seed); fprintf (stderr, "\n"); gmp_randseed (rands, seed); mpz_clear (seed); count *= 20; } #endif /* !NETTLE_USE_MINI_GMP */ for (i = 0; ecc_curves[i]; i++) { test_modulo (rands, "p", &ecc_curves[i]->p, count); test_modulo (rands, "q", &ecc_curves[i]->q, count); } gmp_randclear (rands); }
char * lto_get_section_name (int section_type, const char *name, struct lto_file_decl_data *f) { const char *add; char post[32]; const char *sep; if (section_type == LTO_section_function_body) { gcc_assert (name != NULL); if (name[0] == '*') name++; add = name; sep = ""; } else if (section_type < LTO_N_SECTION_TYPES) { add = lto_section_name[section_type]; sep = "."; } else internal_error ("bytecode stream: unexpected LTO section %s", name); /* Make the section name unique so that ld -r combining sections doesn't confuse the reader with merged sections. For options don't add a ID, the option reader cannot deal with them and merging should be ok here. */ if (section_type == LTO_section_opts) strcpy (post, ""); else if (f != NULL) sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, f->id); else sprintf (post, "." HOST_WIDE_INT_PRINT_HEX_PURE, get_random_seed (false)); return concat (section_name_prefix, sep, add, post, NULL); }
/* --------------------------------------------------------------*/ void play_gmp(Gameinfo *gameinfo, int simplified) { SGFTree sgftree; Gmp *ge; GmpResult message; const char *error; int i, j; int passes = 0; /* two passes and its over */ int to_move; /* who's turn is next ? */ int mycolor = -1; /* who has which color */ int yourcolor; if (gameinfo->computer_player == WHITE) mycolor = 1; else if (gameinfo->computer_player == BLACK) mycolor = 0; sgftree_clear(&sgftree); sgftreeCreateHeaderNode(&sgftree, board_size, komi, gameinfo->handicap); ge = gmp_create(0, 1); TRACE("board size=%d\n", board_size); /* * The specification of the go modem protocol doesn't even discuss * komi. So we have to guess the komi. If the komi is set on the * command line, keep it. Otherwise, its value will be 0.0 and we * use 5.5 in an even game, 0.5 otherwise. */ if (komi == 0.0) { if (gameinfo->handicap == 0) komi = 5.5; else komi = 0.5; } if (!simplified) { /* Leave all the -1's so the client can negotiate the game parameters. */ if (chinese_rules) gmp_startGame(ge, -1, -1, 5.5, -1, mycolor, 0); else gmp_startGame(ge, -1, -1, 5.5, 0, mycolor, 0); } else { gmp_startGame(ge, board_size, gameinfo->handicap, komi, chinese_rules, mycolor, 1); } do { message = gmp_check(ge, 1, NULL, NULL, &error); } while (message == gmp_nothing || message == gmp_reset); if (message == gmp_err) { fprintf(stderr, "gnugo-gmp: Error \"%s\" occurred.\n", error); exit(EXIT_FAILURE); } else if (message != gmp_newGame) { fprintf(stderr, "gnugo-gmp: Expecting a newGame, got %s\n", gmp_resultString(message)); exit(EXIT_FAILURE); } gameinfo->handicap = gmp_handicap(ge); if (!check_boardsize(gmp_size(ge), stderr)) exit(EXIT_FAILURE); gnugo_clear_board(gmp_size(ge)); /* Let's pretend GMP knows about komi in case something will ever change. */ komi = gmp_komi(ge); #if ORACLE if (metamachine && oracle_exists) oracle_clear_board(board_size); #endif sgfOverwritePropertyInt(sgftree.root, "SZ", board_size); TRACE("size=%d, handicap=%d, komi=%f\n", board_size, gameinfo->handicap, komi); if (gameinfo->handicap) to_move = WHITE; else to_move = BLACK; if (gmp_iAmWhite(ge)) { mycolor = WHITE; /* computer white */ yourcolor = BLACK; /* human black */ } else { mycolor = BLACK; yourcolor = WHITE; } gameinfo->computer_player = mycolor; sgf_write_header(sgftree.root, 1, get_random_seed(), komi, gameinfo->handicap, get_level(), chinese_rules); gameinfo->handicap = gnugo_sethand(gameinfo->handicap, sgftree.root); sgfOverwritePropertyInt(sgftree.root, "HA", gameinfo->handicap); /* main GMP loop */ while (passes < 2) { if (to_move == yourcolor) { int move; /* Get opponent's move from gmp client. */ message = gmp_check(ge, 1, &j, &i, &error); if (message == gmp_err) { fprintf(stderr, "GNU Go: Sorry, error from gmp client\n"); sgftreeAddComment(&sgftree, "got error from gmp client"); sgffile_output(&sgftree); return; } if (message == gmp_undo) { int k; assert(j > 0); for (k = 0; k < j; k++) { if (!undo_move(1)) { fprintf(stderr, "GNU Go: play_gmp UNDO: can't undo %d moves\n", j - k); break; } sgftreeAddComment(&sgftree, "undone"); sgftreeBack(&sgftree); to_move = OTHER_COLOR(to_move); } continue; } if (message == gmp_pass) { passes++; move = PASS_MOVE; } else { passes = 0; move = POS(i, j); } TRACE("\nyour move: %1m\n\n", move); sgftreeAddPlay(&sgftree, to_move, I(move), J(move)); gnugo_play_move(move, yourcolor); sgffile_output(&sgftree); } else { /* Generate my next move. */ float move_value; int move; if (autolevel_on) adjust_level_offset(mycolor); move = genmove(mycolor, &move_value, NULL); gnugo_play_move(move, mycolor); sgffile_add_debuginfo(sgftree.lastnode, move_value); if (is_pass(move)) { /* pass */ sgftreeAddPlay(&sgftree, to_move, -1, -1); gmp_sendPass(ge); ++passes; } else { /* not pass */ sgftreeAddPlay(&sgftree, to_move, I(move), J(move)); gmp_sendMove(ge, J(move), I(move)); passes = 0; TRACE("\nmy move: %1m\n\n", move); } sgffile_add_debuginfo(sgftree.lastnode, 0.0); sgffile_output(&sgftree); } to_move = OTHER_COLOR(to_move); } /* two passes: game over */ gmp_sendPass(ge); if (!quiet) fprintf(stderr, "Game over - waiting for client to shut us down\n"); who_wins(mycolor, stderr); if (showtime) { gprintf("\nSLOWEST MOVE: %d at %1m ", slowest_movenum, slowest_move); fprintf(stderr, "(%.2f seconds)\n", slowest_time); fprintf(stderr, "\nAVERAGE TIME: %.2f seconds per move\n", total_time / movenum); fprintf(stderr, "\nTOTAL TIME: %.2f seconds\n", total_time); } /* play_gmp() does not return to main(), therefore the score * writing code is here. */ { float score = gnugo_estimate_score(NULL, NULL); sgfWriteResult(sgftree.root, score, 1); } sgffile_output(&sgftree); if (!simplified) { /* We hang around here until cgoban asks us to go, since * sometimes cgoban crashes if we exit first. * * FIXME: Check if this is still needed. I made it dependand on * `simplifed' just to avoid changes in GMP mode. */ while (1) { message = gmp_check(ge, 1, &j, &i, &error); if (!quiet) fprintf(stderr, "Message %d from gmp\n", message); if (message == gmp_err) break; } } #if ORACLE if (metamachine && oracle_exists) dismiss_oracle(); #endif if (!quiet) fprintf(stderr, "gnugo going down\n"); }
lua_State* luaL_newstate2() { lua_State *L = lua_newstate2(l_alloc, NULL, get_random_seed()); if (L) lua_atpanic(L, &panic); return L; }
return boost::random_device()(); #else int fd = open("/dev/urandom", O_RDONLY); if (fd != -1) { boost::uint64_t result; int sz = read(fd, reinterpret_cast<char*>(&result), sizeof(result)); if (sz == sizeof(result)) { return result; } } return static_cast<boost::uint64_t>(std::time(nullptr)); #endif } } AdvancedFlag<boost::int64_t> random_seed("random_seed", "Random seed to use.", get_random_seed()); IMPKERNEL_END_INTERNAL_NAMESPACE IMPKERNEL_BEGIN_NAMESPACE ::boost::mt19937 random_number_generator( static_cast<boost::int64_t>(internal::random_seed)); AdvancedFlag<bool> run_quick_test( "run_quick_test", "Run (quicker) tests on the program." " Not all executables do useful things with this.", false); IMPKERNEL_END_NAMESPACE IMPKERNEL_BEGIN_INTERNAL_NAMESPACE
int main (int argc, char **argv) { const char *test_data_dir; const char *failure_dir_c; int total_failures_found; if (argc > 1) test_data_dir = argv[1]; else { fprintf (stderr, "Must specify a top_srcdir/test/data directory\n"); return 1; } total_failures_found = 0; total_attempts = 0; if (!_dbus_string_init (&failure_dir)) return 1; /* so you can leave it overnight safely */ #define MAX_FAILURES 1000 while (total_failures_found < MAX_FAILURES) { unsigned int seed; failures_this_iteration = 0; seed = get_random_seed (); _dbus_string_set_length (&failure_dir, 0); if (!_dbus_string_append (&failure_dir, "failures-")) return 1; if (!_dbus_string_append_uint (&failure_dir, seed)) return 1; failure_dir_c = _dbus_string_get_const_data (&failure_dir); if (mkdir (failure_dir_c, 0700) < 0) { if (errno != EEXIST) fprintf (stderr, "didn't mkdir %s: %s\n", failure_dir_c, strerror (errno)); } printf ("next seed = %u \ttotal failures %d of %d attempts\n", seed, total_failures_found, total_attempts); srand (seed); if (!dbus_internal_do_not_use_foreach_message_file (test_data_dir, find_breaks_based_on, NULL)) { fprintf (stderr, "fatal error iterating over message files\n"); rmdir (failure_dir_c); return 1; } printf (" did %d random mutations: %d %d %d %d %d %d %d\n", _DBUS_N_ELEMENTS (times_we_did_each_thing), times_we_did_each_thing[0], times_we_did_each_thing[1], times_we_did_each_thing[2], times_we_did_each_thing[3], times_we_did_each_thing[4], times_we_did_each_thing[5], times_we_did_each_thing[6]); printf ("Found %d failures with seed %u stored in %s\n", failures_this_iteration, seed, failure_dir_c); total_failures_found += failures_this_iteration; rmdir (failure_dir_c); /* does nothing if non-empty */ } return 0; }
// ZZZ: if in predictive mode, restore the saved partial game-state (it'd better take us back // to _exactly_ the same full game-state we saved earlier, else problems.) static void exit_predictive_mode() { if(sPredictedTicks > 0) { for(short i = 0; i < dynamic_world->player_count; i++) { player_data* player = get_player_data(i); assert(player->monster_index == sSavedPlayerData[i].monster_index); { // We *don't* restore this tiny part of the game-state back because // otherwise the player can't use [] to scroll the inventory panel. // [] scrolling happens outside the normal input/update system, so that's // enough to persuade me that not restoring this won't OOS any more often // than []-scrolling did before prediction. :) int16 saved_interface_flags = player->interface_flags; int16 saved_interface_decay = player->interface_decay; *player = sSavedPlayerData[i]; player->interface_flags = saved_interface_flags; player->interface_decay = saved_interface_decay; } if(sSavedPlayerData[i].monster_index != NONE) { assert(get_monster_data(sSavedPlayerData[i].monster_index)->object_index == sSavedPlayerMonsterData[i].object_index); *get_monster_data(sSavedPlayerData[i].monster_index) = sSavedPlayerMonsterData[i]; if(sSavedPlayerMonsterData[i].object_index != NONE) { assert(get_object_data(sSavedPlayerMonsterData[i].object_index)->parasitic_object == sSavedPlayerObjectData[i].parasitic_object); remove_object_from_polygon_object_list(sSavedPlayerMonsterData[i].object_index); *get_object_data(sSavedPlayerMonsterData[i].object_index) = sSavedPlayerObjectData[i]; // We have to defer this insertion since the object lists could still have other players // in their predictive locations etc. - we need to reconstruct everything exactly as it // was when we entered predictive mode. deferred_add_object_to_polygon_object_list(sSavedPlayerMonsterData[i].object_index, sSavedPlayerObjectNextObject[i]); if(sSavedPlayerObjectData[i].parasitic_object != NONE) *get_object_data(sSavedPlayerObjectData[i].parasitic_object) = sSavedPlayerParasiticObjectData[i]; } } } perform_deferred_polygon_object_list_manipulations(); sPredictedTicks = 0; // Sanity checking if(sSavedTickCount != dynamic_world->tick_count) logWarning2("saved tick count %d != dynamic_world->tick_count %d", sSavedTickCount, dynamic_world->tick_count); if(sSavedRandomSeed != get_random_seed()) logWarning2("saved random seed %d != get_random_seed() %d", sSavedRandomSeed, get_random_seed()); } }
void play_solo(Gameinfo *gameinfo, int moves) { SGFTree sgftree; int passes = 0; /* num. consecutive passes */ float move_value; double t1, t2; int save_moves = moves; struct stats_data totalstats; int total_owl_count = 0; /* It tends not to be very imaginative in the opening, * so we scatter a few stones randomly to start with. * We add two random numbers to reduce the probability * of playing stones near the edge. */ int n = 6 + 2*gg_rand()%5; int i, j; komi = 5.5; sgftree_clear(&sgftree); sgftreeCreateHeaderNode(&sgftree, board_size, komi, handicap); sgf_write_header(sgftree.root, 1, get_random_seed(), 5.5, handicap, get_level(), chinese_rules); /* Generate some random moves. */ if (board_size > 6) { do { do { i = (gg_rand() % 4) + (gg_rand() % (board_size - 4)); j = (gg_rand() % 4) + (gg_rand() % (board_size - 4)); } while (!is_allowed_move(POS(i, j), gameinfo->to_move)); gnugo_play_move(POS(i, j), gameinfo->to_move); sgftreeAddPlay(&sgftree, gameinfo->to_move, i, j); sgftreeAddComment(&sgftree, "random move"); gameinfo->to_move = OTHER_COLOR(gameinfo->to_move); } while (--n > 0); } t1 = gg_cputime(); memset(&totalstats, '\0', sizeof(totalstats)); while (passes < 2 && --moves >= 0) { int move; reset_owl_node_counter(); move = genmove(gameinfo->to_move, &move_value, NULL); gnugo_play_move(move, gameinfo->to_move); sgffile_add_debuginfo(sgftree.lastnode, move_value); sgftreeAddPlay(&sgftree, gameinfo->to_move, I(move), J(move)); sgffile_output(&sgftree); gameinfo->to_move = OTHER_COLOR(gameinfo->to_move); if (move == PASS_MOVE) { passes++; printf("%s(%d): Pass\n", gameinfo->to_move == BLACK ? "Black" : "White", movenum); } else { passes = 0; gprintf("%s(%d): %1m\n", gameinfo->to_move == BLACK ? "Black" : "White", movenum, move); } totalstats.nodes += stats.nodes; totalstats.read_result_entered += stats.read_result_entered; totalstats.read_result_hits += stats.read_result_hits; totalstats.trusted_read_result_hits += stats.trusted_read_result_hits; total_owl_count += get_owl_node_counter(); } t2 = gg_cputime(); /* Two passes and it's over. (EMPTY == BOTH) */ who_wins(EMPTY, stdout); { float score = gnugo_estimate_score(NULL, NULL); sgfWriteResult(sgftree.root, score, 1); } sgffile_output(&sgftree); printf("%10d moves played in %0.3f seconds\n", save_moves-moves, t2-t1); if (save_moves != moves) printf("%10.3f seconds/move\n", (t2-t1)/(save_moves-moves)); printf("%10d nodes\n", totalstats.nodes); printf("%10d read results entered\n", totalstats.read_result_entered); printf("%10d read result hits\n", totalstats.read_result_hits); printf("%10d trusted read result hits\n", totalstats.trusted_read_result_hits); printf("%10d owl nodes\n", total_owl_count); }
void update_params_wmm_sta(UWORD8 *msa, UWORD16 rx_len, UWORD16 index, UWORD8 sub_type) { /* Check if the WMM Parameter element is present in the frame */ while(index < (rx_len - FCS_LEN)) { /* WMM Parameter Element Format */ /* ----------------------------------------------------------------- */ /* |OUI |OUI Type |OUI Subtype |Version |QoS Info |Resd |AC Params | */ /* ----------------------------------------------------------------- */ /* |3 |1 |1 |1 |1 |1 |16 | */ /* ----------------------------------------------------------------- */ if(is_wmm_param_elem(msa + index) == BTRUE) { UWORD8 set_count = 0; UWORD8 i = 0; /* Increment the index to point to the QoS Info field */ index += 8; /* Read the EDCA parameter set count value from the frame */ set_count = msa[index] & 0x0F; /* If the received frame is a beacon check the EDCA parameter */ /* set update count before updation. If the count saved at STA */ /* matches the current set count sent by the AP, no updation is */ /* required. Do nothing and return. */ if((sub_type == BEACON) && (mget_EDCAParameterSetUpdateCount() == set_count)) return; /* Increment the index to point to the AC Params field */ index += 2; /* Update EDCA parameters for all the access categories */ for(i = 0; i < NUM_AC; i++) { update_ac_param_record_sta(&msa[index]); index += AC_PARAM_REC_LEN; } /* Update the current EDCA parameter set update count to the new */ /* value received. */ mset_EDCAParameterSetUpdateCount(set_count); /* Update the MAC H/w registers for the same */ update_edca_machw(); #ifdef AUTORATE_FEATURE /* Re-initialize the transmit rate based on the updated EDCA */ /* parameters. */ update_per_entry_rate_idx(); #endif /* AUTORATE_FEATURE */ return; } index += (2 + msa[index + 1]); } /* Disable WMM if AP is not WMM capable */ if(sub_type == ASSOC_RSP) { disable_machw_edca(); set_wmm_enabled(BFALSE); /* Program default EDCA parameters for AC_VO queue when AP is not */ /* WMM capable. */ set_machw_aifsn(); set_machw_cw(get_cwmax(), get_cwmin()); set_machw_prng_seed_val(get_random_seed()); } }