/**************************************************************************** NAME configManagerHFP_SupportedFeatures DESCRIPTION Gets the HFP Supported features set from PS RETURNS void */ void configManagerHFP_SupportedFeatures( void ) { uint16 lConfigID = get_config_id ( PSKEY_CONFIGURATION_ID ) ; ConfigRetrieve( lConfigID , PSKEY_ADDITIONAL_HFP_SUPPORTED_FEATURES , &theHeadset.HFP_supp_features , sizeof( HFP_features_type ) ) ; if ( ! theHeadset.HFP_supp_features.HFP_Version ) { /*then set the defaults*/ theHeadset.HFP_supp_features.HFP_Version = headset_hfp_version_1_0 ; theHeadset.HFP_supp_features.supportedSyncPacketTypes = (sync_hv1 | sync_hv2 | sync_hv3) ; } else { /*make sure the mask we have read in is within range*/ uint16 lAllPktTypes = ( sync_hv1 | sync_hv2 | sync_hv3 | sync_ev3 | sync_ev4 | sync_ev5 | sync_2ev3 | sync_3ev3 | sync_2ev5 | sync_3ev5 ) ; uint16 lPSPktTypes = theHeadset.HFP_supp_features.supportedSyncPacketTypes ; CONF_DEBUG(("CONF: Feat[%x]&[%x] = [%x]\n" , lAllPktTypes , lPSPktTypes , (lAllPktTypes & lPSPktTypes) )) ; theHeadset.HFP_supp_features.supportedSyncPacketTypes = (lAllPktTypes & lPSPktTypes) ; } }
/* get_config_gfx_driver: * Helper function for set_gfx_mode: it reads the gfx_card* config variables and * tries to set the graphics mode if a matching driver is found. Returns TRUE if * at least one matching driver was found, FALSE otherwise. */ static int get_config_gfx_driver(char *gfx_card, int w, int h, int v_w, int v_h, int flags, _DRIVER_INFO *driver_list) { char buf[512], tmp[64]; GFX_DRIVER *drv; int found = FALSE; int card, n; /* try the drivers that are listed in the config file */ for (n=-2; n<255; n++) { switch (n) { case -2: /* example: gfx_card_640x480x16 = */ uszprintf(buf, sizeof(buf), uconvert_ascii("%s_%dx%dx%d", tmp), gfx_card, w, h, _color_depth); break; case -1: /* example: gfx_card_24bpp = */ uszprintf(buf, sizeof(buf), uconvert_ascii("%s_%dbpp", tmp), gfx_card, _color_depth); break; case 0: /* example: gfx_card = */ uszprintf(buf, sizeof(buf), uconvert_ascii("%s", tmp), gfx_card); break; default: /* example: gfx_card1 = */ uszprintf(buf, sizeof(buf), uconvert_ascii("%s%d", tmp), gfx_card, n); break; } card = get_config_id(uconvert_ascii("graphics", tmp), buf, 0); if (card) { drv = get_gfx_driver_from_id(card, driver_list); if (drv && gfx_driver_is_valid(drv, flags)) { found = TRUE; screen = init_gfx_driver(drv, w, h, v_w, v_h); if (screen) break; } } else { /* Stop searching the gfx_card#n (n>0) family at the first missing member, * except gfx_card1 which could have been identified with gfx_card. */ if (n > 1) break; } } return found; }
/**************************************************************************** NAME get_service_record DESCRIPTION This function is called to get a special service record associated with a given configuration RETURNS a pointer to the service record */ uint8 * get_service_record ( void ) { uint16 lIndex = get_config_id(PSKEY_CONFIGURATION_ID); uint8 * lServiceRecord = (uint8*) default_service_records[lIndex] ; DEBUG(("CONF: Service_Record[%d][%d]\n",lIndex , (int)lServiceRecord)) ; return lServiceRecord ; }
/**************************************************************************** NAME get_service_record_length DESCRIPTION This function is called to get the length of a special service record associated with a given configuration RETURNS the length of the service record */ uint16 get_service_record_length ( void ) { uint16 lIndex = get_config_id(PSKEY_CONFIGURATION_ID); uint16 lLength = 0 ; if (default_service_record_lengths[lIndex]) { lLength = *default_service_record_lengths[lIndex] ; } DEBUG(("CONF: Service Record Len = [%d]\n", lLength)) ; return lLength ; }
/* load_joystick_data: * Restores a set of joystick calibration data previously saved by * save_joystick_data(). */ int load_joystick_data(char *filename) { int ret, c; joy_loading = TRUE; if (_joystick_installed) remove_joystick(); if (filename) { push_config_state(); set_config_file(filename); } joy_type = get_config_id("joystick", "joytype", -1); if (joy_type < 0) { joy_type = JOY_TYPE_NONE; ret = -1; } else { ret = install_joystick(joy_type); if (ret == 0) { if (joystick_driver->load_data) ret = joystick_driver->load_data(); } } if (filename) pop_config_state(); if (ret == 0) { for (c=0; c<num_joysticks; c++) update_calib(c); poll_joystick(); } joy_loading = FALSE; return ret; }
void configManagerInit( void ) { /* use a memory allocation for the lengths data to reduce stack usage */ lengths_config_type * keyLengths = mallocPanic(sizeof(lengths_config_type)); /*get the config ID**/ uint16 lConfigID = get_config_id ( PSKEY_CONFIGURATION_ID ) ; /* Read key lengths */ configManagerKeyLengths(lConfigID, keyLengths); /* Allocate the memory required for the configuration data */ InitConfigMemory_1(keyLengths); /* Read and configure the button durations */ configManagerButtonDurations(lConfigID ); #ifndef T3ProductionTest /* Read the system event configuration and configure the buttons */ configManagerButtons(lConfigID ); #endif /*configures the pattern button events*/ configManagerButtonPatterns(lConfigID ) ; /*Read and configure the event tones*/ configManagerEventTones( lConfigID, keyLengths->no_tones ) ; /* Read and configure the system features */ configManagerFeatureBlock( lConfigID ); /* Read and configure the user defined tones */ configManagerUserDefinedTones( lConfigID, keyLengths->userTonesLength ); #ifdef ROM_LEDS /* Read and configure the LEDs */ configManagerLEDS(lConfigID); #endif /* Read and configure the voume settings */ configManagerVolume( lConfigID ); /* Read and configure the automatic switch off time*/ configManagerConfiguration( lConfigID ); /* Read and configure the power management system */ configManagerPower( lConfigID ); /* Read and configure the radio parameters */ configManagerRadio( lConfigID ); #ifdef BHC612 /* Read and configure the volume orientation, LED Disable state, and tts_language */ configManagerReadSessionData ( lConfigID ) ; #else configManagerReadSessionData ( lConfigID ) ; #endif #ifdef T3ProductionTest configManagerButtons(lConfigID ); #endif /* Read and configure the sniff sub-rate parameters */ configManagerSetupSsr ( lConfigID ) ; configManagerEventTTSPhrases( lConfigID, keyLengths->no_tts ) ; configManagerVoicePromptsInit( lConfigID, keyLengths->no_vp , keyLengths->no_tts_languages ); /* release the memory used for the lengths key */ free(keyLengths); }
/**************************************************************************** NAME configManagerHFP_Init DESCRIPTION Gets the HFP initialisation parameters from PS RETURNS void */ void configManagerHFP_Init( hfp_init_params * hfp_params ) { uint16 lConfigID = get_config_id ( PSKEY_CONFIGURATION_ID ) ; ConfigRetrieve( lConfigID , PSKEY_HFP_INIT , hfp_params , sizeof( hfp_init_params ) ) ; }
/* install_mouse: * Installs the Allegro mouse handler. You must do this before using any * other mouse functions. Return -1 if it can't find a mouse driver, * otherwise the number of buttons on the mouse. */ int install_mouse(void) { _DRIVER_INFO *driver_list; int num_buttons = -1; int config_num_buttons; AL_CONST char *emulate; char tmp1[64], tmp2[64]; int i; if (mouse_driver) return 0; LOCK_VARIABLE(mouse_driver); LOCK_VARIABLE(mousedrv_none); LOCK_VARIABLE(mouse_x); LOCK_VARIABLE(mouse_y); LOCK_VARIABLE(mouse_z); LOCK_VARIABLE(mouse_w); LOCK_VARIABLE(mouse_b); LOCK_VARIABLE(mouse_pos); LOCK_VARIABLE(_mouse_x); LOCK_VARIABLE(_mouse_y); LOCK_VARIABLE(_mouse_z); LOCK_VARIABLE(_mouse_w); LOCK_VARIABLE(_mouse_b); LOCK_VARIABLE(_mouse_on); LOCK_VARIABLE(mon); LOCK_VARIABLE(emulate_three); LOCK_VARIABLE(freeze_mouse_flag); LOCK_VARIABLE(mouse_callback); LOCK_VARIABLE(mouse_x_focus); LOCK_VARIABLE(mouse_y_focus); LOCK_VARIABLE(mouse_sprite); LOCK_VARIABLE(_mouse_pointer); LOCK_VARIABLE(_mouse_screen); LOCK_VARIABLE(mx); LOCK_VARIABLE(my); LOCK_VARIABLE(ms); LOCK_VARIABLE(mtemp); LOCK_VARIABLE(mouse_polled); LOCK_VARIABLE(mouse_semaphore); LOCK_VARIABLE(cursors); LOCK_FUNCTION(draw_mouse_doublebuffer); LOCK_FUNCTION(draw_mouse); LOCK_FUNCTION(update_mouse); LOCK_FUNCTION(mouse_move); LOCK_FUNCTION(poll_mouse); LOCK_FUNCTION(mouse_needs_poll); LOCK_FUNCTION(_handle_mouse_input); /* Construct mouse pointers */ if (!default_cursors[MOUSE_CURSOR_ARROW]) default_cursors[MOUSE_CURSOR_ARROW] = create_mouse_pointer(mouse_arrow_data); if (!default_cursors[MOUSE_CURSOR_BUSY]) default_cursors[MOUSE_CURSOR_BUSY] = create_mouse_pointer(mouse_busy_data); if (!default_cursors[MOUSE_CURSOR_QUESTION]) default_cursors[MOUSE_CURSOR_QUESTION] = create_mouse_pointer(mouse_arrow_data); if (!default_cursors[MOUSE_CURSOR_EDIT]) default_cursors[MOUSE_CURSOR_EDIT] = create_mouse_pointer(mouse_arrow_data); cursors[MOUSE_CURSOR_ARROW] = default_cursors[MOUSE_CURSOR_ARROW]; cursors[MOUSE_CURSOR_BUSY] = default_cursors[MOUSE_CURSOR_BUSY]; cursors[MOUSE_CURSOR_QUESTION] = default_cursors[MOUSE_CURSOR_QUESTION]; cursors[MOUSE_CURSOR_EDIT] = default_cursors[MOUSE_CURSOR_EDIT]; if (system_driver->mouse_drivers) driver_list = system_driver->mouse_drivers(); else driver_list = _mouse_driver_list; if (_mouse_type == MOUSEDRV_AUTODETECT) _mouse_type = get_config_id(uconvert_ascii("mouse", tmp1), uconvert_ascii("mouse", tmp2), MOUSEDRV_AUTODETECT); if (_mouse_type != MOUSEDRV_AUTODETECT) { for (i=0; driver_list[i].driver; i++) { if (driver_list[i].id == _mouse_type) { mouse_driver = driver_list[i].driver; break; } } } if (mouse_driver) { mouse_driver->name = mouse_driver->desc = get_config_text(mouse_driver->ascii_name); num_buttons = mouse_driver->init(); } else { for (i=0; num_buttons<0; i++) { if (!driver_list[i].driver) break; mouse_driver = driver_list[i].driver; mouse_driver->name = mouse_driver->desc = get_config_text(mouse_driver->ascii_name); num_buttons = mouse_driver->init(); } } if (num_buttons < 0) { mouse_driver = NULL; return -1; } config_num_buttons = get_config_int(uconvert_ascii("mouse", tmp1), uconvert_ascii("num_buttons", tmp2), -1); emulate = get_config_string(uconvert_ascii("mouse", tmp1), uconvert_ascii("emulate_three", tmp2), NULL); /* clamp config_num_buttons to zero/positive values */ if (config_num_buttons >= 0) num_buttons = config_num_buttons; if ((emulate) && ((i = ugetc(emulate)) != 0)) { if ((i == 'y') || (i == 'Y') || (i == '1')) emulate_three = TRUE; else emulate_three = FALSE; } else { emulate_three = FALSE; } mouse_polled = (mouse_driver->poll) ? TRUE : FALSE; _mouse_installed = TRUE; disable_hardware_cursor(); set_mouse_etc(); _add_exit_func(remove_mouse, "remove_mouse"); if (mouse_driver->timer_poll) install_int(mouse_move, 10); return num_buttons; }
/* _install_allegro: * Initialises the Allegro library, activating the system driver. */ static int _install_allegro(int system_id, int *errno_ptr, int (*atexit_ptr)(void (*func)(void))) { RGB black_rgb = {0, 0, 0, 0}; char tmp1[64], tmp2[64]; int i; #ifndef ALLEGRO_USE_CONSTRUCTOR /* call constructor functions manually */ extern void _initialize_datafile_types(); extern void _midi_constructor(); extern void _mouse_constructor(); _initialize_datafile_types(); _midi_constructor(); _mouse_constructor(); _register_bitmap_file_type_init(); _register_sample_file_type_init(); _register_font_file_type_init(); #endif if (errno_ptr) allegro_errno = errno_ptr; else allegro_errno = &errno; /* set up default palette structures */ for (i=0; i<256; i++) black_palette[i] = black_rgb; for (i=16; i<256; i++) desktop_palette[i] = desktop_palette[i & 15]; /* lock some important variables */ LOCK_VARIABLE(screen); LOCK_VARIABLE(gfx_driver); LOCK_VARIABLE(gfx_capabilities); LOCK_VARIABLE(_last_bank_1); LOCK_VARIABLE(_last_bank_2); LOCK_VARIABLE(_gfx_bank); LOCK_VARIABLE(_drawing_mode); LOCK_VARIABLE(_drawing_pattern); LOCK_VARIABLE(_drawing_x_anchor); LOCK_VARIABLE(_drawing_y_anchor); LOCK_VARIABLE(_drawing_x_mask); LOCK_VARIABLE(_drawing_y_mask); LOCK_VARIABLE(_current_palette); LOCK_VARIABLE(os_type); /* nasty stuff to set up the config system before the system driver */ system_driver = _system_driver_list[0].driver; /* needed in case set_config_file was called before allegro_init */ _reload_config(); reload_config_texts(NULL); if (system_id == SYSTEM_AUTODETECT) system_id = get_config_id(uconvert_ascii("system", tmp1), uconvert_ascii("system", tmp2), SYSTEM_AUTODETECT); system_driver = NULL; /* initialise the system driver */ usetc(allegro_error, 0); for (i=0; _system_driver_list[i].driver; i++) { if ((_system_driver_list[i].id == system_id) || ((_system_driver_list[i].autodetect) && (system_id == SYSTEM_AUTODETECT))) { system_driver = _system_driver_list[i].driver; system_driver->name = system_driver->desc = get_config_text(system_driver->ascii_name); if (system_driver->init() != 0) { system_driver = NULL; if (system_id != SYSTEM_AUTODETECT) break; } else break; } } if (!system_driver) return -1; /* disable close button */ set_close_button_callback(NULL); /* detect CPU type */ check_cpu(); #if defined(ALLEGRO_UNIX) || defined(ALLEGRO_WINDOWS) /* detect filename encoding used by libc */ /* XXX This should be done for all platforms but I'm not set up to check * that all platforms have been covered before making the 4.2.3 release. * --pw */ _al_detect_filename_encoding(); #endif /* set up screensaver policy */ _screensaver_policy = get_config_int(uconvert_ascii("system", tmp1), uconvert_ascii("disable_screensaver", tmp2), FULLSCREEN_DISABLED); /* install shutdown handler */ if (_allegro_count == 0) { if (atexit_ptr) atexit_ptr(allegro_exit_stub); } _allegro_count++; TRACE(PREFIX_I "Allegro initialised (instance %d)\n", _allegro_count); return 0; }