irda driver for wince6

This forum is for users of Atmel's SAM Series and who are interested in using WinCE OS.

Moderator: nferre

zym0805
Contact:
Location: nanjing
Posts: 3
Joined: Wed Mar 14, 2007 4:20 pm

irda driver for wince6

Fri Dec 25, 2009 3:46 am

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?
zym0805
Contact:
Location: nanjing
Posts: 3
Joined: Wed Mar 14, 2007 4:20 pm

Re: irda driver for wince6

Fri Jan 08, 2010 3:48 am

not yet
zym0805
Contact:
Location: nanjing
Posts: 3
Joined: Wed Mar 14, 2007 4:20 pm

Re: irda driver for wince6

Thu Jan 21, 2010 6:20 am

解决方法:

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使能红外模式即可;
knowind
Posts: 1
Joined: Thu Aug 15, 2013 11:13 am

Re: irda driver for wince6

Thu Aug 15, 2013 11:22 am

请问第三步,应该修改COM_Write的函数的哪个位置?
kartahon1
Posts: 1
Joined: Wed Apr 01, 2015 12:31 pm

Re: irda driver for wince6

Wed Apr 01, 2015 12:40 pm

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.?????
han ya na kuch tu kaho

Return to “WinCE”

Who is online

Users browsing this forum: No registered users and 3 guests