summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorhathach <[email protected]>2024-04-09 17:05:25 +0700
committerhathach <[email protected]>2024-04-09 17:05:25 +0700
commit2828a56a4f858c6ad72fec3175fec5ff794e2fac (patch)
tree3d8f13af22cdb4a3f9d7a31401ed29842db90b20 /hw
parentbd67fdf01108304061f9dfaf4aa8624bb2a731ef (diff)
apply oldPRCR to board_init()
Diffstat (limited to 'hw')
-rw-r--r--hw/bsp/rx/boards/rx65n_target/rx65n_target.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c
index 032dac810..66a319541 100644
--- a/hw/bsp/rx/boards/rx65n_target/rx65n_target.c
+++ b/hw/bsp/rx/boards/rx65n_target/rx65n_target.c
@@ -249,9 +249,10 @@ void board_init(void)
EN(SCI5, TEI5) = 1;
/* Enable USB0 */
+ unsigned short oldPRCR = SYSTEM.PRCR.WORD;
SYSTEM.PRCR.WORD = SYSTEM_PRCR_PRKEY | SYSTEM_PRCR_PRC1;
MSTP(USB0) = 0;
- SYSTEM.PRCR.WORD = SYSTEM_PRCR_PRKEY;
+ SYSTEM.PRCR.WORD = SYSTEM_PRCR_PRKEY | oldPRCR;
/* setup USBI0 interrupt. */
IR(USB0, USBI0) = 0;
@@ -277,6 +278,7 @@ int board_uart_read(uint8_t* buf, int len)
sci_buf[1].buf = buf;
sci_buf[1].cnt = len;
SCI5.SCR.BYTE |= SCI_SCR_RE | SCI_SCR_RIE;
+ // TODO change to non blocking, return -1 immediately if no data
while (SCI5.SCR.BIT.RE) ;
return len - sci_buf[1].cnt;
}