xref: /haiku/headers/os/drivers/bus/ISA.h (revision 079eccf655ba39812b421ae1b87a727d41b50354)
1 /*
2 ** Copyright 2002/03, Thomas Kurschel. All rights reserved.
3 ** Distributed under the terms of the OpenBeOS License.
4 */
5 
6 /*
7 	ISA bus manager
8 
9 	This is an improper name - this bus manager uses the PnP manager to
10 	load device drivers, but calling it ISA PnP manager would be wrong as
11 	ISA PnP information isn't used at all.
12 
13 	All ISA drivers must be Universal driver (see pnp_manager.h), as they
14 	are all direct children of the ISA bus node. Having an ISA PnP bus manager
15 	(which we don't), one node would be created per ISA device and thus you
16 	could write Specific drivers, but under normal ISA we don't even know
17 	how many devices are there, therefore the Universal driver trick.
18 
19 	Apart from the loading, the main change is the resource manager. In
20 	a driver, you must allocate the resources before registering the node and
21 	deallocate it when your node is removed and if the driver isn't loaded at
22 	this time. If it is, you must delay deallocation until the driver gets
23 	unloaded to make sure no new driver touches the same resources like you
24 	meanwhile.
25 */
26 
27 #ifndef _ISA2_H
28 #define _ISA2_H
29 
30 #include <device_manager.h>
31 #include <ISA.h>
32 
33 // maximum size of one dma transfer
34 // (in bytes for 8 bit transfer, in words for 16 bit transfer)
35 #define B_MAX_ISA_DMA_COUNT	0x10000
36 
37 typedef struct isa2_module_info {
38 	driver_module_info info;
39 
40 	uint8 (*read_io_8)(int mapped_io_addr);
41 	void (*write_io_8)(int mapped_io_addr, uint8 value);
42 	uint16 (*read_io_16)(int mapped_io_addr);
43 	void (*write_io_16)(int mapped_io_addr, uint16 value);
44 	uint32 (*read_io_32)(int mapped_io_addr);
45 	void (*write_io_32)(int mapped_io_addr, uint32 value);
46 
47 	// don't know what it's for, remains for compatibility
48 	void *(*ram_address)(const void *physical_address_in_system_memory);
49 
50 	// start dma transfer (scattered DMA is not supported as it's EISA specific)
51 	status_t (*start_isa_dma)(
52 		long	channel,				// dma channel to use
53 		void	*buf,					// buffer to transfer
54 		long	transfer_count,			// # transfers
55 		uchar	mode,					// mode flags
56 		uchar	e_mode					// extended mode flags
57 	);
58 } isa2_module_info;
59 
60 // type of isa device
61 #define ISA_DEVICE_TYPE_NAME "isa/device/v1"
62 // directory of ISA drivers
63 // (there is only one device node, so put all drivers under "universal")
64 #define ISA_DRIVERS_DIR "isa"
65 
66 
67 #endif	/* _ISA2_H */
68