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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [freertos-6.1.1/] [Source/] [portable/] [IAR/] [RX600/] [port.c] - Blame information for rev 572

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
 
54
/*-----------------------------------------------------------
55
 * Implementation of functions defined in portable.h for the SH2A port.
56
 *----------------------------------------------------------*/
57
 
58
/* Scheduler includes. */
59
#include "FreeRTOS.h"
60
#include "task.h"
61
 
62
/* Library includes. */
63
#include "string.h"
64
 
65
/* Hardware specifics. */
66
#include <iorx62n.h>
67
 
68
/*-----------------------------------------------------------*/
69
 
70
/* Tasks should start with interrupts enabled and in Supervisor mode, therefore
71
PSW is set with U and I set, and PM and IPL clear. */
72
#define portINITIAL_PSW  ( ( portSTACK_TYPE ) 0x00030000 )
73
#define portINITIAL_FPSW        ( ( portSTACK_TYPE ) 0x00000100 )
74
 
75
/*-----------------------------------------------------------*/
76
 
77
/*
78
 * Function to start the first task executing - written in asm code as direct
79
 * access to registers is required.
80
 */
81
extern void prvStartFirstTask( void );
82
 
83
/*
84
 * The tick ISR handler.  The peripheral used is configured by the application
85
 * via a hook/callback function.
86
 */
87
__interrupt void vTickISR( void );
88
 
89
/*-----------------------------------------------------------*/
90
 
91
extern void *pxCurrentTCB;
92
 
93
/*-----------------------------------------------------------*/
94
 
95
/*
96
 * See header file for description.
97
 */
98
portSTACK_TYPE *pxPortInitialiseStack( portSTACK_TYPE *pxTopOfStack, pdTASK_CODE pxCode, void *pvParameters )
99
{
100
        /* R0 is not included as it is the stack pointer. */
101
 
102
        *pxTopOfStack = 0xdeadbeef;
103
        pxTopOfStack--;
104
        *pxTopOfStack = portINITIAL_PSW;
105
        pxTopOfStack--;
106
        *pxTopOfStack = ( portSTACK_TYPE ) pxCode;
107
 
108
        /* When debugging it can be useful if every register is set to a known
109
        value.  Otherwise code space can be saved by just setting the registers
110
        that need to be set. */
111
        #ifdef USE_FULL_REGISTER_INITIALISATION
112
        {
113
                pxTopOfStack--;
114
                *pxTopOfStack = 0xffffffff;     /* r15. */
115
                pxTopOfStack--;
116
                *pxTopOfStack = 0xeeeeeeee;
117
                pxTopOfStack--;
118
                *pxTopOfStack = 0xdddddddd;
119
                pxTopOfStack--;
120
                *pxTopOfStack = 0xcccccccc;
121
                pxTopOfStack--;
122
                *pxTopOfStack = 0xbbbbbbbb;
123
                pxTopOfStack--;
124
                *pxTopOfStack = 0xaaaaaaaa;
125
                pxTopOfStack--;
126
                *pxTopOfStack = 0x99999999;
127
                pxTopOfStack--;
128
                *pxTopOfStack = 0x88888888;
129
                pxTopOfStack--;
130
                *pxTopOfStack = 0x77777777;
131
                pxTopOfStack--;
132
                *pxTopOfStack = 0x66666666;
133
                pxTopOfStack--;
134
                *pxTopOfStack = 0x55555555;
135
                pxTopOfStack--;
136
                *pxTopOfStack = 0x44444444;
137
                pxTopOfStack--;
138
                *pxTopOfStack = 0x33333333;
139
                pxTopOfStack--;
140
                *pxTopOfStack = 0x22222222;
141
                pxTopOfStack--;
142
        }
143
        #else
144
        {
145
                pxTopOfStack -= 15;
146
        }
147
        #endif
148
 
149
        *pxTopOfStack = ( portSTACK_TYPE ) pvParameters; /* R1 */
150
        pxTopOfStack--;
151
        *pxTopOfStack = portINITIAL_FPSW;
152
        pxTopOfStack--;
153
        *pxTopOfStack = 0x12345678; /* Accumulator. */
154
        pxTopOfStack--;
155
        *pxTopOfStack = 0x87654321; /* Accumulator. */
156
 
157
        return pxTopOfStack;
158
}
159
/*-----------------------------------------------------------*/
160
 
161
portBASE_TYPE xPortStartScheduler( void )
162
{
163
extern void vApplicationSetupTimerInterrupt( void );
164
 
165
        /* Use pxCurrentTCB just so it does not get optimised away. */
166
        if( pxCurrentTCB != NULL )
167
        {
168
                /* Call an application function to set up the timer that will generate the
169
                tick interrupt.  This way the application can decide which peripheral to
170
                use.  A demo application is provided to show a suitable example. */
171
                vApplicationSetupTimerInterrupt();
172
 
173
                /* Enable the software interrupt. */
174
                _IEN( _ICU_SWINT ) = 1;
175
 
176
                /* Ensure the software interrupt is clear. */
177
                _IR( _ICU_SWINT ) = 0;
178
 
179
                /* Ensure the software interrupt is set to the kernel priority. */
180
                _IPR( _ICU_SWINT ) = configKERNEL_INTERRUPT_PRIORITY;
181
 
182
                /* Start the first task. */
183
                prvStartFirstTask();
184
        }
185
 
186
        /* Should not get here. */
187
        return pdFAIL;
188
}
189
/*-----------------------------------------------------------*/
190
 
191
#pragma vector = configTICK_VECTOR
192
__interrupt void vTickISR( void )
193
{
194
        /* Re-enable interrupts. */
195
        __enable_interrupt();
196
 
197
        /* Increment the tick, and perform any processing the new tick value
198
        necessitates. */
199
        __set_interrupt_level( configMAX_SYSCALL_INTERRUPT_PRIORITY );
200
        {
201
                vTaskIncrementTick();
202
        }
203
        __set_interrupt_level( configKERNEL_INTERRUPT_PRIORITY );
204
 
205
        /* Only select a new task if the preemptive scheduler is being used. */
206
        #if( configUSE_PREEMPTION == 1 )
207
                taskYIELD();
208
        #endif
209
}
210
/*-----------------------------------------------------------*/
211
 
212
void vPortEndScheduler( void )
213
{
214
        /* Not implemented as there is nothing to return to. */
215
}
216
/*-----------------------------------------------------------*/
217
 
218
 
219
 

powered by: WebSVN 2.1.0

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