*.bin
Makefile.user.cfg
+QemuLog.txt
+Screenshots/
include/iocache.h \
arch/archdoc.h \
include/apidoc/arch_x86.h \
- include/tpl_drv_common.h \
- include/tpl_drv_video.h \
- include/tpl_drv_terminal.h \
- include/tpl_drv_disk.h \
- include/tpl_drv_keyboard.h \
- include/tpl_drv_network.h
+ include/api_drv_common.h \
+ include/api_drv_video.h \
+ include/api_drv_terminal.h \
+ include/api_drv_disk.h \
+ include/api_drv_keyboard.h \
+ include/api_drv_joystick.h \
+ include/api_drv_network.h
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is
# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py *.f90
-FILE_PATTERNS = tpl_drv_*.h
+FILE_PATTERNS = api_drv_*.h
#*.c *.h
# The RECURSIVE tag can be used to turn specify whether or not subdirectories
#include <acess.h>
#include <fs_devfs.h>
#include <modules.h>
-#include <tpl_drv_video.h>
-#include <tpl_drv_keyboard.h>
-#include <tpl_drv_terminal.h>
+#include <api_drv_video.h>
+#include <api_drv_keyboard.h>
+#include <api_drv_terminal.h>
#include <errno.h>
#include <semaphore.h>
*/
#define DEBUG 0
#include <acess.h>
-#include <tpl_drv_disk.h>
-#include <tpl_drv_video.h>
+#include <api_drv_disk.h>
+#include <api_drv_video.h>
// === CODE ===
// --- Video Driver Helpers ---
--- /dev/null
+/**
+ * \file api_drv_common.h
+ * \brief Common Driver Interface Definitions
+ * \author John Hodge (thePowersGang)
+ *
+ * \section Introduction
+ * There are two ways Acess drivers can communicate with userspace
+ * applications, both are through the VFS. The first is by exposing a
+ * device as a file buffer, the second is by sending commands via the
+ * ioctl() system call.
+ * All drivers in Acess must at least conform to the specifcation in this
+ * file (even if it is just implementing eTplDrv_IOCtl.DRV_IOCTL_TYPE and
+ * returning eTplDrv_Type.DRV_TYPE_NULL, however, doing so is discouraged)
+ *
+ * \section ioctls Core IOCtl calls
+ * As said, the core Acess driver specifcation defines specific IOCtl calls
+ * that all drivers should implement. The four core IOCtls (defined in
+ * ::eTplDrv_IOCtl) allow another binary (wether it be a user-mode application
+ * or another driver) to tell what type of device a driver provides, the
+ * basic identifcation of the driver (4 character ID and BCD version number)
+ * and be able to use externally standardised calls that may not have
+ * standardised call numbers.
+ * NOTE: All ioctl calls WILL return -1 if the driver ran into an error
+ * of its own fault while executing the call. If the user was at fault
+ * (e.g. by passing a bad buffer) the call will return -2.
+ *
+ * \section types Driver Types
+ * When the eTplDrv_IOCtl.DRV_IOCTL_TYPE call is made, the driver should
+ * return the relevant entry in the ::eTplDrv_Type enumeration that describes
+ * what sub-specifcation (and hence, what device type) it implements.
+ * These device types are described in their own files, which are liked
+ * from their entries in ::eTplDrv_Type.
+ */
+#ifndef _API_DRV_COMMON_H
+#define _API_DR_COMMON_H
+
+/**
+ * \enum eTplDrv_IOCtl
+ * \brief Common IOCtl Calls
+ */
+enum eTplDrv_IOCtl {
+ /**
+ * ioctl(...)
+ * \brief Get driver type
+ * \return The relevant entry from ::eTplDrv_Type
+ */
+ DRV_IOCTL_TYPE,
+
+ /**
+ * ioctl(..., char *dest[32])
+ * \brief Get driver identifier string
+ * \return 0 on no error
+ *
+ * This call sets the 32-byte array \a dest to the drivers 31 charater
+ * identifier. This identifier must be unique to the driver series.
+ */
+ DRV_IOCTL_IDENT,
+
+ /**
+ * ioctl(...)
+ * \brief Get driver version number
+ * \return 24-bit BCD version number (2.2.2)
+ *
+ * This call returns the 6-digit (2 major, 2 minor, 2 patch) version
+ * number of the driver.
+ */
+ DRV_IOCTL_VERSION,
+
+ /**
+ * ioctl(..., char *name)
+ * \brief Get a IOCtl call ID from a symbolic name
+ * \return ID number of the call, or 0 if not found
+ *
+ * This call allows user applications to not need to know the ID numbers
+ * of this driver's IOCtl calls by taking a string and returning the
+ * IOCtl call number associated with that method name.
+ */
+ DRV_IOCTL_LOOKUP
+};
+
+/**
+ * \brief eTplDrv_IOCtl.DRV_IOCTL_LOOKUP names for the core IOCtls
+ * These are the official lookup names of the core calls
+ */
+#define DRV_IOCTLNAMES "type", "ident", "version", "lookup"
+
+/**
+ * \brief Helper macro for the base IOCtl calls
+ * \param _type Type number from eTplDrv_Type to return
+ * \param _ident String of max 32-characters that identifies this driver
+ * \param _version Driver's 8.8.8 BCD version number
+ * \param _ioctls Pointer to the IOCtls string array
+ * \warning If you have DEBUG enabled in the calling file, this function
+ * will do LEAVE()s before returning, so make sure that the
+ * IOCtl function is ENTER()ed when using debug with this macro
+ *
+ * Usage: (Id is the IOCtl call ID)
+ * \code
+ * switch(Id)
+ * {
+ * BASE_IOCTLS(DRV_TYPE_MISC, "Ident", 0x100, csaIOCtls)
+ * // Your IOCtls go here, starting at index 4
+ * }
+ * \endcode
+ */
+#define BASE_IOCTLS(_type, _ident, _version, _ioctls) \
+ case DRV_IOCTL_TYPE: LEAVE('i', (_type)); return (_type);\
+ case DRV_IOCTL_IDENT: {\
+ int tmp = ModUtil_SetIdent(Data, (_ident));\
+ LEAVE('i', tmp); return tmp;\
+ }\
+ case DRV_IOCTL_VERSION: LEAVE('x', (_version)); return (_version);\
+ case DRV_IOCTL_LOOKUP:{\
+ int tmp = ModUtil_LookupString( _ioctls, (const char*)Data );\
+ LEAVE('i', tmp);\
+ return tmp;\
+ }
+
+/**
+ * \enum eTplDrv_Type
+ * \brief Driver Types returned by DRV_IOCTL_TYPE
+ */
+enum eTplDrv_Type {
+ DRV_TYPE_NULL, //!< NULL Type - Custom Interface
+ DRV_TYPE_MISC, //!< Miscelanious Compilant - Supports the core calls
+ DRV_TYPE_TERMINAL, //!< Terminal - see api_drv_terminal.h
+ DRV_TYPE_VIDEO, //!< Video - see api_drv_video.h
+ DRV_TYPE_SOUND, //!< Audio
+ DRV_TYPE_DISK, //!< Disk - see api_drv_disk.h
+ DRV_TYPE_KEYBOARD, //!< Keyboard - see api_drv_keyboard.h
+ DRV_TYPE_MOUSE, //!< Mouse
+ DRV_TYPE_JOYSTICK, //!< Joystick / Gamepad
+ DRV_TYPE_NETWORK //!< Network Device - see api_drv_network.h
+};
+
+#endif
--- /dev/null
+/**\r
+ * \file api_drv_disk.h\r
+ * \brief Disk Driver Interface Definitions\r
+ * \author John Hodge (thePowersGang)\r
+ * \r
+ * \section Nomeclature\r
+ * All addreses are 64-bit counts of bytes from the logical beginning of\r
+ * the disk unless explicitly stated.\r
+ * \r
+ * \section dirs VFS Layout\r
+ * Disk drivers have a flexible directory layout. The root directory can\r
+ * contain subdirectories, with the only conditions being that all nodes\r
+ * must support ::eTplDrv_IOCtl with DRV_IOCTL_TYPE returning DRV_TYPE_DISK.\r
+ * And all file nodes representing disk devices (or partitions) and implemeting\r
+ * ::eTplDisk_IOCtl fully\r
+ * \r
+ * \section files Files\r
+ * When a read or write occurs on a normal file in the disk driver it will\r
+ * read/write the represented device. The accesses need not be aligned to\r
+ * the block size, however aligned reads/writes should be handled specially\r
+ * to improve speed (this can be aided by using ::DrvUtil_ReadBlock and\r
+ * ::DrvUtil_WriteBlock)\r
+ */\r
+#ifndef _API_DRV_DISK_H\r
+#define _API_DRV_DISK_H\r
+\r
+#include <api_drv_common.h>\r
+\r
+/**\r
+ * \enum eTplDisk_IOCtl\r
+ * \brief Common Disk IOCtl Calls\r
+ * \extends eTplDrv_IOCtl\r
+ */\r
+enum eTplDisk_IOCtl {\r
+ /**\r
+ * ioctl(..., void)\r
+ * \brief Get the block size\r
+ * \return Size of a hardware block for this device\r
+ */\r
+ DISK_IOCTL_GETBLOCKSIZE = 4,\r
+ \r
+ /**\r
+ * ioctl(..., tTplDisk_CacheRegion *RegionInfo)\r
+ * \brief Sets the cache importantce and protocol for a section of\r
+ * memory.\r
+ * \param RegionInfo Pointer to a region information structure\r
+ * \return Boolean failure\r
+ */\r
+ DISK_IOCTL_SETCACHEREGION,\r
+ \r
+ /**\r
+ * ioctl(..., Uint64 *Info[2])\r
+ * \brief Asks the driver to precache a region of disk.\r
+ * \param Region 64-bit Address and Size pair describing the area to cache\r
+ * \return Number of blocks cached\r
+ */\r
+ DISK_IOCTL_PRECACHE,\r
+ \r
+ /**\r
+ * ioclt(..., Uint64 *Region[2])\r
+ * \brief Asks to driver to flush the region back to disk\r
+ * \param Region 64-bit Address and Size pair describing the area to flush\r
+ * \note If Region[0] == -1 then the entire disk's cache is flushed\r
+ * \return Number of blocks flushed (or 0 for entire disk)\r
+ */\r
+ DISK_IOCTL_FLUSH\r
+};\r
+\r
+/**\r
+ * \brief Describes the cache parameters of a region on the disk\r
+ */\r
+typedef struct sTplDisk_CacheRegion\r
+{\r
+ Uint64 Base; //!< Base of cache region\r
+ Uint64 Length; //!< Size of cache region\r
+ /**\r
+ * \brief Cache Protocol & Flags\r
+ * \r
+ * The low 4 bits denot the cache protocol to be used by the\r
+ * region (see ::eTplDisk_CacheProtocols for a list).\r
+ * The high 4 bits denote flags to apply to the cache (see\r
+ * ::eTplDisk_CacheFlags)\r
+ */\r
+ Uint8 Flags;\r
+ Uint8 Priority; //!< Lower is a higher proritory\r
+ /**\r
+ * \brief Maximum size of cache, in blocks\r
+ * \note If CacheSize is zero, the implemenation defined limit is used\r
+ */\r
+ Uint16 CacheSize;\r
+} tTplDisk_CacheRegion;\r
+\r
+/**\r
+ * \brief Cache protocols to use\r
+ */\r
+enum eTplDisk_CacheProtocols\r
+{\r
+ /**\r
+ * \brief Don't cache the region\r
+ */\r
+ \r
+ DISK_CACHEPROTO_DONTCACHE,\r
+ /**\r
+ * \brief Most recently used blocks cached\r
+ * \note This is the default action for undefined regions\r
+ */\r
+ DISK_CACHEPROTO_RECENTLYUSED,\r
+ /**\r
+ * \brief Cache the entire region in memory\r
+ * \r
+ * This is a faster version of setting Length to CacheSize*BlockSize\r
+ */\r
+ DISK_CACHEPROTO_FULLCACHE,\r
+ \r
+ /**\r
+ * \brief Cache only on demand\r
+ * \r
+ * Only cache when the ::DISK_IOCTL_PRECACHE IOCtl is used\r
+ */\r
+ DISK_CACHEPROTO_EXPLICIT\r
+};\r
+\r
+/**\r
+ * \brief Flags for the cache\r
+ */\r
+enum eTplDisk_CacheFlags\r
+{\r
+ /**\r
+ * \brief Write all changes to the region straight back to media\r
+ */\r
+ DISK_CACHEFLAG_WRITETHROUGH = 0x10\r
+};\r
+\r
+/**\r
+ * \brief IOCtl name strings\r
+ */\r
+#define DRV_DISK_IOCTLNAMES "get_block_size","set_cache_region","set_precache"\r
+\r
+/**\r
+ * \name Disk Driver Utilities\r
+ * \{\r
+ */\r
+\r
+/**\r
+ * \brief Callback function type used by DrvUtil_ReadBlock and DrvUtil_WriteBlock\r
+ * \param Address Zero based block number to read\r
+ * \param Count Number of blocks to read\r
+ * \param Buffer Destination for read blocks\r
+ * \param Argument Argument provided in ::DrvUtil_ReadBlock and ::DrvUtil_WriteBlock\r
+ */\r
+typedef Uint (*tDrvUtil_Callback)(Uint64 Address, Uint Count, void *Buffer, Uint Argument);\r
+\r
+/**\r
+ * \brief Reads a range from a block device using aligned reads\r
+ * \param Start Base byte offset\r
+ * \param Length Number of bytes to read\r
+ * \param Buffer Destination for read data\r
+ * \param ReadBlocks Callback function to read a sequence of blocks\r
+ * \param BlockSize Size of an individual block\r
+ * \param Argument An argument to pass to \a ReadBlocks\r
+ * \return Number of bytes read\r
+ */\r
+extern Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer,\r
+ tDrvUtil_Callback ReadBlocks, Uint64 BlockSize, Uint Argument);\r
+/**\r
+ * \brief Writes a range to a block device using aligned writes\r
+ * \param Start Base byte offset\r
+ * \param Length Number of bytes to write\r
+ * \param Buffer Destination for read data\r
+ * \param ReadBlocks Callback function to read a sequence of blocks\r
+ * \param WriteBlocks Callback function to write a sequence of blocks\r
+ * \param BlockSize Size of an individual block\r
+ * \param Argument An argument to pass to \a ReadBlocks and \a WriteBlocks\r
+ * \return Number of bytes written\r
+ */\r
+extern Uint64 DrvUtil_WriteBlock(Uint64 Start, Uint64 Length, void *Buffer,\r
+ tDrvUtil_Callback ReadBlocks, tDrvUtil_Callback WriteBlocks,\r
+ Uint64 BlockSize, Uint Argument);\r
+\r
+/**\r
+ * \}\r
+ */\r
+\r
+#endif\r
--- /dev/null
+/**\r
+ * \file api_drv_joystick\r
+ * \brief Joystick Driver Interface Definitions\r
+ * \author John Hodge (thePowersGang)\r
+ * \r
+ * \section dirs VFS Layout\r
+ * Joystick drivers define a single VFS node, that acts as a fixed size file.\r
+ * Reads from this file return the current state, writes are ignored.\r
+ *\r
+ * \section File Structure\r
+ * The device file must begin with a valid sJoystick_FileHeader structure.\r
+ * The file header is followed by \a NAxies instances of sJoystick_Axis, one\r
+ * for each axis.\r
+ * This is followed by \a NButtons boolean values (represented using \a Uint8),\r
+ * each representing the state of a single button (where 0 is unpressed,\r
+ * 0xFF is fully depressed - intermediate values are valid in the case of\r
+ * variable-pressure buttons)\r
+ */\r
+#ifndef _API_DRV_JOYSTICK_H\r
+#define _API_DRV_JOYSTICK_H\r
+\r
+#include <api_drv_common.h>\r
+\r
+/**\r
+ * \enum eTplJoystick_IOCtl\r
+ * \brief Common Joystick IOCtl Calls\r
+ * \extends eTplDrv_IOCtl\r
+ */\r
+enum eTplJoystick_IOCtl {\r
+ /**\r
+ * ioctl(..., tJoystick_Callback *Callback)\r
+ * \brief Sets the callback\r
+ * \note Can be called from kernel mode only\r
+ *\r
+ * Sets the callback that is called when a event occurs (button or axis\r
+ * change). This function pointer must be in kernel mode (although,\r
+ * kernel->user or kernel->ring3driver abstraction functions can be used)\r
+ * \r
+ * Axis events depend on the axis limit, if non-zero, the callback fires\r
+ * if the cursor position changes. Otherwise it fires when the axis value\r
+ * (cursor accelleration) changes.\r
+ */\r
+ JOY_IOCTL_SETCALLBACK = 4,\r
+\r
+ /**\r
+ * ioctl(..., int *Argument)\r
+ * \brief Set the argument passed as the first parameter to the callback\r
+ * \note Kernel mode only\r
+ */\r
+ JOY_IOCTL_SETCALLBACKARG,\r
+\r
+ /**\r
+ * ioctl(..., tJoystickNumValue *)\r
+ * \brief Set maximum value for sJoystick_Axis.CurState\r
+ * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
+ */\r
+ JOY_IOCTL_GETSETAXISLIMIT,\r
+\r
+ /**\r
+ * ioctl(..., tJoystickNumValue *)\r
+ * \brief Set the value of sJoystick_Axis.CurState\r
+ * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
+ */\r
+ JOY_IOCTL_GETSETAXISPOSITION,\r
+ \r
+ /**\r
+ * ioctl(..., tJoystickNumValue *)\r
+ * \brief Set axis flags\r
+ * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
+ * \todo Define flag values\r
+ */\r
+ JOY_IOCTL_GETSETAXISFLAGS,\r
+\r
+ /**\r
+ * ioctl(..., tJoystickNumValue *)\r
+ * \brief Set Button Flags\r
+ * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
+ * \todo Define flag values\r
+ */\r
+ JOY_IOCTL_GETSETBUTTONFLAGS,\r
+};\r
+\r
+#define DRV_JOY_IOCTLNAMES "set_callback", "set_callback_arg", "getset_axis_limit", "getset_axis_position", \\r
+ "getset_axis_flags", "getset_button_flags"\r
+\r
+// === TYPES ===\r
+typedef struct sJoystick_NumValue tJoystick_NumValue;\r
+typedef struct sJoystick_FileHeader tJoystick_FileHeader;\r
+typedef struct sJoystick_Axis tJoystick_Axis;\r
+\r
+/**\r
+ * \brief Number/Value pair for joystick IOCtls\r
+ */\r
+struct sJoystick_NumValue\r
+{\r
+ int Num; //!< Axis/Button number\r
+ int Value; //!< Value (see IOCtl defs for meaning)\r
+};\r
+\r
+/**\r
+ * \brief Callback type for JOY_IOCTL_SETCALLBACK\r
+ * \param Ident Ident value passed to JOY_IOCTL_SETCALLBACK\r
+ * \r
+ */\r
+typedef void (*tJoystick_Callback)(int Ident, int bIsAxis, int Num, int Delta);\r
+\r
+/**\r
+ * \struct sJoystick_FileHeader\r
+ */\r
+struct sJoystick_FileHeader\r
+{\r
+ Uint16 NAxies; //!< Number of Axies\r
+ Uint16 NButtons; //!< Number of buttons\r
+};\r
+\r
+/**\r
+ * \brief Axis Definition in file data\r
+ *\r
+ * Describes the current state of an axis on the joystick.\r
+ * \a CursorPos is between zero and the current limit set by the\r
+ * JOY_IOCTL_GETSETAXISLIMIT IOCtl, while \a CurValue indicates the\r
+ * current position of the joystick axis. This is defined to be between\r
+ * \a MinValue and \a MaxValue.\r
+ */\r
+struct sJoystick_Axis\r
+{\r
+ Sint16 MinValue; //!< Minumum value for \a CurValue\r
+ Sint16 MaxValue; //!< Maximum value for \a CurValue\r
+ Sint16 CurValue; //!< Current value (joystick position)\r
+ Uint16 CursorPos; //!< Current state (cursor position)\r
+};\r
+\r
+#define JOY_INFOSTRUCT(_naxies, _nbuttons) struct { \\r
+ Uint16 NAxies, NButtons;\\r
+ tJoystick_Axis Axies[_naxies];\\r
+ Uint16 Buttons[_nbuttons];\\r
+ }\r
+\r
+#endif\r
--- /dev/null
+/**\r
+ * \file api_drv_keyboard.h\r
+ * \brief Keyboard Driver Interface Definitions\r
+ * \author John Hodge (thePowersGang)\r
+ * \r
+ * \section dirs VFS Layout\r
+ * Keyboard drivers consist of only a single node, which is a normal file\r
+ * node with a size of zero. All reads and writes to this node are ignored\r
+ * (tVFS_Node.Read and tVFS_Node.Write are NULL)\r
+ */\r
+#ifndef _API_DRV_KEYBOARD_H\r
+#define _API_KEYBOARD_H\r
+\r
+#include <api_drv_common.h>\r
+\r
+/**\r
+ * \enum eTplKeyboard_IOCtl\r
+ * \brief Common Keyboard IOCtl Calls\r
+ * \extends eTplDrv_IOCtl\r
+ */\r
+enum eTplKeyboard_IOCtl {\r
+ /**\r
+ * ioctl(..., int *Rate)\r
+ * \brief Get/Set Repeat Rate\r
+ * \param Rate New repeat rate (pointer)\r
+ * \return Current/New Repeat rate\r
+ * \r
+ * Gets/Set the repeat rate (actually the time in miliseconds between\r
+ * repeats) of a held down key.\r
+ * If the rate is set to zero, repeating will be disabled.\r
+ */\r
+ KB_IOCTL_REPEATRATE = 4,\r
+ \r
+ /**\r
+ * ioctl(..., int *Delay)\r
+ * \brief Get/Set Repeat Delay\r
+ * \param Delay New repeat delay (pointer)\r
+ * \return Current/New repeat delay\r
+ * \r
+ * Gets/Set the time in miliseconds before a key starts repeating\r
+ * after a key is pressed.\r
+ * Setting the delay to a negative number will cause the function to\r
+ * return -1\r
+ */\r
+ KB_IOCTL_REPEATDELAY,\r
+ \r
+ \r
+ /**\r
+ * ioctl(..., tKeybardCallback *Callback)\r
+ * \brief Sets the callback\r
+ * \note Can be called from kernel mode only\r
+ * \r
+ * Sets the function to be called when a key event occurs (press, release\r
+ * or repeat). This function pointer must be in kernel mode (although,\r
+ * kernel->user or kernel->ring3driver abstraction functions can be used)\r
+ */\r
+ KB_IOCTL_SETCALLBACK\r
+};\r
+\r
+#define DRV_KEYBAORD_IOCTLNAMES "getset_repeat_rate", "getset_repeat_delay", "set_callback"\r
+\r
+/**\r
+ * \brief Callback type for KB_IOCTL_SETCALLBACK\r
+ * \param Key Unicode character code for the pressed key (with bit 31\r
+ * set if the key is released)\r
+ */\r
+typedef void (*tKeybardCallback)(Uint32 Key);\r
+\r
+/**\r
+ * \brief Symbolic key codes\r
+ * \r
+ * These key codes represent non-pritable characters and are placed above\r
+ * the Unicode character space.\r
+ * If the using driver recieves a key code with the 31st bit set, it means\r
+ * that that key has been released.\r
+ */\r
+enum eTplKeyboard_KeyCodes {\r
+ KEY_ESC = 0x1B, //!< Escape Character\r
+ \r
+ KEY_NP_MASK = 0x40000000, //! Mask for non-printable characters\r
+ \r
+ /**\r
+ * \name Special Keys\r
+ * \brief These keys are usually used on their own\r
+ * \{\r
+ */\r
+ KEY_CAPSLOCK,\r
+ KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT,\r
+ KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, \r
+ KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12,\r
+ KEY_NUMLOCK, KEY_SCROLLLOCK,\r
+ KEY_HOME, KEY_END, KEY_INS, KEY_DEL,\r
+ KEY_PAUSE, KEY_BREAK,\r
+ KEY_PGUP, KEY_PGDOWN,\r
+ KEY_KPENTER, KEY_KPSLASH, KEY_KPMINUS, KEY_KPPLUS, KEY_KPSTAR,\r
+ KEY_KPHOME, KEY_KPUP, KEY_KPPGUP, KEY_KPLEFT, KEY_KP5, KEY_KPRIGHT,\r
+ KEY_KPEND, KEY_KPDOWN, KEY_KPPGDN, KEY_KPINS, KEY_KPDEL,\r
+ KEY_WIN, KEY_MENU,\r
+ /**\r
+ * \}\r
+ */\r
+ \r
+ // Modifiers\r
+ /**\r
+ * \name Modifiers\r
+ * \brief These keye usually alter the character stream sent to the user\r
+ * \{\r
+ */\r
+ KEY_MODIFIERS = 0x60000000,\r
+ KEY_LCTRL, KEY_RCTRL,\r
+ KEY_LALT, KEY_RALT,\r
+ KEY_LSHIFT, KEY_RSHIFT,\r
+ /**\r
+ * \}\r
+ */\r
+};\r
+\r
+\r
+#endif\r
--- /dev/null
+/**\r
+ * \file api_drv_network.h\r
+ * \brief Network Interface Driver Interface Definitions\r
+ * \r
+ * \section dirs VFS Layout\r
+ * All network drivers must have the following basic VFS structure\r
+ * The root of the driver will only contain files that are named from zero\r
+ * upwards that represent the present network adapters that this driver\r
+ * controls. All VFS nodes must implement ::eTplDrv_IOCtl with\r
+ * DRV_IOCTL_TYPE returning DRV_TYPE_NETWORK.\r
+ * The adapter nodes must also implement ::eTplNetwork_IOCtl fully\r
+ * (unless it is noted in the ::eTplNetwork_IOCtl documentation that a\r
+ * call is optional)\r
+ * \r
+ * \section files Adapter Files\r
+ * \subsection Reading\r
+ * When an adapter file is read from, the driver will block the reading\r
+ * thread until a packet arrives (if there is not already an unhandled\r
+ * packet in the queue) this will then be read into the destination buffer.\r
+ * If the packet does not fit in the buffer, the end of it is discarded.\r
+ * Likewise, if the packet does not completely fill the buffer, the call\r
+ * will still read to the buffer and then return the size of the packet.\r
+ * \subsection Writing\r
+ * When an adapter is written to, the data written is encoded as a packet\r
+ * and sent, if the data is not the correct size to be sent (if the packet\r
+ * is too small, or if it is too large) -1 should be returned and the packet\r
+ * will not be sent.\r
+ */\r
+#ifndef _API_DRV_NETWORK_H\r
+#define _API_DRV_NETWORK_H\r
+\r
+#include <api_drv_common.h>\r
+\r
+/**\r
+ * \enum eTplNetwork_IOCtl\r
+ * \brief Common Network IOCtl Calls\r
+ * \extends eTplDrv_IOCtl\r
+ */\r
+enum eTplNetwork_IOCtl {\r
+ /**\r
+ * ioctl(..., Uint8 *MAC[6])\r
+ * \brief Get the MAC address of the interface\r
+ * \return 1 on success, 0 if the file is the root, -1 on error\r
+ * \r
+ * Copies the six byte Media Access Control (MAC) address of the\r
+ * adapter to the \a MAC array.\r
+ */\r
+ NET_IOCTL_GETMAC = 4\r
+};\r
+\r
+/**\r
+ * \brief IOCtl name strings for use with eTplDrv_IOCtl.DRV_IOCTL_LOOKUP\r
+ */\r
+#define DRV_NETWORK_IOCTLNAMES "get_mac_addr"\r
+\r
+#endif\r
--- /dev/null
+/**\r
+ * \file api_drv_terminal.h\r
+ * \brief Terminal Driver Interface Definitions\r
+*/\r
+#ifndef _API_DRV_TERMINAL_H\r
+#define _API_DRV_TERMINAL_H\r
+\r
+#include <api_drv_common.h>\r
+\r
+/**\r
+ * \brief Common Terminal IOCtl Calls\r
+ * \extends eTplDrv_IOCtl\r
+ */\r
+enum eTplTerminal_IOCtl {\r
+ /**\r
+ * ioctl(..., int *mode)\r
+ * \brief Get/Set the current video mode type\r
+ * \param mode Pointer to an integer with the new mode number (or NULL)\r
+ * If \a mode is non-NULL the current terminal mode is changed/updated\r
+ * to the mode indicated by \a *mode\r
+ * \note See ::eTplTerminal_Modes\r
+ * \return Current/new terminal mode\r
+ */\r
+ TERM_IOCTL_MODETYPE = 4,\r
+ \r
+ /**\r
+ * ioctl(..., int *width)\r
+ * \brief Get/set the display width\r
+ * \param width Pointer to an integer containing the new width (or NULL)\r
+ * \return Current/new width\r
+ * \r
+ * If \a width is non-NULL the current width is updated (but is not\r
+ * applied until ::TERM_IOCTL_MODETYPE is called with \a mode non-NULL.\r
+ */\r
+ TERM_IOCTL_WIDTH,\r
+ \r
+ /**\r
+ * ioctl(..., int *height)\r
+ * \brief Get/set the display height\r
+ * \param height Pointer to an integer containing the new height\r
+ * \return Current height\r
+ * \r
+ * If \a height is non-NULL the current height is updated (but is not\r
+ * applied until ::TERM_IOCTL_MODETYPE is called with a non-NULL \a mode.\r
+ */\r
+ TERM_IOCTL_HEIGHT,\r
+ \r
+ /**\r
+ * ioctl(..., tTerm_IOCtl_Mode *info)\r
+ * \brief Queries the current driver about it's native modes\r
+ * \param info A pointer to a ::tTerm_IOCtl_Mode with \a ID set to\r
+ * the mode index (or NULL)\r
+ * \return Number of modes\r
+ * \r
+ * If \a info is NULL, the number of avaliable vative display modes\r
+ * is returned. These display modes will have sequential ID numbers\r
+ * from zero up to this value.\r
+ * \r
+ * \note The id field of \a info is not for use with ::TERM_IOCTL_MODETYPE\r
+ * This field is just for indexing the mode to get its information.\r
+ */\r
+ TERM_IOCTL_QUERYMODE,\r
+ \r
+ /**\r
+ * ioctl(...)\r
+ * \brief Forces the current terminal to be shown\r
+ */\r
+ TERM_IOCTL_FORCESHOW,\r
+ \r
+ /**\r
+ * ioctl(...)\r
+ * \brief Returns the current text cursor position\r
+ * \return Cursor position (as X+Y*Width)\r
+ */\r
+ TERM_IOCTL_GETCURSOR\r
+};\r
+\r
+/**\r
+ * \brief Virtual Terminal Mode\r
+ * Describes a VTerm mode to the caller of ::TERM_IOCTL_QUERYMODE\r
+ */\r
+typedef struct sTerm_IOCtl_Mode\r
+{\r
+ short ID; //!< Zero Based index of mode\r
+ short DriverID; //!< Driver's ID number (from ::tVideo_IOCtl_Mode)\r
+ Uint16 Height; //!< Height\r
+ Uint16 Width; //!< Width\r
+ Uint8 Depth; //!< Bits per cell\r
+ struct {\r
+ unsigned bText: 1; //!< Text Mode marker\r
+ unsigned unused: 7;\r
+ };\r
+} tTerm_IOCtl_Mode;\r
+\r
+/**\r
+ * \brief Terminal Modes\r
+ */\r
+enum eTplTerminal_Modes {\r
+ /**\r
+ * \brief UTF-8 Text Mode\r
+ * Any writes to the terminal file are treated as UTF-8 encoded\r
+ * strings and reads will also return UTF-8 strings.\r
+ */\r
+ TERM_MODE_TEXT,\r
+ \r
+ /**\r
+ * \brief 32bpp Framebuffer\r
+ * Writes to the terminal file will write to the framebuffer.\r
+ * Reads will return UTF-32 characters\r
+ */\r
+ TERM_MODE_FB,\r
+ \r
+ /**\r
+ * \brief 32bpp 2D Accellerated mode\r
+ * Writes to the terminal file will be read as a command stream\r
+ * defined in ::eTplTerminal_2D_Commands\r
+ */\r
+ TERM_MODE_2DACCEL,\r
+ \r
+ /**\r
+ * \brief OpenGL 2D/3D\r
+ * Writes to the terminal file will send 3D commands\r
+ * Reads will return UTF-32 characters\r
+ * \note May or may not stay in the spec\r
+ */\r
+ TERM_MODE_3D,\r
+ \r
+ /**\r
+ * \brief Number of terminal modes\r
+ */\r
+ NUM_TERM_MODES\r
+};\r
+\r
+/**\r
+ * \brief 2D Command IDs\r
+ * \todo Complete this structure\r
+ * \r
+ * Command IDs for when the terminal type is eTplTerminal_Modes.TERM_MODE_2DACCEL\r
+ */\r
+enum eTplTerminal_2D_Commands\r
+{\r
+ /**\r
+ * \brief No Operation - Used for padding\r
+ */\r
+ TERM_2DCMD_NOP,\r
+ \r
+ /**\r
+ * (Uint16 X, Y, W, H, Uint32 Data[])\r
+ * \brief Blits a bitmap to the display\r
+ * \param X,Y Coordinates of Top-Left corner\r
+ * \param W,H Dimensions\r
+ * \param Data 32-bpp pixel data\r
+ */\r
+ TERM_2DCMD_PUSH\r
+};\r
+\r
+#endif\r
--- /dev/null
+/**\r
+ * \file api_drv_video.h\r
+ * \brief Video Driver Interface Definitions\r
+ * \note For AcessOS Version 1\r
+ * \r
+ * Video drivers extend the common driver interface api_drv_common.h\r
+ * and must support _at least_ the IOCtl numbers defined in this file\r
+ * to be compatable with Acess.\r
+ * \r
+ * \section IOCtls\r
+ * As said, a compatable driver must implement these calls correctly,\r
+ * but they may choose not to allow direct user access to the framebuffer.\r
+ * \r
+ * \section Screen Contents\r
+ * Writes to the driver's file while in component colour modes\r
+ * must correspond to a change of the contents of the screen. The framebuffer\r
+ * must start at offset 0 in the file.\r
+ * Reading from the screen must either return zero, or read from the\r
+ * framebuffer.\r
+ * \r
+ * \section Mode Support\r
+ * All video drivers must support at least one text mode (Mode #0)\r
+ * For each graphics mode the driver exposes, there must be a corresponding\r
+ * text mode with the same resolution, this mode will be used when the\r
+ * user switches to a text Virtual Terminal while in graphics mode.\r
+ */\r
+#ifndef _API_DRV_VIDEO_H\r
+#define _API_DRV_VIDEO_H\r
+\r
+#include <api_drv_common.h>\r
+\r
+/**\r
+ * \enum eTplVideo_IOCtl\r
+ * \brief Common Video IOCtl Calls\r
+ * \extends eTplDrv_IOCtl\r
+ */\r
+enum eTplVideo_IOCtl {\r
+ /**\r
+ * ioctl(..., int *mode)\r
+ * \brief Get/Set Mode\r
+ * \return Current mode ID or -1 on error\r
+ * \r
+ * If \a mode is non-NULL, the current video mode is set to \a *mode.\r
+ * This updated ID is then returned to the user.\r
+ */\r
+ VIDEO_IOCTL_GETSETMODE = 4,\r
+ \r
+ /**\r
+ * ioctl(..., tVideo_IOCtl_Mode *info)\r
+ * \brief Find a matching mode\r
+ * \return 1 if a mode was found, 0 otherwise\r
+ * \r
+ * Using avaliable modes matching the \a bpp and \a flags fields\r
+ * set the \a id field to the mode id of the mode with the closest\r
+ * \a width and \a height.\r
+ */\r
+ VIDEO_IOCTL_FINDMODE,\r
+ \r
+ /**\r
+ * ioctl(..., tVideo_IOCtl_Mode *info)\r
+ * \brief Get mode info\r
+ * \return 1 if the mode exists, 0 otherwise\r
+ * \r
+ * Set \a info's fields to the mode specified by the \a id field.\r
+ */\r
+ VIDEO_IOCTL_MODEINFO,\r
+ \r
+ /**\r
+ * ioctl(..., int *NewFormat)\r
+ * \brief Switches between Text, Framebuffer and 3D modes\r
+ * \param NewFormat Pointer to the new format code (see eTplVideo_BufFormats)\r
+ * \return Original format\r
+ * \r
+ * Enabes and disables the video text mode, changing the behavior of\r
+ * writes to the device file.\r
+ */\r
+ VIDEO_IOCTL_SETBUFFORMAT,\r
+ \r
+ /**\r
+ * ioctl(..., tVideo_IOCtl_Pos *pos)\r
+ * \brief Sets the cursor position\r
+ * \return Boolean success\r
+ * \r
+ * Set the text mode cursor position (if it is supported)\r
+ * If the \a pos is set to (-1,-1) the cursor is hidden, otherwise\r
+ * \a pos MUST be within the current screen size (as given by the\r
+ * current mode's tVideo_IOCtl_Mode.width and tVideo_IOCtl_Mode.height\r
+ * fields).\r
+ */\r
+ VIDEO_IOCTL_SETCURSOR,\r
+ \r
+ /**\r
+ * ioctl(..., tVideo_IOCtl_Bitmap *Image)\r
+ * \brief Sets the cursor image\r
+ * \return Boolean success\r
+ *\r
+ * Sets the graphics mode cursor image\r
+ */\r
+ VIDEO_IOCTL_SETCURSORBITMAP\r
+};\r
+#define DRV_VIDEO_IOCTLNAMES "getset_mode", "find+mode", "mode_info", "set_buf_format", "set_cursor", "set_cursor_bitmap"\r
+\r
+/**\r
+ * \brief Mode Structure used in IOCtl Calls\r
+ * \r
+ * Defines a video mode supported by (or requested of) this driver (depending\r
+ * on what ioctl call is used)\r
+ */\r
+typedef struct sVideo_IOCtl_Mode\r
+{\r
+ short id; //!< Mode ID\r
+ Uint16 width; //!< Width\r
+ Uint16 height; //!< Height\r
+ Uint8 bpp; //!< Bits per Unit (Character or Pixel, depending on \a flags)\r
+ Uint8 flags; //!< Mode Flags\r
+} tVideo_IOCtl_Mode;\r
+\r
+/**\r
+ * \brief Buffer Format Codes\r
+ */\r
+enum eTplVideo_BufFormats\r
+{\r
+ /**\r
+ * \brief Text Mode\r
+ * \r
+ * The device file presents itself as an array of ::tVT_Char\r
+ * each describing a character cell on the screen.\r
+ * These cells are each \a giVT_CharWidth pixels wide and\r
+ * \a giVT_CharHeight high.\r
+ */\r
+ VIDEO_BUFFMT_TEXT,\r
+ /**\r
+ * \brief Framebuffer Mode\r
+ * \r
+ * The device file presents as an array of 32-bpp pixels describing\r
+ * the entire screen. The format of a single pixel is in xRGB format\r
+ * (top 8 bits ignored, next 8 bits red, next 8 bits green and\r
+ * the bottom 8 bits blue)\r
+ */\r
+ VIDEO_BUFFMT_FRAMEBUFFER,\r
+ /**\r
+ * \brief 2D Accelerated Mode\r
+ * \r
+ * The device file acts as a character device, accepting a stream of\r
+ * commands described in eTplVideo_2DCommands when written to.\r
+ */\r
+ VIDEO_BUFFMT_2DSTREAM,\r
+ /**\r
+ * \brief 3D Accelerated Mode\r
+ * \r
+ * The device file acts as a character device, accepting a stream of\r
+ * commands described in eTplVideo_3DCommands when written to.\r
+ */\r
+ VIDEO_BUFFMT_3DSTREAM\r
+};\r
+\r
+/**\r
+ * \brief 2D Accellerated Video Commands\r
+ * \r
+ * Commands passed in the command stream for ::VIDEO_BUFFMT_2DSTREAM\r
+ */\r
+enum eTplVideo_2DCommands\r
+{\r
+ /**\r
+ * \brief No Operation\r
+ */\r
+ VIDEO_2DOP_NOP,\r
+ /**\r
+ * \brief Fill a region\r
+ * \param X Uint16 - Leftmost pixels of the region\r
+ * \param Y Uint16 - Topmost pixels of the region\r
+ * \param W Uint16 - Width of the region\r
+ * \param H Uint16 - Height of the region\r
+ * \param Colour Uint32 - Value to fill with\r
+ */\r
+ VIDEO_2DOP_FILL,\r
+ /**\r
+ * \brief Copy a region from one part of the framebuffer to another\r
+ * \param DestX Uint16 - Leftmost pixels of the destination\r
+ * \param DestY Uint16 - Topmost pixels of the destination\r
+ * \param SrcX Uint16 - Leftmost pixels of the source\r
+ * \param SrcY Uint16 - Topmost pixels of the source\r
+ * \param Width Uint16 - Width of the region\r
+ * \param Height Uint16 - Height of the region\r
+ */\r
+ VIDEO_2DOP_BLIT,\r
+\r
+\r
+ /**\r
+ * \brief Copy a region from video memory to the framebuffer\r
+ */\r
+ VIDEO_2DOP_BLITBUF,\r
+\r
+ /**\r
+ * \brief Copy and scale a region from video memory to the framebuffer\r
+ */\r
+ VIDEO_2DOP_BLITSCALEBUF,\r
+\r
+ NUM_VIDEO_2DOPS\r
+};\r
+\r
+/**\r
+ * \brief Describes a position in the video framebuffer\r
+ */\r
+typedef struct sVideo_IOCtl_Pos\r
+{\r
+ Sint16 x; //!< X Coordinate\r
+ Sint16 y; //!< Y Coordinate\r
+} tVideo_IOCtl_Pos;\r
+\r
+/**\r
+ * \brief Bitmap object (out of band image)\r
+ */\r
+typedef struct sVideo_IOCtl_Bitmap\r
+{\r
+ Sint16 W; //!< Width of image\r
+ Sint16 H; //!< Height of image\r
+ Sint16 XOfs; //!< X Offset of center\r
+ Sint16 YOfs; //!< Y Offset of center\r
+ Uint32 Data[]; //!< Image data (ARGB array)\r
+} tVideo_IOCtl_Bitmap;\r
+\r
+/**\r
+ * \brief Virtual Terminal Representation of a character\r
+ */\r
+typedef struct sVT_Char\r
+{\r
+ Uint32 Ch; //!< UTF-32 Character\r
+ union {\r
+ struct {\r
+ Uint16 BGCol; //!< 12-bit Foreground Colour\r
+ Uint16 FGCol; //!< 12-bit Background Colour\r
+ };\r
+ Uint32 Colour; //!< Compound colour for ease of access\r
+ };\r
+} tVT_Char;\r
+\r
+/**\r
+ * \name Basic builtin colour definitions\r
+ * \{\r
+ */\r
+#define VT_COL_BLACK 0x0000\r
+#define VT_COL_GREY 0x0888\r
+#define VT_COL_LTGREY 0x0CCC\r
+#define VT_COL_WHITE 0x0FFF\r
+/**\r
+ * \}\r
+ */\r
+\r
+//! \brief Defines the width of a rendered character\r
+extern int giVT_CharWidth;\r
+//! \brief Defines the height of a rendered character\r
+extern int giVT_CharHeight;\r
+/**\r
+ * \brief Driver helper that renders a character to a buffer\r
+ * \param Codepoint Unicode character to render\r
+ * \param Buffer Buffer to render to\r
+ * \param Depth Bit depth of the destination buffer\r
+ * \param Pitch Number of bytes per line\r
+ * \param BGC 32-bit Background Colour\r
+ * \param FGC 32-bit Foreground Colour\r
+ * \r
+ * This function is provided to help video drivers to support a simple\r
+ * text mode by keeping the character rendering abstracted from the driver,\r
+ * easing the driver development and reducing code duplication.\r
+ */\r
+extern void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Depth, int Pitch, Uint32 BGC, Uint32 FGC);\r
+/**\r
+ * \fn Uint32 VT_Colour12to24(Uint16 Col12)\r
+ * \brief Converts a colour from 12bpp to 24bpp\r
+ * \param Col12 12-bpp input colour\r
+ * \return Expanded 32-bpp (24-bit colour) version of \a Col12\r
+ */\r
+extern Uint32 VT_Colour12to24(Uint16 Col12);\r
+/**\r
+ * \brief Converts a colour from 12bpp to 14bpp\r
+ * \param Col12 12-bpp input colour\r
+ * \return 15 bits per pixel value\r
+ */\r
+extern Uint16 VT_Colour12to15(Uint16 Col12);\r
+/**\r
+ * \brief Converts a colour from 12bpp to 32bpp\r
+ * \param Col12 12-bpp input colour\r
+ * \param Depth Desired bit depth\r
+ * \return \a Depth bit number, denoting Col12\r
+ * \r
+ * Expands the source colour into a \a Depth bits per pixel representation.\r
+ * The colours are expanded with preference to Green, Blue and Red in that order\r
+ * (so, green gets the first spare pixel, blue gets the next, and red never gets\r
+ * the spare). \n\r
+ * The final bit of each component is used to fill the lower bits of the output.\r
+ */\r
+extern Uint32 VT_Colour12toN(Uint16 Col12, int Depth);\r
+\r
+/**\r
+ * \brief Handlers for eTplVideo_2DCommands\r
+ */\r
+typedef struct sDrvUtil_Video_2DHandlers\r
+{\r
+ /**\r
+ * \brief No Operation, Ignored\r
+ * \see VIDEO_2DOP_NOP\r
+ */\r
+ void *Nop;\r
+ /**\r
+ * \brief Fill a buffer region\r
+ * \param X Lefthand edge\r
+ * \param Y Top edge\r
+ * \param W Width\r
+ * \param H Height\r
+ * \param Colour Colour to fill with\r
+ * \see VIDEO_2DOP_FILL\r
+ */\r
+ void (*Fill)(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour);\r
+ /**\r
+ * \brief Fill a buffer region\r
+ * \param DestX Lefthand edge of destination\r
+ * \param DestY Top edge of destination\r
+ * \param SrcX Lefthand edge of source\r
+ * \param SrcY Top edge of source\r
+ * \param W Width\r
+ * \param H Height\r
+ * \see VIDEO_2DOP_BLIT\r
+ */\r
+ void (*Blit)(void *Ent, Uint16 DestX, Uint16 DestY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H);\r
+} tDrvUtil_Video_2DHandlers;\r
+\r
+/**\r
+ * \brief Handle a 2D operation stream for a driver\r
+ * \param Ent Value to pass to handlers\r
+ * \param Buffer Stream buffer\r
+ * \param Length Length of stream\r
+ * \param Handlers Handlers to use for the stream\r
+ * \param SizeofHandlers Size of \a tDrvUtil_Video_2DHandlers according\r
+ * to the driver. Used as version control and error avoidence.\r
+ */\r
+extern Uint64 DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length,\r
+ tDrvUtil_Video_2DHandlers *Handlers, int SizeofHandlers);\r
+\r
+#endif\r
* capabilities for the the user.
*
* The device driver interfaces are all based on the core specifcation
- * in tpl_drv_common.h (Common Device Driver definitions).
+ * in api_drv_common.h (Common Device Driver definitions).
* The following subsections define the various specific types of driver
* interfaces. These definitions only define the bare minimum of what the
* driver must implement, if the driver author so wants to, they can add
* identify itself as a miscelanious device by returning DRV_TYPE_MISC
* from \ref DRV_IOCTL_TYPE.
* A misc device must at least implement the IOCtl calls defined in the
- * \ref tpl_drv_common.h "Common Device Driver definitions", allowing it
+ * \ref api_drv_common.h "Common Device Driver definitions", allowing it
* to be identified easily by the user and for interfacing programs to
* utilise the DRV_IOCTL_LOOKUP call.
*
* which is not yet fully standardised, so should be ignored).
* The driver will contain only one VFS node, that exposes the video
* framebuffer (this may not be the true framebuffer, to allow for double-buffering)
- * to the user. See the full documentation in tpl_drv_video.h for the
+ * to the user. See the full documentation in api_drv_video.h for the
* complete specifcation.
*
* \subsection drv_disk Disk/Storage Devices
* The functions DrvUtil_ReadBlock and DrvUtil_WriteBlock are provided
* to storage drivers to assist in handling non-alinged reads and writes.
*
- * \see tpl_drv_common.h Common Spec.
- * \see tpl_drv_video.h Video Device Spec.
- * \see tpl_drv_keyboard.h Keyboard Device Spec.
- * \see tpl_drv_disk.h Disk/Storage Device Spec.
- * \see tpl_drv_network.h Network Device Spec.
- * \see tpl_drv_terminal.h Virtual Terminal Spec.
+ * \see api_drv_common.h Common Spec.
+ * \see api_drv_video.h Video Device Spec.
+ * \see api_drv_keyboard.h Keyboard Device Spec.
+ * \see api_drv_disk.h Disk/Storage Device Spec.
+ * \see api_drv_network.h Network Device Spec.
+ * \see api_drv_terminal.h Virtual Terminal Spec.
*/
+++ /dev/null
-/**
- * \file tpl_drv_common.h
- * \brief Common Driver Interface Definitions
- * \author John Hodge (thePowersGang)
- *
- * \section Introduction
- * There are two ways Acess drivers can communicate with userspace
- * applications, both are through the VFS. The first is by exposing a
- * device as a file buffer, the second is by sending commands via the
- * ioctl() system call.
- * All drivers in Acess must at least conform to the specifcation in this
- * file (even if it is just implementing eTplDrv_IOCtl.DRV_IOCTL_TYPE and
- * returning eTplDrv_Type.DRV_TYPE_NULL, however, doing so is discouraged)
- *
- * \section ioctls Core IOCtl calls
- * As said, the core Acess driver specifcation defines specific IOCtl calls
- * that all drivers should implement. The four core IOCtls (defined in
- * ::eTplDrv_IOCtl) allow another binary (wether it be a user-mode application
- * or another driver) to tell what type of device a driver provides, the
- * basic identifcation of the driver (4 character ID and BCD version number)
- * and be able to use externally standardised calls that may not have
- * standardised call numbers.
- * NOTE: All ioctl calls WILL return -1 if the driver ran into an error
- * of its own fault while executing the call. If the user was at fault
- * (e.g. by passing a bad buffer) the call will return -2.
- *
- * \section types Driver Types
- * When the eTplDrv_IOCtl.DRV_IOCTL_TYPE call is made, the driver should
- * return the relevant entry in the ::eTplDrv_Type enumeration that describes
- * what sub-specifcation (and hence, what device type) it implements.
- * These device types are described in their own files, which are liked
- * from their entries in ::eTplDrv_Type.
- */
-#ifndef _TPL_COMMON_H
-#define _TPL_COMMON_H
-
-/**
- * \enum eTplDrv_IOCtl
- * \brief Common IOCtl Calls
- */
-enum eTplDrv_IOCtl {
- /**
- * ioctl(...)
- * \brief Get driver type
- * \return The relevant entry from ::eTplDrv_Type
- */
- DRV_IOCTL_TYPE,
-
- /**
- * ioctl(..., char *dest[32])
- * \brief Get driver identifier string
- * \return 0 on no error
- *
- * This call sets the 32-byte array \a dest to the drivers 31 charater
- * identifier. This identifier must be unique to the driver series.
- */
- DRV_IOCTL_IDENT,
-
- /**
- * ioctl(...)
- * \brief Get driver version number
- * \return 24-bit BCD version number (2.2.2)
- *
- * This call returns the 6-digit (2 major, 2 minor, 2 patch) version
- * number of the driver.
- */
- DRV_IOCTL_VERSION,
-
- /**
- * ioctl(..., char *name)
- * \brief Get a IOCtl call ID from a symbolic name
- * \return ID number of the call, or 0 if not found
- *
- * This call allows user applications to not need to know the ID numbers
- * of this driver's IOCtl calls by taking a string and returning the
- * IOCtl call number associated with that method name.
- */
- DRV_IOCTL_LOOKUP
-};
-
-/**
- * \brief eTplDrv_IOCtl.DRV_IOCTL_LOOKUP names for the core IOCtls
- * These are the official lookup names of the core calls
- */
-#define DRV_IOCTLNAMES "type", "ident", "version", "lookup"
-
-/**
- * \brief Helper macro for the base IOCtl calls
- * \param _type Type number from eTplDrv_Type to return
- * \param _ident String of max 32-characters that identifies this driver
- * \param _version Driver's 8.8.8 BCD version number
- * \param _ioctls Pointer to the IOCtls string array
- * \warning If you have DEBUG enabled in the calling file, this function
- * will do LEAVE()s before returning, so make sure that the
- * IOCtl function is ENTER()ed when using debug with this macro
- *
- * Usage: (Id is the IOCtl call ID)
- * \code
- * switch(Id)
- * {
- * BASE_IOCTLS(DRV_TYPE_MISC, "Ident", 0x100, csaIOCtls)
- * // Your IOCtls go here, starting at index 4
- * }
- * \endcode
- */
-#define BASE_IOCTLS(_type, _ident, _version, _ioctls) \
- case DRV_IOCTL_TYPE: LEAVE('i', (_type)); return (_type);\
- case DRV_IOCTL_IDENT: {\
- int tmp = ModUtil_SetIdent(Data, (_ident));\
- LEAVE('i', tmp); return tmp;\
- }\
- case DRV_IOCTL_VERSION: LEAVE('x', (_version)); return (_version);\
- case DRV_IOCTL_LOOKUP:{\
- int tmp = ModUtil_LookupString( _ioctls, (const char*)Data );\
- LEAVE('i', tmp);\
- return tmp;\
- }
-
-/**
- * \enum eTplDrv_Type
- * \brief Driver Types returned by DRV_IOCTL_TYPE
- */
-enum eTplDrv_Type {
- DRV_TYPE_NULL, //!< NULL Type - Custom Interface
- DRV_TYPE_MISC, //!< Miscelanious Compilant - Supports the core calls
- DRV_TYPE_TERMINAL, //!< Terminal - see tpl_drv_terminal.h
- DRV_TYPE_VIDEO, //!< Video - see tpl_drv_video.h
- DRV_TYPE_SOUND, //!< Audio
- DRV_TYPE_DISK, //!< Disk - see tpl_drv_disk.h
- DRV_TYPE_KEYBOARD, //!< Keyboard - see tpl_drv_keyboard.h
- DRV_TYPE_MOUSE, //!< Mouse
- DRV_TYPE_JOYSTICK, //!< Joystick / Gamepad
- DRV_TYPE_NETWORK //!< Network Device - see tpl_drv_network.h
-};
-
-#endif
+++ /dev/null
-/**\r
- * \file tpl_drv_disk.h\r
- * \brief Disk Driver Interface Definitions\r
- * \author John Hodge (thePowersGang)\r
- * \r
- * \section Nomeclature\r
- * All addreses are 64-bit counts of bytes from the logical beginning of\r
- * the disk unless explicitly stated.\r
- * \r
- * \section dirs VFS Layout\r
- * Disk drivers have a flexible directory layout. The root directory can\r
- * contain subdirectories, with the only conditions being that all nodes\r
- * must support ::eTplDrv_IOCtl with DRV_IOCTL_TYPE returning DRV_TYPE_DISK.\r
- * And all file nodes representing disk devices (or partitions) and implemeting\r
- * ::eTplDisk_IOCtl fully\r
- * \r
- * \section files Files\r
- * When a read or write occurs on a normal file in the disk driver it will\r
- * read/write the represented device. The accesses need not be aligned to\r
- * the block size, however aligned reads/writes should be handled specially\r
- * to improve speed (this can be aided by using ::DrvUtil_ReadBlock and\r
- * ::DrvUtil_WriteBlock)\r
- */\r
-#ifndef _TPL_DRV_DISK_H\r
-#define _TPL_DRV_DISK_H\r
-\r
-#include <tpl_drv_common.h>\r
-\r
-/**\r
- * \enum eTplDisk_IOCtl\r
- * \brief Common Disk IOCtl Calls\r
- * \extends eTplDrv_IOCtl\r
- */\r
-enum eTplDisk_IOCtl {\r
- /**\r
- * ioctl(..., void)\r
- * \brief Get the block size\r
- * \return Size of a hardware block for this device\r
- */\r
- DISK_IOCTL_GETBLOCKSIZE = 4,\r
- \r
- /**\r
- * ioctl(..., tTplDisk_CacheRegion *RegionInfo)\r
- * \brief Sets the cache importantce and protocol for a section of\r
- * memory.\r
- * \param RegionInfo Pointer to a region information structure\r
- * \return Boolean failure\r
- */\r
- DISK_IOCTL_SETCACHEREGION,\r
- \r
- /**\r
- * ioctl(..., Uint64 *Info[2])\r
- * \brief Asks the driver to precache a region of disk.\r
- * \param Region 64-bit Address and Size pair describing the area to cache\r
- * \return Number of blocks cached\r
- */\r
- DISK_IOCTL_PRECACHE,\r
- \r
- /**\r
- * ioclt(..., Uint64 *Region[2])\r
- * \brief Asks to driver to flush the region back to disk\r
- * \param Region 64-bit Address and Size pair describing the area to flush\r
- * \note If Region[0] == -1 then the entire disk's cache is flushed\r
- * \return Number of blocks flushed (or 0 for entire disk)\r
- */\r
- DISK_IOCTL_FLUSH\r
-};\r
-\r
-/**\r
- * \brief Describes the cache parameters of a region on the disk\r
- */\r
-typedef struct sTplDisk_CacheRegion\r
-{\r
- Uint64 Base; //!< Base of cache region\r
- Uint64 Length; //!< Size of cache region\r
- /**\r
- * \brief Cache Protocol & Flags\r
- * \r
- * The low 4 bits denot the cache protocol to be used by the\r
- * region (see ::eTplDisk_CacheProtocols for a list).\r
- * The high 4 bits denote flags to apply to the cache (see\r
- * ::eTplDisk_CacheFlags)\r
- */\r
- Uint8 Flags;\r
- Uint8 Priority; //!< Lower is a higher proritory\r
- /**\r
- * \brief Maximum size of cache, in blocks\r
- * \note If CacheSize is zero, the implemenation defined limit is used\r
- */\r
- Uint16 CacheSize;\r
-} tTplDisk_CacheRegion;\r
-\r
-/**\r
- * \brief Cache protocols to use\r
- */\r
-enum eTplDisk_CacheProtocols\r
-{\r
- /**\r
- * \brief Don't cache the region\r
- */\r
- \r
- DISK_CACHEPROTO_DONTCACHE,\r
- /**\r
- * \brief Most recently used blocks cached\r
- * \note This is the default action for undefined regions\r
- */\r
- DISK_CACHEPROTO_RECENTLYUSED,\r
- /**\r
- * \brief Cache the entire region in memory\r
- * \r
- * This is a faster version of setting Length to CacheSize*BlockSize\r
- */\r
- DISK_CACHEPROTO_FULLCACHE,\r
- \r
- /**\r
- * \brief Cache only on demand\r
- * \r
- * Only cache when the ::DISK_IOCTL_PRECACHE IOCtl is used\r
- */\r
- DISK_CACHEPROTO_EXPLICIT\r
-};\r
-\r
-/**\r
- * \brief Flags for the cache\r
- */\r
-enum eTplDisk_CacheFlags\r
-{\r
- /**\r
- * \brief Write all changes to the region straight back to media\r
- */\r
- DISK_CACHEFLAG_WRITETHROUGH = 0x10\r
-};\r
-\r
-/**\r
- * \brief IOCtl name strings\r
- */\r
-#define DRV_DISK_IOCTLNAMES "get_block_size","set_cache_region","set_precache"\r
-\r
-/**\r
- * \name Disk Driver Utilities\r
- * \{\r
- */\r
-\r
-/**\r
- * \brief Callback function type used by DrvUtil_ReadBlock and DrvUtil_WriteBlock\r
- * \param Address Zero based block number to read\r
- * \param Count Number of blocks to read\r
- * \param Buffer Destination for read blocks\r
- * \param Argument Argument provided in ::DrvUtil_ReadBlock and ::DrvUtil_WriteBlock\r
- */\r
-typedef Uint (*tDrvUtil_Callback)(Uint64 Address, Uint Count, void *Buffer, Uint Argument);\r
-\r
-/**\r
- * \brief Reads a range from a block device using aligned reads\r
- * \param Start Base byte offset\r
- * \param Length Number of bytes to read\r
- * \param Buffer Destination for read data\r
- * \param ReadBlocks Callback function to read a sequence of blocks\r
- * \param BlockSize Size of an individual block\r
- * \param Argument An argument to pass to \a ReadBlocks\r
- * \return Number of bytes read\r
- */\r
-extern Uint64 DrvUtil_ReadBlock(Uint64 Start, Uint64 Length, void *Buffer,\r
- tDrvUtil_Callback ReadBlocks, Uint64 BlockSize, Uint Argument);\r
-/**\r
- * \brief Writes a range to a block device using aligned writes\r
- * \param Start Base byte offset\r
- * \param Length Number of bytes to write\r
- * \param Buffer Destination for read data\r
- * \param ReadBlocks Callback function to read a sequence of blocks\r
- * \param WriteBlocks Callback function to write a sequence of blocks\r
- * \param BlockSize Size of an individual block\r
- * \param Argument An argument to pass to \a ReadBlocks and \a WriteBlocks\r
- * \return Number of bytes written\r
- */\r
-extern Uint64 DrvUtil_WriteBlock(Uint64 Start, Uint64 Length, void *Buffer,\r
- tDrvUtil_Callback ReadBlocks, tDrvUtil_Callback WriteBlocks,\r
- Uint64 BlockSize, Uint Argument);\r
-\r
-/**\r
- * \}\r
- */\r
-\r
-#endif\r
+++ /dev/null
-/**\r
- * \file tpl_drv_joystick\r
- * \brief Joystick Driver Interface Definitions\r
- * \author John Hodge (thePowersGang)\r
- * \r
- * \section dirs VFS Layout\r
- * Joystick drivers define a single VFS node, that acts as a fixed size file.\r
- * Reads from this file return the current state, writes are ignored.\r
- *\r
- * \section File Structure\r
- * The device file must begin with a valid sJoystick_FileHeader structure.\r
- * The file header is followed by \a NAxies instances of sJoystick_Axis, one\r
- * for each axis.\r
- * This is followed by \a NButtons boolean values (represented using \a Uint8),\r
- * each representing the state of a single button (where 0 is unpressed,\r
- * 0xFF is fully depressed - intermediate values are valid in the case of\r
- * variable-pressure buttons)\r
- */\r
-#ifndef _TPL_JOYSTICK_H\r
-#define _TPL_JOYSTICK_H\r
-\r
-#include <tpl_drv_common.h>\r
-\r
-/**\r
- * \enum eTplJoystick_IOCtl\r
- * \brief Common Joystick IOCtl Calls\r
- * \extends eTplDrv_IOCtl\r
- */\r
-enum eTplJoystick_IOCtl {\r
- /**\r
- * ioctl(..., tJoystick_Callback *Callback)\r
- * \brief Sets the callback\r
- * \note Can be called from kernel mode only\r
- *\r
- * Sets the callback that is called when a event occurs (button or axis\r
- * change). This function pointer must be in kernel mode (although,\r
- * kernel->user or kernel->ring3driver abstraction functions can be used)\r
- * \r
- * Axis events depend on the axis limit, if non-zero, the callback fires\r
- * if the cursor position changes. Otherwise it fires when the axis value\r
- * (cursor accelleration) changes.\r
- */\r
- JOY_IOCTL_SETCALLBACK = 4,\r
-\r
- /**\r
- * ioctl(..., int *Argument)\r
- * \brief Set the argument passed as the first parameter to the callback\r
- * \note Kernel mode only\r
- */\r
- JOY_IOCTL_SETCALLBACKARG,\r
-\r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set maximum value for sJoystick_Axis.CurState\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- */\r
- JOY_IOCTL_GETSETAXISLIMIT,\r
-\r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set the value of sJoystick_Axis.CurState\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- */\r
- JOY_IOCTL_GETSETAXISPOSITION,\r
- \r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set axis flags\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- * \todo Define flag values\r
- */\r
- JOY_IOCTL_GETSETAXISFLAGS,\r
-\r
- /**\r
- * ioctl(..., tJoystickNumValue *)\r
- * \brief Set Button Flags\r
- * \note If \a Value is equal to -1 (all bits set), the value is not changed\r
- * \todo Define flag values\r
- */\r
- JOY_IOCTL_GETSETBUTTONFLAGS,\r
-};\r
-\r
-#define DRV_JOY_IOCTLNAMES "set_callback", "set_callback_arg", "getset_axis_limit", "getset_axis_position", \\r
- "getset_axis_flags", "getset_button_flags"\r
-\r
-// === TYPES ===\r
-typedef struct sJoystick_NumValue tJoystick_NumValue;\r
-typedef struct sJoystick_FileHeader tJoystick_FileHeader;\r
-typedef struct sJoystick_Axis tJoystick_Axis;\r
-\r
-/**\r
- * \brief Number/Value pair for joystick IOCtls\r
- */\r
-struct sJoystick_NumValue\r
-{\r
- int Num; //!< Axis/Button number\r
- int Value; //!< Value (see IOCtl defs for meaning)\r
-};\r
-\r
-/**\r
- * \brief Callback type for JOY_IOCTL_SETCALLBACK\r
- * \param Ident Ident value passed to JOY_IOCTL_SETCALLBACK\r
- * \r
- */\r
-typedef void (*tJoystick_Callback)(int Ident, int bIsAxis, int Num, int Delta);\r
-\r
-/**\r
- * \struct sJoystick_FileHeader\r
- */\r
-struct sJoystick_FileHeader\r
-{\r
- Uint16 NAxies; //!< Number of Axies\r
- Uint16 NButtons; //!< Number of buttons\r
-};\r
-\r
-/**\r
- * \brief Axis Definition in file data\r
- *\r
- * Describes the current state of an axis on the joystick.\r
- * \a CursorPos is between zero and the current limit set by the\r
- * JOY_IOCTL_GETSETAXISLIMIT IOCtl, while \a CurValue indicates the\r
- * current position of the joystick axis. This is defined to be between\r
- * \a MinValue and \a MaxValue.\r
- */\r
-struct sJoystick_Axis\r
-{\r
- Sint16 MinValue; //!< Minumum value for \a CurValue\r
- Sint16 MaxValue; //!< Maximum value for \a CurValue\r
- Sint16 CurValue; //!< Current value (joystick position)\r
- Uint16 CursorPos; //!< Current state (cursor position)\r
-};\r
-\r
-#define JOY_INFOSTRUCT(_naxies, _nbuttons) struct { \\r
- Uint16 NAxies, NButtons;\\r
- tJoystick_Axis Axies[_naxies];\\r
- Uint16 Buttons[_nbuttons];\\r
- }\r
-\r
-#endif\r
+++ /dev/null
-/**\r
- * \file tpl_drv_keyboard.h\r
- * \brief Keyboard Driver Interface Definitions\r
- * \author John Hodge (thePowersGang)\r
- * \r
- * \section dirs VFS Layout\r
- * Keyboard drivers consist of only a single node, which is a normal file\r
- * node with a size of zero. All reads and writes to this node are ignored\r
- * (tVFS_Node.Read and tVFS_Node.Write are NULL)\r
- */\r
-#ifndef _TPL_KEYBOARD_H\r
-#define _TPL_KEYBOARD_H\r
-\r
-#include <tpl_drv_common.h>\r
-\r
-/**\r
- * \enum eTplKeyboard_IOCtl\r
- * \brief Common Keyboard IOCtl Calls\r
- * \extends eTplDrv_IOCtl\r
- */\r
-enum eTplKeyboard_IOCtl {\r
- /**\r
- * ioctl(..., int *Rate)\r
- * \brief Get/Set Repeat Rate\r
- * \param Rate New repeat rate (pointer)\r
- * \return Current/New Repeat rate\r
- * \r
- * Gets/Set the repeat rate (actually the time in miliseconds between\r
- * repeats) of a held down key.\r
- * If the rate is set to zero, repeating will be disabled.\r
- */\r
- KB_IOCTL_REPEATRATE = 4,\r
- \r
- /**\r
- * ioctl(..., int *Delay)\r
- * \brief Get/Set Repeat Delay\r
- * \param Delay New repeat delay (pointer)\r
- * \return Current/New repeat delay\r
- * \r
- * Gets/Set the time in miliseconds before a key starts repeating\r
- * after a key is pressed.\r
- * Setting the delay to a negative number will cause the function to\r
- * return -1\r
- */\r
- KB_IOCTL_REPEATDELAY,\r
- \r
- \r
- /**\r
- * ioctl(..., tKeybardCallback *Callback)\r
- * \brief Sets the callback\r
- * \note Can be called from kernel mode only\r
- * \r
- * Sets the function to be called when a key event occurs (press, release\r
- * or repeat). This function pointer must be in kernel mode (although,\r
- * kernel->user or kernel->ring3driver abstraction functions can be used)\r
- */\r
- KB_IOCTL_SETCALLBACK\r
-};\r
-\r
-#define DRV_KEYBAORD_IOCTLNAMES "getset_repeat_rate", "getset_repeat_delay", "set_callback"\r
-\r
-/**\r
- * \brief Callback type for KB_IOCTL_SETCALLBACK\r
- * \param Key Unicode character code for the pressed key (with bit 31\r
- * set if the key is released)\r
- */\r
-typedef void (*tKeybardCallback)(Uint32 Key);\r
-\r
-/**\r
- * \brief Symbolic key codes\r
- * \r
- * These key codes represent non-pritable characters and are placed above\r
- * the Unicode character space.\r
- * If the using driver recieves a key code with the 31st bit set, it means\r
- * that that key has been released.\r
- */\r
-enum eTplKeyboard_KeyCodes {\r
- KEY_ESC = 0x1B, //!< Escape Character\r
- \r
- KEY_NP_MASK = 0x40000000, //! Mask for non-printable characters\r
- \r
- /**\r
- * \name Special Keys\r
- * \brief These keys are usually used on their own\r
- * \{\r
- */\r
- KEY_CAPSLOCK,\r
- KEY_UP, KEY_DOWN, KEY_LEFT, KEY_RIGHT,\r
- KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, \r
- KEY_F7, KEY_F8, KEY_F9, KEY_F10, KEY_F11, KEY_F12,\r
- KEY_NUMLOCK, KEY_SCROLLLOCK,\r
- KEY_HOME, KEY_END, KEY_INS, KEY_DEL,\r
- KEY_PAUSE, KEY_BREAK,\r
- KEY_PGUP, KEY_PGDOWN,\r
- KEY_KPENTER, KEY_KPSLASH, KEY_KPMINUS, KEY_KPPLUS, KEY_KPSTAR,\r
- KEY_KPHOME, KEY_KPUP, KEY_KPPGUP, KEY_KPLEFT, KEY_KP5, KEY_KPRIGHT,\r
- KEY_KPEND, KEY_KPDOWN, KEY_KPPGDN, KEY_KPINS, KEY_KPDEL,\r
- KEY_WIN, KEY_MENU,\r
- /**\r
- * \}\r
- */\r
- \r
- // Modifiers\r
- /**\r
- * \name Modifiers\r
- * \brief These keye usually alter the character stream sent to the user\r
- * \{\r
- */\r
- KEY_MODIFIERS = 0x60000000,\r
- KEY_LCTRL, KEY_RCTRL,\r
- KEY_LALT, KEY_RALT,\r
- KEY_LSHIFT, KEY_RSHIFT,\r
- /**\r
- * \}\r
- */\r
-};\r
-\r
-\r
-#endif\r
+++ /dev/null
-/**\r
- * \file tpl_drv_network.h\r
- * \brief Network Interface Driver Interface Definitions\r
- * \r
- * \section dirs VFS Layout\r
- * All network drivers must have the following basic VFS structure\r
- * The root of the driver will only contain files that are named from zero\r
- * upwards that represent the present network adapters that this driver\r
- * controls. All VFS nodes must implement ::eTplDrv_IOCtl with\r
- * DRV_IOCTL_TYPE returning DRV_TYPE_NETWORK.\r
- * The adapter nodes must also implement ::eTplNetwork_IOCtl fully\r
- * (unless it is noted in the ::eTplNetwork_IOCtl documentation that a\r
- * call is optional)\r
- * \r
- * \section files Adapter Files\r
- * \subsection Reading\r
- * When an adapter file is read from, the driver will block the reading\r
- * thread until a packet arrives (if there is not already an unhandled\r
- * packet in the queue) this will then be read into the destination buffer.\r
- * If the packet does not fit in the buffer, the end of it is discarded.\r
- * Likewise, if the packet does not completely fill the buffer, the call\r
- * will still read to the buffer and then return the size of the packet.\r
- * \subsection Writing\r
- * When an adapter is written to, the data written is encoded as a packet\r
- * and sent, if the data is not the correct size to be sent (if the packet\r
- * is too small, or if it is too large) -1 should be returned and the packet\r
- * will not be sent.\r
- */\r
-#ifndef _TPL_NETWORK_H\r
-#define _TPL_NETWORK_H\r
-\r
-#include <tpl_drv_common.h>\r
-\r
-/**\r
- * \enum eTplNetwork_IOCtl\r
- * \brief Common Network IOCtl Calls\r
- * \extends eTplDrv_IOCtl\r
- */\r
-enum eTplNetwork_IOCtl {\r
- /**\r
- * ioctl(..., Uint8 *MAC[6])\r
- * \brief Get the MAC address of the interface\r
- * \return 1 on success, 0 if the file is the root, -1 on error\r
- * \r
- * Copies the six byte Media Access Control (MAC) address of the\r
- * adapter to the \a MAC array.\r
- */\r
- NET_IOCTL_GETMAC = 4\r
-};\r
-\r
-/**\r
- * \brief IOCtl name strings for use with eTplDrv_IOCtl.DRV_IOCTL_LOOKUP\r
- */\r
-#define DRV_NETWORK_IOCTLNAMES "get_mac_addr"\r
-\r
-#endif\r
+++ /dev/null
-/**\r
- * \file tpl_drv_terminal.h\r
- * \brief Terminal Driver Interface Definitions\r
-*/\r
-#ifndef _TPL_TERMINAL_H\r
-#define _TPL_TERMINAL_H\r
-\r
-#include <tpl_drv_common.h>\r
-\r
-/**\r
- * \brief Common Terminal IOCtl Calls\r
- * \extends eTplDrv_IOCtl\r
- */\r
-enum eTplTerminal_IOCtl {\r
- /**\r
- * ioctl(..., int *mode)\r
- * \brief Get/Set the current video mode type\r
- * \param mode Pointer to an integer with the new mode number (or NULL)\r
- * If \a mode is non-NULL the current terminal mode is changed/updated\r
- * to the mode indicated by \a *mode\r
- * \note See ::eTplTerminal_Modes\r
- * \return Current/new terminal mode\r
- */\r
- TERM_IOCTL_MODETYPE = 4,\r
- \r
- /**\r
- * ioctl(..., int *width)\r
- * \brief Get/set the display width\r
- * \param width Pointer to an integer containing the new width (or NULL)\r
- * \return Current/new width\r
- * \r
- * If \a width is non-NULL the current width is updated (but is not\r
- * applied until ::TERM_IOCTL_MODETYPE is called with \a mode non-NULL.\r
- */\r
- TERM_IOCTL_WIDTH,\r
- \r
- /**\r
- * ioctl(..., int *height)\r
- * \brief Get/set the display height\r
- * \param height Pointer to an integer containing the new height\r
- * \return Current height\r
- * \r
- * If \a height is non-NULL the current height is updated (but is not\r
- * applied until ::TERM_IOCTL_MODETYPE is called with a non-NULL \a mode.\r
- */\r
- TERM_IOCTL_HEIGHT,\r
- \r
- /**\r
- * ioctl(..., tTerm_IOCtl_Mode *info)\r
- * \brief Queries the current driver about it's native modes\r
- * \param info A pointer to a ::tTerm_IOCtl_Mode with \a ID set to\r
- * the mode index (or NULL)\r
- * \return Number of modes\r
- * \r
- * If \a info is NULL, the number of avaliable vative display modes\r
- * is returned. These display modes will have sequential ID numbers\r
- * from zero up to this value.\r
- * \r
- * \note The id field of \a info is not for use with ::TERM_IOCTL_MODETYPE\r
- * This field is just for indexing the mode to get its information.\r
- */\r
- TERM_IOCTL_QUERYMODE,\r
- \r
- /**\r
- * ioctl(...)\r
- * \brief Forces the current terminal to be shown\r
- */\r
- TERM_IOCTL_FORCESHOW,\r
- \r
- /**\r
- * ioctl(...)\r
- * \brief Returns the current text cursor position\r
- * \return Cursor position (as X+Y*Width)\r
- */\r
- TERM_IOCTL_GETCURSOR\r
-};\r
-\r
-/**\r
- * \brief Virtual Terminal Mode\r
- * Describes a VTerm mode to the caller of ::TERM_IOCTL_QUERYMODE\r
- */\r
-typedef struct sTerm_IOCtl_Mode\r
-{\r
- short ID; //!< Zero Based index of mode\r
- short DriverID; //!< Driver's ID number (from ::tVideo_IOCtl_Mode)\r
- Uint16 Height; //!< Height\r
- Uint16 Width; //!< Width\r
- Uint8 Depth; //!< Bits per cell\r
- struct {\r
- unsigned bText: 1; //!< Text Mode marker\r
- unsigned unused: 7;\r
- };\r
-} tTerm_IOCtl_Mode;\r
-\r
-/**\r
- * \brief Terminal Modes\r
- */\r
-enum eTplTerminal_Modes {\r
- /**\r
- * \brief UTF-8 Text Mode\r
- * Any writes to the terminal file are treated as UTF-8 encoded\r
- * strings and reads will also return UTF-8 strings.\r
- */\r
- TERM_MODE_TEXT,\r
- \r
- /**\r
- * \brief 32bpp Framebuffer\r
- * Writes to the terminal file will write to the framebuffer.\r
- * Reads will return UTF-32 characters\r
- */\r
- TERM_MODE_FB,\r
- \r
- /**\r
- * \brief 32bpp 2D Accellerated mode\r
- * Writes to the terminal file will be read as a command stream\r
- * defined in ::eTplTerminal_2D_Commands\r
- */\r
- TERM_MODE_2DACCEL,\r
- \r
- /**\r
- * \brief OpenGL 2D/3D\r
- * Writes to the terminal file will send 3D commands\r
- * Reads will return UTF-32 characters\r
- * \note May or may not stay in the spec\r
- */\r
- TERM_MODE_3D,\r
- \r
- /**\r
- * \brief Number of terminal modes\r
- */\r
- NUM_TERM_MODES\r
-};\r
-\r
-/**\r
- * \brief 2D Command IDs\r
- * \todo Complete this structure\r
- * \r
- * Command IDs for when the terminal type is eTplTerminal_Modes.TERM_MODE_2DACCEL\r
- */\r
-enum eTplTerminal_2D_Commands\r
-{\r
- /**\r
- * \brief No Operation - Used for padding\r
- */\r
- TERM_2DCMD_NOP,\r
- \r
- /**\r
- * (Uint16 X, Y, W, H, Uint32 Data[])\r
- * \brief Blits a bitmap to the display\r
- * \param X,Y Coordinates of Top-Left corner\r
- * \param W,H Dimensions\r
- * \param Data 32-bpp pixel data\r
- */\r
- TERM_2DCMD_PUSH\r
-};\r
-\r
-#endif\r
+++ /dev/null
-/**\r
- * \file tpl_drv_video.h\r
- * \brief Video Driver Interface Definitions\r
- * \note For AcessOS Version 1\r
- * \r
- * Video drivers extend the common driver interface tpl_drv_common.h\r
- * and must support _at least_ the IOCtl numbers defined in this file\r
- * to be compatable with Acess.\r
- * \r
- * \section IOCtls\r
- * As said, a compatable driver must implement these calls correctly,\r
- * but they may choose not to allow direct user access to the framebuffer.\r
- * \r
- * \section Screen Contents\r
- * Writes to the driver's file while in component colour modes\r
- * must correspond to a change of the contents of the screen. The framebuffer\r
- * must start at offset 0 in the file.\r
- * Reading from the screen must either return zero, or read from the\r
- * framebuffer.\r
- * \r
- * \section Mode Support\r
- * All video drivers must support at least one text mode (Mode #0)\r
- * For each graphics mode the driver exposes, there must be a corresponding\r
- * text mode with the same resolution, this mode will be used when the\r
- * user switches to a text Virtual Terminal while in graphics mode.\r
- */\r
-#ifndef _TPL_VIDEO_H\r
-#define _TPL_VIDEO_H\r
-\r
-#include <tpl_drv_common.h>\r
-\r
-/**\r
- * \enum eTplVideo_IOCtl\r
- * \brief Common Video IOCtl Calls\r
- * \extends eTplDrv_IOCtl\r
- */\r
-enum eTplVideo_IOCtl {\r
- /**\r
- * ioctl(..., int *mode)\r
- * \brief Get/Set Mode\r
- * \return Current mode ID or -1 on error\r
- * \r
- * If \a mode is non-NULL, the current video mode is set to \a *mode.\r
- * This updated ID is then returned to the user.\r
- */\r
- VIDEO_IOCTL_GETSETMODE = 4,\r
- \r
- /**\r
- * ioctl(..., tVideo_IOCtl_Mode *info)\r
- * \brief Find a matching mode\r
- * \return 1 if a mode was found, 0 otherwise\r
- * \r
- * Using avaliable modes matching the \a bpp and \a flags fields\r
- * set the \a id field to the mode id of the mode with the closest\r
- * \a width and \a height.\r
- */\r
- VIDEO_IOCTL_FINDMODE,\r
- \r
- /**\r
- * ioctl(..., tVideo_IOCtl_Mode *info)\r
- * \brief Get mode info\r
- * \return 1 if the mode exists, 0 otherwise\r
- * \r
- * Set \a info's fields to the mode specified by the \a id field.\r
- */\r
- VIDEO_IOCTL_MODEINFO,\r
- \r
- /**\r
- * ioctl(..., int *NewFormat)\r
- * \brief Switches between Text, Framebuffer and 3D modes\r
- * \param NewFormat Pointer to the new format code (see eTplVideo_BufFormats)\r
- * \return Original format\r
- * \r
- * Enabes and disables the video text mode, changing the behavior of\r
- * writes to the device file.\r
- */\r
- VIDEO_IOCTL_SETBUFFORMAT,\r
- \r
- /**\r
- * ioctl(..., tVideo_IOCtl_Pos *pos)\r
- * \brief Sets the cursor position\r
- * \return Boolean success\r
- * \r
- * Set the text mode cursor position (if it is supported)\r
- * If the \a pos is set to (-1,-1) the cursor is hidden, otherwise\r
- * \a pos MUST be within the current screen size (as given by the\r
- * current mode's tVideo_IOCtl_Mode.width and tVideo_IOCtl_Mode.height\r
- * fields).\r
- */\r
- VIDEO_IOCTL_SETCURSOR,\r
- \r
- /**\r
- * ioctl(..., tVideo_IOCtl_Bitmap *Image)\r
- * \brief Sets the cursor image\r
- * \return Boolean success\r
- *\r
- * Sets the graphics mode cursor image\r
- */\r
- VIDEO_IOCTL_SETCURSORBITMAP\r
-};\r
-#define DRV_VIDEO_IOCTLNAMES "getset_mode", "find+mode", "mode_info", "set_buf_format", "set_cursor", "set_cursor_bitmap"\r
-\r
-/**\r
- * \brief Mode Structure used in IOCtl Calls\r
- * \r
- * Defines a video mode supported by (or requested of) this driver (depending\r
- * on what ioctl call is used)\r
- */\r
-typedef struct sVideo_IOCtl_Mode\r
-{\r
- short id; //!< Mode ID\r
- Uint16 width; //!< Width\r
- Uint16 height; //!< Height\r
- Uint8 bpp; //!< Bits per Unit (Character or Pixel, depending on \a flags)\r
- Uint8 flags; //!< Mode Flags\r
-} tVideo_IOCtl_Mode;\r
-\r
-/**\r
- * \brief Buffer Format Codes\r
- */\r
-enum eTplVideo_BufFormats\r
-{\r
- /**\r
- * \brief Text Mode\r
- * \r
- * The device file presents itself as an array of ::tVT_Char\r
- * each describing a character cell on the screen.\r
- * These cells are each \a giVT_CharWidth pixels wide and\r
- * \a giVT_CharHeight high.\r
- */\r
- VIDEO_BUFFMT_TEXT,\r
- /**\r
- * \brief Framebuffer Mode\r
- * \r
- * The device file presents as an array of 32-bpp pixels describing\r
- * the entire screen. The format of a single pixel is in xRGB format\r
- * (top 8 bits ignored, next 8 bits red, next 8 bits green and\r
- * the bottom 8 bits blue)\r
- */\r
- VIDEO_BUFFMT_FRAMEBUFFER,\r
- /**\r
- * \brief 2D Accelerated Mode\r
- * \r
- * The device file acts as a character device, accepting a stream of\r
- * commands described in eTplVideo_2DCommands when written to.\r
- */\r
- VIDEO_BUFFMT_2DSTREAM,\r
- /**\r
- * \brief 3D Accelerated Mode\r
- * \r
- * The device file acts as a character device, accepting a stream of\r
- * commands described in eTplVideo_3DCommands when written to.\r
- */\r
- VIDEO_BUFFMT_3DSTREAM\r
-};\r
-\r
-/**\r
- * \brief 2D Accellerated Video Commands\r
- * \r
- * Commands passed in the command stream for ::VIDEO_BUFFMT_2DSTREAM\r
- */\r
-enum eTplVideo_2DCommands\r
-{\r
- /**\r
- * \brief No Operation\r
- */\r
- VIDEO_2DOP_NOP,\r
- /**\r
- * \brief Fill a region\r
- * \param X Uint16 - Leftmost pixels of the region\r
- * \param Y Uint16 - Topmost pixels of the region\r
- * \param W Uint16 - Width of the region\r
- * \param H Uint16 - Height of the region\r
- * \param Colour Uint32 - Value to fill with\r
- */\r
- VIDEO_2DOP_FILL,\r
- /**\r
- * \brief Copy a region from one part of the framebuffer to another\r
- * \param DestX Uint16 - Leftmost pixels of the destination\r
- * \param DestY Uint16 - Topmost pixels of the destination\r
- * \param SrcX Uint16 - Leftmost pixels of the source\r
- * \param SrcY Uint16 - Topmost pixels of the source\r
- * \param Width Uint16 - Width of the region\r
- * \param Height Uint16 - Height of the region\r
- */\r
- VIDEO_2DOP_BLIT,\r
-\r
-\r
- /**\r
- * \brief Copy a region from video memory to the framebuffer\r
- */\r
- VIDEO_2DOP_BLITBUF,\r
-\r
- /**\r
- * \brief Copy and scale a region from video memory to the framebuffer\r
- */\r
- VIDEO_2DOP_BLITSCALEBUF,\r
-\r
- NUM_VIDEO_2DOPS\r
-};\r
-\r
-/**\r
- * \brief Describes a position in the video framebuffer\r
- */\r
-typedef struct sVideo_IOCtl_Pos\r
-{\r
- Sint16 x; //!< X Coordinate\r
- Sint16 y; //!< Y Coordinate\r
-} tVideo_IOCtl_Pos;\r
-\r
-/**\r
- * \brief Bitmap object (out of band image)\r
- */\r
-typedef struct sVideo_IOCtl_Bitmap\r
-{\r
- Sint16 W; //!< Width of image\r
- Sint16 H; //!< Height of image\r
- Sint16 XOfs; //!< X Offset of center\r
- Sint16 YOfs; //!< Y Offset of center\r
- Uint32 Data[]; //!< Image data (ARGB array)\r
-} tVideo_IOCtl_Bitmap;\r
-\r
-/**\r
- * \brief Virtual Terminal Representation of a character\r
- */\r
-typedef struct sVT_Char\r
-{\r
- Uint32 Ch; //!< UTF-32 Character\r
- union {\r
- struct {\r
- Uint16 BGCol; //!< 12-bit Foreground Colour\r
- Uint16 FGCol; //!< 12-bit Background Colour\r
- };\r
- Uint32 Colour; //!< Compound colour for ease of access\r
- };\r
-} tVT_Char;\r
-\r
-/**\r
- * \name Basic builtin colour definitions\r
- * \{\r
- */\r
-#define VT_COL_BLACK 0x0000\r
-#define VT_COL_GREY 0x0888\r
-#define VT_COL_LTGREY 0x0CCC\r
-#define VT_COL_WHITE 0x0FFF\r
-/**\r
- * \}\r
- */\r
-\r
-//! \brief Defines the width of a rendered character\r
-extern int giVT_CharWidth;\r
-//! \brief Defines the height of a rendered character\r
-extern int giVT_CharHeight;\r
-/**\r
- * \brief Driver helper that renders a character to a buffer\r
- * \param Codepoint Unicode character to render\r
- * \param Buffer Buffer to render to\r
- * \param Depth Bit depth of the destination buffer\r
- * \param Pitch Number of bytes per line\r
- * \param BGC 32-bit Background Colour\r
- * \param FGC 32-bit Foreground Colour\r
- * \r
- * This function is provided to help video drivers to support a simple\r
- * text mode by keeping the character rendering abstracted from the driver,\r
- * easing the driver development and reducing code duplication.\r
- */\r
-extern void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Depth, int Pitch, Uint32 BGC, Uint32 FGC);\r
-/**\r
- * \fn Uint32 VT_Colour12to24(Uint16 Col12)\r
- * \brief Converts a colour from 12bpp to 24bpp\r
- * \param Col12 12-bpp input colour\r
- * \return Expanded 32-bpp (24-bit colour) version of \a Col12\r
- */\r
-extern Uint32 VT_Colour12to24(Uint16 Col12);\r
-/**\r
- * \brief Converts a colour from 12bpp to 14bpp\r
- * \param Col12 12-bpp input colour\r
- * \return 15 bits per pixel value\r
- */\r
-extern Uint16 VT_Colour12to15(Uint16 Col12);\r
-/**\r
- * \brief Converts a colour from 12bpp to 32bpp\r
- * \param Col12 12-bpp input colour\r
- * \param Depth Desired bit depth\r
- * \return \a Depth bit number, denoting Col12\r
- * \r
- * Expands the source colour into a \a Depth bits per pixel representation.\r
- * The colours are expanded with preference to Green, Blue and Red in that order\r
- * (so, green gets the first spare pixel, blue gets the next, and red never gets\r
- * the spare). \n\r
- * The final bit of each component is used to fill the lower bits of the output.\r
- */\r
-extern Uint32 VT_Colour12toN(Uint16 Col12, int Depth);\r
-\r
-/**\r
- * \brief Handlers for eTplVideo_2DCommands\r
- */\r
-typedef struct sDrvUtil_Video_2DHandlers\r
-{\r
- /**\r
- * \brief No Operation, Ignored\r
- * \see VIDEO_2DOP_NOP\r
- */\r
- void *Nop;\r
- /**\r
- * \brief Fill a buffer region\r
- * \param X Lefthand edge\r
- * \param Y Top edge\r
- * \param W Width\r
- * \param H Height\r
- * \param Colour Colour to fill with\r
- * \see VIDEO_2DOP_FILL\r
- */\r
- void (*Fill)(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour);\r
- /**\r
- * \brief Fill a buffer region\r
- * \param DestX Lefthand edge of destination\r
- * \param DestY Top edge of destination\r
- * \param SrcX Lefthand edge of source\r
- * \param SrcY Top edge of source\r
- * \param W Width\r
- * \param H Height\r
- * \see VIDEO_2DOP_BLIT\r
- */\r
- void (*Blit)(void *Ent, Uint16 DestX, Uint16 DestY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H);\r
-} tDrvUtil_Video_2DHandlers;\r
-\r
-/**\r
- * \brief Handle a 2D operation stream for a driver\r
- * \param Ent Value to pass to handlers\r
- * \param Buffer Stream buffer\r
- * \param Length Length of stream\r
- * \param Handlers Handlers to use for the stream\r
- * \param SizeofHandlers Size of \a tDrvUtil_Video_2DHandlers according\r
- * to the driver. Used as version control and error avoidence.\r
- */\r
-extern Uint64 DrvUtil_Video_2DStream(void *Ent, void *Buffer, int Length,\r
- tDrvUtil_Video_2DHandlers *Handlers, int SizeofHandlers);\r
-\r
-#endif\r
#include <vfs.h>\r
#include <fs_devfs.h>\r
#include <drv_pci.h>\r
-#include <tpl_drv_video.h>\r
+#include <api_drv_video.h>\r
\r
#define INT\r
\r
\r
#include <acess.h>\r
#include <vfs.h>\r
-#include <tpl_drv_video.h>\r
+#include <api_drv_video.h>\r
#include <fs_devfs.h>\r
#include <modules.h>\r
#include <vm8086.h>\r
#define VERSION VER2(0,10)
#include "ipstack.h"
#include "link.h"
-#include <tpl_drv_common.h>
-#include <tpl_drv_network.h>
+#include <api_drv_common.h>
+#include <api_drv_network.h>
// === CONSTANTS ===
//! Default timeout value, 30 seconds
#define DEBUG 0
#define VERSION VER2(0,10)
#include <acess.h>
-#include <tpl_drv_common.h>
+#include <api_drv_common.h>
#include "ipstack.h"
#include "link.h"
* - SCTP (Stream Control Transmission Protocol) Handling
*/
#include "ipstack.h"
-#include <tpl_drv_common.h>
+#include <api_drv_common.h>
#include "sctp.h"
#define SCTP_ALLOC_BASE 0xC000
* - UDP Handling
*/
#include "ipstack.h"
-#include <tpl_drv_common.h>
+#include <api_drv_common.h>
#include "udp.h"
#define UDP_ALLOC_BASE 0xC000
#include <acess.h>
#include <modules.h>
#include <fs_devfs.h>
-#include <tpl_drv_common.h>
-#include <tpl_drv_keyboard.h>
+#include <api_drv_common.h>
+#include <api_drv_keyboard.h>
#include "kb_kbdus.h"
// === CONSTANTS ===
#include <modules.h>\r
#include <vfs.h>\r
#include <fs_devfs.h>\r
-#include <tpl_drv_common.h>\r
-#include <tpl_drv_joystick.h>\r
+#include <api_drv_common.h>\r
+#include <api_drv_joystick.h>\r
\r
static inline int MIN(int a, int b) { return (a < b) ? a : b; }\r
static inline int MAX(int a, int b) { return (a > b) ? a : b; }\r
#include <modules.h>
#include <fs_devfs.h>
#include <drv_pci.h>
-#include <tpl_drv_network.h>
+#include <api_drv_network.h>
#include <semaphore.h>
// === CONSTANTS ===
#include <modules.h>
#include <fs_devfs.h>
#include <drv_pci.h>
-#include <tpl_drv_network.h>
+#include <api_drv_network.h>
#include <semaphore.h>
// === CONSTANTS ===
#include <modules.h>
#include <fs_devfs.h>
#include <drv_pci.h>
-#include <tpl_drv_network.h>
+#include <api_drv_network.h>
#include <semaphore.h>
// === CONSTANTS ===
#include <vfs.h>\r
#include <fs_devfs.h>\r
#include <drv_pci.h>\r
-#include <tpl_drv_sound.h>\r
+#include <api_drv_sound.h>\r
\r
#define INT\r
\r
#include <modules.h>
#include <vfs.h>
#include <fs_devfs.h>
-#include <tpl_drv_common.h>
-#include <tpl_drv_disk.h>
+#include <api_drv_common.h>
+#include <api_drv_disk.h>
#include "common.h"
// === MACROS ===
#include <acess.h>
#include <modules.h>
#include <fs_devfs.h>
-#include <tpl_drv_disk.h>
+#include <api_drv_disk.h>
#include <dma.h>
#include <iocache.h>
#define DEBUG 0
#include <acess.h>
#include <fs_devfs.h>
-#include <tpl_drv_video.h>
+#include <api_drv_video.h>
#include <modules.h>
// === CONSTANTS ===