xref: /haiku/headers/os/drivers/isapnp.h (revision 21258e2674226d6aa732321b6f8494841895af5f)
1 #ifndef _ISA_CONFIG_H
2 #define _ISA_CONFIG_H
3 
4 #include <config_manager.h>
5 
6 #ifdef __cplusplus
7 extern "C" {
8 #endif
9 
10 typedef union {
11 	uint32 id;
12 	uchar b[4];
13 } EISA_PRODUCT_ID;
14 
15 /* uint32 MAKE_EISA_PRODUCT_ID(EISA_PRODUCT_ID* ptr, char ch0, char ch1, char ch2, uint12 prod_num, uint4 rev) */
16 /* example: MAKE_EISA_PRODUCT_ID(&foo_id, 'F','O','O', 0xdb1, 3); */
17 /* makes correct little-endian format */
18 #define	MAKE_EISA_PRODUCT_ID(ptr, ch0, ch1, ch2, prod_num, rev) \
19 	do { \
20 		(ptr)->b[0] = (uint8)(((((ch0) - 'A' + 1) & 0x1f) << 2) | ((((ch1) - 'A' + 1) & 0x18) >> 3));  	\
21 		(ptr)->b[1] = (uint8)(((((ch1) - 'A' + 1) & 0x07) << 5) | ((((ch2) - 'A' + 1) & 0x1f)     ));  	\
22 		(ptr)->b[2] = (uint8)((((prod_num) & 0xff0) >> 4)); \
23 		(ptr)->b[3] = (uint8)((((prod_num) & 0x00f) << 4) | ((rev) & 0xf) ); \
24 	} while(0)
25 
26 /* Compare IDs without revision */
27 /* bool EQUAL_EISA_PRODUCT_ID(EISA_PRODUCT_ID id1, EISA_PRODUCT_ID id2); */
28 #define	EQUAL_EISA_PRODUCT_ID(id1, id2) \
29 	(((id1).b[0] == (id2).b[0]) && ((id1).b[1] == (id2).b[1]) && ((id1).b[2] == (id2).b[2]) && (((id1).b[3] & 0xf0) == ((id2).b[3] & 0xf0)))
30 
31 #define B_MAX_COMPATIBLE_IDS 8
32 
33 /* This structure is deprecated and will be going away in the next release */
34 struct isa_device_info {
35 	struct device_info info;
36 
37 	uchar	csn;
38 	uchar	ldn;
39 	uint32	vendor_id;
40 	uint32	card_id;			/* a.k.a. serial number */
41 	uint32	logical_device_id;
42 	uint32	num_compatible_ids;
43 	uint32	compatible_ids[B_MAX_COMPATIBLE_IDS];
44 	char	card_name[B_OS_NAME_LENGTH];
45 	char	logical_device_name[B_OS_NAME_LENGTH];
46 };
47 
48 /* So use this instead */
49 struct isa_info {
50 	uchar	csn;
51 	uchar	ldn;
52 	uint32	vendor_id;
53 	uint32	card_id;			/* a.k.a. serial number */
54 	uint32	logical_device_id;
55 	uint32	num_compatible_ids;
56 	uint32	compatible_ids[B_MAX_COMPATIBLE_IDS];
57 	char	card_name[B_OS_NAME_LENGTH];
58 	char	logical_device_name[B_OS_NAME_LENGTH];
59 };
60 
61 /* for the mem_descriptor cookie */
62 #define B_ISA_MEMORY_32_BIT 0x100
63 
64 #ifdef __cplusplus
65 }
66 #endif
67 
68 #endif
69