OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Demo/] [OpenRISC_SIM_GCC/] [arch/] [support.c] - Blame information for rev 609

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 584 jeremybenn
/* Support */
2
#include "spr_defs.h"
3
#include "support.h"
4
#include "int.h"
5
 
6
void int_main();
7
 
8
void ext_except(void) {
9
        int_main();
10
}
11
 
12
/* Start function, called by reset exception handler.  */
13
static char *main_argv[2] = {"NULL", " "};
14
 
15
void _main(void) {
16
        int i = main(2, main_argv);
17
        or32_exit (i);
18
}
19
 
20
/* return value by making a syscall */
21
void or32_exit(int i) {
22
        asm("l.add r3,r0,%0": : "r" (i));
23
        asm("l.nop %0": :"K" (NOP_EXIT));
24
        while (1);
25
}
26
 
27
 
28
/* print long */
29
void report(unsigned long value) {
30
        asm("l.addi\tr3,%0,0": :"r" (value));
31
        asm("l.nop %0": :"K" (NOP_REPORT));
32
}
33
 
34
/* For writing into SPR. */
35
void mtspr(unsigned long spr, unsigned long value) {
36
        asm("l.mtspr\t\t%0,%1,0": : "r" (spr), "r" (value));
37
}
38
 
39
/* For reading SPR. */
40
unsigned long mfspr(unsigned long spr) {
41
        unsigned long value;
42
        asm("l.mfspr\t\t%0,%1,0" : "=r" (value) : "r" (spr));
43
        return value;
44
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.