Chapter 44
FreeBSD Driver Set: liboskit_freebsd_dev.a

44.1 Introduction

This chapter is woefully incomplete. The OSKit FreeBSD device library provides an infrastructure for using unmodified FreeBSD 2.1.7 device drivers.

44.2 Supported Devices

The FreeBSD device library currently supports only the system console and a few ISA-based serial port interfaces all exporting the oskit_ttystream interface. Only the system console and PS/2 mouse have been tested.

Following is a list of supported drivers. The tag is the name used by the device library to refer to the devices (see Section 17.3 for details on device naming).

44.3 Header Files

44.3.1 freebsd.h: common device driver framework definitions

SYNOPSIS

#include <oskit/dev/freebsd.h>

DESCRIPTION

Contains common definitions and function prototypes for the OSKit’s FreeBSD device interfaces described in the next section.

44.4 Interfaces

44.4.1 oskit_freebsd_init: Initialize and FreeBSD device driver support package

SYNOPSIS

#include <oskit/dev/freebsd.h>

void oskit_freebsd_init(void);

DIRECTION

OS --> Component

DESCRIPTION

Initializes the support code for FreeBSD device drivers.

Currently the oskit_freebsd_init_driver routines take care of invoking any required freebsd device initialization functions, including this one. This may change in the future.

44.4.2 oskit_freebsd_init_devs: Initialize and register all FreeBSD device drivers

SYNOPSIS

#include <oskit/dev/freebsd.h>

void oskit_freebsd_init_devs(void);

DIRECTION

OS --> Component

DESCRIPTION

Initialize and register all available FreeBSD device drivers.

Warning messages will be printed with osenv_log for drivers which cannot be initialized but the initialization process will continue.

RELATED INFORMATION

osenv_log

44.4.3 oskit_freebsd_init_isa: Initialize and register all FreeBSD ISA bus device drivers

SYNOPSIS

#include <oskit/dev/freebsd.h>

void oskit_freebsd_init_isa(void);

DIRECTION

OS --> Component

DESCRIPTION

Initialize and register all available FreeBSD ISA bus device drivers. See <oskit/dev/freebsd_isa.h> for the currently available devices.

Warning messages will be printed with osenv_log for drivers which cannot be initialized but the initialization process will continue.

Currently the oskit_freebsd_init_driver routines take care of invoking any required freebsd device initialization functions, including this one. This may change in the future.

RELATED INFORMATION

osenv_log

44.4.4 oskit_freebsd_init_driver : Initialize and register a single FreeBSD device driver

SYNOPSIS

#include <oskit/dev/freebsd.h>

oskit_error_t oskit_freebsd_init_driver(void);

DIRECTION

OS --> Component

DESCRIPTION

Initialize a single FreeBSD device driver. Possible values for driver are listed in Section 44.2.

RETURNS

Returns 0 on success, an error code specified in <oskit/dev/error.h> on error.

44.5 “Back door” Interfaces

“Back door” interfaces are intended for users which have some builtin knowledge of FreeBSD internals and want to convert that knowledge to interface-level equivalents.

44.5.1 oskit_freebsd_chardev_open: Open a character device using a FreeBSD major/minor device value

SYNOPSIS

#include <oskit/dev/freebsd.h>

oskit_error_t oskit_freebsd_chardev_open(int major, int minor, int flags, [out] oskit_ttystream_t **tty_stream);

DIRECTION

OS --> Component

DESCRIPTION

Opens a character device given a FreeBSD major and minor device value. Returns a pointer to an oskit_ttystream_t interface as though oskit_ttydev_open was called on an OSKit oskit_ttydev_t interface.

PARAMETERS
major:
Major device number. In FreeBSD, this is the index of the device in the character device switch.
minor:
Minor device number. In FreeBSD, the interpretation of the minor device number is device specific.
flags:
POSIX open flags.
tty_stream:
Returned oskit_ttystream_t interface.
RETURNS

Returns 0 on success, an error from <oskit/dev/error.h> otherwise.

44.5.2 oskit_freebsd_xlate_errno: Translate a FreeBSD error number

SYNOPSIS

#include <oskit/dev/freebsd.h>

oskit_error_t oskit_freebsd_xlate_errno(int freebsd_error);

DIRECTION

OS --> Component

DESCRIPTION

Translates a FreeBSD error number into an OSKit error number.

PARAMETERS
freebsd_error:
The FreeBSD error code to be translated.
RETURNS

Returns an equivalent error value from <oskit/dev/error.h>, or OSKIT_E_UNEXPECTED if there is no suitable translation.