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 32 33 enum { 34 B_8_BIT_TRANSFER, 35 B_16_BIT_TRANSFER 36 }; 37 38 // maximum size of one dma transfer 39 // (in bytes for 8 bit transfer, in words for 16 bit transfer) 40 #define B_MAX_ISA_DMA_COUNT 0x10000 41 42 typedef struct isa2_module_info { 43 pnp_bus_info binfo; 44 45 uint8 (*read_io_8)( int mapped_io_addr ); 46 void (*write_io_8)( int mapped_io_addr, uint8 value ); 47 uint16 (*read_io_16)( int mapped_io_addr ); 48 void (*write_io_16)( int mapped_io_addr, uint16 value ); 49 uint32 (*read_io_32)( int mapped_io_addr ); 50 void (*write_io_32)( int mapped_io_addr, uint32 value ); 51 52 // don't know what it's for, remains for compatibility 53 void *(*ram_address)( const void *physical_address_in_system_memory ); 54 55 // start dma transfer (scattered DMA is not supported as it's EISA specific) 56 status_t (*start_isa_dma)( 57 long channel, // dma channel to use 58 void *buf, // buffer to transfer 59 long transfer_count, // # transfers 60 uchar mode, // mode flags 61 uchar e_mode // extended mode flags 62 ); 63 } isa2_module_info; 64 65 // type of isa device 66 #define ISA_DEVICE_TYPE_NAME "isa/device/v1" 67 // directory of ISA drivers 68 // (there is only one device node, so put all drivers under "universal") 69 #define ISA_DRIVERS_DIR "isa" 70 71 72 #endif 73