libnile
Loading...
Searching...
No Matches
hardware.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_HARDWARE_H_
24#define NILE_HARDWARE_H_
25
26#include <wonderful.h>
27
28#define NILE_SPI_MODE_WRITE 0x0000
29#define NILE_SPI_MODE_READ 0x0200
30#define NILE_SPI_MODE_EXCH 0x0400
31#define NILE_SPI_MODE_WAIT_READ 0x0600
32#define NILE_SPI_MODE_MASK 0x0600
33#define NILE_SPI_CLOCK_CART 0x0800
34#define NILE_SPI_CLOCK_FAST 0x0000
35#define NILE_SPI_CLOCK_MASK 0x0800
36#define NILE_SPI_DEV_NONE 0x0000
37#define NILE_SPI_DEV_TF 0x1000
38#define NILE_SPI_DEV_FLASH 0x2000
39#define NILE_SPI_DEV_MCU 0x3000
40#define NILE_SPI_DEV_MASK 0x3000
41#define NILE_SPI_BUFFER_IDX 0x4000
42#define NILE_SPI_START 0x8000
43#define NILE_SPI_BUSY 0x8000
44#define NILE_SPI_CFG_MASK (NILE_SPI_BUFFER_IDX | NILE_SPI_DEV_MASK | NILE_SPI_CLOCK_MASK)
45#define IO_NILE_SPI_CNT 0xE0
46
47#define NILE_POW_CLOCK 0x01
48#define NILE_POW_TF 0x02
49#define NILE_POW_IO_NILE 0x04
50#define NILE_POW_IO_2001 0x08
51#define NILE_POW_IO_2003 0x10
52#define NILE_POW_MCU_BOOT0 0x20
53#define NILE_POW_SRAM 0x40
54#define NILE_POW_MCU_RESET 0x80
55#define NILE_POW_UNLOCK 0xDD
56#define IO_NILE_POW_CNT 0xE2
57
58#define NILE_EMU_EEPROM_MASK 0x03
59#define NILE_EMU_EEPROM_128B 0x00
60#define NILE_EMU_EEPROM_1KB 0x01
61#define NILE_EMU_EEPROM_2KB 0x02
62#define NILE_EMU_FLASH_FSM 0x04
63#define NILE_EMU_ROM_BUS_16BIT 0x00
64#define NILE_EMU_ROM_BUS_8BIT 0x08
65#define NILE_EMU_SRAM_32KB 0x10
66#define IO_NILE_EMU_CNT 0xE3
67
68#define NILE_SEG_MASK_RAM_MASK 0xF
69#define NILE_SEG_MASK_RAM_SHIFT 12
70#define NILE_SEG_MASK_ROM_MASK 0x1FF
71#define NILE_SEG_MASK_ROM_SHIFT 0
72#define NILE_SEG_MASK_ROM0_LOCK (1 << 9)
73#define NILE_SEG_MASK_ROM1_LOCK (1 << 10)
74#define NILE_SEG_MASK_RAM_LOCK (1 << 11)
75#define NILE_SEG_MASK_LOCK (7 << 9)
76#define IO_NILE_SEG_MASK 0xE4
77
78#define NILE_SEG_RAM_IPC 14
79#define NILE_SEG_RAM_SPI_TX 15
80#define NILE_SEG_ROM_SPI_RX 510
81#define NILE_SEG_ROM_BOOT 511
82
83#define IO_NILE_WARMBOOT_CNT 0xE6
84#define IO_NILE_BOARD_REVISION 0xE6
85
86#define IO_NILE_IRQ_ENABLE 0xE8
87#define IO_NILE_IRQ_STATUS 0xE9
88#define NILE_IRQ_MCU 0x01
89
90#endif /* NILE_HARDWARE_H_ */