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