source: branches/reconfiguration/modules/vci_cc_vcache_wrapper/caba/test/simple_wdt_test/reset.S @ 850

Last change on this file since 850 was 850, checked in by cfuguet, 10 years ago

reconf: introducing a softs directory in the reconfiguration branch

  • This softs directory contains a minimalistic (giet-like) library of drivers and some utility functions.
  • Introducing a simple unit test in the vci_cc_vcache_wrapper component to test the newly introduced watchdog timer mechanism. This unit test uses the minimalistic library.
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
23reset:
24    .set noreorder
25
26    /*
27     * SR register initialization
28     * - Disable interrupts
29     * - Keep the Bootstrap Exception Vector (BEV) bit set
30     */
31    li     k0,  0x00400000
32    mtc0   k0,  CP0_STATUS
33
34    /*
35     * All processors compute:
36     *   cid = (x * Y_SIZE) + y
37     *   pid = (cid * NB_PROCS_MAX) + lpid
38     */
39    mfc0   k0,  CP0_PROCID
40    andi   k0,  k0,  0xFFF             /* k0 <= proc_xyl                 */
41    andi   t1,  k0,  P_MASK            /* t1 <= lpid                     */
42    srl    t2,  k0,  P_WIDTH           /* t2 <= cluster_xy               */
43    srl    t3,  t2,  Y_WIDTH           /* t3 <= x coordinate             */
44    andi   t4,  t2,  Y_MASK            /* t4 <= y coordinate             */
45
46    li     t6,  Y_SIZE                 /* t6 <= Y_SIZE                   */
47    multu  t3,  t6
48    mflo   t5
49    addu   k0,  t5,  t4                /* k0 <= cid                      */
50
51    li     t7,  NB_PROCS_MAX
52    multu  t5,  t7
53    mflo   t0
54    addu   k1,  t0,  t1                /* k1 <= pid                      */
55
56    /* each proc initializes stack pointer (16K per processor) */
57    addi   t0,  k1,  1                 /* t0 <= (pid + 1)                */
58    sll    t0,  t0,  14                /* t0 <= (pid + 1) * 16K          */
59    la     sp,  _stack
60    addu   sp,  sp,  t0                /* sp <= _stack[pid]              */
61
62    /* jumps to main in kernel mode */
63    jal    main
64    nop
65
66    j      exit
67    nop
68
69    .set reorder
70    .end reset
71
72
73
74.org 0x380
75
76reset_exception_handler:
77    mtc2   $0,  MMU_DATA_PADDR_EXT
78    j exception_handler
79
80
81
82    .section .data
83
84/*
85 * Stack segment definition
86 * It contains the stacks of all processors, thus, if each one is using a
87 * 16 Kbytes stack and the segment is 512 Kbytes length then the max number
88 * of processors supported is 32
89 */
90_stack:
91    .space (1<<19)                     /* 512 Kbytes                     */
92
93/*
94 * vim: tabstop=4 : softtabstop=4 : shiftwidth=4 : expandtab
95 */
Note: See TracBrowser for help on using the repository browser.