Beispiel #1
0
void configManagerSqifPartitionsInit( void )
{
    /* read currently free SQIF partitions */                          
    uint16 ret_len = 0;
    uint16 partition_data = 0;
 
    /* Read partition information from PS */
    ret_len = PsRetrieve(PSKEY_SQIF_PARTITIONS, &partition_data, sizeof(uint16));
     
    if(!ret_len)
    {            
        /* no key present - assume all partitions are in use */
        theSink.rundata->partitions_free = 0;
    }
    else
    {
        theSink.rundata->partitions_free = LOWORD(partition_data);
    }
    
    CONF_DEBUG(("CONF : Current SQIF partitions free 0x%x \n", theSink.rundata->partitions_free));
    
    /* Check that the currently selected languages partition is available */
    if((1<<theSink.tts_language) & theSink.rundata->partitions_free)
    {
        uint16 currentLang = theSink.tts_language;
        CONF_DEBUG(("CONF : Current SQIF VP partition (%u) not valid\n", currentLang));
        TTSSelectTTSLanguageMode();
        /* if the new selected language is the same then none could be found so disable TTS */
        if (currentLang == theSink.tts_language)
        {
            theSink.tts_enabled = FALSE;
            CONF_DEBUG(("CONF : Disabling TTS, no valid VP partitions\n"));
        }
    }
}
Beispiel #2
0
/****************************************************************************
NAME 
  	configManagerButtonPatterns

DESCRIPTION
  	Read and configure any buttonpattern matches that exist
 
RETURNS

*/
static void configManagerButtonPatterns( void ) 
{  
      		/* Allocate enough memory to hold event configuration */
    button_pattern_config_type* config = (button_pattern_config_type*) mallocPanic(BM_NUM_BUTTON_MATCH_PATTERNS * sizeof(button_pattern_config_type));
   
    CONF_DEBUG(("Co: No Button Patterns - %d\n", BM_NUM_BUTTON_MATCH_PATTERNS));
   
        /* Now read in event configuration */
    if(config)
    {     
        if(ConfigRetrieve(theSink.config_id , PSKEY_BUTTON_PATTERN_CONFIG, config, BM_NUM_BUTTON_MATCH_PATTERNS * sizeof(button_pattern_config_type)))
        {
            uint16 n;
     
           /* Now we have the event configuration, map required events to system events */
            for(n = 0; n < BM_NUM_BUTTON_MATCH_PATTERNS ; n++)
            {	 
     	      CONF_DEBUG(("Co : AddPattern Ev[%x]\n", config[n].event )) ;
                        
          			   /* Map PIO button event to system events in specified states */
          	    buttonManagerAddPatternMapping ( theSink.theButtonsTask , config[n].event , config[n].pattern, n ) ;
            }
        }
        else
 	    {
 	      CONF_DEBUG(("Co: !EvLen\n")) ;
        }
        freePanic(config) ;
    }    
}
Beispiel #3
0
/****************************************************************************
NAME 
 	configManagerEnableMultipoint
*/ 
void configManagerEnableMultipoint(bool enable)
{
    CONF_DEBUG(("CONF: Multipoint %s\n", enable ? "Enable" : "Disable"));
    if(enable)
    {
        /* Check we can make HFP multi point */
        if(HfpLinkSetMaxConnections(2))
        {
            /* If A2DP disabled or we can make it multi point then we're done */
            if(!theSink.features.EnableA2dpStreaming || A2dpConfigureMaxRemoteDevices(2))
            {
                CONF_DEBUG(("CONF: Success\n"));
                theSink.MultipointEnable = TRUE;
                return;
            }
        }
    }
    else
    {
        /* Check we can make HFP single point */
        if(HfpLinkSetMaxConnections(1))
        {
            /* If A2DP disabled or we can make it single point then we're done */
            if(!theSink.features.EnableA2dpStreaming || A2dpConfigureMaxRemoteDevices(1))
            {
                CONF_DEBUG(("CONF: Success\n"));
                theSink.MultipointEnable = FALSE;
                return;
            }
        }
    }
    CONF_DEBUG(("CONF: Failed\n"));
    /* Setting failed, make sure HFP setting is restored */
    HfpLinkSetMaxConnections(theSink.MultipointEnable ? 2 : 1);
}
/*************************************************************************
NAME    
    ConfigManagerSetupSsr
    
DESCRIPTION
    This function attempts to retreive SSR parameters from the PS, setting
	them to zero if none are found

RETURNS

*/
static void configManagerSetupSsr( uint16 pConfigID  ) 
{
	CONF_DEBUG(("CO: SSR\n")) ;

	/* Get the SSR params from the PS/Config if there */
	if(!ConfigRetrieve(pConfigID , PSKEY_SSR_PARAMS, theHeadset.ssr_data, sizeof(subrate_t)))
	{
		CONF_DEBUG(("CO: SSR Defaults\n")) ;
		/* If we failed to read in params then set the pointer to NULL */
		theHeadset.ssr_data = NULL;
	}
}
Beispiel #5
0
/*************************************************************************
NAME    
    ConfigManagerSetupSsr
    
DESCRIPTION
    This function attempts to retreive SSR parameters from the PS, setting
	them to zero if none are found

RETURNS

*/
static void configManagerSetupSsr( void  ) 
{
	CONF_DEBUG(("CO: SSR\n")) ;

	/* Get the SSR params from the PS/Config */
	ConfigRetrieve(theSink.config_id , PSKEY_SSR_PARAMS, &theSink.conf2->ssr_data, sizeof(subrate_t));
}
Beispiel #6
0
/****************************************************************************
NAME 
 	configManagerWriteSessionData

*/ 
void configManagerWriteSessionData( void )
{
    session_data_type lTemp ;

    lTemp.vol_orientation   = theSink.gVolButtonsInverted;
    lTemp.led_disable       = theSink.theLEDTask->gLEDSEnabled;
	lTemp.tts_language      = theSink.tts_language;
    lTemp.tts_enable        = theSink.tts_enabled;
    lTemp.multipoint_enable = theSink.MultipointEnable;
    lTemp.iir_enable        = theSink.iir_enabled ;
    lTemp.lbipm_enable      = theSink.lbipmEnable;
    lTemp.ssr_enabled       = theSink.ssr_enabled;
    lTemp.eq                = 0;
    lTemp.unused            = 0;
    lTemp.audio_enhancements = ((theSink.a2dp_link_data->a2dp_audio_mode_params.music_mode_processing - A2DP_MUSIC_PROCESSING_FULL_SET_EQ_BANK0) & A2DP_MUSIC_CONFIG_USER_EQ_SELECT)|
                               (theSink.a2dp_link_data->a2dp_audio_mode_params.music_mode_enhancements & ~A2DP_MUSIC_CONFIG_USER_EQ_SELECT);
#ifdef ENABLE_FM
    lTemp.fm_frequency      = theSink.conf2->sink_fm_data.fmRxTunedFreq;
#else
    lTemp.fm_frequency = 0;
#endif    

    CONF_DEBUG(("CONF : PS Write Vol Inverted[%c], LED Disable [%c], Multipoint Enable [%c], IIR Enable [%c], LBIPM Enable [%c] Enhancements[%x]\n" , 
						theSink.gVolButtonsInverted ? 'T':'F' , 
						lTemp.led_disable ? 'T':'F',
                        theSink.MultipointEnable ? 'T':'F',
                        theSink.iir_enabled ? 'T':'F',
                        theSink.lbipmEnable ? 'T':'F',
                        lTemp.audio_enhancements));
    
    (void) PsStore(PSKEY_VOLUME_ORIENTATION, &lTemp, sizeof(session_data_type)); 
    
}
/****************************************************************************
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) ;
    }
}
Beispiel #8
0
void configManagerRestoreDefaults( void ) 
{
    CONF_DEBUG(("CO: Restore Defaults\n")) ;
    /*Set local values*/
	theSink.gVolButtonsInverted = FALSE ;
    
    theSink.tts_language = 0 ;
    theSink.tts_enabled = TRUE;
    configManagerEnableMultipoint(FALSE);
    theSink.iir_enabled = FALSE  ;
    theSink.lbipmEnable = FALSE ;
    theSink.a2dp_link_data->a2dp_audio_mode_params.music_mode_processing = A2DP_MUSIC_PROCESSING_FULL;
    
	/*Reset PSKEYS*/
	(void)PsStore ( PSKEY_VOLUME_ORIENTATION , 0 , 0 ) ;
    
	/*Call function to reset the PDL*/
	deviceManagerRemoveAllDevices();
	
	if	(!(theSink.theLEDTask->gLEDSEnabled))
	{
		/*Enable the LEDs*/
		MessageSend (&theSink.task , EventEnableLEDS , 0) ;
	}
}
Beispiel #9
0
/****************************************************************************
NAME 
  	configManagerUserDefinedTones

DESCRIPTION
  	Attempt to read the user configured tones, if data exists it will be in the following format:
    
    uint16 offset in array to user tone 1,
    uint16 offset in array to user tone ....,
    uint16 offset in array to user tone 8,
    uint16[] user tone data
    
    To play a particular tone it can be access via gVariableTones, e.g. to access tone 1
    
    theSink.audioData.gConfigTones->gVariableTones[0] + (uint16)*theSink.audioData.gConfigTones->gVariableTones[0]
    
    or to access tone 2

    theSink.audioData.gConfigTones->gVariableTones[0] + (uint16)*theSink.audioData.gConfigTones->gVariableTones[1]
    
    and so on
 
RETURNS
  	void
*/
static void configManagerUserDefinedTones( uint16 KeyLength ) 
{
    /* if the keyLength is zero there are no user tones so don't malloc any memory */
    if(KeyLength)
    {
        /* malloc only enough memory to hold the configured tone data */
        uint16 * configTone = mallocPanic(KeyLength * sizeof(uint16));
    
        /* retrieve pskey data up to predetermined max size */
        uint16 size_ps_key = ConfigRetrieve( theSink.config_id, PSKEY_CONFIG_TONES , configTone , KeyLength );
      
        CONF_DEBUG(("Co : Configurable Tones Malloc size [%x]\n", KeyLength )) ;
        
        /* is there any configurable tone data, if present update pointer to tone data */
        if (size_ps_key)
        {
            /* the data is in the form of 8 x uint16 audio note start offsets followed by the 
               up to 8 lots of tone data */
            theSink.conf1->gConfigTones.gVariableTones = (ringtone_note*)&configTone[0];
        
        }
        /* no user configured tone data is available, so free previous malloc as not in use */
        else
        {
            /* no need to waste memory */
        	freePanic(configTone);      
        }
    }
    /* no tone data available, ensure data pointer is null */
    else
    {
            theSink.conf1->gConfigTones.gVariableTones = NULL;
    }
}
/****************************************************************************
NAME 
 	configManagerWriteSessionData

*/ 
void configManagerWriteSessionData( void )
{
    session_data_type lTemp ;

    lTemp.vol_orientation   = theHeadset.gVolButtonsInverted;
	
#ifdef ROM_LEDS	
    lTemp.led_disable       = theHeadset.theLEDTask->gLEDSEnabled;
#endif	

#ifdef Rubidium
    lTemp.tts_language      = Language;
	lTemp.Rubidium_enable	= 0;/*Enable*/
#else
    lTemp.tts_language      = theHeadset.tts_language;
#endif

    lTemp.multipoint_enable = theHeadset.MultipointEnable;

#ifdef ENABLE_ENERGY_FILTER
    lTemp.iir_enable        = theHeadset.iir_enabled ;
#endif

#ifdef T3ProductionTest

	lTemp.Productionflag	= theHeadset.ProductionData;

	CONF_DEBUG(("CONF : PS Write Vol Inverted[%c], LED Disable [%c], Multipoint Enable [%c], IIR Enable [%c]\n" , 
					theHeadset.gVolButtonsInverted ? 'T':'F' , 
					lTemp.led_disable ? 'T':'F',
					theHeadset.MultipointEnable ? 'T':'F',
					theHeadset.iir_enabled ? 'T':'F'));

#else
	lTemp.lbipm_enable      = theHeadset.lbipmEnable;
	CONF_DEBUG(("CONF : PS Write Vol Inverted[%c], LED Disable [%c], Multipoint Enable [%c], IIR Enable [%c], LBIPM Enable [%c]\n" , 
					theHeadset.gVolButtonsInverted ? 'T':'F' , 
					lTemp.led_disable ? 'T':'F',
					theHeadset.MultipointEnable ? 'T':'F',
					theHeadset.iir_enabled ? 'T':'F',
					theHeadset.lbipmEnable ? 'T':'F'));

#endif
	lTemp.unused = 0;

    (void) PsStore(PSKEY_VOLUME_ORIENTATION, &lTemp, sizeof(session_data_type)); 
}
void configManagerReset( void ) 
{
    CONF_DEBUG(("CO: Reset\n")) ;
       
        /* Delete the Connecction Libs Paired Device List */
    ConnectionSmDeleteAllAuthDevices(ATTRIBUTE_PSKEY_BASE);
	
}
Beispiel #12
0
/****************************************************************************
NAME 
  	configManagerDefragCheck

DESCRIPTION
  	Defrag PS if required.

RETURNS
  	void
*/
void configManagerDefragCheck(void)
{
    CONF_DEBUG(("CONF: Defrag Check ")) ;
    if(theSink.rundata->defrag.key_size)
    {
        uint16 count = PsFreeCount(theSink.rundata->defrag.key_size);
        CONF_DEBUG(("Enabled [%d] ", count)) ;
        if(count <= theSink.rundata->defrag.key_minimum)
        {
            CONF_DEBUG(("Flooding PS")) ;
            PsFlood();
            /* try to set the same boot mode; this triggers the target to reboot.*/
            BootSetMode(BootGetMode());
        }
    }
    CONF_DEBUG(("\n")) ;
}
static void InitConfigMemory_1(lengths_config_type * keyLengths)
{
    uint16 lSize = 0;
    uint16 *buffer;
    uint16 pos=0, pos1=0, pos2;
	uint16 no_tones = keyLengths->no_tones;
    
	/*** One memory slot ***/
	/* Allocate memory for Button data and volume mapping */
    pos  = sizeof(button_config_type);
    pos1 = pos + sizeof(ConfigTone_t);
    lSize = pos1 + (VOL_NUM_VOL_SETTINGS * sizeof(VolMapping_t) ); 
    
	buffer = mallocPanic( lSize );
	CONF_DEBUG(("INIT: Malloc size 1: [%d]\n",lSize));
    
	/* Store pointer to button task memory */
	theHeadset.buttons_duration = (button_config_type *)&buffer[0];
    /* The config tone */
	theHeadset.audioData.gConfigTones = (ConfigTone_t *)&buffer[pos];
	/* The volume configuaration */
	theHeadset.audioData.gVolMaps = (VolMapping_t *)&buffer[pos1];
    
    /* ***************************************************** */
    /*** One memory slot ***/
	/* Allocate memory for SSR data and Event Tone */
    /* Added PIO block and radio */
    pos = sizeof(subrate_t);
    pos1 = pos + ((no_tones +1) * sizeof(tone_config_type));
    pos2 = pos1 + sizeof(PIO_block_t);
    lSize = pos2 + sizeof(radio_config_type);
    
    buffer = mallocPanic( lSize );
 	CONF_DEBUG(("INIT: Malloc size 2: [%d]\n",lSize));   

    /* Store pointer to SSR data */
    theHeadset.ssr_data = (subrate_t *)&buffer[0];
    /* Hold event tone configuration */
    theHeadset.audioData.gEventTones = (HeadsetTone_t*)&buffer[pos];
    /* PIOs assigned to fixed events */
    theHeadset.PIO = (PIO_block_t*)&buffer[pos1];
    /* radio configuration data */
    theHeadset.radio = (radio_config_type*)&buffer[pos2];
}
/****************************************************************************
NAME 
  	configManagerButtonPatterns

DESCRIPTION
  	Read and configure any buttonpattern matches that exist
 
RETURNS

*/
static void configManagerButtonPatterns( uint16 pConfigID ) 
{  
      		/* Allocate enough memory to hold event configuration */
    button_pattern_config_type* config = (button_pattern_config_type*) mallocPanic(BM_NUM_BUTTON_MATCH_PATTERNS * sizeof(button_pattern_config_type));
   
    CONF_DEBUG(("Co: No Button Patterns - %d\n", BM_NUM_BUTTON_MATCH_PATTERNS));
   
        /* Now read in event configuration */
    if(config)
    {     
        if(ConfigRetrieve(pConfigID , PSKEY_BUTTON_PATTERN_CONFIG, config, BM_NUM_BUTTON_MATCH_PATTERNS * sizeof(button_pattern_config_type)))
        {
            uint16 n;
     
           /* Now we have the event configuration, map required events to system events */
            for(n = 0; n < BM_NUM_BUTTON_MATCH_PATTERNS ; n++)
            {	 
     	      CONF_DEBUG(("Co : AddPattern Ev[%x]\n", config[n].event )) ;

			  #ifdef BHC612
				if(n == 0)
				{
					config[0].event = 0x6000;
					config[0].pattern[0] = 2;/*Vol - */
					config[0].pattern[1] = 4;/*Talk*/
					config[0].pattern[2] = 1;/*Vol +*/
					config[0].pattern[3] = 6;/*Vol - & Talk*/
					config[0].pattern[4] = 5;/*Vol + & Talk*/
					config[0].pattern[5] = 2;/*Vol -*/
				}
			  #endif
                        
          			   /* Map PIO button event to system events in specified states */
          	    buttonManagerAddPatternMapping ( theHeadset.theButtonsTask , config[n].event , config[n].pattern, n ) ;
            }
        }
        else
 	    {
 	      CONF_DEBUG(("Co: !EvLen\n")) ;
        }
        free (config) ;
    }    
}
Beispiel #15
0
/****************************************************************************
NAME 
 	InitConfigMemoryAtCommands

DESCRIPTION
    Dynamically allocate memory slot for AT commands (conf3)
 
RETURNS
 	void
*/ 
static void InitConfigMemoryAtCommands(uint16 atCmdsKeyLength)
{    
	/* Allocate memory for supported custom AT commands, malloc one extra word to ensure 
       a string terminator is present should the data read from ps be incorrect */
    theSink.conf3 = mallocPanic( sizeof(config_block3_t) + atCmdsKeyLength + 1);
    /* ensure that all data is set as string terminator in case of incorrect pskey 
       data being read */
    memset(theSink.conf3, 0, (sizeof(config_block3_t) + atCmdsKeyLength + 1));
	CONF_DEBUG(("INIT: Malloc size %d:\n", sizeof(config_block3_t) + atCmdsKeyLength ));
}
Beispiel #16
0
void configManagerInitMemory( void )  
{ 
#ifdef DEBUG_CONFIG
    uint8 slot_count = 1;
#endif
	/* Allocate memory for run time data*/
    theSink.rundata = mallocPanic( sizeof(runtime_block1_t) );
    memset(theSink.rundata, 0, sizeof (runtime_block1_t));
	CONF_DEBUG(("INIT: Malloc size %d: [%d]\n",slot_count++,sizeof(runtime_block1_t)));    
   
}
Beispiel #17
0
/****************************************************************************
NAME 
 	configManagerPioMap

DESCRIPTION
    Read PIO config and map in configured PIOs.
 
RETURNS
 	void
*/ 
void configManagerPioMap(void)
{
    pio_config_type* pio;

	/* Allocate memory for Button data, volume mapping */
    theSink.conf1 = mallocPanic( sizeof(config_block1_t) );
    memset(theSink.conf1, 0, sizeof (config_block1_t));
	CONF_DEBUG(("INIT: Malloc size 1: [%d]\n",sizeof(config_block1_t)));    

    /* Retrieve config */
    pio = &theSink.conf1->PIOIO;
    ConfigRetrieve(theSink.config_id , PSKEY_PIO_BLOCK, pio, sizeof(pio_config_type));

    /* Make sure all references to mic parameters point to the right place */
    theSink.cvc_params.digital = &pio->digital;

    /* Map in any required pins */
    CONF_DEBUG(("INIT: Map PIO 0x%lX\n", pio->pio_map));
    PioSetMapPins32(pio->pio_map,pio->pio_map);
}
Beispiel #18
0
/****************************************************************************
NAME 
  	configManagerFillPs

DESCRIPTION
  	Fill PS to the point defrag is required (for testing only)

RETURNS
  	void
*/
void configManagerFillPs(void)
{
    CONF_DEBUG(("CONF: Fill PS ")) ;
    if(theSink.rundata->defrag.key_size)
    {
        uint16 count     = PsFreeCount(theSink.rundata->defrag.key_size);
        uint16* buff     = mallocPanic(theSink.rundata->defrag.key_size);
        CONF_DEBUG(("[%d] ", count));
        if(count > theSink.rundata->defrag.key_minimum)
        {
            for(count = count - theSink.rundata->defrag.key_minimum ; count > 0; count --)
            {
                *buff = count;
                PsStore(PSKEY_CONFIGURATION_ID, buff, theSink.rundata->defrag.key_size);
            }
            PsStore(PSKEY_CONFIGURATION_ID, &theSink.config_id, sizeof(uint16));
        }
        CONF_DEBUG(("[%d]", PsFreeCount(theSink.rundata->defrag.key_size)));
    }
    CONF_DEBUG(("\n"));
}
Beispiel #19
0
static void InitConfigMemory(lengths_config_type * keyLengths)
{    
	/* Allocate memory for SSR, PIO and radio data, and Event Tone */
    theSink.conf2 = mallocPanic( sizeof(config_block2_t) + (keyLengths->no_tones * sizeof(tone_config_type)) );
 	CONF_DEBUG(("INIT: Malloc size %d:\n", sizeof(config_block2_t) + (keyLengths->no_tones * sizeof(tone_config_type))));
    
    /* initialise the memory block to 0 */    
    memset(theSink.conf2,0,sizeof(config_block2_t) + (keyLengths->no_tones * sizeof(tone_config_type)));
    
    theSink.conf3 = NULL;
    
    /* Allocate memory for voice prompts config if required*/
    if(keyLengths->no_tts || keyLengths->no_vp)
    {
        theSink.conf4 = mallocPanic( sizeof(config_block4_t) + (keyLengths->no_tts * sizeof(tts_config_type)));
        CONF_DEBUG(("INIT: Malloc size %d:\n", sizeof(config_block4_t) + (keyLengths->no_tts * sizeof(tts_config_type))));
    }
    else
    {
        theSink.conf4 = NULL;
    }
}
Beispiel #20
0
static void configManagerButtons( void )
{  
	/* Allocate enough memory to hold event configuration */
    event_config_type* configA = (event_config_type*) mallocPanic(BM_EVENTS_PER_PS_BLOCK * sizeof(event_config_type));
    event_config_type* configB = (event_config_type*) mallocPanic(BM_EVENTS_PER_PS_BLOCK * sizeof(event_config_type));
    event_config_type* configC = (event_config_type*) mallocPanic(BM_EVENTS_PER_PS_BLOCK * sizeof(event_config_type));
       
    uint16 n;
    uint8  i = 0;
 
    ConfigRetrieve(theSink.config_id , PSKEY_EVENTS_A, configA, BM_EVENTS_PER_PS_BLOCK * sizeof(event_config_type)) ;
    ConfigRetrieve(theSink.config_id , PSKEY_EVENTS_B, configB, BM_EVENTS_PER_PS_BLOCK * sizeof(event_config_type)) ; 
    ConfigRetrieve(theSink.config_id , PSKEY_EVENTS_C, configC, BM_EVENTS_PER_PS_BLOCK * sizeof(event_config_type)) ;  
  
        /* Now we have the event configuration, map required events to system events */
    for(n = 0; n < BM_EVENTS_PER_PS_BLOCK; n++)
    { 
        CONF_DEBUG(("Co : AddMap indexes [%u,%u] Ev[%x][%x][%x]\n", n, i, configA[n].event , configB[n].event, configC[n].event )) ;
                       
           /* check to see if a valid pio mask is present, this includes the upper 2 bits of the state
              info as these are being used for bc5 as vreg enable and charger detect */
        if ( (configA[n].pio_mask)||(configA[n].state_mask & 0xC000))
            buttonManagerAddMapping ( &configA[n], i++ ); 
               
        if ( (configB[n].pio_mask)||(configB[n].state_mask & 0xC000))
            buttonManagerAddMapping ( &configB[n], i++ ); 
        
        if ( (configC[n].pio_mask)||(configC[n].state_mask & 0xC000))
            buttonManagerAddMapping ( &configC[n], i++ );         
                                                                 
   	}
    
    freePanic(configA) ;
    freePanic(configB) ; 
    freePanic(configC) ; 
    
    /* perform an initial pio check to see if any pio changes need processing following the completion
       of the configuration ps key reading */
    BMCheckButtonsAfterReadingConfig();


}
Beispiel #21
0
/****************************************************************************
NAME 
 	configManagerReadSessionData
*/ 
static void configManagerReadSessionData( void ) 
{
    session_data_type lTemp ;
   
    /*read in the volume orientation*/
    ConfigRetrieve( theSink.config_id , PSKEY_VOLUME_ORIENTATION , &lTemp , sizeof( session_data_type ) ) ;
  
    theSink.VolumeOrientationIsInverted = lTemp.vol_orientation ;
    /* if the feature bit to reset led disable state after a reboot is set then enable the leds
       otherwise get the led enable state from ps */
    if(!theSink.features.ResetLEDEnableStateAfterReset)
    {
        theSink.theLEDTask->gLEDSEnabled    = lTemp.led_disable ;
    }
    else
    {
        theSink.theLEDTask->gLEDSEnabled    = TRUE;   
    }  
            
    theSink.tts_language                = lTemp.tts_language;
    theSink.tts_enabled                 = lTemp.tts_enable;
    theSink.iir_enabled                 = lTemp.iir_enable;
    theSink.lbipmEnable                 = lTemp.lbipm_enable;
    theSink.ssr_enabled                 = lTemp.ssr_enabled;
    theSink.a2dp_link_data->a2dp_audio_mode_params.music_mode_processing = lTemp.eq;
    configManagerEnableMultipoint(lTemp.multipoint_enable);
    theSink.a2dp_link_data->a2dp_audio_mode_params.music_mode_processing = (A2DP_MUSIC_PROCESSING_FULL_SET_EQ_BANK0 + (lTemp.audio_enhancements & A2DP_MUSIC_CONFIG_USER_EQ_SELECT));
    theSink.a2dp_link_data->a2dp_audio_mode_params.music_mode_enhancements = (lTemp.audio_enhancements & ~A2DP_MUSIC_CONFIG_USER_EQ_SELECT);
#ifdef ENABLE_FM
    theSink.conf2->sink_fm_data.fmRxTunedFreq = lTemp.fm_frequency;
#endif                                                
    CONF_DEBUG(("CONF : Rd Vol Inverted [%c], LED Disable [%c], Multipoint Enable [%c], IIR Enable [%c], LBIPM Enable [%c] EQ[%x]\n", theSink.VolumeOrientationIsInverted ? 'T':'F' ,
 																							 lTemp.led_disable ? 'T':'F' ,
        																					 theSink.MultipointEnable ? 'T':'F',
                                                                                             theSink.iir_enabled ? 'T':'F',
                                                                                             theSink.lbipmEnable ? 'T':'F',
                                                                                             theSink.a2dp_link_data->a2dp_audio_mode_params.music_mode_processing)) ; 
    
    
}
void configManagerRestoreDefaults( void ) 
{
#ifdef ChineseTTS
	configManagerReadSessionData(0);
#else

    CONF_DEBUG(("CO: Restore Defaults\n")) ;
    /*Set local values*/
	theHeadset.gVolButtonsInverted = FALSE ;
    
    theHeadset.tts_language = FALSE ;
    theHeadset.MultipointEnable = FALSE ;
#ifdef ENABLE_ENERGY_FILTER
    theHeadset.iir_enabled = FALSE  ;
#endif

#ifdef T3ProductionTest
	theHeadset.ProductionData = 0;
#else
	theHeadset.lbipmEnable = FALSE ;
#endif
    
	/*Reset PSKEYS*/
	(void)PsStore ( PSKEY_VOLUME_ORIENTATION , 0 , 0 ) ;
    
	/*Call function to reset the PDL*/
	configManagerReset();
	
#ifdef ROM_LEDS
	if	(!(theHeadset.theLEDTask->gLEDSEnabled))
	{
		/*Enable the LEDs*/
		MessageSend (&theHeadset.task , EventEnableLEDS , 0) ;
	}
#endif
#endif
}
/****************************************************************************
NAME 
 	configManagerReadSessionData
*/ 
static void configManagerReadSessionData( uint16 pConfig ) 
{
    session_data_type lTemp ;
   
    /*read in the volume orientation*/
    ConfigRetrieve( pConfig , PSKEY_VOLUME_ORIENTATION , &lTemp , sizeof( uint16 ) ) ;
  
    theHeadset.VolumeOrientationIsInverted = lTemp.vol_orientation ;
#ifdef ROM_LEDS
    /* if the feature bit to reset led disable state after a reboot is set then enable the leds
       otherwise get the led enable state from ps */
    if(!theHeadset.features.ResetLEDEnableStateAfterReset)
    {
        theHeadset.theLEDTask->gLEDSEnabled    = lTemp.led_disable ;
    }
    else
    {
        theHeadset.theLEDTask->gLEDSEnabled    = TRUE;   
    }
#endif	

#ifdef Rubidium
	
	/*theHeadset.Rubi_enable : 0 /1 (Rubidium TTS/ASR Enable/Disable)*/
	theHeadset.Rubi_enable = lTemp.Rubidium_enable;

    /*theHeadset.tts_language                = Language;*/    
    Language = lTemp.tts_language;
	theHeadset.tts_language = 0;

#ifdef Three_Language
	if((Language != AUDIO_TTS_LANGUAGE_AMERICAN_ENGLISH) && (Language != AUDIO_TTS_LANGUAGE_SPANISH_EUROPEAN) && (Language != AUDIO_TTS_LANGUAGE_FRENCH))
#else
	#ifdef MANDARIN_SUPPORT
	if((Language != AUDIO_TTS_LANGUAGE_AMERICAN_ENGLISH) &&  (Language != AUDIO_TTS_LANGUAGE_CHINESE_MANDARIN))
	#else
    if((Language != AUDIO_TTS_LANGUAGE_AMERICAN_ENGLISH) &&  (Language != AUDIO_TTS_LANGUAGE_SPANISH_EUROPEAN))
	#endif
#endif
	{	
    	CONF_DEBUG(("TTS : Reset default...%d\n",Language));
		#ifdef MANDARIN_SUPPORT
		Language = AUDIO_TTS_LANGUAGE_CHINESE_MANDARIN;
		#else
		Language = AUDIO_TTS_LANGUAGE_AMERICAN_ENGLISH;
		#endif
		
		theHeadset.tts_language = 0;
    }

#else
    theHeadset.tts_language                = lTemp.tts_language;      
#endif

    theHeadset.MultipointEnable            = lTemp.multipoint_enable; 

#ifdef ENABLE_ENERGY_FILTER
    theHeadset.iir_enabled                 = lTemp.iir_enable;
#endif

#ifdef T3ProductionTest
	theHeadset.ProductionData			   = lTemp.Productionflag;
    CONF_DEBUG(("CONF : Rd Vol Inverted [%c], LED Disable [%c], Multipoint Enable [%c], IIR Enable [%c]\n", theHeadset.VolumeOrientationIsInverted ? 'T':'F' ,
 																							 lTemp.led_disable ? 'T':'F' ,
																							 theHeadset.MultipointEnable ? 'T':'F',
                                                                                             theHeadset.iir_enabled ? 'T':'F'));
                                                                                         
#else	
	theHeadset.lbipmEnable				   = lTemp.lbipm_enable;

    CONF_DEBUG(("CONF : Rd Vol Inverted [%c], LED Disable [%c], Multipoint Enable [%c], IIR Enable [%c], LBIPM Enable [%c]\n", theHeadset.VolumeOrientationIsInverted ? 'T':'F' ,
 																							 lTemp.led_disable ? 'T':'F' ,
																							 theHeadset.MultipointEnable ? 'T':'F',
                                                                                             theHeadset.iir_enabled ? 'T':'F',
                                                                                             theHeadset.lbipmEnable ? 'T':'F')) ;
#endif
}