xref: /haiku/headers/os/drivers/bus/ISA.h (revision aef94baf32b4370979ce315902c400d23076366c)
10d59a3d2SAxel Dörfler /*
2f46308c9SAxel Dörfler  * Copyright 2002-2003, Thomas Kurschel. All rights reserved.
3f46308c9SAxel Dörfler  * Distributed under the terms of the MIT License.
40d59a3d2SAxel Dörfler  */
5f46308c9SAxel Dörfler #ifndef _ISA2_H
6f46308c9SAxel Dörfler #define _ISA2_H
70d59a3d2SAxel Dörfler 
8f46308c9SAxel Dörfler 
9f46308c9SAxel Dörfler /*!	ISA bus manager
100d59a3d2SAxel Dörfler 
110d59a3d2SAxel Dörfler 	This is an improper name - this bus manager uses the PnP manager to
120d59a3d2SAxel Dörfler 	load device drivers, but calling it ISA PnP manager would be wrong as
130d59a3d2SAxel Dörfler 	ISA PnP information isn't used at all.
140d59a3d2SAxel Dörfler 
150d59a3d2SAxel Dörfler 	All ISA drivers must be Universal driver (see pnp_manager.h), as they
160d59a3d2SAxel Dörfler 	are all direct children of the ISA bus node. Having an ISA PnP bus manager
170d59a3d2SAxel Dörfler 	(which we don't), one node would be created per ISA device and thus you
180d59a3d2SAxel Dörfler 	could write Specific drivers, but under normal ISA we don't even know
190d59a3d2SAxel Dörfler 	how many devices are there, therefore the Universal driver trick.
200d59a3d2SAxel Dörfler 
210d59a3d2SAxel Dörfler 	Apart from the loading, the main change is the resource manager. In
220d59a3d2SAxel Dörfler 	a driver, you must allocate the resources before registering the node and
230d59a3d2SAxel Dörfler 	deallocate it when your node is removed and if the driver isn't loaded at
240d59a3d2SAxel Dörfler 	this time. If it is, you must delay deallocation until the driver gets
250d59a3d2SAxel Dörfler 	unloaded to make sure no new driver touches the same resources like you
260d59a3d2SAxel Dörfler 	meanwhile.
270d59a3d2SAxel Dörfler */
280d59a3d2SAxel Dörfler 
290d59a3d2SAxel Dörfler 
300d59a3d2SAxel Dörfler #include <device_manager.h>
314f91f115SAxel Dörfler #include <ISA.h>
320d59a3d2SAxel Dörfler 
33f46308c9SAxel Dörfler 
340d59a3d2SAxel Dörfler // maximum size of one dma transfer
350d59a3d2SAxel Dörfler // (in bytes for 8 bit transfer, in words for 16 bit transfer)
360d59a3d2SAxel Dörfler #define B_MAX_ISA_DMA_COUNT	0x10000
370d59a3d2SAxel Dörfler 
380d59a3d2SAxel Dörfler typedef struct isa2_module_info {
39368167edSAxel Dörfler 	driver_module_info info;
400d59a3d2SAxel Dörfler 
410d59a3d2SAxel Dörfler 	uint8 (*read_io_8)(int mapped_io_addr);
420d59a3d2SAxel Dörfler 	void (*write_io_8)(int mapped_io_addr, uint8 value);
430d59a3d2SAxel Dörfler 	uint16 (*read_io_16)(int mapped_io_addr);
440d59a3d2SAxel Dörfler 	void (*write_io_16)(int mapped_io_addr, uint16 value);
450d59a3d2SAxel Dörfler 	uint32 (*read_io_32)(int mapped_io_addr);
460d59a3d2SAxel Dörfler 	void (*write_io_32)(int mapped_io_addr, uint32 value);
470d59a3d2SAxel Dörfler 
480d59a3d2SAxel Dörfler 	// don't know what it's for, remains for compatibility
49*aef94bafSFrançois Revol 	phys_addr_t (*ram_address)(phys_addr_t physical_address_in_system_memory);
500d59a3d2SAxel Dörfler 
510d59a3d2SAxel Dörfler 	// start dma transfer (scattered DMA is not supported as it's EISA specific)
520d59a3d2SAxel Dörfler 	status_t (*start_isa_dma)(
530d59a3d2SAxel Dörfler 		long	channel,				// dma channel to use
540d59a3d2SAxel Dörfler 		void	*buf,					// buffer to transfer
550d59a3d2SAxel Dörfler 		long	transfer_count,			// # transfers
560d59a3d2SAxel Dörfler 		uchar	mode,					// mode flags
570d59a3d2SAxel Dörfler 		uchar	e_mode					// extended mode flags
580d59a3d2SAxel Dörfler 	);
590d59a3d2SAxel Dörfler } isa2_module_info;
600d59a3d2SAxel Dörfler 
610d59a3d2SAxel Dörfler // type of isa device
620d59a3d2SAxel Dörfler #define ISA_DEVICE_TYPE_NAME "isa/device/v1"
630d59a3d2SAxel Dörfler // directory of ISA drivers
640d59a3d2SAxel Dörfler // (there is only one device node, so put all drivers under "universal")
650d59a3d2SAxel Dörfler #define ISA_DRIVERS_DIR "isa"
660d59a3d2SAxel Dörfler 
670d59a3d2SAxel Dörfler 
68368167edSAxel Dörfler #endif	/* _ISA2_H */
69