home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fish 'n' More 2
/
fishmore-publicdomainlibraryvol.ii1991xetec.iso
/
fish
/
libraries
/
gameport
/
my_include
/
devicetoolkits
/
gameport.h
next >
Wrap
C/C++ Source or Header
|
1991-01-03
|
6KB
|
191 lines
/*
****************************************************************************
GamePort Device ToolKit Subroutines.
Standard Include File.
GamePort.h.
Version 1.1.
Paris E. Bingham Jr.
Copyright © 1986 - 1990 All Rights Reserved.
History:
Version Date Comments
------- -------- -----------------------------------------------
1.0 10/01/89 PEB - Created.
1.1 08/12/90 PEB - Add support for Manx C V5.0.
09/18/90 PEB - Add support for SAS C V5.10.
12/19/90 PEB - Added hardware interface routines.
****************************************************************************
*/
#ifndef DT_GAMEPORT_H
#define DT_GAMEPORT_H
/*
Compiler Definitions
*/
#ifdef SAS
#define ANSI_PROTO 1
#endif
#ifdef MANXV3
#undef ANSI_PROTO
#undef NO_PRAGMAS
#define NO_PRAGMAS 1
#define MANX 1
#endif
#ifdef MANXV5
#define ANSI_PROTO 1
#define MANX 1
#endif
/*
Include Files
*/
#include <exec/types.h>
#include <exec/exec.h>
#include <exec/execbase.h>
#include <devices/gameport.h>
#include <devices/inputevent.h>
#ifdef SAS
#include <proto/exec.h>
#endif
#ifdef MANX
#ifndef NO_PRAGMAS
#include <pragmas.h>
#else
#include <functions.h>
#endif
#endif
/*
Definitions
*/
/*
****************************************************************************
DTGamePort - GamePort Control Structure
****************************************************************************
*/
struct DTGamePort {
ULONG gp_flags; /* Control flags */
ULONG gp_unit; /* Gameport unit */
struct MsgPort *gp_wport; /* Write reply port */
struct IOStdReq *gp_wreq; /* Write request block */
struct MsgPort *gp_rport; /* Read reply port */
struct IOStdReq *gp_rreq; /* Read request block */
LONG gp_error; /* Error on request */
};
/* Flag bits */
#define DTGPB_GOTUNIT 0 /* Got unit */
#define DTGPF_GOTUNIT (1 << DTGPB_GOTUNIT)
#define DTGPB_GOTWPORT 1 /* Got write reply port */
#define DTGPF_GOTWPORT (1 << DTGPB_GOTWPORT)
#define DTGPB_GOTWREQB 2 /* Got write request block */
#define DTGPF_GOTWREQB (1 << DTGPB_GOTWREQB)
#define DTGPB_GOTRPORT 3 /* Got read reply port */
#define DTGPF_GOTRPORT (1 << DTGPB_GOTRPORT)
#define DTGPB_GOTRREQB 4 /* Got read request block */
#define DTGPF_GOTRREQB (1 << DTGPB_GOTRREQB)
#define DTGPB_GOTDEVICE 5 /* Got device */
#define DTGPF_GOTDEVICE (1 << DTGPB_GOTDEVICE)
#define DTGPB_READQUEUED 6 /* Read queued */
#define DTGPF_READQUEUED (1 << DTGPB_READQUEUED)
#define DTGPB_INIT 7 /* All done */
#define DTGPF_INIT (1 << DTGPB_INIT)
#define DTGPB_COPY 8 /* Is copy */
#define DTGPF_COPY (1 << DTGPB_COPY)
/* Typedef for User */
typedef struct DTGamePort *DTGamePort_t;
/*
****************************************************************************
DTGamePortDJoy Bits (Digital Joystick)
****************************************************************************
*/
#define DTGPB_DJUP 0
#define DTGPF_DJUP (1 << DTGPB_DJUP)
#define DTGPB_DJDOWN 1
#define DTGPF_DJDOWN (1 << DTGPB_DJDOWN)
#define DTGPB_DJLEFT 2
#define DTGPF_DJLEFT (1 << DTGPB_DJLEFT)
#define DTGPB_DJRIGHT 3
#define DTGPF_DJRIGHT (1 << DTGPB_DJRIGHT)
#define DTGPB_DJLB 4 /* Left Button */
#define DTGPF_DJLB (1 << DTGPB_DJLB)
#define DTGPB_DJRB 5 /* Right Button */
#define DTGPF_DJRB (1 << DTGPB_DJRB)
#define DTGPB_DJMB 6 /* Middle Button */
#define DTGPF_DJMB (1 << DTGPB_DJMB)
/*
****************************************************************************
Error Codes
****************************************************************************
*/
#define DTGPE_NO_ERROR 0L /* No error */
#define DTGPE_NO_STRUCTURE 1L /* No control structure */
#define DTGPE_NO_WPORT 2L /* Write reply port not alloc. */
#define DTGPE_NO_WREQB 3L /* Write req. not alloc. */
#define DTGPE_NO_RPORT 4L /* Read reply port not alloc. */
#define DTGPE_NO_RREQB 5L /* Read req. not alloc. */
#define DTGPE_NO_DEVICE 6L /* Device not opened */
#define DTGPE_NO_INIT 7L /* Control not initialized */
#define DTGPE_NO_DATA 8L /* No pointer to data */
#define DTGPE_NO_LENGTH 9L /* No data length */
#define DTGPE_ALREADY_QUEUED 10L /* Read already queued */
#define DTGPE_NO_READ 11L /* No read queued */
/*
****************************************************************************
Useful Macros
****************************************************************************
*/
#define DTGamePortFree(g) { DTGamePortDestroy(g); g = NULL; }
#define DTGamePortReadLength(g) ((g)->gp_rreq->io_Actual)
#ifndef DTBuildStdRequest
#define DTBuildStdRequest(r,c,f,o,d,l) \
{ (r)->io_Command = (UWORD) c; \
(r)->io_Flags = (UBYTE) f; \
(r)->io_Offset = (ULONG) o; \
(r)->io_Data = (APTR) d; \
(r)->io_Length = (ULONG) l; }
#endif
/*
****************************************************************************
End of GamePort.h
****************************************************************************
*/
#endif