All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Kisdaroczi <kisda@domain.hid>
To: Anisha Kaul <anisha.kaul@domain.hid>, xenomai@xenomai.org
Subject: Re: [Xenomai-help] unable to open serial port from a kernel module
Date: Wed, 11 Nov 2009 15:30:06 +0100	[thread overview]
Message-ID: <4AFACA6E.8000301@domain.hid> (raw)
In-Reply-To: <200911111932.10783.anisha.kaul@domain.hid>

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

Hi,

> int main ()
> {
>     mlockall (MCL_CURRENT|MCL_FUTURE);

you need to call rt_task_shadow(...) here (see docs),
which turns the current Linux task into a native Xenomai task.

>     rt_heap_bind  (&heap_desc, "MyHeap", TM_NONBLOCK);
>     rt_heap_alloc (&heap_desc, 1, TM_NONBLOCK, &shmem);

check all return values. I guess its -19 too without rt_task_shadow.

> /***************************************/
>     int result = rt_dev_open  ("rtdev0", 0);
> 
>     printf ("\n%d passed ", result);
> 
>     rt_dev_write (result, "abcd", 4);
> /***************************************/
> }

good luck,
kisda


Anisha Kaul schrieb:
> On Wednesday November 11 2009 14  : 49  : 19 you wrote:
>> Anisha Kaul wrote:
>>> hi,
>>>
>>> when i use rt_dev_open ("/dev/ttyS0", 0); from the function init_module
>>> () of a self written kernel module, it returns -19 ! What must be the
>>> reason, can't a file be opened from a kernel module ?
>> Please read documentation and examples more carefully: "rtdev0" is the
>> answer.
>>
>> Jan
> 
> Hi,
> 
> I forgot to attach the kernel module file as well as the user space file in 
> the previous mail. Hereby I have included both of them !
> 
> kernel module file: serialPortISR.c
> user space file   : userSpace.c
> 
> thanks,
> anisha
> 
> 
> ------------------------------------------------------------------------
> 
> 
> 
> -------------------------------------
> Hi-Tech Gears Limited, Gurgaon, India
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help



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

      reply	other threads:[~2009-11-11 14:30 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-11  8:52 [Xenomai-help] unable to open serial port from a kernel module Anisha Kaul
2009-11-11  9:19 ` Jan Kiszka
2009-11-11 13:19   ` Anisha Kaul
2009-11-11 14:02   ` Anisha Kaul
2009-11-11 14:30     ` Stefan Kisdaroczi [this message]

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=4AFACA6E.8000301@domain.hid \
    --to=kisda@domain.hid \
    --cc=anisha.kaul@domain.hid \
    --cc=xenomai@xenomai.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 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.