|
Nugget
Bare-metal libraries and examples for the original PlayStation
|
#include "common/hardware/hwregs.h"#include "common/hardware/irq.h"#include "common/hardware/sio.h"#include "common/syscalls/syscalls.h"#include "exotic/cester.h"
Macros | |
| #define | PCSX_TESTS 0 |
| #define | CESTER_NO_SIGNAL |
| #define | CESTER_NO_TIME |
| #define | EXIT_SUCCESS 0 |
| #define | EXIT_FAILURE 1 |
Functions | |
| CESTER_BODY (static int s_interruptsWereEnabled;static uint8_t s_reply;static void settle(int n) { for(;n > 0;n--) __asm__ volatile("");} static void padDeselect(void) { SIOS[0].ctrl=0;settle(100);} static void padSelect(void) { SIOS[0].ctrl=SIO_CTRL_DTR;SIOS[0].baudRate=0x88;SIOS[0].mode=0xd;while(SIOS[0].stat &SIO_STAT_RXRDY) {(void) SIOS[0].fifo;} SIOS[0].ctrl|=SIO_CTRL_TXEN;settle(100);} static uint8_t padTransceive(uint8_t out) { SIOS[0].ctrl|=SIO_CTRL_ERRRES;IREG=~IRQ_CONTROLLER;SIOS[0].fifo=out;while(!(SIOS[0].stat &SIO_STAT_RXRDY)) __asm__ volatile("");return SIOS[0].fifo;} static void padFrame(const uint8_t *out) { int i;padSelect();for(i=0;i< 9;i++) s_reply[i]=padTransceive(out[i]);padDeselect();} static void dumpReply(const char *what) { int i;ramsyscall_printf("%s reply:", what);for(i=0;i< 9;i++) ramsyscall_printf(" %02x", s_reply[i]);ramsyscall_printf("\n");}[9]) | |
| padFrame (enterConfig) | |
| dumpReply ("43h enter") | |
| cester_assert_uint_ne (s_reply[1], 0xff) | |
| padFrame (queryOnly) | |
| dumpReply ("4Dh query") | |
| cester_assert_uint_eq (s_reply[1], 0xf3) | |
| cester_assert_uint_eq (s_reply[2], 0x5a) | |
| #define CESTER_NO_SIGNAL |
| #define CESTER_NO_TIME |
| #define EXIT_FAILURE 1 |
| #define EXIT_SUCCESS 0 |
| #define PCSX_TESTS 0 |
| cester_assert_uint_eq | ( | s_reply | [1], |
| 0xf3 | |||
| ) |
| cester_assert_uint_eq | ( | s_reply | [2], |
| 0x5a | |||
| ) |
| cester_assert_uint_ne | ( | s_reply | [1], |
| 0xff | |||
| ) |
| CESTER_BODY | ( | static int s_interruptsWereEnabled;static uint8_t s_reply;static void settle(int n) { for(;n > 0;n--) __asm__ volatile("");} static void padDeselect(void) { SIOS[0].ctrl=0;settle(100);} static void padSelect(void) { SIOS[0].ctrl=SIO_CTRL_DTR;SIOS[0].baudRate=0x88;SIOS[0].mode=0xd;while(SIOS[0].stat &SIO_STAT_RXRDY) {(void) SIOS[0].fifo;} SIOS[0].ctrl|=SIO_CTRL_TXEN;settle(100);} static uint8_t padTransceive(uint8_t out) { SIOS[0].ctrl|=SIO_CTRL_ERRRES;IREG=~IRQ_CONTROLLER;SIOS[0].fifo=out;while(!(SIOS[0].stat &SIO_STAT_RXRDY)) __asm__ volatile("");return SIOS[0].fifo;} static void padFrame(const uint8_t *out) { int i;padSelect();for(i=0;i< 9;i++) s_reply[i]=padTransceive(out[i]);padDeselect();} static void dumpReply(const char *what) { int i;ramsyscall_printf("%s reply:", what);for(i=0;i< 9;i++) ramsyscall_printf(" %02x", s_reply[i]);ramsyscall_printf("\n");} | [9] | ) |
| dumpReply | ( | "43h enter" | ) |
| dumpReply | ( | "4Dh query" | ) |
| padFrame | ( | enterConfig | ) |
| padFrame | ( | queryOnly | ) |