chore: cc

This commit is contained in:
2024-12-09 05:29:40 +06:00
parent 44faaec560
commit cb320a9537
7 changed files with 97 additions and 56 deletions

View File

@@ -5,7 +5,6 @@
extern uint32_t DiagPrintf(const char *fmt, ...)
__attribute__((format(printf, 1, 2)));
extern void DelayMs(uint32_t ms);
#define printf DiagPrintf

View File

@@ -1217,12 +1217,13 @@ typedef struct {
(((uint32_t)(val) << 8) & BKUP_RTC_BACKUP_MASK))
/* rtl8710b_clk.h */
#define CLK_TABLE_ROM 0x00046E68
#define XTAL_TABLE_ROM 0x00046E10
/* Clock source position and mask */
#define CPU_CLK_POS 4
/* Clock freq set macro */
#define SET_CPU_CLOCK(source) \
(SYSTEM_CTRL->CLK_CTRL1 = (SYSTEM_CTRL->CLK_CTRL1 & ~SYS_CLK_CPU_CLK_SEL) | (source))
/* Clock sources - values pre-shifted to position */
#define CPU_CLK_125M (0 << CPU_CLK_POS)
#define CPU_CLK_62_5M (1 << CPU_CLK_POS)
@@ -1231,10 +1232,6 @@ typedef struct {
#define CPU_CLK_XTAL (4 << CPU_CLK_POS)
#define CPU_CLK_ANA_4M (5 << CPU_CLK_POS)
/* Clock control macro */
#define SET_CPU_CLOCK(source) \
(SYSTEM_CTRL->CLK_CTRL1 = (SYSTEM_CTRL->CLK_CTRL1 & ~CPU_CLK_MASK) | (source))
/* NCO32k (NCO1) CLK_INFO Register Bits */
#define NCO1_CLK_INFO_FREQ_MASK 0x00FFFFFF /* Unregulated clock freq */
#define NCO1_CLK_INFO_32K_RDY (1 << 24) /* 32K clock output rdy */

View File

@@ -1,9 +0,0 @@
#ifndef STARTUP_H
#define STARTUP_H
#include <stdint.h>
// from bootloader
extern uint32_t SystemCoreClock;
#endif // STARTUP_H

View File

@@ -0,0 +1,43 @@
#ifndef SYSTEM_RTL8710BX
#define SYSTEM_RTL8710BX
#include <stdint.h>
#ifdef USE_ROM_TABLES
#define CPU_CLK_TABLE 0x00046E68
#define XTAL_TABLE_ROM 0x00046E10
#else
/* CPU clock frequency table (Hz) */
static const uint32_t CPU_CLK_TABLE[] = {
125000000, /* 125 MHz */
62500000, /* 62.5 MHz */
31250000, /* 31.25 MHz */
15625000, /* 15.625 MHz */
7812500, /* 7.8125 MHz */
4000000 /* 4 MHz */
};
/* Crystal oscillator frequency table (Hz) */
static const uint32_t XTAL_TABLE[] = {
40000000, /* 40 MHz */
25000000, /* 25 MHz */
13000000, /* 13 MHz */
19200000, /* 19.2 MHz */
20000000, /* 20 MHz */
26000000, /* 26 MHz */
38400000, /* 38.4 MHz */
17664000, /* 17.664 MHz */
16000000, /* 16 MHz */
14318000, /* 14.318 MHz */
12000000, /* 12 MHz */
};
#endif
/* System Clock Frequency (Core Clock)*/
extern uint32_t SystemCoreClock;
void SystemCoreClockUpdate(void);
void SystemInit(void);
#endif // SYSTEM_RTL8710BX