Exemple #1
0
/*
** Function: callDoBusy (phone number result)
**
** Description:
** called when busy tone is needed
**
** Input Parameters:
** pState: pointer to channel state data structure
**
** Return:
**
*/
static void callDoBusy(chanState *pState) {
    int busyTone = USA_BUSY_TONE;
    ProSLIC_ToneGenStop(pState->ProObj);
    ProSLIC_ToneGenSetup(pState->ProObj,busyTone);
    ProSLIC_ToneGenStart(pState->ProObj,TRUE);
    pState->currentState = SignalingTone;
}
Exemple #2
0
/*
** Function: onHook (state)
**
** Description:
** called when current state is onHook and interrupt occurs
**
** Input Parameters:
** pState: pointer to channel state data structure
** eInput: interrupt that has occured
**
** Return:
**
*/
static void OnHook (chanState *pState, ProslicInt eInput) {
    int tone = USA_DIAL_TONE;

    if (eInput==LOOP_STATUS) {
        ProSLIC_ToneGenSetup(pState->ProObj,tone);
        ProSLIC_ToneGenStart(pState->ProObj,FALSE);
        printMenu();
        pState->digitCount=0;
        pState->currentState = DialTone;
    }
    else if (eInput>=PQ1 && eInput<=PQ6) {
        powerAlarm(pState);
    }
}
Exemple #3
0
int CustomerVoice_HWInit() 
{
	int i; 
ctrl_S  spiGciObj;              /* User¡¦s control interface object */ 
systemTimer_S timerObj;         /* User¡¦s timer object */ 

 
/* Define Voice control interface object */ 
SiVoiceControlInterfaceType *VoiceHWIntf; 
 
/* Define array of Voice device objects */ 
SiVoiceDeviceType *VoiceDevices[NUMBER_OF_DEVICES]; 
 
/* Define array of ProSLIC channel object pointers */ 
SiVoiceChanType_ptr arrayOfVoiceChans[NUMBER_OF_CHAN]; 

    ProSLIC_dbgRingCfg ringCfg; 
    uInt8 hsState;  
    /* 
    ** Step 1: (optional) 
    ** Initialize user¡¦s control interface and timer objects ¡V this 
    ** may already be done, if not, do it here  
    */ 
 
    /*  
    ** Step 2: (required) 
    ** Create Voice Control Interface Object 
    */  
    SiVoice_createControlInterface(&VoiceHWIntf); 
 
    /* 
    ** Step 3: (required) 
    ** Create Voice Device Objects 
    */ 
    for(i=0;i<NUMBER_OF_DEVICES;i++) 
    { 
        SiVoice_createDevice(&(VoiceDevices[i])); 
    } 
 
    /* 
    ** Step 4: (required) 
    ** Create and initialize Voice channel objects 
    ** Also initialize array pointers to user¡¦s proslic channel object 
    ** members to simplify initialization process. 
    */ 
    for(i=0;i<NUMBER_OF_CHAN;i++) 
    { 
        SiVoice_createChannel(&(ports[i].VoiceObj)); 
        SiVoice_SWInitChan(ports[i].VoiceObj,i,VOICE_DEVICE_TYPE, 
                           VoiceDevices[i/CHAN_PER_DEVICE],VoiceHWIntf); 
        arrayOfVoiceChans[i] = ports[i].VoiceObj; 
        SiVoice_setSWDebugMode(ports[i].VoiceObj,TRUE);  /* optional */ 
        //ProSLIC_setSWDebugMode(ports[i].ProObj,TRUE); /* optional */
    } 
 
    /* 
    ** Step 5: (required) 
    ** Establish linkage between host objects/functions and 
    ** API  
    */ 
    SiVoice_setControlInterfaceCtrlObj (VoiceHWIntf, &spiGciObj); 
    SiVoice_setControlInterfaceReset (VoiceHWIntf, ctrl_ResetWrapper); 
    SiVoice_setControlInterfaceWriteRegister (VoiceHWIntf, ctrl_WriteRegisterWrapper); 
    SiVoice_setControlInterfaceReadRegister (VoiceHWIntf, ctrl_ReadRegisterWrapper);   
    SiVoice_setControlInterfaceWriteRAM (VoiceHWIntf, ctrl_WriteRAMWrapper); 
    SiVoice_setControlInterfaceReadRAM (VoiceHWIntf, ctrl_ReadRAMWrapper); 
    SiVoice_setControlInterfaceTimerObj (VoiceHWIntf, &timerObj); 
    SiVoice_setControlInterfaceDelay (VoiceHWIntf, time_DelayWrapper); 
    SiVoice_setControlInterfaceTimeElapsed (VoiceHWIntf, time_TimeElapsedWrapper); 
    SiVoice_setControlInterfaceGetTime (VoiceHWIntf, time_GetTimeWrapper); 
    SiVoice_setControlInterfaceSemaphore (VoiceHWIntf, NULL); 
/* 
    ** Step 6: (system dependent) 
    ** Assert hardware Reset ¡V ensure VDD, PCLK, and FSYNC are present and stable 
    ** before releasing reset 
    */ 
    SiVoice_Reset(ports[0].VoiceObj);    
 
    /* 
    ** Step 7: (required) 
    ** Initialize channels (loading of general parameters, calibrations,  
    **   dc-dc powerup, etc.) 
    ** Note that VDAA channels are ignored by ProSLIC_Init and ProSLIC  
    ** channels are ignored by Vdaa_Init. 
    */ 
    ProSLIC_Init(arrayOfVoiceChans,NUMBER_OF_CHAN);
    for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		if(arrayOfVoiceChans[i]->error!=0)
		{
			printk("ProSLIC_Init[%d] ERR=%d\n",i,arrayOfVoiceChans[i]->error);
			return 0;
		}
	}
#if 0
    Vdaa_Init(arrayOfVoiceChans,NUMBER_OF_CHAN); 
#endif	
 
    /* 
    ** Step 8: (design dependent) 
    ** Execute longitudinal balance calibration 
    ** or reload coefficients from factory LB cal 
    ** 
    ** Note: all batteries should be up and stable prior to  
    ** executing the lb cal 
    */ 
    ProSLIC_LBCal(arrayOfVoiceChans,NUMBER_OF_CHAN); 
 
     
    /* 
    ** Step 9: (design dependent) 
    ** Load custom configuration presets(generated using 
    ** ProSLIC API Config Tool) 
    */ 
    for(i=0;i<NUMBER_OF_CHAN;i++) 
    { 
        ProSLIC_DCFeedSetup(ports[i].VoiceObj,DCFEED_48V_20MA); 
        ProSLIC_RingSetup(ports[i].VoiceObj,RING_F20_45VRMS_0VDC_LPR); 
        ProSLIC_PCMSetup(ports[i].VoiceObj,PCM_DEFAULT_CONFIG); 
        ProSLIC_ZsynthSetup(ports[i].VoiceObj,ZSYN_600_0_0); 
        ProSLIC_ToneGenSetup(ports[i].VoiceObj,TONEGEN_FCC_DIAL); 
        ProSLIC_PCMTimeSlotSetup(ports[i].VoiceObj,CONFIG_PCM_TS_START+i*16,CONFIG_PCM_TS_START+i*16);
    #if 0    
        Vdaa_CountrySetup(ports[i].VoiceObj,COU_USA); 
        Vdaa_HybridSetup(ports[i].VoiceObj,HYB_600_0_0_500FT_24AWG); 
        Vdaa_PCMSetup(ports[i].VoiceObj,PCM_LINEAR16); 
 	Vdaa_PCMTimeSlotSetup(ports[i].VoiceObj,CONFIG_PCM_TS_START+i*16,CONFIG_PCM_TS_START+i*16);
    #endif
    } 
     
    /* 
    ** END OF TYPICAL INITIALIZATION  
    */ 
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		ProSLIC_PCMStart(ports[i].VoiceObj);
	}	
	
    
     /*  
    ** EXAMPLE: Change ALL ProSLIC ports to FWD_ACTIVE linefeed state 
    */ 
	for(i=0;i<NUMBER_OF_CHAN;i++) 
	{ 
		ProSLIC_SetLinefeedStatus(ports[i].VoiceObj,LF_FWD_ACTIVE); 
	} 
	#if 0
	
	ProSLIC_SetDAAEnable(ports[1].VoiceObj, 1);
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		Vdaa_PCMStart(ports[i].VoiceObj);
	}
	
	
	hsState = Vdaa_GetHookStatus(ports[1].VoiceObj);
	if(hsState == VDAA_ONHOOK) {
		Vdaa_SetHookStatus(ports[1].VoiceObj, VDAA_OFFHOOK); 
	}      
	
	hsState = Vdaa_PowerupLineside(ports[1].VoiceObj);     
	#endif
	
	//ProSLIC_PrintDebugData(ports[0].VoiceObj);
	//Vdaa_PrintDebugData(ports[1].VoiceObj);
	
	
	return 1;
} 
Exemple #4
0
/*
** Function: callDoreorder (phone number result)
**
** Description:
** called when reorder tone is needed
**
** Input Parameters:
** pState: pointer to channel state data structure
**
** Return:
**
*/
static void callDoReorder (chanState *pState) {
    int reorderTone = USA_REORDER_TONE;
    ProSLIC_ToneGenSetup(pState->ProObj,reorderTone);
    ProSLIC_ToneGenStart(pState->ProObj,TRUE);
    pState->currentState = SignalingTone;
}
Exemple #5
0
/*
** Function: callDoCongestion (phone number result)
**
** Description:
** called when congestion tone is needed
**
** Input Parameters:
** pState: pointer to channel state data structure
**
** Return:
**
*/
static void callDoCongestion (chanState *pState) {
    int congestionTone = USA_CONGESTION_TONE;
    ProSLIC_ToneGenSetup(pState->ProObj,congestionTone);
    ProSLIC_ToneGenStart(pState->ProObj,TRUE);
    pState->currentState = SignalingTone;
}
Exemple #6
0
/*
** Function: callDoRingback (phone number result)
**
** Description:
** called when ring back tone is needed
**
** Input Parameters:
** pState: pointer to channel state data structure
**
** Return:
**
*/
static void callDoRingback (chanState *pState) {
    int ringbackTone = USA_RINGBACK_TONE;
    ProSLIC_ToneGenSetup(pState->ProObj,ringbackTone);
    ProSLIC_ToneGenStart(pState->ProObj,TRUE);
    pState->currentState = RingbackTone;
}
Exemple #7
0
int ProSLIC_HWInit(void)
{
	int32 i, result = 0;
	ctrl_S spiGciObj; /* User¡¦s control interface object */
	systemTimer_S timerObj; /* User¡¦s timer object */
	chanState ports[NUMBER_OF_CHAN]; /* User¡¦s channel object, which has
									** a member defined as
									** proslicChanType_ptr ProObj;
									*/
	/* Define ProSLIC control interface object */
	controlInterfaceType *ProHWIntf;
	/* Define array of ProSLIC device objects */
	ProslicDeviceType *ProSLICDevices[NUMBER_OF_PROSLIC];
	/* Define array of ProSLIC channel object pointers */
	proslicChanType_ptr arrayOfProslicChans[NUMBER_OF_CHAN];
	/*
	** Step 1: (optional)
	** Initialize user¡¦s control interface and timer objects ¡V this
	** may already be done, if not, do it here
	*/
	/*
	** Step 2: (required)
	** Create ProSLIC Control Interface Object
	*/
	ProSLIC_createControlInterface(&ProHWIntf);
	/*
	** Step 3: (required)
	** Create ProSLIC Device Objects
	*/
	for(i=0;i<NUMBER_OF_PROSLIC;i++)
	{
		ProSLIC_createDevice(&(ProSLICDevices[i]));
	}
	/*
	** Step 4: (required)
	** Create and initialize ProSLIC channel objects
	** Also initialize array pointers to user¡¦s proslic channel object
	** members to simplify initialization process.
	*/
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		ProSLIC_createChannel(&(ports[i].ProObj));
		ProSLIC_SWInitChan(ports[i].ProObj,i,PROSLIC_DEVICE_TYPE,
		ProSLICDevices[i/CHAN_PER_DEVICE],ProHWIntf);
		arrayOfProslicChans[i] = ports[i].ProObj;
		ProSLIC_setSWDebugMode(ports[i].ProObj,TRUE); /* optional */
	}
	/*
	** Step 5: (required)
	** Establish linkage between host objects/functions and
	** ProSLIC API
	*/
	ProSLIC_setControlInterfaceCtrlObj (ProHWIntf, &spiGciObj);
	ProSLIC_setControlInterfaceReset (ProHWIntf, ctrl_ResetWrapper);
	ProSLIC_setControlInterfaceWriteRegister (ProHWIntf, ctrl_WriteRegisterWrapper);
	ProSLIC_setControlInterfaceReadRegister (ProHWIntf, ctrl_ReadRegisterWrapper);
	ProSLIC_setControlInterfaceWriteRAM (ProHWIntf, ctrl_WriteRAMWrapper);
	ProSLIC_setControlInterfaceReadRAM (ProHWIntf, ctrl_ReadRAMWrapper);
	ProSLIC_setControlInterfaceTimerObj (ProHWIntf, &timerObj);
	ProSLIC_setControlInterfaceDelay (ProHWIntf, time_DelayWrapper);
	ProSLIC_setControlInterfaceTimeElapsed (ProHWIntf, time_TimeElapsedWrapper);
	ProSLIC_setControlInterfaceGetTime (ProHWIntf, time_GetTimeWrapper);
	ProSLIC_setControlInterfaceSemaphore (ProHWIntf, NULL);
	/*
	** Step 6: (system dependent)
	** Assert hardware Reset ¡V ensure VDD, PCLK, and FSYNC are present and stable
	** before releasing reset
	*/
	ProSLIC_Reset(ports[0].ProObj);
	
	//initialize SPI interface
    if (SPI_Init (NULL) ==  FALSE){

        printk ("Cannot connect\n");

        return 0;
    }

	/*
	** Step 7: (required)
	** Initialize device (loading of general parameters, calibrations,
	** dc-dc powerup, etc.)
	*/
	ProSLIC_Init(arrayOfProslicChans,NUMBER_OF_CHAN);
	printk("ProSLIC_Init done\n");
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		if(arrayOfProslicChans[i]->error!=0)
		{
			printk("ProSLIC_Init[%d] ERR=%d\n",i,arrayOfProslicChans[i]->error);
			return 0;
		}
	}
	
	/*
	** Step 8: (design dependent)
	** Execute longitudinal balance calibration
	** or reload coefficients from factory LB cal
	**
	** Note: all batteries should be up and stable prior to
	** executing the lb cal
	*/
	ProSLIC_LBCal(arrayOfProslicChans,NUMBER_OF_CHAN);
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		ProSLIC_GetLBCalResultPacked(arrayOfProslicChans[i], &result);
		printk("LBCal=0x%08X\n",result);
	}
	/*
	** Step 9: (design dependent)
	** Load custom configuration presets(generated using
	** ProSLIC API Config Tool)


	*/
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		ProSLIC_PCMTimeSlotSetup(ports[i].ProObj,ppcm_config->ts_start[i],ppcm_config->ts_start[i]);
		
		ProSLIC_DCFeedSetup(ports[i].ProObj,DCFEED_48V_20MA);
		ProSLIC_RingSetup(ports[i].ProObj,RING_F20_45VRMS_0VDC_LPR);
#if defined(PCM_LINEAR)||defined(PCM_A2L2A)||defined(PCM_U2L2U)			
		ProSLIC_PCMSetup(ports[i].ProObj,PCM_16LIN);
#endif
#if defined(PCM_ULAW)||defined(PCM_L2U2L)		
		ProSLIC_PCMSetup(ports[i].ProObj,PCM_8ULAW);
#endif
#if defined(PCM_ALAW)			
		ProSLIC_PCMSetup(ports[i].ProObj,PCM_8ALAW);
#endif
#if defined(PCM_L2A2L)			
		ProSLIC_PCMSetup(ports[i].ProObj,PCM_8ALAW);
#endif
		ProSLIC_ZsynthSetup(ports[i].ProObj,ZSYN_600_0_0_30_0);
		ProSLIC_ToneGenSetup(ports[i].ProObj,TONEGEN_FCC_DIAL);
		
	}
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		ProSLIC_PCMStart(ports[i].ProObj);
	}	
	for(i=0;i<NUMBER_OF_CHAN;i++)
	{
		ProSLIC_SetLinefeedStatus(ports[i].ProObj,LF_FWD_ACTIVE);
	}	
	return 1;
}