This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to use CAN in poll mode?


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]