diff options
| author | spicyjpeg <thatspicyjpeg@gmail.com> | 2023-06-20 03:17:34 +0200 |
|---|---|---|
| committer | spicyjpeg <thatspicyjpeg@gmail.com> | 2023-06-20 03:17:34 +0200 |
| commit | eaea5649a0803cc4bfeb6d21ee9f4098d4b493fc (patch) | |
| tree | 786f6edfae0c6affe0d7c7b222cd12f52578ca01 /libpsn00b/psxsio | |
| parent | 7eed71a90bed67e4a987a9db55e15e9403523dca (diff) | |
| download | psn00bsdk-eaea5649a0803cc4bfeb6d21ee9f4098d4b493fc.tar.gz | |
Fix IRQ bugs, PutDispEnv() PAL screen centering
Diffstat (limited to 'libpsn00b/psxsio')
| -rw-r--r-- | libpsn00b/psxsio/sio.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/libpsn00b/psxsio/sio.c b/libpsn00b/psxsio/sio.c index 919f0cb..b487148 100644 --- a/libpsn00b/psxsio/sio.c +++ b/libpsn00b/psxsio/sio.c @@ -74,7 +74,7 @@ static void _sio_handler(void) { SIO_CTRL(1) |= CR_TXIEN; SIO_DATA(1) = _tx_buffer.data[head]; } else { - SIO_CTRL(1) &= CR_TXIEN ^ 0xffff; + SIO_CTRL(1) &= CR_TXIEN ^ 0xffff; } } @@ -88,7 +88,7 @@ static void _sio_handler(void) { /* Serial port initialization API */ void SIO_Init(int baud, uint16_t mode) { - EnterCriticalSection(); + int _exit = EnterCriticalSection(); _old_sio_handler = InterruptCallback(IRQ_SIO1, &_sio_handler); SIO_CTRL(1) = CR_ERRRST; @@ -106,16 +106,18 @@ void SIO_Init(int baud, uint16_t mode) { _flow_control = SIO_FC_NONE; _ctrl_reg_flag = 0; - ExitCriticalSection(); + if (_exit) + ExitCriticalSection(); } void SIO_Quit(void) { - EnterCriticalSection(); - InterruptCallback(IRQ_SIO1, _old_sio_handler); + int _exit = EnterCriticalSection(); + InterruptCallback(IRQ_SIO1, _old_sio_handler); SIO_CTRL(1) = CR_ERRRST; - ExitCriticalSection(); + if (_exit) + ExitCriticalSection(); } void SIO_SetFlowControl(SIO_FlowControl mode) { |
