[311dfa6] | 1 | /* |
---|
| 2 | * RTEMS for Nintendo DS platform initialization. |
---|
| 3 | * |
---|
| 4 | * Copyright (c) 2008 by Matthieu Bucchianeri <mbucchia@gmail.com> |
---|
| 5 | * |
---|
| 6 | * The license and distribution terms for this file may be |
---|
| 7 | * found in the file LICENSE in this distribution or at |
---|
| 8 | * |
---|
| 9 | * http://www.rtems.com/license/LICENSE |
---|
| 10 | * |
---|
| 11 | * $Id$ |
---|
| 12 | */ |
---|
| 13 | |
---|
| 14 | #include <bsp.h> |
---|
[d4886a06] | 15 | #include <bsp/bootcard.h> |
---|
[311dfa6] | 16 | #include <nds.h> |
---|
| 17 | |
---|
[391f35c8] | 18 | extern void defaultExceptionHandler (); |
---|
[c193baad] | 19 | extern void BSP_rtems_irq_mngt_init (void); |
---|
[311dfa6] | 20 | /* |
---|
| 21 | * start the platform. |
---|
| 22 | */ |
---|
| 23 | |
---|
[12d853d] | 24 | void bsp_start (void) |
---|
[311dfa6] | 25 | { |
---|
| 26 | /* initialize irq management */ |
---|
| 27 | BSP_rtems_irq_mngt_init (); |
---|
| 28 | |
---|
| 29 | /* setup console mode for lower screen */ |
---|
| 30 | irqEnable (IRQ_VBLANK); |
---|
| 31 | videoSetMode (0); |
---|
| 32 | videoSetModeSub (MODE_0_2D | DISPLAY_BG0_ACTIVE); |
---|
| 33 | vramSetBankC (VRAM_C_SUB_BG); |
---|
| 34 | |
---|
| 35 | SUB_BG0_CR = BG_MAP_BASE (31); |
---|
| 36 | BG_PALETTE_SUB[255] = RGB15 (31, 31, 31); |
---|
| 37 | consoleInitDefault ((u16 *) SCREEN_BASE_BLOCK_SUB (31), |
---|
| 38 | (u16 *) CHAR_BASE_BLOCK_SUB (0), 16); |
---|
| 39 | |
---|
| 40 | /* print status message */ |
---|
| 41 | printk ("[+] kernel console started\n"); |
---|
| 42 | |
---|
| 43 | /* set the cpu mode to system user */ |
---|
| 44 | arm_cpu_mode = 0x1f; |
---|
| 45 | |
---|
| 46 | /* configure clock period */ |
---|
| 47 | Configuration.microseconds_per_tick = 10000; /* us */ |
---|
[391f35c8] | 48 | |
---|
| 49 | defaultExceptionHandler (); |
---|
[311dfa6] | 50 | } |
---|
| 51 | |
---|
| 52 | /* |
---|
| 53 | * reset bss area. |
---|
| 54 | */ |
---|
| 55 | |
---|
[1a1279f] | 56 | extern uint8_t __bss_start; |
---|
| 57 | extern uint8_t __bss_end; |
---|
| 58 | |
---|
[311dfa6] | 59 | void |
---|
| 60 | bss_reset (void) |
---|
| 61 | { |
---|
[d04bf28e] | 62 | |
---|
[311dfa6] | 63 | memset (&__bss_start, 0, (uint32_t) & __bss_end - (uint32_t) & __bss_start); |
---|
| 64 | } |
---|
| 65 | |
---|
| 66 | /* |
---|
| 67 | * A few symbols needed by libnds but not used. |
---|
| 68 | */ |
---|
| 69 | |
---|
| 70 | #include "../include/sys/iosupport.h" |
---|
| 71 | const devoptab_t *devoptab_list[STD_MAX]; |
---|
| 72 | void *punixTime; |
---|