I8255.h
 1  /** EMULib Emulation Library *********************************/
 2  /**                                                         **/
 3  /**                          I8255.h                        **/
 4  /**                                                         **/
 5  /** This file contains emulation for the i8255 parallel     **/
 6  /** port interface (PPI) chip from Intel. See I8255.h for   **/
 7  /** the actual code.                                        **/
 8  /**                                                         **/
 9  /** Copyright (C) Marat Fayzullin 2001-2005                 **/
10  /**     You are not allowed to distribute this software     **/
11  /**     commercially. Please, notify me, if you make any    **/
12  /**     changes to this file.                               **/
13  /*************************************************************/
14  #ifndef I8255_H
15  #define I8255_H
16  
17  #ifndef BYTE_TYPE_DEFINED
18  #define BYTE_TYPE_DEFINED
19  typedef unsigned char byte;
20  #endif
21  
22  /** I8255 ****************************************************/
23  /** This data structure stores i8255 state and port values. **/
24  /*************************************************************/
25  typedef struct
26  {
27    byte R[4];         /* Registers    */
28    byte Rout[3];      /* Output ports */
29    byte Rin[3];       /* Input ports  */
30  } I8255;
31  
32  /** Reset8255 ************************************************/
33  /** Reset the i8255 chip. Set all data to 0x00. Set all     **/
34  /** ports to "input" mode.                                  **/
35  /*************************************************************/
36  void Reset8255(register I8255 *D);
37  
38  /** Write8255 ************************************************/
39  /** Write value V into i8255 register A. Returns 0 when A   **/
40  /** is out of range, 1 otherwise.                           **/
41  /*************************************************************/
42  byte Write8255(register I8255 *D,register byte A,register byte V);
43  
44  /** Read8255 *************************************************/
45  /** Read value from an i8255 register A. Returns 0 when A   **/
46  /** is out of range.                                        **/
47  /*************************************************************/
48  byte Read8255(register I8255 *D,register byte A);
49  
50  #endif /* I8255_H */