OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [GCC/] [OpenRISC/] [portmacro.h] - Blame information for rev 665

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

Line No. Rev Author Line
1 572 jeremybenn
/*
2
    FreeRTOS V6.1.1 - Copyright (C) 2011 Real Time Engineers Ltd.
3
 
4
    ***************************************************************************
5
    *                                                                         *
6
    * If you are:                                                             *
7
    *                                                                         *
8
    *    + New to FreeRTOS,                                                   *
9
    *    + Wanting to learn FreeRTOS or multitasking in general quickly       *
10
    *    + Looking for basic training,                                        *
11
    *    + Wanting to improve your FreeRTOS skills and productivity           *
12
    *                                                                         *
13
    * then take a look at the FreeRTOS books - available as PDF or paperback  *
14
    *                                                                         *
15
    *        "Using the FreeRTOS Real Time Kernel - a Practical Guide"        *
16
    *                  http://www.FreeRTOS.org/Documentation                  *
17
    *                                                                         *
18
    * A pdf reference manual is also available.  Both are usually delivered   *
19
    * to your inbox within 20 minutes to two hours when purchased between 8am *
20
    * and 8pm GMT (although please allow up to 24 hours in case of            *
21
    * exceptional circumstances).  Thank you for your support!                *
22
    *                                                                         *
23
    ***************************************************************************
24
 
25
    This file is part of the FreeRTOS distribution.
26
 
27
    FreeRTOS is free software; you can redistribute it and/or modify it under
28
    the terms of the GNU General Public License (version 2) as published by the
29
    Free Software Foundation AND MODIFIED BY the FreeRTOS exception.
30
    ***NOTE*** The exception to the GPL is included to allow you to distribute
31
    a combined work that includes FreeRTOS without being obliged to provide the
32
    source code for proprietary components outside of the FreeRTOS kernel.
33
    FreeRTOS is distributed in the hope that it will be useful, but WITHOUT
34
    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
35
    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
36
    more details. You should have received a copy of the GNU General Public
37
    License and the FreeRTOS license exception along with FreeRTOS; if not it
38
    can be viewed here: http://www.freertos.org/a00114.html and also obtained
39
    by writing to Richard Barry, contact details for whom are available on the
40
    FreeRTOS WEB site.
41
 
42
    1 tab == 4 spaces!
43
 
44
    http://www.FreeRTOS.org - Documentation, latest information, license and
45
    contact details.
46
 
47
    http://www.SafeRTOS.com - A version that is certified for use in safety
48
    critical systems.
49
 
50
    http://www.OpenRTOS.com - Commercial support, development, porting,
51
    licensing and training services.
52
*/
53
#ifndef PORTMACRO_H
54
#define PORTMACRO_H
55
 
56
#ifdef __cplusplus
57
extern "C" {
58
#endif
59
 
60
//-----------------------------------------------------------
61
// Port specific definitions
62
//-----------------------------------------------------------
63
// Type definitions.
64
#define portCHAR        char
65
#define portFLOAT       float
66
#define portDOUBLE      double
67
#define portLONG        long
68
#define portSHORT       short
69
#define portSTACK_TYPE  unsigned portLONG
70
#define portBASE_TYPE   long
71
#define portTickType    unsigned portLONG
72
#define portMAX_DELAY   (portTickType)0xffffffff
73
 
74
#if( configUSE_16_BIT_TICKS == 1 )
75
        #effor "configUSE_16_BIT_TICKS must be 0"
76
#endif
77
 
78
/*-----------------------------------------------------------*/
79
#define portSTACK_GROWTH                        -1
80
#define portTICK_RATE_MS                        ( (portTickType) 1000 / configTICK_RATE_HZ )
81
#define portBYTE_ALIGNMENT                      4
82
#define portCRITICAL_NESTING_IN_TCB             1
83
#define portINSTRUCTION_SIZE                    ( ( portSTACK_TYPE ) 4 )
84
#define portNO_CRITICAL_SECTION_NESTING ( ( portSTACK_TYPE ) 0 )
85
 
86 664 filepang
#define portYIELD_FROM_ISR()                    portYIELD()
87 572 jeremybenn
#define portYIELD()             {       \
88 664 filepang
        __asm__ __volatile__ ( "l.nop       " ); \
89 572 jeremybenn
        __asm__ __volatile__ ( "l.sys 0x0FCC" ); \
90
        __asm__ __volatile__ ( "l.nop       " ); \
91
}
92
#define portNOP()               __asm__ __volatile__ ( "l.nop" )
93
 
94
 
95
void vPortDisableInterrupts( void );
96
void vPortEnableInterrupts( void );
97
#define portDISABLE_INTERRUPTS()        vPortDisableInterrupts()
98
#define portENABLE_INTERRUPTS()         vPortEnableInterrupts()
99
 
100
/*-----------------------------------------------------------*/
101 664 filepang
extern void vTaskEnterCritical( void );
102
extern void vTaskExitCritical( void );
103
#define portENTER_CRITICAL()            vTaskEnterCritical()
104
#define portEXIT_CRITICAL()                     vTaskExitCritical()
105 572 jeremybenn
 
106
/* Task function macros as described on the FreeRTOS.org WEB site. */
107
#define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters )
108
#define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters )
109
 
110 665 filepang
#define portRESTORE_CONTEXT()                   \
111
        asm volatile (                              \
112
        "   .global pxCurrentTCB            \n\t"   \
113
        "   # restore stack pointer         \n\t"   \
114
        "   l.movhi     r3, hi(pxCurrentTCB)    \n\t"   \
115
        "   l.ori       r3, r3, lo(pxCurrentTCB)\n\t"   \
116
        "   l.lwz       r3, 0x0(r3)                             \n\t"   \
117
        "   l.lwz       r1, 0x0(r3)                             \n\t"   \
118
        "   # restore context               \n\t"   \
119
        "   l.lwz       r9, 0x00(r1)            \n\t"   \
120
        "   l.lwz       r2, 0x04(r1)            \n\t"   \
121
        "   l.lwz       r6, 0x14(r1)            \n\t"   \
122
        "   l.lwz       r7, 0x18(r1)            \n\t"   \
123
        "   l.lwz       r8, 0x1C(r1)            \n\t"   \
124
        "   l.lwz       r10, 0x20(r1)           \n\t"   \
125
        "   l.lwz       r11, 0x24(r1)           \n\t"   \
126
        "   l.lwz       r12, 0x28(r1)           \n\t"   \
127
        "   l.lwz       r13, 0x2C(r1)           \n\t"   \
128
        "   l.lwz       r14, 0x30(r1)           \n\t"   \
129
        "   l.lwz       r15, 0x34(r1)           \n\t"   \
130
        "   l.lwz       r16, 0x38(r1)           \n\t"   \
131
        "   l.lwz       r17, 0x3C(r1)           \n\t"   \
132
        "   l.lwz       r18, 0x40(r1)           \n\t"   \
133
        "   l.lwz       r19, 0x44(r1)           \n\t"   \
134
        "   l.lwz       r20, 0x48(r1)           \n\t"   \
135
        "   l.lwz       r21, 0x4C(r1)           \n\t"   \
136
        "   l.lwz       r22, 0x50(r1)           \n\t"   \
137
        "   l.lwz       r23, 0x54(r1)           \n\t"   \
138
        "   l.lwz       r24, 0x58(r1)           \n\t"   \
139
        "   l.lwz       r25, 0x5C(r1)           \n\t"   \
140
        "   l.lwz       r26, 0x60(r1)           \n\t"   \
141
        "   l.lwz       r27, 0x64(r1)           \n\t"   \
142
        "   l.lwz       r28, 0x68(r1)           \n\t"   \
143
        "   l.lwz       r29, 0x6C(r1)           \n\t"   \
144
        "   l.lwz       r30, 0x70(r1)           \n\t"   \
145
        "   l.lwz       r31, 0x74(r1)           \n\t"   \
146
        "   # restore SPR_ESR_BASE(0), SPR_EPCR_BASE(0)\n\t"    \
147
        "   l.lwz       r3, 0x78(r1)                \n\t"   \
148
        "   l.lwz       r4, 0x7C(r1)                \n\t"   \
149
        "   l.mtspr     r0, r3, ((0<<11) + 64)  \n\t"   \
150
        "   l.mtspr     r0, r4, ((0<<11) + 32)  \n\t"   \
151
        "   # restore clobber register      \n\t"   \
152
        "   l.lwz       r3, 0x08(r1)            \n\t"   \
153
        "   l.lwz       r4, 0x0C(r1)            \n\t"   \
154
        "   l.lwz       r5, 0x10(r1)            \n\t"   \
155
        "   l.addi      r1, r1, 132                 \n\t"   \
156
        "   l.rfe                           \n\t"   \
157
        "   l.nop                           \n\t"   \
158 572 jeremybenn
        );
159
 
160 664 filepang
#ifdef __cplusplus
161
}
162
#endif
163
 
164 572 jeremybenn
#endif /* PORTMACRO_H */

powered by: WebSVN 2.1.0

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