Skip to content

Commit

Permalink
apply oldPRCR to board_init()
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Apr 9, 2024
1 parent bd67fdf commit 2828a56
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .idea/cmake.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions examples/build_system/make/rules.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@
# ESP32-Sx and RP2040 has its own CMake build system
ifeq (,$(findstring $(FAMILY),espressif rp2040))

# ---------------------------------------
# Compiler Flags
# ---------------------------------------

CFLAGS += $(addprefix -I,$(INC))

# Verbose mode
ifeq ("$(V)","1")
$(info CFLAGS $(CFLAGS) ) $(info )
$(info LDFLAGS $(LDFLAGS)) $(info )
$(info ASFLAGS $(ASFLAGS)) $(info )
endif

# ---------------------------------------
# Rules
# ---------------------------------------
Expand All @@ -39,6 +26,19 @@ vpath %.S . $(TOP)

include ${TOP}/examples/build_system/make/toolchain/arm_$(TOOLCHAIN)_rules.mk

# ---------------------------------------
# Compiler Flags
# ---------------------------------------

CFLAGS += $(addprefix -I,$(INC))

# Verbose mode
ifeq ("$(V)","1")
$(info CFLAGS $(CFLAGS) ) $(info )
$(info LDFLAGS $(LDFLAGS)) $(info )
$(info ASFLAGS $(ASFLAGS)) $(info )
endif


OBJ_DIRS = $(sort $(dir $(OBJ)))
$(OBJ): | $(OBJ_DIRS)
Expand Down
4 changes: 3 additions & 1 deletion hw/bsp/rx/boards/rx65n_target/rx65n_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
Expand Down

0 comments on commit 2828a56

Please sign in to comment.