I8255.h 2.2 KB
Newer Older
1
2
3
4
5
6
7
8
/** EMULib Emulation Library *********************************/
/**                                                         **/
/**                          I8255.h                        **/
/**                                                         **/
/** This file contains emulation for the i8255 parallel     **/
/** port interface (PPI) chip from Intel. See I8255.h for   **/
/** the actual code.                                        **/
/**                                                         **/
9
/** Copyright (C) Marat Fayzullin 2001-2016                 **/
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/**     You are not allowed to distribute this software     **/
/**     commercially. Please, notify me, if you make any    **/
/**     changes to this file.                               **/
/*************************************************************/
#ifndef I8255_H
#define I8255_H
#ifdef __cplusplus
extern "C" {
#endif

#ifndef BYTE_TYPE_DEFINED
#define BYTE_TYPE_DEFINED
typedef unsigned char byte;
#endif

/** I8255 ****************************************************/
/** This data structure stores i8255 state and port values. **/
/*************************************************************/
typedef struct
{
  byte R[4];         /* Registers    */
  byte Rout[3];      /* Output ports */
  byte Rin[3];       /* Input ports  */
} I8255;

/** Reset8255 ************************************************/
/** Reset the i8255 chip. Set all data to 0x00. Set all     **/
/** ports to "input" mode.                                  **/
/*************************************************************/
void Reset8255(I8255 *D);

/** Write8255 ************************************************/
/** Write value V into i8255 register A. Returns 0 when A   **/
/** is out of range, 1 otherwise.                           **/
/*************************************************************/
byte Write8255(I8255 *D,byte A,byte V);

/** Read8255 *************************************************/
/** Read value from an i8255 register A. Returns 0 when A   **/
/** is out of range.                                        **/
/*************************************************************/
byte Read8255(I8255 *D,byte A);

#ifdef __cplusplus
}
#endif
#endif /* I8255_H */