debug.c (856B)
1 #include <kernel.h> 2 #include <debug.h> 3 4 static u32 *gpio_wk7 = (u32*)0x4A31E058; 5 static u32 *gpio_wk8 = (u32*)0x4A31E05C; 6 7 void 8 set_led_d1(int on) 9 { 10 u32 cur = readl(gpio_wk7) & 0xffff; 11 if (on) 12 cur |= 0x001B0000; 13 else 14 cur |= 0x00030000; 15 writel(cur, gpio_wk7); 16 } 17 18 void 19 set_led_d2(int on) 20 { 21 u32 cur = readl(gpio_wk8) & 0xffff0000; 22 if (on) 23 cur |= 0x001B; 24 else 25 cur |= 0x0003; 26 writel(cur, gpio_wk8); 27 } 28 29 void 30 set_leds(int on) 31 { 32 set_led_d1(on); 33 set_led_d2(on); 34 } 35 36 static void 37 _kstackdump(void *sp) 38 { 39 u32 *stack = sp; 40 int i; 41 42 for (i = 10; i >= 0; i--) { 43 kprintf("%p: %p\n", &stack[i], stack[i]); 44 } 45 } 46 47 __attribute__((__naked__)) 48 void 49 kstackdump(void) 50 { 51 asm volatile ( 52 "mov r0, sp \n\t" 53 "str lr, [sp, #-4]! \n\t" 54 "ldr lr, =1f \n\t" 55 "mov pc, %0 \n\t" 56 "1: \n\t" 57 "ldr pc, [sp], #4 \n\t" 58 : 59 : "r" (_kstackdump) 60 : "r0" 61 ); 62 }