/*
"isapnp.h"
created by: grayspace aka J. Leveille
for: UbixOS Project
date: May 12, 2002
Purpose: ISA PNP support
$Id$
*/
#ifndef _ISAPNP_H
#define _ISAPNP_H
#include "misc_string_conv.h"
/* structure for holding an ISA-PNP device ID */
typedef struct tagISAPNP_ID
{
WORDg text;
BYTEg a_hex[2];
}
ISAPNP_ID;
/* structure for holding configuration file info about a
particular ISA-PNP device */
typedef struct tagISAPNP_DEV_INFO
{
/* 'class' of device */
BYTEg devclass;
/* device ID */
ISAPNP_ID id;
/* kernal string ID of description */
DWORDg descID;
}
ISAPNP_DEV_INFO;
/* structure for holding device info database
NOTE: should be sorted by 'id' */
typedef struct tagISAPNP_DEV_INFO_DB
{
// pointer to infos
ISAPNP_DEV_INFO * p_infos;
// number of infos
int numinfos;
}
ISAPNP_DEV_INFO_DB;
/* fill a 'ISAPNP_ID' struct from four bytes assumed to be in little endian
format */
#define ISAPNP_ID_FROMBYTES( dst_id, p_bytes )\
(dst_id).text = (WORDg) (((DWORDg) (p_bytes)[1])<<8);\
(dst_id).text |= (WORDg) (p_bytes)[1]
/*
NOTE:
- in 'id.text'
- bits [10,14] are first character - 64
- bits [5,9] are second character - 64
- bits [0,4] are third character - 64
*/
#define ISAPNP_ID_GETSTRING( p_dststr, id )\
(p_dststr)[0] = (((id).text >> 10)&0x1F) + 64;\
(p_dststr)[1] = (((id).text >> 5)&0x1F) + 64;\
(p_dststr)[2] = ((id).text&0x1F) + 64;\
HEX_GETSTRING_BYTE_NONULL( p_dst_str + 3, (id).a_hex[1] );\
HEX_GETSTRING_BYTE( p_dst_str + 5, (id).a_hex[0] )
#define ACCESS_FUNC_PORT "movl %edx, $0x279\n\t"
#define ACCESS_DATA_PORT "movl %edx, $0x2A9\n\t"
#define FUNC_SETREADPORT "movb $0x00, %al\n\toutb %dx, %al\n\t"
#define FUNC_ISOLATION "movb $0x01, %al\n\toutb %dx, %al\n\t"
#define FUNC_CONFIGCONTROL "movb $0x02, %al\n\toutb %dx, %al\n\t"
#define FUNC_WAKEUP "movb $0x03, %al\n\toutb %dx, %al\n\t"
#define FUNC_RESOURCEDATA "movb $0x04, %al\n\toutb %dx, %al\n\t"
#define FUNC_STATUS "movb $0x05, %al\n\toutb %dx, %al\n\t"
#define FUNC_SETCARDNUM "movb $0x06, %al\n\toutb %dx, %al\n\t"
#define FUNC_SETDEVICENUM "movb $0x07, %al\n\toutb %dx, %al\n\t"
#define FUNC_ACTIVATEADDR "movb $0x1E, %al\n\toutb %dx, %al\n\t"
#define FUNC_IORANGECHECK "movb $0x1F, %al\n\toutb %dx, %al\n\t"
#endif // _ISAPNP_H