xref: /haiku/headers/os/drivers/ISA.h (revision 7457ccb4b2f4786525d3b7bda42598487d57ab7d)
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 {
42 	bus_manager_info	binfo;
43 
44 	uint8			(*read_io_8) (int mapped_io_addr);
45 	void			(*write_io_8) (int mapped_io_addr, uint8 value);
46 	uint16			(*read_io_16) (int mapped_io_addr);
47 	void			(*write_io_16) (int mapped_io_addr, uint16 value);
48 	uint32			(*read_io_32) (int mapped_io_addr);
49 	void			(*write_io_32) (int mapped_io_addr, uint32 value);
50 
51 	phys_addr_t		(*ram_address) (phys_addr_t physical_address_in_system_memory);
52 
53 	long			(*make_isa_dma_table) (
54 							const void		*buffer,		/* buffer to make a table for */
55 							long			buffer_size,	/* buffer size */
56 							ulong			num_bits,		/* dma transfer size that will be used */
57 							isa_dma_entry	*table,			/* -> caller-supplied scatter/gather table */
58 							long			num_entries		/* max # entries in table */
59 						);
60 	status_t		(*start_isa_dma) (
61 							long	channel,				/* dma channel to use */
62 							void	*buf,					/* buffer to transfer */
63 							long	transfer_count,			/* # transfers */
64 							uchar	mode,					/* mode flags */
65 							uchar	e_mode					/* extended mode flags */
66 						);
67 	long			(*start_scattered_isa_dma) (
68 							long				channel,	/* channel # to use */
69 							const isa_dma_entry	*table,		/* physical address of scatter/gather table */
70 							uchar				mode,		/* mode flags */
71 							uchar				emode		/* extended mode flags */
72 						);
73 	status_t		(*lock_isa_dma_channel) (long channel);
74 	status_t		(*unlock_isa_dma_channel) (long channel);
75 } isa_module_info;
76 
77 #define	B_ISA_MODULE_NAME		"bus_managers/isa/v1"
78 
79 #ifdef __cplusplus
80 }
81 #endif
82 
83 #endif	/* _ISA_H */
84