viernes, 21 de abril de 2017

superpro.h

/* superpro.h
(C) Copyright 1986-1994 Rainbow Technologies, Inc. All rights reserved. */

/**  SuperPro API functions.  **/


#define API_INITIALIZE          0
#define API_FIND_FIRST_UNIT     1
#define API_FIND_NEXT_UNIT      2
#define API_READ                3
#define API_EXTENDED_READ       4
#define API_WRITE               5
#define API_OVERWRITE           6
#define API_DECREMENT           7
#define API_ACTIVATE_ALGORITHM  8
#define API_QUERY               9
#define API_GET_VERSION         11
#define API_GET_EXTENDED_STATUS 12

/**  SuperPro API error codes.  **/

#define SP_SUCCESS                      0
#define SP_INVALID_FUNCTION_CODE        1
#define SP_INVALID_PACKET               2
#define SP_UNIT_NOT_FOUND               3
#define SP_ACCESS_DENIED                4
#define SP_INVALID_MEMORY_ADDRESS       5
#define SP_INVALID_ACCESS_CODE          6
#define SP_PORT_IS_BUSY                 7
#define SP_WRITE_NOT_READY              8
#define SP_NO_PORT_FOUND                9
#define SP_ALREADY_ZERO                 10

#define SP_MAX_STATUS                   10

#define USE_STI_CLI                     0X01
#define USE_PIC_REGS                    0X02
#define USE_WIN_CRITICAL                0X04
#define SPD_USE_LINKED_DRVR             0X20
#define SPD_USE_SYSTEM_DRVR             0X40

#define DEFAULT_INT_METHODS             (USE_PIC_REGS | USE_WIN_CRITICAL | SPD_USE_LINKED_DRVR | SPD_USE_SYSTEM_DRVR)

/*
There are 3 methods of disabling interrupts, each method is represented by a
bit in DEFAULT_INT_METHODS. Any combination of methods may be used, but it
does not make much sense to use the PIC if CLI/STI is being used since
CLI/STI affects all the interrupts in the PIC register. BITS NOT DEFINED
IN DEFAULT_INT_METHODS ARE RESERVED AND SHOULD ALWAYS BE 0.


USE_STI_CLI      => Tells the SuperPro driver to use STI/CLI to disable ALL
   interrupts when using the parallel port.

USE_PIC_REGS     => Tells the SuperPro driver to use the PIC register to
   Disable interrupts. This is done by using DEFAULT_PIC_MASK1
   and DEFAULT_PIC_MASK2, which are defined below).

USE_WIN_CRITICAL => Tells the SuperPro driver to issue a DOS system call
   to start and end critical sections. This is only useful
   under Windows or a Window's DOS box. This has nothing to
   do with interrupts, instead it prevents the code inside
   the critical section from being executed if another
   process is already executing it.
*/

#define DEFAULT_PIC_MASK1               0X81    /* Mask Timer Tick & Printer */
#define DEFAULT_PIC_MASK2               0X00    /* Don't mask any            */

/*
Here are the definitions of the bits in the 2 PIC registers. Setting a bit
to 1 disables the corresponding interrupt and setting a bit to 0 enables the
corresponding interrupt.

      PIC MASK 1                    PIC MASK 2
  HARDWARE INTERRUPTS           HARDWARE INTERRUPTS            BIT IN PIC
  -------------------           -------------------            ----------
  IRQ0    TIMER TICK            IRQ8    REAL TIME CLOCK           0X01
  IRQ1    KEYBOARD              IRQ9    IRQ2 REDIRECT             0X02
  IRQ2    SLAVE CONTROLLER      IRQ10                             0X04
  IRQ3    COM2                  IRQ11                             0X08
  IRQ4    COM1                  IRQ12   IBM MOUSE EVENT           0X10
  IRQ5    FIXED DISK            IRQ13   MATH COPROCESSOR ERROR    0X20
  IRQ6    FLOPPY DISK           IRQ14   HARD DISK                 0X40
  IRQ7    PRINTER               IRQ15                             0X80

*/


/**  Structure of a unit's handle.  **/

typedef struct {
  unsigned short developerID;     /* unit's developer ID                  */
  unsigned short serialNumber;    /* serial number                        */
  unsigned short port;            /* port address used by the key         */
  unsigned char  reserved[18];    /* reserved area (for internal use)     */
} UNITINFO;

typedef struct {
  unsigned char  functionCode;    /* Function code                        */
  unsigned char  intMode;         /* Method for disabling interrupts      */
  unsigned short portAddrs[4];    /* addresses of port LPT1 - LPT4        */
  unsigned char  reserved1[10];   /* reserved for internal use            */
  unsigned short delay5usec;      /* loops to make at least 5 microsecond */
  unsigned short delay100usec;    /* loops to make at least 100 microsecon*/
  UNITINFO       ui;              /* current unit information             */
  /* . . . . . . . . . . command specific variables . . . . . . . . . . . */
  unsigned short writePassword;   /*                                      */
  unsigned short xtraPassword1;   /*                                      */
  unsigned short xtraPassword2;   /*                                      */
  unsigned short memoryAddress;   /*                                      */
  unsigned short memoryContents;  /*                                      */
  unsigned char  status;          /* Status value returned from driver    */
  unsigned char  accessCode;      /*                                      */
  unsigned long  QueryIn;         /*                                      */
  unsigned long  QueryOut;        /*                                      */
  unsigned long  longResult;      /*                                      */
  unsigned short dataLength;      /*                                      */
  unsigned char  InitialPICMask1; /* PIC mask 1 for API_INITIALIZE only   */
  unsigned char  InitialPICMask2; /* PIC mask 2 for API_INITIALIZE only   */
  unsigned char  reserved2[28];   /*                                      */
  unsigned char  reserved3[516];   /*                                      */
} APIPACKET;

/**  SuperPro API function prototype.  **/

#ifdef CPP          /** CPP declaration to avoid name managling **/
  #ifdef __ZORTC__   /** for Zortech C++ users **/
     extern "C" {int _pascal SUPERPRO(APIPACKET *);}
  #else              /** all other C++ users **/
     extern "C" {int far pascal SUPERPRO(APIPACKET far *);}
  #endif
#else
  #ifdef __HIGHC__  /** HIGHC declaration  **/
    #define PASCAL _CC(_DEFAULT_CALLING_CONVENTION |  _CALLEE_POPS_STACK )
    extern int PASCAL SUPERPRO(APIPACKET *);
  #else
    #ifdef __ZORTC__  /** ZORTECH C declaration **/
      int _pascal SUPERPRO(APIPACKET *);
    #else
      #ifdef __WATC__ /** WATCOM C declaration **/
extern int _pascal SUPERPRO(APIPACKET *);
      #else       /** C compilers other than CPP, HIGHC, or ZORTC **/
int far pascal SUPERPRO(APIPACKET far *);
      #endif
    #endif
  #endif
#endif

No hay comentarios:

Publicar un comentario

zen consultora

Blogger Widgets

Entrada destacada

Platzy y el payaso Freddy Vega, PLATZI APESTA, PLATZI NO SIRVE, PLATZI ES UNA ESTAFA

  Platzy y los payasos fredy vega y cvander parte 1,  PLATZI ES UNA ESTAFA Hola amigos, este post va a ir creciendo conforme vaya escribiend...