Rewrite header ISA.h

partially fixes #1576

Change-Id: I245f55ab466222279e74df7f206a609d3b913ed5
Reviewed-on: https://review.haiku-os.org/c/haiku/+/6298
Reviewed-by: Fredrik Holmqvist <[email protected]>
This commit is contained in:
wszdexdrf
2023-04-11 16:32:56 +00:00
committed by Fredrik Holmqvist
parent 0ec55fb069
commit a2755521d5
+46 -52
View File
@@ -1,83 +1,77 @@
/******************************************************************************* /*
/ * Copyright 2023, Haiku Inc. All Rights Reserved.
/ File: ISA.h * Distributed under the terms of the MIT License.
/ */
/ Description: Interface to ISA module
/
/ Copyright 1998, Be Incorporated, All Rights Reserved.
/
*******************************************************************************/
#ifndef _ISA_H #ifndef ISA_H
#define _ISA_H #define ISA_H
//#include <SupportDefs.h>
#include <bus_manager.h> #include <bus_manager.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
/* --- /*
ISA scatter/gather dma support. * ISA scatter/gather dma support.
--- */ */
typedef struct { typedef struct {
ulong address; /* memory address (little endian!) 4 bytes */ uint32 address; // memory address in little endian
ushort transfer_count; /* # transfers minus one (little endian!) 2 bytes*/ uint16 transfer_count; // number of transfers -1 in little endian
uchar reserved; /* filler, 1byte*/ uint8 reserved; // empty space
uchar flag; /* end of link flag, 1byte */ uint8 flag; // end of link flag
} isa_dma_entry; } isa_dma_entry;
#define B_LAST_ISA_DMA_ENTRY 0x80 /* sets end of link flag in isa_dma_entry */ #define B_LAST_ISA_DMA_ENTRY 0x80 // sets end of link flag
#define B_MAX_ISA_DMA_COUNT 0x10000
#define B_ISA_MODULE_NAME "bus_managers/isa/v1"
enum { enum {
B_8_BIT_TRANSFER, B_8_BIT_TRANSFER,
B_16_BIT_TRANSFER B_16_BIT_TRANSFER
}; };
#define B_MAX_ISA_DMA_COUNT 0x10000
typedef struct isa_module_info { typedef struct isa_module_info {
bus_manager_info binfo; bus_manager_info binfo;
uint8 (*read_io_8) (int mapped_io_addr); uint8 (*read_io_8) (int mapped_io_addr);
void (*write_io_8) (int mapped_io_addr, uint8 value); void (*write_io_8) (int mapped_io_addr, uint8 value);
uint16 (*read_io_16) (int mapped_io_addr); uint16 (*read_io_16) (int mapped_io_addr);
void (*write_io_16) (int mapped_io_addr, uint16 value); void (*write_io_16) (int mapped_io_addr, uint16 value);
uint32 (*read_io_32) (int mapped_io_addr); uint32 (*read_io_32) (int mapped_io_addr);
void (*write_io_32) (int mapped_io_addr, uint32 value); void (*write_io_32) (int mapped_io_addr, uint32 value);
phys_addr_t (*ram_address) (phys_addr_t physical_address_in_system_memory); phys_addr_t (*ram_address) (phys_addr_t physical_address_in_system_memory);
long (*make_isa_dma_table) ( long (*make_isa_dma_table) (
const void *buffer, /* buffer to make a table for */ const void *buffer, // buffer for making table
long buffer_size, /* buffer size */ long buffer_size, // size of the buffer
ulong num_bits, /* dma transfer size that will be used */ ulong num_bits, // dma transfer size
isa_dma_entry *table, /* -> caller-supplied scatter/gather table */ isa_dma_entry *table, // -> caller-supplied
long num_entries /* max # entries in table */ // scatter/gather table
long num_entries // max # of entries in table
); );
status_t (*start_isa_dma) ( status_t (*start_isa_dma) (
long channel, /* dma channel to use */ long channel, // dma channel to use
void *buf, /* buffer to transfer */ void *buf, // buffer to transfer
long transfer_count, /* # transfers */ long transfer_count, // number of transfers
uchar mode, /* mode flags */ uchar mode, // mode flags
uchar e_mode /* extended mode flags */ uchar e_mode // extended mode flags
); );
long (*start_scattered_isa_dma) ( long (*start_scattered_isa_dma) (
long channel, /* channel # to use */ long channel, // channel number to use
const isa_dma_entry *table, /* physical address of scatter/gather table */ const isa_dma_entry *table, // physical address of
uchar mode, /* mode flags */ // scatter/gather table
uchar emode /* extended mode flags */ uchar mode, // mode flags
uchar emode // extended mode flags
); );
status_t (*lock_isa_dma_channel) (long channel); status_t (*lock_isa_dma_channel) (long channel);
status_t (*unlock_isa_dma_channel) (long channel); status_t (*unlock_isa_dma_channel) (long channel);
} isa_module_info; } isa_module_info;
#define B_ISA_MODULE_NAME "bus_managers/isa/v1"
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif /* _ISA_H */ #endif /* ISA_H */