linux-can.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: Florian Feldbauer <florian@ep1.ruhr-uni-bochum.de>,
	linux-can@vger.kernel.org
Subject: Re: Writing socketCAN module for my own hardware
Date: Tue, 12 Aug 2014 10:24:07 +0200	[thread overview]
Message-ID: <53E9CF27.90400@pengutronix.de> (raw)
In-Reply-To: <53E9C774.3040401@ep1.ruhr-uni-bochum.de>

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

On 08/12/2014 09:51 AM, Florian Feldbauer wrote:
> I have developed a CAN interface for the Raspberry Pi computer using the
> SJA1000 directly connected to the GPIOs of the CPU.

This sounds very slow :)

> So far this interface is used as chardev and works fine.
> But I'm also developing a user-space program using this CAN interface.
> This program should also be compatible with other CAN interfaces like
> the ones from PEAK or Kvazer. So I thought using socketCAN would be a
> good idea.

Yes.

> Is there any documentation on how to write a socketCAN compatible kernel
> module for my own hardware?
> I tried writing something similar to the sja1000_isa driver...

IMHO sja1000_platform.c is a better blueprint, as it uses the device
tree to describe the hardware and does not rely on module parameters.

> So far my modified kernel compiles and I can change bitrate and bring
> the interface up.
> But as soon as I try to send a CAN frame I get the error:
> Error 105: No buffer space available

You are sending CAN frames faster than the driver is able to send them,
you have to wait a bit, before sending new CAN frames.

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: 181 bytes --]

  reply	other threads:[~2014-08-12  8:24 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-12  7:51 Writing socketCAN module for my own hardware Florian Feldbauer
2014-08-12  8:24 ` Marc Kleine-Budde [this message]
2014-08-12  8:57   ` Florian Feldbauer
2014-08-12 10:01     ` Marc Kleine-Budde
2014-10-01  7:26       ` Florian Feldbauer
2014-10-01  7:49         ` Marc Kleine-Budde
2014-10-01 12:32           ` Florian Feldbauer
2014-10-01 12:41             ` Marc Kleine-Budde
2014-10-01 12:56               ` Florian Feldbauer
2014-10-01 13:11                 ` Marc Kleine-Budde
2014-10-09 15:06               ` Florian Feldbauer
2014-10-09 16:13                 ` Marc Kleine-Budde
2014-10-10  7:43                   ` Florian Feldbauer
2014-10-10  8:06                     ` Marc Kleine-Budde
2014-10-10  8:09                       ` Florian Feldbauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53E9CF27.90400@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=florian@ep1.ruhr-uni-bochum.de \
    --cc=linux-can@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).