Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions iop/arcade/acata/src/ata.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include "acata_internal.h"
#include "atahw.h"

static struct ata_softc Atac;

Expand Down Expand Up @@ -187,7 +188,7 @@ int ata_probe(acAtaReg atareg)
int count;

(void)atareg;
while ( (*((volatile acUint16 *)0xB6070000) & 0x80) != 0 )
while ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY) != 0 )
;
*((volatile acUint16 *)0xB6020000) = 4660;
// cppcheck-suppress knownConditionTrueFalse
Expand All @@ -210,7 +211,7 @@ int ata_probe(acAtaReg atareg)
while ( count <= 1999999 )
{
// cppcheck-suppress knownConditionTrueFalse
if ( (*((volatile acUint16 *)0xB6070000) & 0x80) == 0 )
if ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY) == 0 )
break;
++count;
}
Expand Down
21 changes: 11 additions & 10 deletions iop/arcade/acata/src/atacmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

#include "acata_internal.h"
#include "atahw.h"

static int ata_dma_xfer(acDmaT dma, int intr, acDmaOp op);
static void ata_dma_done(acDmaT dma);
Expand Down Expand Up @@ -182,7 +183,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
int a_size;

a_size = atah->a_size;
while ( (*((volatile acUint16 *)0xB6070000) & 0x80) != 0 )
while ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY) != 0 )
;
while ( a_size > 0 )
{
Expand All @@ -198,7 +199,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
a_size -= xlen;
xlen_v15 = (unsigned int)xlen >> 1;
xlen_v16 = xlen_v15 - 1;
while ( (*((volatile acUint16 *)0xB6070000) & 8) != 0 )
while ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_DRQ) != 0 )
{
int ret_v17;

Expand Down Expand Up @@ -226,7 +227,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
else
{
ret_v20 = *((volatile acUint16 *)0xB6070000);
while ( (ret_v20 & 0x80) != 0 )
while ( (ret_v20 & ATA_STAT_BUSY) != 0 )
{
sr = *((volatile acUint16 *)0xB6070000);
ret_v20 = sr & 0xFF;
Expand Down Expand Up @@ -268,7 +269,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
else
{
sr_v25 = *((volatile acUint16 *)0xB6070000);
while ( (sr_v25 & 0x80) != 0 )
while ( (sr_v25 & ATA_STAT_BUSY) != 0 )
{
sr_v25 = *((volatile acUint16 *)0xB6070000);
sr_v25 = sr_v25 & 0xFF;
Expand All @@ -283,9 +284,9 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
xlen_v28 = (unsigned int)xlen_v27 >> 1;
if ( (sr_v25 & 1) != 0 )
xlen_v28 = 0;
(void)(*((volatile acUint16 *)0xB6070000) & 0x80);
(void)(*((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY);
xlen_v30 = xlen_v28 - 1;
while ( (*((volatile acUint16 *)0xB6070000) & 8) != 0 )
while ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_DRQ) != 0 )
{
if ( xlen_v30 >= 0 )
{
Expand All @@ -294,7 +295,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
}
--xlen_v30;
}
ret_v29 = *((volatile acUint16 *)0xB6070000) & 0x80;
ret_v29 = *((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY;
if ( !ret_v29 )
break;
}
Expand Down Expand Up @@ -346,7 +347,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
ret = 0;
if ( v16 )
{
while ( (*((volatile acUint16 *)0xB6160000) & 0x81) == 128 )
while ( (*((volatile acUint16 *)0xB6160000) & (ATA_STAT_BUSY|ATA_STAT_ERR)) == ATA_STAT_BUSY )
{
if ( SleepThread() )
{
Expand All @@ -360,7 +361,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
int tmout;

tmout = 99999;
while ( (*((volatile acUint16 *)0xB6070000) & 0x81) == 128 )
while ( (*((volatile acUint16 *)0xB6070000) & (ATA_STAT_BUSY|ATA_STAT_ERR)) == ATA_STAT_BUSY )
{
if ( tmout < 0 )
{
Expand All @@ -380,7 +381,7 @@ static int ata_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
return ret;
}
sr_v34 = *((volatile acUint16 *)0xB6070000);
if ( (*((volatile acUint16 *)0xB6070000) & 1) != 0 )
if ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_ERR) != 0 )
return -((sr_v34 << 8) + *((volatile acUint16 *)0xB6010000));
if ( atah->a_state < 0x1FFu )
{
Expand Down
28 changes: 15 additions & 13 deletions iop/arcade/acata/src/atapicmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

#include "acata_internal.h"

#include "atahw.h"

static int atapi_dma_xfer(acDmaT dma, int intr, acDmaOp op);
static void atapi_dma_done(acDmaT dma);
static void atapi_dma_error(acDmaT dma, int intr, acDmaState state, int result);
Expand Down Expand Up @@ -84,11 +86,11 @@ static int atapi_packet_send(acAtaReg atareg, acAtapiPacketData *pkt, int flag)
*((volatile acUint16 *)0xB6060000) = flag & 0x10;
*((volatile acUint16 *)0xB6160000) = (flag & 2) ^ 2;
*((volatile acUint16 *)0xB6010000) = flag & 1;
*((volatile acUint16 *)0xB6070000) = 160;
*((volatile acUint16 *)0xB6070000) = 160; // ATA_STAT_BUSY|ATA_STAT_READY?
tmout = 999;
v6 = 1000;
// cppcheck-suppress knownConditionTrueFalse
while ( (*((volatile acUint16 *)0xB6070000) & 0x80) != 0 )
while ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY) != 0 )
{
if ( tmout < 0 )
{
Expand All @@ -105,7 +107,7 @@ static int atapi_packet_send(acAtaReg atareg, acAtapiPacketData *pkt, int flag)
return -116;
}
// cppcheck-suppress knownConditionTrueFalse
while ( (*((volatile acUint16 *)0xB6070000) & 8) != 0 )
while ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_DRQ) != 0 )
{
--count;
if ( count < 0 )
Expand Down Expand Up @@ -139,7 +141,7 @@ static int atapi_pio_read(acAtaReg atareg, acUint16 *buf, int count, int flag)
if ( !sr )
{
sr_v5 = *((volatile acUint16 *)0xB6070000);
while ( (sr_v5 & 0x80) != 0 )
while ( (sr_v5 & ATA_STAT_BUSY) != 0 )
{
xlen = *((volatile acUint16 *)0xB6070000);
sr_v5 = xlen & 0xFF;
Expand Down Expand Up @@ -178,7 +180,7 @@ static int atapi_pio_read(acAtaReg atareg, acUint16 *buf, int count, int flag)
for ( drop_v10 = sr_v9 / 2 - 1; drop_v10 >= 0; --drop_v10 )
;
sr = v6 & 2;
if ( (*((volatile acUint16 *)0xB6070000) & 0x80) == 0 )
if ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY) == 0 )
{
break;
}
Expand Down Expand Up @@ -326,7 +328,7 @@ static int atapi_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
else
{
sr_v14 = *((volatile acUint16 *)0xB6070000);
while ( (sr_v14 & 0x80) != 0 )
while ( (sr_v14 & ATA_STAT_BUSY) != 0 )
{
xlen = *((volatile acUint16 *)0xB6070000);
sr_v14 = xlen & 0xFF;
Expand Down Expand Up @@ -357,7 +359,7 @@ static int atapi_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
for ( drop_v20 = sr_v18 / 2 - 1; drop_v20 >= 0; --drop_v20 )
*((volatile acUint16 *)0xB6000000) = 0;
sr = flag & 2;
if ( (*((volatile acUint16 *)0xB6070000) & 0x80) == 0 )
if ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_BUSY) == 0 )
{
ret_v5 = size - a_size;
break;
Expand Down Expand Up @@ -388,7 +390,7 @@ static int atapi_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
v32 = 0;
if ( (flag & 2) != 0 )
{
while ( (*((volatile acUint16 *)0xB6160000) & 0x81) == 128 )
while ( (*((volatile acUint16 *)0xB6160000) & (ATA_STAT_BUSY|ATA_STAT_ERR)) == ATA_STAT_BUSY )
{
if ( SleepThread() )
{
Expand All @@ -402,7 +404,7 @@ static int atapi_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
int tmout;

tmout = 99999;
while ( (*((volatile acUint16 *)0xB6070000) & 0x81) == 128 )
while ( (*((volatile acUint16 *)0xB6070000) & (ATA_STAT_BUSY|ATA_STAT_ERR)) == ATA_STAT_BUSY )
{
if ( tmout < 0 )
{
Expand Down Expand Up @@ -460,7 +462,7 @@ static int atapi_ops_command(struct ac_ata_h *atah, int cmdpri, int pri)
}
if ( ret_v5 < 0 )
return ret_v5;
if ( (*((volatile acUint16 *)0xB6070000) & 1) != 0 )
if ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_ERR) != 0 )
return -((*((volatile acUint16 *)0xB6070000) << 8) + *((volatile acUint16 *)0xB6010000));
if ( atah->a_state >= 0x1FFu )
{
Expand Down Expand Up @@ -503,7 +505,7 @@ static int atapi_ops_error(struct ac_ata_h *atah, int ret)
acAtapiT atapi;

atapi = (acAtapiT)atah;
if ( (*((volatile acUint16 *)0xB6070000) & 1) == 0 )
if ( (*((volatile acUint16 *)0xB6070000) & ATA_STAT_ERR) == 0 )
return ret;
memset(&sense, 0, sizeof(sense));
memset(&u, 0, sizeof(u));
Expand Down Expand Up @@ -532,7 +534,7 @@ static int atapi_ops_error(struct ac_ata_h *atah, int ret)
v6 = 0;
if ( (flag & 2) != 0 )
{
while ( (*((volatile acUint16 *)0xB6160000) & 0x81) == 128 )
while ( (*((volatile acUint16 *)0xB6160000) & 0x81) == ATA_STAT_BUSY )
{
if ( SleepThread() )
{
Expand All @@ -546,7 +548,7 @@ static int atapi_ops_error(struct ac_ata_h *atah, int ret)
int tmout;

tmout = 99999;
while ( (*((volatile acUint16 *)0xB6070000) & 0x81) == 128 )
while ( (*((volatile acUint16 *)0xB6070000) & 0x81) == ATA_STAT_BUSY )
{
if ( tmout < 0 )
{
Expand Down
5 changes: 3 additions & 2 deletions iop/arcade/accdvd/src/acd.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# Review ps2sdk README & LICENSE files for further details.
*/

#include <atahw.h>
#include "accdvd_internal.h"

static struct acd_softc Acdc;
Expand Down Expand Up @@ -739,7 +740,7 @@ int acd_getstatus()
{
acAtaCommandData v1[4];

v1[1] = 2021;
v1[1] = ATA_C_CHECK_POWER_MODE | 0x700;
v1[0] = (Acdc.drive & 0xFF) | 0x2600;
return acd_ata_request(Acdc.drive | 2, v1, 2, acd_getstatus_done, "getstatus");
}
Expand Down Expand Up @@ -833,7 +834,7 @@ static int acd_identify(int drive)

flag = 16 * (drive != 0);
cmd[0] = flag | 0x600;
cmd[1] = 1953;
cmd[1] = ATA_C_IDENTIFY_PACKET_DEVICE | 0x700;
acAtaSetup(&acdata.a_ata, acd_ata_done, 0, 0x4C4B40u);
// cppcheck-suppress unreadVariable
acdata.a_thid = GetThreadId();
Expand Down
2 changes: 1 addition & 1 deletion iop/arcade/accore/src/intr.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "accore_internal.h"

static acUint8 masks_8[3] = {128u, 2u, 64u};
static struct intr_softc Intrc;
static struct intr_softc Intrc ={0,1};

static int intr_intr(void *arg)
{
Expand Down
Loading