@@ -86,8 +86,11 @@ extern "C" {
8686
8787// chip-specific control pins
8888#define RIA816_PIN_CS (40)
89- #define RIA816_PIN_TIMERS_CS (41)
90- #define RIA816_PIN_IRQ (42)
89+ #define RIA816_PIN_IRQ (41)
90+ #define RIA816_PIN_TIMERS_CS (48)
91+ #define RIA816_PIN_RGB_CS (49)
92+ #define RIA816_PIN_BUZZER_CS (50)
93+ #define RIA816_PIN_HID_CS (52)
9194
9295// interrupt sources
9396#define RIA816_INT_CIA_MASK (0x01) // CIA interrupt
@@ -111,9 +114,15 @@ extern "C" {
111114#define RIA816_DB_PINS (0xFF0000ULL)
112115#define RIA816_RW (1ULL << RIA816_PIN_RW)
113116#define RIA816_CS (1ULL << RIA816_PIN_CS)
114- #define RIA816_TIMERS_CS (1ULL << RIA816_PIN_TIMERS_CS)
115- #define RIA816_TIMERS_RS (RIA816_RS4 | RIA816_RS3 | RIA816_RS2 | RIA816_RS1 | RIA816_RS0)
116117#define RIA816_IRQ (1ULL << RIA816_PIN_IRQ)
118+ #define RIA816_TIMERS_CS (1ULL << RIA816_PIN_TIMERS_CS)
119+ #define RIA816_TIMERS_RS (RIA816_RS2 | RIA816_RS1 | RIA816_RS0)
120+ #define RIA816_RGB_CS (1ULL << RIA816_PIN_RGB_CS)
121+ #define RIA816_RGB_RS (RIA816_RS3 | RIA816_RS2 | RIA816_RS1 | RIA816_RS0)
122+ #define RIA816_BUZZER_CS (1ULL << RIA816_PIN_BUZZER_CS)
123+ #define RIA816_BUZZER_RS (RIA816_RS1 | RIA816_RS0)
124+ #define RIA816_HID_CS (1ULL << RIA816_PIN_HID_CS)
125+ #define RIA816_HID_RS (RIA816_RS3 | RIA816_RS2 | RIA816_RS1 | RIA816_RS0)
117126
118127// register indices
119128#define RIA816_MATH_OPERA (0x00) // Operand A for multiplication and division.
@@ -128,9 +137,11 @@ extern "C" {
128137#define RIA816_DMA_COUNT (0x18) // DMA transfers count.
129138#define RIA816_DMA_DMAERR (0x19) // DMA transfer errno.
130139#define RIA816_FS_FDA (0x1A) // File-descriptor A number. (Obtained from open() API call.)
131- #define RIA816_FS_FDARW (0x1B) // Read bytes from the FDA. Write bytes to the FDA .
132- #define RIA816_FS_FDB (0x1C) // File-descriptor B number .
140+ #define RIA816_FS_FDB (0x1B) // File-descriptor B number .
141+ #define RIA816_FS_FDARW (0x1C) // Read bytes from the FDA. Write bytes to the FDA .
133142#define RIA816_FS_FDBRW (0x1D) // Read bytes from the FDB. Write bytes to the FDB.
143+ #define RIA816_FS_FDAST (0x1E) // File-descriptor A status.
144+ #define RIA816_FS_FDBST (0x1F) // File-descriptor B status.
134145#define RIA816_UART_READY (0x20) // Flow control for UART FIFO.
135146#define RIA816_UART_TX_RX (0x21) // Write bytes to the UART. Read bytes from the UART.
136147#define RIA816_HW_RNG (0x22) // Random Number Generator.
@@ -141,7 +152,7 @@ extern "C" {
141152#define RIA816_IRQ_ENABLE (0x2C) // RIA interrupts enable
142153#define RIA816_IRQ_STATUS (0x2D) // Interrupt Controller status
143154#define RIA816_CPU_N_IRQB (0x2E) // 65816 vector.
144- #define RIA816_API_OP (0x30) // Write the API operation id here to begin a kernel call.
155+ #define RIA816_API_OP_RET (0x30) // Write the API operation id here to begin a kernel call.
145156#define RIA816_API_RET_HI (0x31) // High byte of 16 bit return value. Otherwise `0`.
146157#define RIA816_API_STACK (0x32) // 512 bytes for passing call parameters.
147158#define RIA816_API_STATUS (0x33) // Bit 7 high while operation is running. Bit 0 high when ERRNO.
@@ -202,6 +213,10 @@ void ria816_reset(ria816_t* ria816);
202213uint64_t ria816_tick (ria816_t * ria816 , uint64_t pins );
203214
204215uint8_t ria816_uart_status (const ria816_t * c );
216+ uint8_t ria816_reg_read (ria816_t * c , uint8_t addr );
217+ void ria816_reg_write (ria816_t * c , uint8_t addr , uint8_t data );
218+ uint8_t ria816_hid_read (ria816_t * c , uint8_t reg );
219+ void ria816_hid_write (ria816_t * c , uint8_t reg , uint8_t data );
205220
206221#ifdef __cplusplus
207222} // extern "C"
0 commit comments