All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: CAN Driver
       [not found]   ` <1354779353.5010.2.camel@punsfloyd-desktop>
@ 2012-12-06  9:02     ` Marc Kleine-Budde
       [not found]       ` <1354785999.5871.8.camel@punsfloyd-desktop>
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2012-12-06  9:02 UTC (permalink / raw)
  To: puneet.sharma, linux-can@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 2044 bytes --]

Hello,

I've put the linux-can mailinglist on Cc.

On 12/06/2012 08:35 AM, Puneet Sharma wrote:
> Can you guide me how to implement system wide per CAN device
> filterting in driver code.

Here is my old mail with some thoughts:

From my point of view it should become a per device callback, which you
(admin, i.e. the root user) can set when the device is down. You have to
extend the CAN netlink interface [1].

Each device should identify what kind and how many hardware filters it
supports:
a) mask+id
b) just id
c) ...
Analogue to ctrlmode [2][3].

The requested filers are transferred into the kernel via netlink, but
you have to figure out how to encode a variable length list (netfilter
has probably a solution for this). Then the code in can_changelink() [4]
should check if the transferred filter is supported on that hardware.
Then, during open the driver should code the filters into hardware, on
at91 it should be done in at91_setup_mailboxes [5][6].

Marc

[1] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L585
[2] http://lxr.free-electrons.com/source/include/linux/can/netlink.h#L81
[3] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L724
[4] http://lxr.free-electrons.com/source/drivers/net/can/dev.c#L633
[5] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L418
[6] http://lxr.free-electrons.com/source/drivers/net/can/at91_can.c#L336

> We also want to test CAN controller in u-boot. Can you help me out to
> write some test cases which can test the CAN controller on a basic
> level.

If you just want to do testing, I suggest, don't do it in u-boot. I
think it's more complicated to port a CAN driver to u-boot, than to boot
linux and do the tests there.

Marc
-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: CAN Driver
       [not found]       ` <1354785999.5871.8.camel@punsfloyd-desktop>
@ 2012-12-06  9:44         ` Marc Kleine-Budde
       [not found]           ` <1354787514.6620.3.camel@punsfloyd-desktop>
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2012-12-06  9:44 UTC (permalink / raw)
  To: puneet.sharma; +Cc: linux-can@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

On 12/06/2012 10:26 AM, Puneet Sharma wrote:
> Thanks a lot for the immediate response. I cannot test the controller
> in kernel as it increases the abstraction which is not desirable in
> my case.

YMMV :)

> My intention is to write simple test cases which can test the
> controller thereby exploiting the basic functionalities of the
> controller.
> 
> If you can give me some points namely some minimum functions that can
> help me to do so.

You're using a at91sam9263, right?. Then have a look at the linux driver.

To setup the controller:
at91_can_probe();
at91_open();

To send a message:
at91_start_xmit();

To receive a message:
at91_poll_rx();

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: CAN Driver
       [not found]           ` <1354787514.6620.3.camel@punsfloyd-desktop>
@ 2012-12-06 10:09             ` Marc Kleine-Budde
       [not found]               ` <1354789804.6620.6.camel@punsfloyd-desktop>
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2012-12-06 10:09 UTC (permalink / raw)
  To: puneet.sharma, linux-can@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 1395 bytes --]

Hello,

please keep the mailinglist on Cc.

On 12/06/2012 10:51 AM, Puneet Sharma wrote:
> I have read the driver code (at91_can.c) but what i want is some
> simple application which will make use of this driver in u-boot to
> test the Controller.

Have you already ported the CAN driver to u-boot?

> For eg. the application can continously send CAN frames in binary,
> dec or Hex format thereby incrementing the CAN ID everytime or doing
> some similar thing. Is it possible to do such things in u-boot. I
> know in linux this can be achieved via SOCKET CAN.

I think you haev to first invent some kind of interface from your
application to the driver, e.g.:

can_init();
can_write(struct can_frame *cf);
can_read_timeout(struct can_frame *cf, unsinged long timeout);

All these functions should be blocking (with timeout in the read case).
Then you can write an application against that API. You have to write
some glue code to attach the API to the driver. For testing applications
have a look the the can-utils at gitorious [1].

Marc

[1] https://gitorious.org/linux-can/can-utils

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: CAN Driver
       [not found]               ` <1354789804.6620.6.camel@punsfloyd-desktop>
@ 2012-12-06 10:42                 ` Marc Kleine-Budde
  2012-12-06 10:43                   ` Puneet Sharma
  0 siblings, 1 reply; 5+ messages in thread
From: Marc Kleine-Budde @ 2012-12-06 10:42 UTC (permalink / raw)
  To: puneet.sharma; +Cc: linux-can@vger.kernel.org

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

On 12/06/2012 11:30 AM, Puneet Sharma wrote:
> Sorry but my messages are not being delivered to mailinglist. (they
> are failing).

The error message probably says: You should not send HTML messages.

> Till now i havent ported the driver but i will be able to do that. I
> got your point and will start doing things in that direction.
> 
> I will keep you updated of the application.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: CAN Driver
  2012-12-06 10:42                 ` Marc Kleine-Budde
@ 2012-12-06 10:43                   ` Puneet Sharma
  0 siblings, 0 replies; 5+ messages in thread
From: Puneet Sharma @ 2012-12-06 10:43 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-can@vger.kernel.org

ok..

On Thu, 2012-12-06 at 16:12 +0530, Marc Kleine-Budde wrote:
> On 12/06/2012 11:30 AM, Puneet Sharma wrote:
> > Sorry but my messages are not being delivered to mailinglist. (they
> > are failing).
>
> The error message probably says: You should not send HTML messages.
>
> > Till now i havent ported the driver but i will be able to do that. I
> > got your point and will start doing things in that direction.
> >
> > I will keep you updated of the application.
>
> Marc
>

--
Puneet Sharma <puneet.sharma@moschip.com>


The information contained in this email and any attachments is confidential and may be subject to copyright or other intellectual property protection. If you are not the intended recipient, you are not authorized to use or disclose this information, and we request that you notify us by reply mail or telephone and delete the original message from your mail system.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-12-06 10:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <1346761707.5009.4.camel@punsfloyd-desktop>
     [not found] ` <5045F53F.7070209@pengutronix.de>
     [not found]   ` <1354779353.5010.2.camel@punsfloyd-desktop>
2012-12-06  9:02     ` CAN Driver Marc Kleine-Budde
     [not found]       ` <1354785999.5871.8.camel@punsfloyd-desktop>
2012-12-06  9:44         ` Marc Kleine-Budde
     [not found]           ` <1354787514.6620.3.camel@punsfloyd-desktop>
2012-12-06 10:09             ` Marc Kleine-Budde
     [not found]               ` <1354789804.6620.6.camel@punsfloyd-desktop>
2012-12-06 10:42                 ` Marc Kleine-Budde
2012-12-06 10:43                   ` Puneet Sharma

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.