This commit is contained in:
hathach 2021-11-03 12:24:10 +07:00
parent 28b177484d
commit e16506cb52
3 changed files with 11 additions and 14 deletions

View File

@ -30,10 +30,9 @@
#include "broadcom/interrupts.h"
#include "broadcom/io.h"
#include "broadcom/mmu.h"
//#include "broadcom/caches.h"
#include "broadcom/vcmailbox.h"
uint32_t SystemCoreClock = 700 * 1000 * 1000;
//--------------------------------------------------------------------+
// Forward USB interrupt events to TinyUSB IRQ Handler
//--------------------------------------------------------------------+
@ -49,11 +48,6 @@ void USB_IRQHandler(void)
//--------------------------------------------------------------------+
// Board porting API
//--------------------------------------------------------------------+
void print(const char* str) {
board_uart_write(str, strlen(str));
}
void board_init(void)
{
gpio_initOutputPinWithPullNone(18);
@ -63,13 +57,14 @@ void board_init(void)
gpio_setPinOutputBool(18, true);
gpio_initOutputPinWithPullNone(42);
setup_mmu_flat_map();
// init_caches();
// gpio_initOutputPinWithPullNone(23);
// gpio_initOutputPinWithPullNone(24);
// gpio_initOutputPinWithPullNone(25);
gpio_setPinOutputBool(18, false);
uart_init();
gpio_setPinOutputBool(18, true);
const char* greeting = "hello to gdb2\r\n";
gpio_setPinOutputBool(18, false);
for (size_t i = 0; i < 5; i++) {
// while (true) {
@ -92,7 +87,6 @@ void board_init(void)
}
// uart_writeText("hello from io\n");
// gpio_setPinOutputBool(24, true);
board_uart_write(greeting, strlen(greeting));
// gpio_setPinOutputBool(24, false);
// gpio_setPinOutputBool(25, true);
// print();
@ -110,13 +104,8 @@ void board_init(void)
// }
// while (1) uart_update();
printf("hello %d\r\n", 21);
// Turn on USB peripheral.
print("Turning on USB power\r\n");
vcmailbox_set_power_state(VCMAILBOX_DEVICE_USB_HCD, true);
print("USB power on\r\n");
BP_SetPriority(USB_IRQn, 0x00);
BP_ClearPendingIRQ(USB_IRQn);

View File

@ -6,6 +6,7 @@ include $(TOP)/$(BOARD_PATH)/board.mk
CC = clang
CFLAGS += \
-mcpu=cortex-a72 \
-Wall \
-O0 \
-ffreestanding \
@ -26,6 +27,8 @@ SRC_C += \
$(MCU_DIR)/broadcom/mmu.c \
$(MCU_DIR)/broadcom/vcmailbox.c
# $(MCU_DIR)/broadcom/caches.c \
CROSS_COMPILE = aarch64-none-elf-
SKIP_NANOLIB = 1

View File

@ -32,11 +32,16 @@
#endif
#include "broadcom/interrupts.h"
//#include "broadcom/caches.h"
#define DWC2_REG_BASE 0xFE980000UL
#define DWC2_EP_MAX 8
#define DWC2_EP_FIFO_SIZE 4096
//#define dcache_clean(_addr, _size) data_clean(_addr, _size)
//#define dcache_invalidate(_addr, _size) data_invalidate(_addr, _size)
//#define dcache_clean_invalidate(_addr, _size) data_clean_and_invalidate(_addr, _size)
TU_ATTR_ALWAYS_INLINE
static inline void dwc2_dcd_int_enable(uint8_t rhport)
{