1/* 2 * Copyright 2005, Oscar Lesta. All rights reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5#ifndef _POKE_DRIVER_H_ 6#define _POKE_DRIVER_H_ 7 8#include <Drivers.h> 9#include <ISA.h> 10#include <PCI.h> 11 12 13#define POKE_DEVICE_NAME "poke" 14#define POKE_DEVICE_FULLNAME "/dev/misc/poke" 15#define POKE_SIGNATURE 'wltp' // "We Like To Poke" 16 17 18enum { 19 POKE_PORT_READ = B_DEVICE_OP_CODES_END + 1, 20 POKE_PORT_WRITE, 21 POKE_PORT_INDEXED_READ, 22 POKE_PORT_INDEXED_WRITE, 23 POKE_PCI_READ_CONFIG, 24 POKE_PCI_WRITE_CONFIG, 25 POKE_GET_NTH_PCI_INFO, 26 POKE_GET_PHYSICAL_ADDRESS, 27 POKE_MAP_MEMORY, 28 POKE_UNMAP_MEMORY 29}; 30 31 32typedef struct { 33 uint32 signature; 34 uint8 index; 35 pci_info* info; 36 status_t status; 37} pci_info_args; 38 39 40typedef struct { 41 uint32 signature; 42 uint16 port; 43 uint8 size; // == index for POKE_PORT_INDEXED_* 44 uint32 value; 45} port_io_args; 46 47 48typedef struct { 49 uint32 signature; 50 uint8 bus; 51 uint8 device; 52 uint8 function; 53 uint8 size; 54 uint8 offset; 55 uint32 value; 56} pci_io_args; 57 58 59typedef struct { 60 uint32 signature; 61 area_id area; 62 const char* name; 63 phys_addr_t physical_address; 64 size_t size; 65 uint32 flags; 66 uint32 protection; 67 void* address; 68} mem_map_args; 69 70 71#endif // _POKE_DRIVER_H_ 72