iso9660fs: initialize buffer cache
[minix.git] / include / minix / devio.h
blob8a2b3c8fe5e42a87c6e0c76c16e026ecf2a8eb59
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.
5 * Created:
6 * Apr 08, 2004 by Jorrit N. Herder
7 */
9 #ifndef _DEVIO_H
10 #define _DEVIO_H
12 #include <minix/sys_config.h> /* needed to include <minix/type.h> */
13 #include <minix/types.h> /* u8_t, u16_t, u32_t needed */
15 typedef u16_t port_t;
17 /* We have different granularities of port I/O: 8, 16, 32 bits.
18 * Also see <ibm/portio.h>, which has functions for bytes, words,
19 * and longs. Hence, we need different (port,value)-pair types.
21 typedef struct { u16_t port; u8_t value; } pvb_pair_t;
22 typedef struct { u16_t port; u16_t value; } pvw_pair_t;
23 typedef struct { u16_t port; u32_t value; } pvl_pair_t;
25 /* Macro shorthand to set (port,value)-pair. */
26 #define pv_set(pv, p, v) do { \
27 u32_t _p = (p), _v = (v); \
28 (pv).port = _p; \
29 (pv).value = _v; \
30 if((pv).port != _p || (pv).value != _v) { \
31 printf("%s:%d: actual port: 0x%x != 0x%x || " \
32 "actual value: 0x%x != 0x%x\n", \
33 __FILE__, __LINE__, (pv).port, _p, (pv).value, _v); \
34 panic("pv_set(" #pv ", " #p ", " #v ")"); \
35 } \
36 } while(0)
38 #if 0 /* no longer in use !!! */
39 /* Define a number of flags to indicate granularity we are using. */
40 #define MASK_GRANULARITY 0x000F /* not in use! does not match flags */
41 #define PVB_FLAG 'b'
42 #define PVW_FLAG 'w'
43 #define PVL_FLAG 'l'
45 /* Flags indicating whether request wants to do input or output. */
46 #define MASK_IN_OR_OUT 0x00F0
47 #define DEVIO_INPUT 0x0010
48 #define DEVIO_OUTPUT 0x0020
49 #endif /* 0 */
51 #if 0 /* no longer used !!! */
52 /* Define how large the (port,value)-pair buffer in the kernel is.
53 * This buffer is used to copy the (port,value)-pairs in kernel space.
55 #define PV_BUF_SIZE 64 /* creates char pv_buf[PV_BUF_SIZE] */
57 /* Note that SYS_VDEVIO sends a pointer to a vector of (port,value)-pairs,
58 * whereas SYS_DEVIO includes a single (port,value)-pair in the messages.
59 * Calculate maximum number of (port,value)-pairs that can be handled
60 * in a single SYS_VDEVIO system call with above struct definitions.
62 #define MAX_PVB_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvb_pair_t))
63 #define MAX_PVW_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvw_pair_t))
64 #define MAX_PVL_PAIRS ((PV_BUF_SIZE * sizeof(char)) / sizeof(pvl_pair_t))
65 #endif /* 0 */
68 #endif /* _DEVIO_H */