diff options
| author | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-07-07 13:22:53 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi92@disroot.org> | 2025-07-25 14:16:41 +0200 |
| commit | 14f60e4fd65c42f126eaee7e09cb4251c167c6ed (patch) | |
| tree | 313b5e16d7d99cf1518c953e2efe5e5fc920dfbf /src/drv/ps1/bios/include | |
| parent | 48a61c16eaa6dcfc75d00dba302537ce1492db98 (diff) | |
| download | wnix-tty.tar.gz | |
wiptty
Diffstat (limited to 'src/drv/ps1/bios/include')
| -rw-r--r-- | src/drv/ps1/bios/include/drv/ps1/bios.h | 112 |
1 files changed, 112 insertions, 0 deletions
diff --git a/src/drv/ps1/bios/include/drv/ps1/bios.h b/src/drv/ps1/bios/include/drv/ps1/bios.h new file mode 100644 index 0000000..2686f12 --- /dev/null +++ b/src/drv/ps1/bios/include/drv/ps1/bios.h @@ -0,0 +1,112 @@ +/* + * wanix, a Unix-like operating system for WebAssembly applications. + * Copyright (C) 2025 Xavier Del Campo Romero + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <https://www.gnu.org/licenses/>. + */ + +#ifndef PS1_BIOS_H +#define PS1_BIOS_H + +#include <stdint.h> + +enum +{ + CLASS_IRQ0 = (long)0xf0000001, + CLASS_GPU, + CLASS_CDROM, + CLASS_DMA, + CLASS_RTC0 = (long)0xf2000000, + CLASS_RTC1, + CLASS_RTC2, + CLASS_VBLANK, + CLASS_CONTROLLER = (long)0xf0000008, + CLASS_SPU, + CLASS_PIO, + CLASS_SIO +}; + +enum +{ + MODE_EXECUTE = 0x1000, + MODE_READY = 0x2000 +}; + +enum +{ + SPEC_COUNTER_ZERO = 1, + SPEC_INTERRUPTED = 1 << 1, + SPEC_EOF = 1 << 2, + SPEC_FILE_CLOSED = 1 << 3, + SPEC_COMMAND_ACK = 1 << 4, + SPEC_COMMAND_COMPLETE = 1 << 5, + SPEC_DATA_READY = 1 << 6, + SPEC_DATA_END = 1 << 7, + SPEC_TIMEOUT = 1 << 8, + SPEC_UNKNOWN_CMD = 1 << 9, + SPEC_END_READ_BUF = 1 << 10, + SPEC_END_WRITE_BUF = 1 << 11, + SPEC_GENERAL_INTERRUPT = 1 << 12, + SPEC_NEW_DEVICE = 1 << 13, + SPEC_SYSCALL = 1 << 14, + SPEC_ERROR = 1 << 15, + SPEC_WRITE_ERROR, + SPEC_DOMAIN_ERROR = 0x301, + SPEC_RANGE_RNG +}; + +struct CdAsyncSeekL +{ + uint8_t minutes, seconds, frames; +}; + +union SetMode +{ + struct + { + uint8_t cdda :1, autopause :1, report :1, xa_filter :1, ignore :1, + whole_sector :1, xa_adpcm :1, speed :1; + } bits; + + uint8_t mask; +}; + +struct CdAsyncReadSector_mode +{ + union SetMode mode; + union + { + struct + { + uint8_t reads :1, :7; + } bits; + } read; + + uint16_t reserved; +}; + +void EnterCriticalSection(void); +void ExitCriticalSection(void); +int OpenEvent(int class, int spec, int mode, int (*f)(void)); +int EnableEvent(int event); +int DisableEvent(int event); +int CloseEvent(int event); +int TestEvent(int event); +int WaitEvent(int event); +int CdAsyncGetStatus(uint8_t *response); +int CdAsyncReadSector(unsigned count, void *dst, + struct CdAsyncReadSector_mode mode); +int CdAsyncSeekL(const struct CdAsyncSeekL *seekl); + +#endif |
