Page 1 of 1

irda driver for wince6

Posted: Fri Dec 25, 2009 3:46 am
by zym0805
Can Adeneo at91x wince bsp for serial driver support irda mode? Can anybody answer this question?

how can modify serial driver of Adeneo wince bsp to support irda mode?

Re: irda driver for wince6

Posted: Fri Jan 08, 2010 3:48 am
by zym0805
not yet

Re: irda driver for wince6

Posted: Thu Jan 21, 2010 6:20 am
by zym0805
解决方法:

1.第一步在Serial_SAM926X_HW.cpp中添加

//-----------------------------------------------------------------------------
//! \fn VOID HWSetIrFilter (T_SERIAL_INIT_STRUCTURE *pInitContext, DWORD dwFilter)
//-----------------------------------------------------------------------------
VOID HWEnableIrMode (T_SERIAL_INIT_STRUCTURE *pInitContext)
{
EnterCriticalSection(&pInitContext->csUsartReg);
pInitContext->pUSARTReg->US_MR &= ~AT91C_US_USMODE;
pInitContext->pUSARTReg->US_MR |= AT91C_US_USMODE_IRDA;
pInitContext->pUSARTReg->US_IF = 30;
pInitContext->m_fIREnable = 1;
LeaveCriticalSection(&pInitContext->csUsartReg);
}

//-----------------------------------------------------------------------------
//! \fn VOID HWSetIrFilter (T_SERIAL_INIT_STRUCTURE *pInitContext, DWORD dwFilter)
//-----------------------------------------------------------------------------
VOID HWDisableIrMode (T_SERIAL_INIT_STRUCTURE *pInitContext)
{
EnterCriticalSection(&pInitContext->csUsartReg);
pInitContext->pUSARTReg->US_MR &= ~AT91C_US_USMODE;
pInitContext->pUSARTReg->US_MR |= AT91C_US_USMODE_NORMAL;
pInitContext->m_fIREnable = 0;
LeaveCriticalSection(&pInitContext->csUsartReg);
}

//-----------------------------------------------------------------------------
//! \fn
//-----------------------------------------------------------------------------

VOID HWIrdaPutByte(T_SERIAL_INIT_STRUCTURE *pInitContext, BYTE ch)
{
while(!(pInitContext->pUSARTReg->US_CSR & AT91C_US_TXEMPTY));
pInitContext->pUSARTReg->US_THR = (ch & 0x1FF);
while(!(pInitContext->pUSARTReg->US_CSR & AT91C_US_TXEMPTY));
}


第二步:修改Serial_SAM926X.cpp中COM_IOControl的函数,添加使能红外和禁止红外的函数;

case IOCTL_SERIAL_ENABLE_IR :
//DEBUGMSG (ZONE_IR,(TEXT("IOCTL Enable IR not supported\r\n")));
HWEnableIrMode(pHWIHead);
break;
case IOCTL_SERIAL_DISABLE_IR :
//DEBUGMSG (ZONE_IR,(TEXT("IOCTL Disable IR not supported\r\n")));
HWDisableIrMode(pHWIHead);
break;


第三步:修改COM_Write的函数,增加红外模式功能:

else if(pInitContext->m_fIREnable == 1)//红外模式
{

ULONG byteID=0;

HWDisableReceive(pInitContext);

pInitContext->pUSARTReg->US_CR = AT91C_US_TXEN;

while(byteID<NumberOfBytes)
{
HWIrdaPutByte(pInitContext, pSourceBytes[byteID]);
byteID++;
}

pInitContext->pUSARTReg->US_CR = AT91C_US_TXDIS;

HWEnableReceive(pInitContext);

dwNbByteSent = byteID;
//printf("comm_send\r\n ");
RETAILMSG (1,(TEXT("-COM_WRITE: returning %d\r\n"),byteID));

}

第四步:应用时除了Create后,调用KernernIOControl使能红外模式即可;

Re: irda driver for wince6

Posted: Thu Aug 15, 2013 11:22 am
by knowind
请问第三步,应该修改COM_Write的函数的哪个位置?

Re: irda driver for wince6

Posted: Wed Apr 01, 2015 12:40 pm
by kartahon1
If something wrong in nandflash, why wince starts ok?
No debug serial in my mainboard, so it is not easy for me to find the cause.?????