xref: /haiku/headers/os/drivers/ISA.h (revision 0daa3f2af3683b7a700a5e29bb533fa21974fc42)
1 /*******************************************************************************
2 /
3 /	File:			ISA.h
4 /
5 /	Description:	Interface to ISA module
6 /
7 /	Copyright 1998, Be Incorporated, All Rights Reserved.
8 /
9 *******************************************************************************/
10 
11 #ifndef _ISA_H
12 #define _ISA_H
13 
14 //#include <SupportDefs.h>
15 #include <bus_manager.h>
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 /* ---
22 	ISA scatter/gather dma support.
23 --- */
24 
25 typedef struct {
26 	ulong	address;				/* memory address (little endian!) 4 bytes */
27 	ushort	transfer_count;			/* # transfers minus one (little endian!) 2 bytes*/
28 	uchar	reserved;				/* filler, 1byte*/
29     uchar   flag;					/* end of link flag, 1byte */
30 } isa_dma_entry;
31 
32 #define 	B_LAST_ISA_DMA_ENTRY	0x80	/* sets end of link flag in isa_dma_entry */
33 
34 enum {
35 	B_8_BIT_TRANSFER,
36 	B_16_BIT_TRANSFER
37 };
38 
39 #define B_MAX_ISA_DMA_COUNT	0x10000
40 
41 typedef struct isa_module_info isa_module_info;
42 struct isa_module_info {
43 	bus_manager_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 	void *			(*ram_address) (const void *physical_address_in_system_memory);
53 
54 	long			(*make_isa_dma_table) (
55 							const void		*buffer,		/* buffer to make a table for */
56 							long			buffer_size,	/* buffer size */
57 							ulong			num_bits,		/* dma transfer size that will be used */
58 							isa_dma_entry	*table,			/* -> caller-supplied scatter/gather table */
59 							long			num_entries		/* max # entries in table */
60 						);
61 	long			(*start_isa_dma) (
62 							long	channel,				/* dma channel to use */
63 							void	*buf,					/* buffer to transfer */
64 							long	transfer_count,			/* # transfers */
65 							uchar	mode,					/* mode flags */
66 							uchar	e_mode					/* extended mode flags */
67 						);
68 	long			(*start_scattered_isa_dma) (
69 							long				channel,	/* channel # to use */
70 							const isa_dma_entry	*table,		/* physical address of scatter/gather table */
71 							uchar				mode,		/* mode flags */
72 							uchar				emode		/* extended mode flags */
73 						);
74 	long			(*lock_isa_dma_channel) (long channel);
75 	long			(*unlock_isa_dma_channel) (long channel);
76 };
77 
78 #define	B_ISA_MODULE_NAME		"bus_managers/isa/v1"
79 
80 #ifdef __cplusplus
81 }
82 #endif
83 
84 #endif	/* _ISA_H */
85