RetroBSD

2.11BSD operating system for microcontrollers
It is currently Sun Sep 15, 2019 8:14 pm

All times are UTC




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Writing Drivers
PostPosted: Wed Sep 07, 2016 7:07 am 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi Everyone,

Is there a skeleton driver that I can use to develop my own device driver? I want to emulate a Mass Storage Device that uses a directory on the SD card to store files and then use an application to read / write the files and send them over the network interface.

Any pointers or info would be very much appreciated.

Thanks,

Dan


Top
 Profile  
 
 Post subject: Re: Writing Drivers
PostPosted: Wed Sep 07, 2016 1:02 pm 
Contributor

Joined: Mon Nov 12, 2012 1:34 pm
Posts: 1092
Hi Dan,

I have a loadable device driver or sorts working in my kludged version of RetroBSD.

If you take a look in the sources for one of the simpler drivers, it is pretty easy to figure out what you have to do. Essentially there is a power up init call, an in use call, in and out and control, and a few others. I was thinking of just patching one of the unused kernel drivers to some RAM pointers and then load my test driver in that portion of kernel memory. In RetroBSD there is quite a bit of unused kernel memory.

I haven't done that RAM modification yet so my biggest problem is that the whole kernel needs to be recompiled with each test cycle :(.

My question today is whether LiteBSD supports 'kernel loadable modules'. i.e.- Can I just modify the driver and then load and retest or do I have the same problem that I have with RetroBSD?

Ideally the kernel would check some RAM location and determine if and where a 'user' driver was in memory. In that way after I write a new driver, I can just append it to the kernel image, poke one RAM value and have my 'new' driver 'installed'.

Lots of fun :).

Wiz


Top
 Profile  
 
 Post subject: Re: Writing Drivers
PostPosted: Tue Sep 13, 2016 7:41 pm 
Committer
User avatar

Joined: Wed Oct 10, 2012 11:01 pm
Posts: 1081
Location: Sunnyvale, CA
Hi Dan,
DanTheMan wrote:
Is there a skeleton driver that I can use to develop my own device driver? I want to emulate a Mass Storage Device that uses a directory on the SD card to store files and then use an application to read / write the files and send them over the network interface.

Would a generic disk driver skeleton help as a first approximation? I can create one for you. Or you might use the existing sd.c driver, make a copy and remove all the stuff related to SD card.

--Serge


Top
 Profile  
 
 Post subject: Re: Writing Drivers
PostPosted: Wed Sep 14, 2016 8:17 am 

Joined: Mon Nov 24, 2014 1:07 pm
Posts: 58
Hi Serge,

A skeleton driver would be great if you wouldn't mind, I'm sure this would be helpful to others going forward as well.

Thanks,

Dan


Top
 Profile  
 
 Post subject: Re: Writing Drivers
PostPosted: Tue Sep 27, 2016 4:03 pm 

Joined: Wed Sep 21, 2016 4:02 pm
Posts: 2
Hi...as per my knowledge there is a power up init call, an in use call, in and out and control, and a few others. I was thinking of just patching one of the unused kernel drivers to some RAM pointers and then load my test driver in that portion of kernel memory.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
cron




Powered by phpBB® Forum Software © phpBB Group

BSD Daemon used with permission