Browse code

Add source code of the firmware for the IO Board

Pawel Jablonski authored on 05/06/2023 17:01:27
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,44 @@
1
+/*
2
+ * Author: Pawel Jablonski
3
+ * E-mail: pj@xirx.net
4
+ * WWW: xirx.net
5
+ * GIT: git.xirx.net
6
+ *
7
+ * License: You can use this code however you like
8
+ * but leave information about the original author.
9
+ * Code is free for non-commercial and commercial use.
10
+ */
11
+
12
+#ifndef _IO_H
13
+#define _IO_H
14
+
15
+#define IO_FIRE_CLOCK_DELAY 125 //!< Delay between tick of the board clock. It is a 8 Hz clock used for delays and waits.
16
+#define IO_FIRE_PERIPHERIAL_DELAY 10 //!< Delay used to check if a new data is waiting in keyboard or rs232 buffers
17
+
18
+#define IO_IN_DATA_MASK 0x0f //!< Input data mask for the data part of the BUS
19
+#define IO_IN_CONTROL_MASK 0xfff0 //!< Input data mask for the control bits part of the BUS
20
+
21
+#define IO_IN_CLOCK_BIT (1 << 4) //!< Input clock control bit
22
+#define IO_IN_KEYBOARD_READY_BIT (1 << 5) //!< Input "keyboard has data to read" control bit
23
+#define IO_IN_RS232_READY_BIT (1 << 6) //!< Input "RS232 has data to read" control bit
24
+#define IO_IN_OPERATION_COMPLETE_BIT (1 << 7) //!< Input operation completed control bit
25
+
26
+#define IO_OUT_DATA_MASK 0x0f //!< Output data mask for the data part of the BUS
27
+#define IO_OUT_CONTROL_MASK 0xf0 //!< Output data mask for the control bits part of the BUS
28
+
29
+#define IO_OUT_HALF_BIT (1 << 4) //!< Output "half selector of the byte" control bit
30
+#define IO_OUT_MODE_BIT (1 << 5) //!< Output "register selection or data transision mode" control bit
31
+#define IO_OUT_RW_BIT (1 << 6) //!< Output read/write control bit
32
+#define IO_OUT_DATA_READY_BIT (1 << 7) //!< Input "data is ready to read from output" control bit
33
+
34
+#define IO_REG_SELECT_MASK 0x0f //!< Register selection mask
35
+
36
+#define IO_HALF_UP_DATA_MASK 0xf0 //!< Upper half of the byte mask
37
+#define IO_HALF_DATA_OFFSET 4 //!< Upper half of the byte offset
38
+
39
+void ioPreInit(void);
40
+void ioInit(void);
41
+void ioFireClock(void);
42
+void ioFirePeripherial(void);
43
+
44
+#endif