示例#1
0
文件: i2clib.c 项目: LucidOne/Rovio
void i2cEnableInterrupt (BOOL bIsEnableINT)
{	UINT32 regdata;

//k09144-1	sysSetInterruptType(IRQ_FI2C, LOW_LEVEL_SENSITIVE);	//k08184-1
#ifdef ECOS
    if (bIsEnableINT)		// enable I2C interrupt
	{	cyg_interrupt_create(IRQ_FI2C, 1, 0, Int_Handler_FastI2C, NULL, 
	                    &int_handle_I2C, &int_holder_I2C);
		cyg_interrupt_attach(int_handle_I2C);
		cyg_interrupt_unmask(IRQ_FI2C);
	}
	else
	{	cyg_interrupt_mask(IRQ_FI2C);
		cyg_interrupt_detach(int_handle_I2C);
	}
#else
	sysInstallISR(IRQ_LEVEL_1, IRQ_FI2C, (PVOID)Int_Handler_FastI2C);	//IRQ_FI2C=24
	if (bIsEnableINT)	sysEnableInterrupt(IRQ_FI2C);	//k03224-1
	else	sysDisableInterrupt (IRQ_FI2C);
#endif
	_i2c_bINT_EN=bIsEnableINT;	//k07195-1

	//enable sensor I2C engine's interrupt
	if (bIsEnableINT)
	{	regdata=inpw (REG_FastSerialBusCR)|0x02;
		outpw (REG_FastSerialBusCR,regdata);
	}
	//To clear interrupt status
	regdata=inpw (REG_FastSerialBusStatus)|0x03;
	outpw (REG_FastSerialBusStatus,regdata);

    /* enable I2C interrupt */
//k08204-1    sysEnableInterrupt(IRQ_FI2C);	//k03224-1
}
示例#2
0
/**
  * @brief Disable I2C interrupt. And initialize some parameters.
  * @param[in] fd is interface number.
  * @return close status.
  * @retval 0 success.
  * @retval I2C_ERR_NODEV Interface number is out of range.
  */
int32_t i2cClose(int32_t fd)
{
    i2c_dev *dev;

    if(fd != 0 && fd != 1)
        return(I2C_ERR_NODEV);

    dev = (i2c_dev *)( (uint32_t)&i2c_device[fd] );

    dev->openflag = 0;

    if(fd == 0)
        sysDisableInterrupt(I2C0_IRQn);
    else
        sysDisableInterrupt(I2C1_IRQn);

    return 0;
}
示例#3
0
文件: cap.c 项目: LucidOne/Rovio
void capInit(BOOL bCapEngEnable, BOOL bCapIntEnable)
#endif
{
	int j;
	int i=sizeof(VCEInit)/sizeof(T_REG_INFO);	
	for (j=0; j<i ;j++)
		outpw((CAP_BA+VCEInit[j].uAddr),VCEInit[j].uValue);	
	if(bCapEngEnable==TRUE)
	{
		outpw(REG_CAPEngine,inpw(REG_CAPEngine)|0x01);
	}
	else
	{
		outpw(REG_CAPEngine,inpw(REG_CAPEngine)&0xfffffffe);
	}
	if(bCapIntEnable==TRUE)
	{	
#ifdef ECOS	
		cyg_interrupt_disable();
		cyg_interrupt_create(IRQ_VCE, 1, 0, capIntHandler, capIntHandlerDSR, 
					&(t_eCos->cap_int_handle), &(t_eCos->cap_int));
		cyg_interrupt_attach(t_eCos->cap_int_handle);
		cyg_interrupt_unmask(IRQ_VCE);
		cyg_interrupt_enable();		
#else
		sysInstallISR(IRQ_LEVEL_1, IRQ_VCE, (PVOID)capIntHandler);	//
		sysEnableInterrupt(IRQ_VCE);
#endif		
		outpw(REG_CAPFuncEnable,inpw(REG_CAPFuncEnable)|0x2);
	}
	else
	{
#ifdef ECOS
		cyg_interrupt_mask(IRQ_VCE);
		cyg_interrupt_detach(t_eCos->cap_int_handle);
		cyg_interrupt_delete(t_eCos->cap_int_handle);
#else	
		sysDisableInterrupt(IRQ_VCE);
#endif		
		outpw(REG_CAPFuncEnable,inpw(REG_CAPFuncEnable)&0xfffffffd);
	}		
}	
示例#4
0
INT  w5691StopPlay()
{

#ifdef SOFT_MODE
	INT bytes;
#endif	
	const UINT8 abyCmdStopSpeech[] = { 0x03, 0x04, 0x02 };
	
#ifdef ECOS
	cyg_interrupt_mask(GPIO_INT_NUM);
	cyg_interrupt_detach(_tW5691.int_handle_play);
#else
	sysDisableInterrupt(GPIO_INT_NUM);
#endif
#ifdef SOFT_MODE
	
	//outpw(REG_ACTL_M80CON, 0x25202);
	outpw(REG_ACTL_M80CON, inpw(REG_ACTL_M80CON) | W_GFIFO );
	soft_write_command_byte_reg(0x08);
	soft_write_data_reg(0x55);
	for (bytes=0;bytes<3;bytes++){
		soft_write_data_reg(abyCmdStopSpeech[bytes]);
	}
	//outpw(REG_ACTL_M80CON, 0x5202);
	outpw(REG_ACTL_M80CON, inpw(REG_ACTL_M80CON) & ~W_GFIFO );
#else
	outpw(REG_ACTL_M80SIZE, sizeof(abyCmdStopSpeech)+1);
	outpw(REG_ACTL_M80DATA0, 0x55 | abyCmdStopSpeech[0]<<8 | (abyCmdStopSpeech[1]<<16) | (abyCmdStopSpeech[2]<<24) );
	outpw(REG_ACTL_M80ADDR, 0x08);
	//outpw(REG_ACTL_M80CON, 0x25210);
	outpw(REG_ACTL_M80CON, inpw(REG_ACTL_M80CON) | W_GFIFO | W_IF12_ACT);
	while((inpw(REG_ACTL_M80CON)&W_IF12_ACT) != 0);
	//outpw(REG_ACTL_M80CON, 0x5200);
	outpw(REG_ACTL_M80CON, inpw(REG_ACTL_M80CON) & ~W_GFIFO );
#endif
	
	ComDrv_SendCommand(eCOMMAND_DISABLE_SPEECH_INTERRUPT);
	
	DevDrv_PowerDown();
	_W5691_Playing = 0;
	return 0;
}