I would just like to see if any one could tell me how to program drivers?
-MeLkOr
Driver Programming in C++
Re:Driver Programming in C++
Catch the interrupt, copy data, return from interrupt.
Every good solution is obvious once you've found it.
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Driver Programming in C++
or - micro kernel like:
catch interrupt, buffer data, send message to driver task, return from interrupt
it is a splitted interrupt handling: task is shared between isr and a thread which does the actual processing of data fetched by the isr from some port/hardware.
I am still on the way of forming more and more abstraction, til I get some descriptors in the file system which i can open/close/etc., so I can't show an appendable way of how to do it.
catch interrupt, buffer data, send message to driver task, return from interrupt
it is a splitted interrupt handling: task is shared between isr and a thread which does the actual processing of data fetched by the isr from some port/hardware.
I am still on the way of forming more and more abstraction, til I get some descriptors in the file system which i can open/close/etc., so I can't show an appendable way of how to do it.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Driver Programming in C++
there's nothing like a generic procedure to develop any driver for any environment ... which device do you wish to support with your driver ?
Re:Driver Programming in C++
Umm... I don't really know what kind of drivers I want. Lol. Probibly video drivers because that way you can see what is being outputted to the screen.
-MeLkOr
-MeLkOr
Re:Driver Programming in C++
A simple video driver:
This supports one device (the video card whose text-mode buffer is located at B8000) and one operation (display_string). It doesn't use any interrupts because it doesn't need to.
Code: Select all
void display_string(int x, int y, const char *str)
{
unsigned short *vidmem = (unsigned short*) 0xb8000;
while (*str != '\0')
{
vidmem[y * 80 + x] = *str;
x++;
if (x >= 80)
{
x = 0;
y++;
}
if (y >= 25)
y = 0;
str++;
}
}