Skip to content

Commit c342c47

Browse files
committed
[fw-isoldr] Fixes for SCIF on NAOMI.
1 parent 886d23a commit c342c47

File tree

1 file changed

+20
-8
lines changed
  • firmware/isoldr/loader/kos/src

1 file changed

+20
-8
lines changed

firmware/isoldr/loader/kos/src/scif.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
Copyright (C)2000,2001,2004 Dan Potter
55
*/
66

7+
#include <kos/regfield.h>
78
#include <dc/scif.h>
89

910
/*
@@ -32,8 +33,15 @@ kernel or for debugging it.
3233
#define SCSPTR2 SCIFREG16(0xffe80020)
3334
#define SCLSR2 SCIFREG16(0xffe80024)
3435

35-
//#define PTR2_RTSIO (1 << 7)
36-
//#define PTR2_RTSDT (1 << 6)
36+
/* Serial port register bits */
37+
#define SPB2DT BIT(0) /* Serial port break data */
38+
#define SPB2IO BIT(1) /* Serial port break IO */
39+
#define SCKDT BIT(2) /* Clock data */
40+
#define SCKIO BIT(3) /* Clock IO */
41+
#define CTSDT BIT(4) /* CTS data */
42+
#define CTSIO BIT(5) /* CTS IO */
43+
#define RTSDT BIT(6) /* RTS data */
44+
#define RTSIO BIT(7) /* RTS IO */
3745

3846
/* Default serial parameters */
3947
//static int serial_baud = 57600;
@@ -70,21 +78,25 @@ int scif_init() {
7078
for (i=0; i<10000; i++)
7179
__asm__("nop");
7280

81+
#ifdef DEV_TYPE_SD
82+
/* Unreset, disable hardware flow control, triggers on 8 bytes */
83+
SCFCR2 = 0x40;
84+
/* RTS can be used as CS for SCI-SPI SD card on NAOMI */
85+
SCSPTR2 = (RTSIO | RTSDT);
86+
#else
7387
/* Unreset, enable hardware flow control, triggers on 8 bytes */
7488
SCFCR2 = 0x48;
75-
89+
7690
/* Disable manual pin control */
7791
SCSPTR2 = 0;
78-
79-
/* Disable SD */
80-
// SCSPTR2 = PTR2_RTSIO | PTR2_RTSDT;
81-
92+
#endif
93+
8294
/* Clear status */
8395
(void)SCFSR2;
8496
SCFSR2 = 0x60;
8597
(void)SCLSR2;
8698
SCLSR2 = 0;
87-
99+
88100
/* Enable transmit/receive */
89101
SCSCR2 = 0x30;
90102

0 commit comments

Comments
 (0)