[realtek-ambz2] Implement base C API

This commit is contained in:
Kuba Szczodrzyński
2023-05-23 19:54:00 +02:00
parent 43c9d0db10
commit b073290989
16 changed files with 246 additions and 52 deletions

View File

@@ -27,10 +27,6 @@ lt_cpu_model_t lt_cpu_get_model() {
return CPU_MODEL_ENUM(FAMILY, chipId);
}
uint32_t lt_cpu_get_unique_id() {
return lt_cpu_get_mac_id();
}
uint32_t lt_cpu_get_mac_id() {
uint32_t chipId = 0;
uint8_t *id = (uint8_t *)&chipId;
@@ -61,12 +57,6 @@ uint32_t lt_cpu_get_freq() {
| | | |/ _ \ \ / / |/ __/ _ \
| |__| | __/\ V /| | (_| __/
|_____/ \___| \_/ |_|\___\__*/
void lt_reboot() {
// The Watchdog Way
lt_wdt_enable(1L);
while (1) {}
}
bool lt_reboot_download_mode() {
// mww 0x40000138 0x8
HAL_WRITE32(SYSTEM_CTRL_BASE, REG_SYS_NORESET_FF, 0x08);
@@ -76,11 +66,6 @@ bool lt_reboot_download_mode() {
return true;
}
lt_reboot_reason_t lt_get_reboot_reason() {
// TODO
return REBOOT_REASON_UNKNOWN;
}
void lt_gpio_recover() {
// PA14 and PA15 are apparently unusable with SWD enabled
sys_jtag_off();

View File

@@ -0,0 +1,14 @@
/* Copyright (c) Kuba Szczodrzyński 2023-05-23. */
#pragma once
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
int LOGUART_SetBaud(uint32_t BaudRate); // from fixups/log_uart.c
extern void DumpForOneBytes(void *addr, int cnt); // cnt max 0x70!
#ifdef __cplusplus
} // extern "C"
#endif