libnile
Loading...
Searching...
No Matches
fpga.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2023, 2024 Adrian "asie" Siekierka
3 *
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 *
8 * Permission is granted to anyone to use this software for any purpose,
9 * including commercial applications, and to alter it and redistribute it
10 * freely, subject to the following restrictions:
11 *
12 * 1. The origin of this software must not be misrepresented; you must not
13 * claim that you wrote the original software. If you use this software
14 * in a product, an acknowledgment in the product documentation would be
15 * appreciated but is not required.
16 *
17 * 2. Altered source versions must be plainly marked as such, and must not be
18 * misrepresented as being the original software.
19 *
20 * 3. This notice may not be removed or altered from any source distribution.
21 */
22
23#ifndef NILE_FPGA_H_
24#define NILE_FPGA_H_
25
26#include <wonderful.h>
27#include "hardware.h"
28
29#ifndef __ASSEMBLER__
30#include <stdbool.h>
31#include <stdint.h>
32
40
47
51void nile_bank_lock(void);
52
56static inline void nile_io_unlock(void) {
58}
59
63static inline void nile_irq_enable(uint8_t mask) {
64 outportb(NILE_IRQ_ENABLE_PORT, inportb(NILE_IRQ_ENABLE_PORT) | mask);
65}
66
70static inline void nile_irq_disable(uint8_t mask) {
71 outportb(NILE_IRQ_ENABLE_PORT, inportb(NILE_IRQ_ENABLE_PORT) & ~mask);
72}
73
77static inline void nile_irq_disable_all(void) {
78 outportb(NILE_IRQ_ENABLE_PORT, 0);
79}
80
84static inline void nile_irq_ack(uint8_t mask) {
85 outportb(NILE_IRQ_STATUS_PORT, mask);
86}
87
92static inline void nile_irq_set_enabled(uint8_t mask) {
93 outportb(NILE_IRQ_ENABLE_PORT, mask);
94}
95
102
103#endif /* __ASSEMBLER__ */
104
105#endif /* NILE_FPGA_H_ */
static void nile_irq_enable(uint8_t mask)
Enable the specified FPGA interrupts.
Definition fpga.h:63
static void nile_irq_set_enabled(uint8_t mask)
Set the specified FPGA interrupts as enabled; disable all other interrupts.
Definition fpga.h:92
void nile_soft_reset(void)
Jump back to cartridge IPL0 (soft reset).
void nile_bank_lock(void)
Re-lock RAM/ROM0/ROM1 banks.
static void nile_irq_ack(uint8_t mask)
Acknowledge the specified FPGA interrupts.
Definition fpga.h:84
static void nile_io_unlock(void)
Unlock I/O ports used to control the cartridge FPGA.
Definition fpga.h:56
static void nile_irq_disable(uint8_t mask)
Disable the specified FPGA interrupts.
Definition fpga.h:70
void nile_bank_unlock(void)
Adjust banking registers and unlock RAM/ROM0/ROM1 banks.
static void nile_irq_disable_all(void)
Disable all FPGA interrupts.
Definition fpga.h:77
void nile_bank_clear_mask(void)
Adjust banking registers and clear NILE_SEG_MASK.
#define NILE_POW_UNLOCK
Definition hardware.h:56
#define NILE_IRQ_ENABLE_PORT
Definition hardware.h:96
#define NILE_IRQ_STATUS_PORT
Definition hardware.h:98
#define IO_NILE_POW_CNT
Definition hardware.h:57