Tutorial: Device Driver Programming in MINIX 3

2056 views
Skip to first unread message

Niek Linnenbank

unread,
Dec 1, 2009, 7:11:21 PM12/1/09
to minix3
Hi all,

I wrote a tutorial on programming device drivers in MINIX 3. Ever
since I started
with MINIX and operating systems, I really missed a tutorial like
this, so I hope I can make somebody happy with it :-) It can be found
in the developers guide on the wiki:

http://wiki.minix3.org/en/DevelopersGuide/DriverProgramming

Regards,

Niek

Althaf K Backer

unread,
Dec 2, 2009, 1:06:27 AM12/2/09
to min...@googlegroups.com
Wow, nice work, Niek you are filling the gap that Minix currently
have , excellent work , expecting like this more from you :)
Thanking you for this effort. :)

Althaf

Arun Thomas

unread,
Dec 2, 2009, 2:54:00 AM12/2/09
to min...@googlegroups.com
Very impressive work, Niek. Thanks a lot.

Arun

Debjit Biswas

unread,
Dec 2, 2009, 3:27:38 AM12/2/09
to minix3
Now that's the document I have been waiting for. Nice work :-)

Iggo

unread,
Dec 2, 2009, 3:57:54 AM12/2/09
to minix3
Great Niek!

Thank you very much!!

Evgeniy Ivanov

unread,
Dec 2, 2009, 8:49:48 AM12/2/09
to min...@googlegroups.com
Great work!


--

You received this message because you are subscribed to the Google Groups "minix3" group.
To post to this group, send email to min...@googlegroups.com.
To unsubscribe from this group, send email to minix3+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/minix3?hl=en.





--
Evgeniy Ivanov

m r

unread,
Dec 2, 2009, 12:27:11 PM12/2/09
to min...@googlegroups.com
nice...

javadimon

unread,
Dec 2, 2009, 1:47:09 PM12/2/09
to minix3
It's just great!
Thank's.

jonyii

unread,
Dec 2, 2009, 6:21:39 AM12/2/09
to minix3
Very useful in deed.

tota

unread,
Dec 3, 2009, 5:12:33 AM12/3/09
to minix3
Very impressive work, Niek. Thanks!

I have question. "Example 4: RS232 Serial Port" - When it will be
written?
RS-232 it is very important!

Tota

Julian G. D.

unread,
Dec 3, 2009, 11:46:05 AM12/3/09
to minix3
WoWW, thanks a lot!
This is the document I've been looking for.
Who wants to write a usb device driver with me?

Julian G. D.

unread,
Dec 5, 2009, 5:57:13 PM12/5/09
to minix3
Yes, will you write that Example?

Alex Vedenev

unread,
Oct 7, 2012, 1:14:33 PM10/7/12
to min...@googlegroups.com
Great work, Niek!
Thank you very much!
I will study this guide and learn how to write drivers. Now it should be easier.

среда, 2 декабря 2009 г., 6:11:21 UTC+6 пользователь Niek Linnenbank написал:

Patrick Mc(avery

unread,
Oct 7, 2012, 10:58:57 PM10/7/12
to min...@googlegroups.com
I am grateful too.

I don't know that much about writing drivers... Do you think it is
easier to write drivers for Minix then let's say BSD. I was thinking
that since the drivers are in userland it might be.

Thanks

Niek Linnenbank

unread,
Oct 8, 2012, 6:01:40 PM10/8/12
to min...@googlegroups.com
Good to hear my tutorial is useful to you.

Writing a userland driver could indeed help make the task easier, especially in MINIX. If you make a serious mistake
while developing (happens more often than you think), you won't crash your entire machine, but only your driver.

On the other hand, with a userland driver you still need to know C well and study any relevant hardware documentation.

I can also recommend you to use Qemu (http://wiki.qemu.org) for learning how to write drivers. Qemu allows you to
inspect the emulated device and debug your kernel with GDB.

Regards,
Niek

--
You received this message because you are subscribed to the Google Groups "minix3" group.
To post to this group, send email to min...@googlegroups.com.
To unsubscribe from this group, send email to minix3+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/minix3?hl=en.

vengat babu

unread,
Mar 26, 2014, 6:35:35 AM3/26/14
to min...@googlegroups.com
hi sir
     I'm currently working on developing a reasonably sized kernel module in minix os.I need to develop and run a kernel in that os. but m not familiar with minix.please help to achieve the target. send me the complete command with procedure....thank you.!!!! I'm eagerly waiting for your priceless reply..
                                                                      

vengat babu

unread,
Mar 26, 2014, 6:37:25 AM3/26/14
to min...@googlegroups.com, althaf...@gmail.com

vengat babu

unread,
Mar 26, 2014, 6:37:57 AM3/26/14
to min...@googlegroups.com

vengat babu

unread,
Mar 26, 2014, 6:39:06 AM3/26/14
to min...@googlegroups.com

Nicholas Heath

unread,
Apr 30, 2014, 5:07:56 PM4/30/14
to min...@googlegroups.com
This is very well written. Thanks!

Haïssam Razouk

unread,
Nov 1, 2014, 1:16:14 PM11/1/14
to min...@googlegroups.com
Hello,

Thanks a lot for this great tutorial ! Very clear and understandable, though I'm a newbie and I'll work more on this.
I had a simple question -maybe it's more a simple disambiguation-.

On OSDev, it is stated :
For example, if code does "while(update_in_progress_flag != clear)" and then starts reading all the time and date registers, then the update could begin immediately after the "Update in progress" flag was checked and the code could still read dodgy/inconsistent values.

But in your code, we only have :
 /*
  68      * Wait until the Update In Progress (UIP) flag is clear, meaning
  69      * that the RTC registers are in a stable state.
  70      */
  71     while (!(cmos_read_byte(RTC_STATUS_A) & RTC_UIP))
  72     {
  73         ;
  74     }

Does it mean that the code is partly unstable, as stated on OSDev ?
If it is so, it could be a good exercise to rewrite it and enhance it.

Thanks a lot for your time and work !
Haïssam.

Niek Linnenbank

unread,
Nov 2, 2014, 6:15:29 PM11/2/14
to minix3

You're welcome. Im glad you like the tutorial.

It is possible you are right. I wrote this tutorial long ago, so I forgot about the details already.

Niek

--
You received this message because you are subscribed to the Google Groups "minix3" group.
To unsubscribe from this group and stop receiving emails from it, send an email to minix3+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David van Moolenbroek

unread,
Nov 4, 2014, 5:58:22 AM11/4/14
to min...@googlegroups.com
Hey Haïssam,


On Saturday, November 1, 2014 6:16:14 PM UTC+1, Haïssam Razouk wrote:
Does it mean that the code is partly unstable, as stated on OSDev ?

Great observation; you're absolutely right. In fact, MINIX3 is not a hard-realtime OS, and thus no guarantees are given about scheduling of processes (including drivers). As such, the UIP flag is not useful for getting a stable RTC value at all. One solution would be the interrupt-based approach mentioned on the same OSDev page [1]; another would consist of retrieving the RTC values multiple times and doing something "smart" based on the differences if any.

Contributions to driver programming wiki page are certainly welcome!

Regards,
David

[1] http://wiki.osdev.org/CMOS

Juan Carlos Ferrel

unread,
Feb 17, 2015, 9:55:06 PM2/17/15
to min...@googlegroups.com
Hello, I am using Minix 3.2.1 and I am trying to follow the example but in my machine does not work there is a lot of indefinites 
Thanks

Yassmina Eddarkaoui

unread,
Mar 18, 2015, 2:15:40 AM3/18/15
to min...@googlegroups.com


hi, I want, you make a tutoriel that explain how install Minx3 with Ubuntu, please.

David van Moolenbroek

unread,
Mar 20, 2015, 12:54:29 PM3/20/15
to min...@googlegroups.com
Hi,


On Wednesday, March 18, 2015 at 7:15:40 AM UTC+1, Yassmina Eddarkaoui wrote:
hi, I want, you make a tutoriel that explain how install Minx3 with Ubuntu, please.

Please don't hijack threads to ask unrelated questions. There already is a page that contains what you are looking for:

http://wiki.minix3.org/doku.php?id=developersguide:crosscompiling

Regards,
David

johnswolter

unread,
Apr 5, 2015, 11:09:15 AM4/5/15
to min...@googlegroups.com
...& as I briefly look @ ...

" /*
68 * Wait until the Update In Progress (UIP) flag is clear, meaning
69 * that the RTC registers are in a stable state.
70 */
71 while (!(cmos_read_byte(RTC_STATUS_A) & RTC_UIP))
72 {
73 ;
74 }
"
....I'm thinking it looks like an infinite looo...op.

johnswolter

unread,
Apr 5, 2015, 11:20:50 AM4/5/15
to min...@googlegroups.com
Thank you for mentioning http://wiki.osdev.org. Appears to be a great resource for writing not only drivers but entire operating systems.

Yassmina Eddarkaoui

unread,
Apr 9, 2015, 4:14:42 PM4/9/15
to min...@googlegroups.com
Thanks for your help, I am just a beginner on MINIX3


--
You received this message because you are subscribed to a topic in the Google Groups "minix3" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/minix3/qhekxviRpYU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to minix3+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages