Example #1
0
/****************************************************************************
NAME 
  	configManagerLEDS

DESCRIPTION
  	Read the system LED configuration from persistent store and configure
  	the LEDS 
 
RETURNS
  	void
*/ 
static void configManagerLEDS( void )
{ 
  	/* 1. LED state configuration */
    	
    /* Providing there are states to configure */
    if((theSink.theLEDTask->gStatePatternsAllocated > 0) && (theSink.theLEDTask->gStatePatternsAllocated < SINK_NUM_STATES))
    {      		
   		ConfigRetrieve(theSink.config_id , PSKEY_LED_STATES, &theSink.theLEDTask->gStatePatterns, theSink.theLEDTask->gStatePatternsAllocated * sizeof(LEDPattern_t));
  	}      	    
    
    /* 2. LED event configuration */
      
    /* Providing there are events to configure */
    if((theSink.theLEDTask->gEventPatternsAllocated > 0) && (theSink.theLEDTask->gEventPatternsAllocated < EVENTS_MAX_EVENTS))
    {      		
   		ConfigRetrieve(theSink.config_id , PSKEY_LED_EVENTS, &theSink.theLEDTask->gEventPatterns, theSink.theLEDTask->gEventPatternsAllocated * sizeof(LEDPattern_t));
  	} 	    

    /* 3. LED event filter configuration */
	
    /* Providing there are states to configure */
    if((theSink.theLEDTask->gLMNumFiltersUsed > 0) && (theSink.theLEDTask->gLMNumFiltersUsed < LM_NUM_FILTER_EVENTS))
    {                    
           /* read from ps straight into filter config structure */
    	ConfigRetrieve(theSink.config_id , PSKEY_LED_FILTERS, &theSink.theLEDTask->gEventFilters, theSink.theLEDTask->gLMNumFiltersUsed * sizeof(LEDFilter_t));
    }
     
    /*tri colour behaviour*/  	
  	ConfigRetrieve(theSink.config_id , PSKEY_TRI_COL_LEDS, &theSink.theLEDTask->gTriColLeds,  sizeof(uint16)) ; 	
  	DEBUG(("CONF: TRICOL [%x][%x][%x]\n" , theSink.theLEDTask->gTriColLeds.TriCol_a ,
  										   theSink.theLEDTask->gTriColLeds.TriCol_b ,
  										   theSink.theLEDTask->gTriColLeds.TriCol_c )) ;
    
    
}
/****************************************************************************
NAME 
  configManagerTimeouts

DESCRIPTION
  Read and configure the automatic switch off time if the range allows
    Also now handles the power on timeout
 
RETURNS
  void
*/ 
static void configManagerConfiguration ( uint16 pConfigID )
{	
    ConfigRetrieve(pConfigID , PSKEY_PIO_BLOCK, theHeadset.PIO, sizeof(PIO_block_t));
	ConfigRetrieve(pConfigID , PSKEY_INPUT_PIO_BLOCK, &theHeadset.conf->input_PIO, sizeof(input_pio_config_type));
	ConfigRetrieve(pConfigID , PSKEY_TIMEOUTS, (void*)&theHeadset.conf->timeouts, sizeof(Timeouts_t) ) ;
	ConfigRetrieve(pConfigID , PSKEY_RSSI_PAIRING, (void*)&theHeadset.conf->rssi, sizeof(rssi_pairing_t) ) ;
	ConfigRetrieve(pConfigID , PSKEY_FILTER, (void*)&theHeadset.conf->filter, sizeof(filter_t) ) ;
}
Example #3
0
void configManagerReadFmData(void)
{
    /* determine size of data required by fm library */
	int lSize = (sizeof(fm_rx_data_t) + FMRX_MAX_BUFFER_SIZE); 
	/*allocate the memory*/
	theSink.conf2->sink_fm_data.fm_plugin_data = mallocPanic( lSize );
    /* initialise structure */    
    memset(theSink.conf2->sink_fm_data.fm_plugin_data, 0, lSize);  
    /* get the FM config from pskey */
    ConfigRetrieve(theSink.config_id, PSKEY_FM_CONFIG, &theSink.conf2->sink_fm_data.fm_plugin_data->config, sizeof(fm_rx_config));

    /* get the FM stored freq from pskey */
    ConfigRetrieve(theSink.config_id, PSKEY_FM_FREQUENCY_STORE, &theSink.conf2->sink_fm_data.fmStoredFreq, sizeof(fm_stored_freq));   
}       
Example #4
0
/****************************************************************************
NAME    
    sinkDialStoredNumber
    
DESCRIPTION
	Dials a number stored in CONFIG_PHONE_NUMBER
    If HFP and connected - issues command
    If HFP and not connected - connects and issues if not in call
    If HSP sends button press


RETURNS
    void
*/
void sinkDialStoredNumber ( void )
{	
    uint16 ret_len;
	Sink   sink;
    uint16 phone_number_key[SIZE_CONFIG_PHONE_NUMBER];
    
	CM_DEBUG(("sinkDialStoredNumber\n")) ;
    
    if ((ret_len = ConfigRetrieve(CONFIG_PHONE_NUMBER, phone_number_key, SIZE_CONFIG_PHONE_NUMBER )))
	{        
        if((HfpLinkGetSlcSink(hfp_primary_link, &sink)) && SinkIsValid(sink))
        {
            /* Send the dial request now */
            CM_DEBUG(("CM:Dial Stored Number (Connected) len=%x\n",ret_len)) ;  
            HfpDialNumberRequest(hfp_primary_link, ret_len, (uint8 *)&phone_number_key[0]);  
        }
        else
        {
            /* Not connected, connect and queue the dial request */
#ifdef ENABLE_AVRCP
            sinkAvrcpCheckManualConnectReset(NULL);
#endif            
            MessageSend ( &theSink.task , EventUsrEstablishSLC , 0 ) ;
            sinkQueueEvent( EventUsrDialStoredNumber ) ;
        }
    }
    else
	{
        /*The PSKEY could not be read*/
        MessageSend(&theSink.task, EventUsrUpdateStoredNumber, 0);
    }
}
Example #5
0
static void configManagerVoicePromptsInit( uint16 no_vp , uint16 no_tts_languages )
{
#ifdef CSR_VOICE_PROMPTS
  	/* check the number of events configured and the supported tts languages */
	if(no_vp)
  	{
        /* Read in the PSKEY that tells us where the prompt header is */
        if(ConfigRetrieve(theSink.config_id , PSKEY_VOICE_PROMPTS, &theSink.conf4->vp_init_params, sizeof(vp_config_type)))
        {
#ifdef TEXT_TO_SPEECH_LANGUAGESELECTION
            theSink.no_tts_languages = no_tts_languages;
            
#ifdef ENABLE_SQIFVP
            /* Initilaise as no partitions currently mounted */
            theSink.rundata->partitions_mounted = 0;
            
            configManagerSqifPartitionsInit(  );
#endif            
                 
#endif
            /* Pass configuration to the voice prompts plugin */
            TTSConfigureVoicePrompts(no_vp);
        }
    }
#endif /* CSR_VOICE_PROMPTS */
}
Example #6
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;
    }
}
Example #7
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) ;
    }    
}
/****************************************************************************
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) ;
    }
}
Example #9
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));
}
Example #10
0
/****************************************************************************
NAME 
  	configManagerButtonDurations

DESCRIPTION
  	Read the button configuration from persistent store and configure
  	the button durations
 
RETURNS
  	void
*/ 
static void configManagerButtonDurations( void )
{
    if(ConfigRetrieve(theSink.config_id , PSKEY_BUTTON_CONFIG, &theSink.conf1->buttons_duration, sizeof(button_config_type)))
 	{
			/*buttonmanager keeps buttons block*/
  		buttonManagerConfigDurations ( theSink.theButtonsTask ,  &theSink.conf1->buttons_duration ); 
    }
}
/****************************************************************************
NAME 
  	configManagerButtonDurations

DESCRIPTION
  	Read the button configuration from persistent store and configure
  	the button durations
 
RETURNS
  	void
*/ 
static void configManagerButtonDurations( uint16 pConfigID )
{
    if(ConfigRetrieve(pConfigID , PSKEY_BUTTON_CONFIG, theHeadset.buttons_duration, sizeof(button_config_type)))
 	{
			/*buttonmanager keeps buttons block*/
  		buttonManagerConfigDurations ( theHeadset.theButtonsTask ,  theHeadset.buttons_duration ); 
    }
}
/****************************************************************************
NAME 
 	configManagerPower

DESCRIPTION
 	Read the Power Manager configuration
 
RETURNS
 	void
*/ 
static void configManagerPower( uint16 pConfigID )
{
 	/* 1. Read in the battery monitoring configuration */
	ConfigRetrieve(pConfigID , PSKEY_BATTERY_CONFIG, (void*)&((theHeadset.conf->power).battery_config), sizeof(power_config_type) ) ;
   
  	/* 2. Setup the power manager */
    powerManagerConfig(&theHeadset.conf->power);
}
Example #13
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();


}
static void configManagerRadio( uint16 pConfigID )
{ 
  	if(!ConfigRetrieve(pConfigID , PSKEY_RADIO_CONFIG, theHeadset.radio, sizeof(radio_config_type)))
  	{
    	/* Assume HCI defaults */
    	theHeadset.radio->page_scan_interval = HCI_PAGESCAN_INTERVAL_DEFAULT;
    	theHeadset.radio->page_scan_window = HCI_PAGESCAN_WINDOW_DEFAULT;
    	theHeadset.radio->inquiry_scan_interval = HCI_INQUIRYSCAN_INTERVAL_DEFAULT;
    	theHeadset.radio->inquiry_scan_interval = HCI_INQUIRYSCAN_WINDOW_DEFAULT;
  	}
}
Example #15
0
static void configManagerRadio( void )
{ 
  	if(!ConfigRetrieve(theSink.config_id , PSKEY_RADIO_CONFIG, &theSink.conf2->radio, sizeof(radio_config_type)))
  	{
    	/* Assume HCI defaults */
    	theSink.conf2->radio.page_scan_interval = HCI_PAGESCAN_INTERVAL_DEFAULT;
    	theSink.conf2->radio.page_scan_window = HCI_PAGESCAN_WINDOW_DEFAULT;
    	theSink.conf2->radio.inquiry_scan_interval = HCI_INQUIRYSCAN_INTERVAL_DEFAULT;
    	theSink.conf2->radio.inquiry_scan_window  = HCI_INQUIRYSCAN_WINDOW_DEFAULT;
  	}
}
/*************************************************************************
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;
	}
}
Example #17
0
/****************************************************************************
NAME 
  	configManagerEventTone

DESCRIPTION
  	Configure an event tone only if one is defined
 
RETURNS
  	void
*/ 
static void configManagerEventTones( uint16 no_tones )
{ 
  	/* First read the number of events configured */	
  	if(no_tones)		
  	{
        /* Now read in tones configuration */
        if(ConfigRetrieve(theSink.config_id , PSKEY_TONES, &theSink.conf2->gEventTones, no_tones * sizeof(tone_config_type)))
        {
			/*set the last tone (empty) - used by the play tone routine to identify the last tone*/
			theSink.conf2->gEventTones[no_tones].tone = TONE_NOT_DEFINED ;			
        }  
     }                    
}            
Example #18
0
/****************************************************************************
NAME 
 	configManagerPower

DESCRIPTION
 	Read the Power Manager configuration
 
RETURNS
 	void
*/ 
static void configManagerPower( void )
{
    sink_power_config power;

 	/* Read in the battery monitoring configuration */
	ConfigRetrieve(theSink.config_id , PSKEY_BATTERY_CONFIG, (void*)&power, sizeof(sink_power_config) ) ;
   
    /* Store power settings */
    theSink.conf1->power = power.settings;
    
  	/* Setup the power manager */
    powerManagerConfig(&power.config);
}
Example #19
0
/****************************************************************************
NAME 
  	configManagerEventTTSPhrases

DESCRIPTION
  	Configure an event tts phrase only if one is defined
 
RETURNS
  	void
*/ 
static void configManagerEventTTSPhrases( uint16 no_tts )
{
#ifdef TEXT_TO_SPEECH_PHRASES    
  	/* check the number of events configured */
	if(no_tts)
  	{
    	/* Now read in TTS configuration */
        ConfigRetrieve(theSink.config_id , PSKEY_TTS, &theSink.conf4->gEventTTSPhrases, no_tts * sizeof(tts_config_type));
        
        /* Terminate the list */
        theSink.conf4->gEventTTSPhrases[no_tts].tts_id = TTS_NOT_DEFINED;
    }
#endif
}
/****************************************************************************
NAME 
  	configManagerFeatureBlock

DESCRIPTION
  	Read the system feature block and configure system accordingly
 
RETURNS
  	void
*/
static void configManagerFeatureBlock( uint16 pConfigID ) 
{
    uint8 i;
	
    
    /* Read the feature block from persistent store */
  	ConfigRetrieve(pConfigID , PSKEY_FEATURE_BLOCK, &theHeadset.features, sizeof(feature_config_type)) ; 	
	
	/*Set the default volume level*/
    for(i=0;i<MAX_PROFILES;i++)
    {
        theHeadset.profile_data[i].audio.gSMVolumeLevel = theHeadset.features.DefaultVolume ;  
    }    
}
Example #21
0
/****************************************************************************
NAME 
  	configManagerKeyLengths

DESCRIPTION
 	Read the lengths of ps keys for tts, tone and led configuration
 
RETURNS
  	void
*/ 
static void configManagerKeyLengths( lengths_config_type * pLengths )
{		
	ConfigRetrieve(theSink.config_id , PSKEY_LENGTHS, pLengths, sizeof(lengths_config_type));
		
	DEBUG(("CONF: LENGTHS [%x][%x][%x][%x][%x][%x]\n" , pLengths->no_tts,
											pLengths->no_tts_languages,
											pLengths->no_led_filter,
											pLengths->no_led_states,
											pLengths->no_led_events,
											pLengths->no_tones )) ;
											
	/* Set led lengths straight away */											
	theSink.theLEDTask->gStatePatternsAllocated = pLengths->no_led_states;
	theSink.theLEDTask->gEventPatternsAllocated = pLengths->no_led_events;
	theSink.theLEDTask->gLMNumFiltersUsed = pLengths->no_led_filter;
    theSink.rundata->defrag = pLengths->defrag;
}
/****************************************************************************
NAME 
  	configManagerKeyLengths

DESCRIPTION
 	Read the lengths of ps keys for tts, tone and led configuration
 
RETURNS
  	void
*/ 
static void configManagerKeyLengths(uint16 configID, lengths_config_type * pLengths )
{		
	ConfigRetrieve(configID , PSKEY_LENGTHS, pLengths, sizeof(lengths_config_type));
		
	DEBUG(("CONF: LENGTHS [%x][%x][%x][%x][%x][%x]\n" , pLengths->no_tts,
											pLengths->no_tts_languages,
											pLengths->no_led_filter,
											pLengths->no_led_states,
											pLengths->no_led_events,
											pLengths->no_tones )) ;
											
#ifdef ROM_LEDS
	/* Set led lengths straight away */											
	theHeadset.theLEDTask->gStatePatternsAllocated = pLengths->no_led_states;
	theHeadset.theLEDTask->gEventPatternsAllocated = pLengths->no_led_events;
	theHeadset.theLEDTask->gLMNumFiltersUsed = pLengths->no_led_filter;
#endif
}
/****************************************************************************
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) ;
    }    
}
Example #24
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);
}
Example #25
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 sinkGattHidRcConfigRemote(uint16 rc_lookup_sie)
{
#ifdef DEBUG_GATT_HID_RC
    uint16 i;
#endif

    if(!rc_lookup_sie)
    {
        /* No RC lookup table exists, there's nothing the RC task can do without the lookup table, return */
        return;
    }
    
    /* Allocate enough memory to extract the configured BLE HID lookup table (can be of max size 16 entries) */
    GATT_HID_RC.rc_lookup_size = rc_lookup_sie;
    GATT_HID_RC_DEBUG(("GattHIDRc: RC Config: Malloc size for RC Config: [%d]\n", ((sizeof(gattHidRcConfig_t) - sizeof(gattHidRcLookupTable_t)) + (GATT_HID_RC.rc_lookup_size * sizeof(gattHidRcLookupTable_t))) ));    
    GATT_HID_RC.config = mallocPanic( ((sizeof(gattHidRcConfig_t) - sizeof(gattHidRcLookupTable_t)) + (GATT_HID_RC.rc_lookup_size * sizeof(gattHidRcLookupTable_t))) );
   
    /* If there is enough memory available for a look up table, then get it */
    if (GATT_HID_RC.config)
    {
        ConfigRetrieve(CONFIG_BLE_REMOTE_CONTROL, GATT_HID_RC.config, ((sizeof(gattHidRcConfig_t) - sizeof(gattHidRcLookupTable_t)) + (GATT_HID_RC.rc_lookup_size * sizeof(gattHidRcLookupTable_t))) );

#ifdef DEBUG_GATT_HID_RC
        /* Print the lookup table in a readable format for debugging purposes */
        GATT_HID_RC_DEBUG(("GattHIDRc: RC Config :  Max RC[%d], Lookup Size[%d]:\n", GATT_HID_RC.config->max_remotes, GATT_HID_RC.rc_lookup_size));
        for (i=0; i<GATT_HID_RC.rc_lookup_size; i++)
        {
            GATT_HID_RC_DEBUG(("GattHIDRc: RC Config: [0x%x]->[0x%03x]\n", GATT_HID_RC.config->lookup_table[i].input_id, GATT_HID_RC.config->lookup_table[i].hid_code));
        }
#endif
    }
    else
    {
        /* Set look up size as zero, without config memory and data , RC task can not work */
        GATT_HID_RC.rc_lookup_size = 0;
        GATT_HID_RC_DEBUG(("GattHIDRc: Memory for RC config is not available \n"));
    }
}
/****************************************************************************
NAME 
  	configManagerEventTone

DESCRIPTION
  	Configure an event tts phrase only if one is defined
 
RETURNS
  	void
*/ 
static void configManagerEventTTSPhrases( uint16 pConfigID , uint16 no_tts )
{
#ifdef TEXT_TO_SPEECH_PHRASES
  	/* cheack the number of events configured and the supported tts languages */
	if(no_tts)
  	{
		tts_config_type * config;
		
        /* Allocate enough memory to hold event configuration */
    	config = (tts_config_type *) mallocPanic((no_tts + 1) * sizeof(tts_config_type));

    	if (config)
    	{
         	/* Now read in tones configuration */
        	if(ConfigRetrieve(pConfigID , PSKEY_TTS, config, no_tts * sizeof(tts_config_type)))
        	{
          		theHeadset.audioData.gEventTTSPhrases = (HeadsetTts_t*)config;
                theHeadset.audioData.gEventTTSPhrases[no_tts].tts_id = TTS_NOT_DEFINED;
            }
        }
    }
#endif
}
static void configManagerVoicePromptsInit( uint16 pConfigID , uint16 no_vp , uint16 no_tts_languages )
{
#ifdef CSR_VOICE_PROMPTS
  	/* cheack the number of events configured and the supported tts languages */
	if(no_vp)		
  	{
		vp_config_type * config = NULL;
        uint16 size_vp_config = sizeof(vp_config_type);
        
        /* Allocate enough memory to hold event configuration */
        config = (vp_config_type *) mallocPanic(size_vp_config);
        
    	if (config)
    	{
            /* Read in the PSKEY that tells us where the prompt header is */
        	if(ConfigRetrieve(pConfigID , PSKEY_VOICE_PROMPTS, config, size_vp_config))
            {
                TTSConfigureVoicePrompts(no_vp, config, no_tts_languages);
            }
        }
    }
#endif /* CSR_VOICE_PROMPTS */
}
Example #29
0
/****************************************************************************
NAME 
 	configManagerHFP_Init

DESCRIPTION
    Gets the HFP initialisation parameters from PS
 
RETURNS
 	void
*/
void configManagerHFP_Init( hfp_init_params * hfp_params )
{     
    ConfigRetrieve( theSink.config_id , PSKEY_HFP_INIT , hfp_params , sizeof( hfp_init_params ) ) ;
    
}
Example #30
0
/****************************************************************************
NAME 
 	configManagerHFP_SupportedFeatures

DESCRIPTION
    Gets the HFP Supported features set from PS
 
RETURNS
 	void
*/
void configManagerHFP_SupportedFeatures( void )
{
    ConfigRetrieve( theSink.config_id , PSKEY_ADDITIONAL_HFP_SUPPORTED_FEATURES , &theSink.HFP_supp_features , sizeof( HFP_features_type ) ) ;
}