LittleKernel学习笔记(4)

platform_early_init的分析了

 1 void platform_early_init(void) {
 2     uart_init_early();
 3 
 4     printf("stat 0x%x\n", *REG32(0xffd05000));
 5 
 6     /* initialize the interrupt controller */
 7     arm_gic_init();
 8 
 9     /* initialize the timer block */
10     arm_cortex_a9_timer_init(CPUPRIV_BASE, TIMER_CLOCK_FREQ);
11 
12     pmm_add_arena(&sdram_arena);
13 
14     /* start the secondary cpu */
15     *REG32(0xffd05010) = 0;
16 }

 


#define UARTREG(base, reg) (*REG32((base) + (reg)))

1 void uart_init_early(void) {
2 #if 0
3     UARTREG(uart_to_ptr(0), UART_CR) = (1<<4); // txen
4     UARTREG(uart_to_ptr(1), UART_CR) = (1<<4); // txen
5 #endif
6 }

 

其实根本没走

#define GICREG(gic, reg) (*REG32(GICBASE(gic) + (reg)))

1 static void arm_gic_init_percpu(uint level) {
2 #if WITH_LIB_SM
3 GICREG(0, GICC_CTLR) = 0xb; // enable GIC0 and select fiq mode for secure
4 GICREG(0, GICD_IGROUPR(0)) = ~0U; /* GICD_IGROUPR0 is banked */
5 #else
6 GICREG(0, GICC_CTLR) = 1; // enable GIC0
7 #endif
8 GICREG(0, GICC_PMR) = 0xFF; // unmask interrupts at all priority levels
9 }

转了一圈GICBASE(gic)是0xfffec000

posted @ 2021-08-31 14:51  zhougong12  阅读(167)  评论(0)    收藏  举报