wake-0 / fhvOS

This repository contains an os for the arm cortex a8 in combination with beaglebone.
GNU General Public License v2.0
7 stars 1 forks source link

[Driver] Add structure for abstract driver #3

Closed trylimits closed 9 years ago

trylimits commented 9 years ago

See title

trylimits commented 9 years ago

Done. @Blackjack92 pls review.

trylimits commented 9 years ago

I extended the existing driver struct similar to SunOS (unix-based). See http://docs.oracle.com/cd/E19253-01/816-4855/config12-91355/index.html at "cb_ops".

I will implement the driver for LED (Bug #5) to demonstrate the concept.

trylimits commented 9 years ago

@Blackjack92 @mpe5651 Please review and close if this interface to drivers is ok.

Imo this interface covers all use-cases and we should be fine with it.

trylimits commented 9 years ago

Abstract driver works for the momement.

Usage example:

DeviceManagerInit();

int i = 0;
char* leds[] = { "LED0", "LED1", "LED2", "LED3" };
for (i = 0; i < 4; i++) {
    device_t led = DeviceManagerGetDevice(leds[i], 4);
    DeviceManagerOpen(led);
    DeviceManagerWrite(led, "1", 1);
}