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.
6 * Apr 08, 2004 by Jorrit N. Herder
12 #include <minix/sys_config.h> /* needed to include <minix/type.h> */
13 #include <sys/types.h> /* u8_t, u16_t, u32_t needed */
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.
22 typedef struct { u16_t port
; u8_t value
; } pvb_pair_t
;
23 typedef struct { u16_t port
; u16_t value
; } pvw_pair_t
;
24 typedef struct { u16_t port
; u32_t value
; } pvl_pair_t
;
26 /* Macro shorthand to set (port,value)-pair. */
27 #define pv_set(pv, p, v) do { \
28 u32_t _p = (p), _v = (v); \
31 if((pv).port != _p || (pv).value != _v) { \
32 printf("%s:%d: actual port: 0x%x != 0x%lx || " \
33 "actual value: 0x%x != 0x%lx\n", \
34 __FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
35 panic(__FILE__, "pv_set(" #pv ", " #p ", " #v ")", NO_NUM); \
39 #if 0 /* no longer in use !!! */
40 /* Define a number of flags to indicate granularity we are using. */
41 #define MASK_GRANULARITY 0x000F /* not in use! does not match flags */
46 /* Flags indicating whether request wants to do input or output. */
47 #define MASK_IN_OR_OUT 0x00F0
48 #define DEVIO_INPUT 0x0010
49 #define DEVIO_OUTPUT 0x0020
52 #if 0 /* no longer used !!! */
53 /* Define how large the (port,value)-pair buffer in the kernel is.
54 * This buffer is used to copy the (port,value)-pairs in kernel space.
56 #define PV_BUF_SIZE 64 /* creates char pv_buf[PV_BUF_SIZE] */
58 /* Note that SYS_VDEVIO sends a pointer to a vector of (port,value)-pairs,
59 * whereas SYS_DEVIO includes a single (port,value)-pair in the messages.
60 * Calculate maximum number of (port,value)-pairs that can be handled
61 * in a single SYS_VDEVIO system call with above struct definitions.
63 #define MAX_PVB_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvb_pair_t))
64 #define MAX_PVW_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvw_pair_t))
65 #define MAX_PVL_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvl_pair_t))