source: branches/reconfiguration/modules/dspin_router/caba/test/simple_segment_recovery_test/reset.S @ 1016

Last change on this file since 1016 was 1016, checked in by cfuguet, 9 years ago

reconf: dspin_router

  • improve the code readability of the dspin_router model.
  • update the unitary tests of the dspin_router to support the local gateway hardware barrier, and the memory cache scratchpad mode.
File size: 2.3 KB
Line 
1/**
2 * File   : reset.S
3 * Author : Cesar FUGUET <cesar.fuguet-tortolero@lip6.fr>
4 * Date   : 16 October 2014
5 */
6
7#include "hard_config.h"
8#include "cpu_registers.h"
9
10    .section .reset,"ax",@progbits
11
12    .extern seg_stack_base
13    .extern seg_kcode_base
14    .extern main
15
16    .globl  reset
17    .ent    reset
18    .align  2
19
20#define P_MASK ((1<<P_WIDTH)-1)
21#define Y_MASK ((1<<Y_WIDTH)-1)
22
23#define XCU_REG(func, idx) ((((func)<<5)|(idx)) << 2)
24#define XCU_CFG_REG 17
25#define XCU_BARRIER 5
26
27#define MEMC_REG(func,idx) (((func<<7)|idx) << 2)
28#define MEMC_CONFIG 0
29#define MEMC_SCRATCHPAD 4
30
31reset:
32    .set noreorder
33
34    /*
35     * SR register initialization
36     * - Disable interrupts
37     * - Keep the Bootstrap Exception Vector (BEV) bit set
38     */
39    li     k0,  0x00400000
40    mtc0   k0,  CP0_STATUS
41
42    /*
43     * Get processor ID
44     */
45    mfc0   k0,  CP0_PROCID
46    andi   k0,  k0,  0xFFF             /* k0 <= proc_xyl                     */
47
48    /*
49     * Release local gateway hardware barrier
50     */
51    la     k1,     SEG_XCU_BASE        /* k1 <= ICU base address             */
52    li     t0,     XCU_REG(XCU_CFG_REG, XCU_BARRIER)
53    or     k1,     k1,     t0          /* k1 <= &XICU[CFG_REG][BARRIER]      */
54    li     t0,     0xFFFFFFFF
55    sw     t0,     0(k1)
56
57    /*
58     * Disable the scratchpad mode on the local memory cache
59     */
60    la     k1,     SEG_MMC_BASE        /* k1 <= MMC base address             */
61    li     t0,     MEMC_REG(MEMC_CONFIG, MEMC_SCRATCHPAD)
62    or     k1,     k1,     t0          /* k1 <= &MEMC[CONFIG][SCRATCHPAD]    */
63    sw     zero,   0(k1)
64
65    /* Only the processor 0 continues the execution                          */
66    beqz   k0,  1f
67    nop
68    wait
69
701:  /* processor 0 initializes stack pointer (16K) */
71    la     sp,  _stack
72    addiu  sp,  sp,  (1<<14)           /* sp <= _stack + 16K                 */
73
74    /* jumps to main in kernel mode */
75    jal    main
76    nop
77
78    j      exit
79    nop
80
81    .set reorder
82    .end reset
83
84
85
86.org 0x380
87
88reset_exception_handler:
89    mtc2   $0,  MMU_DATA_PADDR_EXT
90    j exception_handler
91
92
93
94    .section .data
95
96/*
97 * Stack segment definition
98 */
99_stack:
100    .space (1<<14)                     /* 16 Kbytes                      */
101
102/*
103 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
104 */
Note: See TracBrowser for help on using the repository browser.