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?


wang cui wrote:
> 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.

I didn't write that stack nor interface, but it seems to me that you
need to add something equivalent to the ethernet poll() function.

You might try contacting the CAN stack author for ideas.

> 
>>
>> 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
------------------------------------------------------------

-- 
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]