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