source: trunk/minix/include/minix/devio.h@ 9

Last change on this file since 9 was 9, checked in by Mattia Monga, 13 years ago

Minix 3.1.2a

File size: 2.2 KB
Line 
1/* This file provides basic types and some constants for the
2 * SYS_DEVIO and SYS_VDEVIO system calls, which allow user-level
3 * processes to perform device I/O.
4 *
5 * Created:
6 * Apr 08, 2004 by Jorrit N. Herder
7 */
8
9#ifndef _DEVIO_H
10#define _DEVIO_H
11
12#include <minix/sys_config.h> /* needed to include <minix/type.h> */
13#include <sys/types.h> /* u8_t, u16_t, u32_t needed */
14
15typedef u16_t port_t;
16typedef U16_t Port_t;
17
18/* We have different granularities of port I/O: 8, 16, 32 bits.
19 * Also see <ibm/portio.h>, which has functions for bytes, words,
20 * and longs. Hence, we need different (port,value)-pair types.
21 */
22typedef struct { u16_t port; u8_t value; } pvb_pair_t;
23typedef struct { u16_t port; u16_t value; } pvw_pair_t;
24typedef struct { u16_t port; u32_t value; } pvl_pair_t;
25
26/* Macro shorthand to set (port,value)-pair. */
27#define pv_set(pv, p, v) ((pv).port = (p), (pv).value = (v))
28#define pv_ptr_set(pv_ptr, p, v) ((pv_ptr)->port = (p), (pv_ptr)->value = (v))
29
30#if 0 /* no longer in use !!! */
31/* Define a number of flags to indicate granularity we are using. */
32#define MASK_GRANULARITY 0x000F /* not in use! does not match flags */
33#define PVB_FLAG 'b'
34#define PVW_FLAG 'w'
35#define PVL_FLAG 'l'
36
37/* Flags indicating whether request wants to do input or output. */
38#define MASK_IN_OR_OUT 0x00F0
39#define DEVIO_INPUT 0x0010
40#define DEVIO_OUTPUT 0x0020
41#endif /* 0 */
42
43#if 0 /* no longer used !!! */
44/* Define how large the (port,value)-pair buffer in the kernel is.
45 * This buffer is used to copy the (port,value)-pairs in kernel space.
46 */
47#define PV_BUF_SIZE 64 /* creates char pv_buf[PV_BUF_SIZE] */
48
49/* Note that SYS_VDEVIO sends a pointer to a vector of (port,value)-pairs,
50 * whereas SYS_DEVIO includes a single (port,value)-pair in the messages.
51 * Calculate maximum number of (port,value)-pairs that can be handled
52 * in a single SYS_VDEVIO system call with above struct definitions.
53 */
54#define MAX_PVB_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvb_pair_t))
55#define MAX_PVW_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvw_pair_t))
56#define MAX_PVL_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvl_pair_t))
57#endif /* 0 */
58
59
60#endif /* _DEVIO_H */
Note: See TracBrowser for help on using the repository browser.