[ECOS] How to use CAN in poll mode?

wang cui iucgnaw@msn.com
Tue Feb 6 03:36:00 GMT 2007


I did researched the mechanism of network drivers and CAN stack.:)

The ethernet driver get polled through the "void (*poll)(struct eth_drv_sc 
*sc);" call back registered in its "eth_hwr_funs". Then Redboot can poll 
ethernet driver through a hw-independent style.

But there is no such poll callback registed in "can_lowlevel_funs". Which 
means when read a CAN device, it assumes the messages have been put into 
the buffer(during interrupt or outside poll). Anyway, there is a "bool 
(*getevent)(can_channel *priv, cyg_can_event *pevent, void *pdata);"

So I have to do a CYG_IO_SET_CONFIG_CAN_INPUT_DRAIN(added by myself) before 
every read.

>
>You should look at the CAN stack and see how to make it "think" you've
>had an interrupt by calling some poll() entry point.  That's how the
>network drivers work - the same drivers work in either RedBoot or full
>eCos with virtually no change.
>
>--
>------------------------------------------------------------
>Gary Thomas                 |  Consulting for the
>MLB Associates              |    Embedded world
>------------------------------------------------------------

_________________________________________________________________
ÏíÓÃÊÀ½çÉÏ×î´óµÄµç×ÓÓʼþϵͳ¡ª MSN Hotmail¡£  http://www.hotmail.com  


-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list