*/\r
\r
/*-----------------------------------------------------------\r
- * Implementation of functions defined in portable.h for the MicroBlaze port.\r
+ * Implementation of functions defined in portable.h for the PPC405 port.\r
*----------------------------------------------------------*/\r
\r
\r
#include "task.h"\r
\r
/* Library includes. */\r
-#include "xexception_l.h"\r
#include "xtime_l.h"\r
\r
/* Standard includes. */\r
\r
/*-----------------------------------------------------------*/\r
\r
-#define portCRITICAL_INTERRUPT_ENABLE ( 1UL << 14UL )\r
-#define portEXTERNAL_INTERRUPT_ENABLE ( 1UL << 16UL )\r
-#define portMACHINE_CHECK_ENABLE ( 1UL << 19UL )\r
+#define portCRITICAL_INTERRUPT_ENABLE ( 0UL << 17UL )\r
+#define portEXTERNAL_INTERRUPT_ENABLE ( 1UL << 15UL )\r
+#define portMACHINE_CHECK_ENABLE ( 0UL << 12UL )\r
#define portINITIAL_MSR ( portCRITICAL_INTERRUPT_ENABLE | portEXTERNAL_INTERRUPT_ENABLE | portMACHINE_CHECK_ENABLE )\r
\r
-\r
/*\r
*/\r
static void prvSetupTimerInterrupt( void );\r
-extern void vStartFirstTask( void );\r
-/*-----------------------------------------------------------*/\r
-\r
-static void prvTickISR( void );\r
+extern void vPortTickISR( void );\r
extern void vPortYield( void );\r
+extern void vPortStartFirstTask( void );\r
\r
/* \r
* Initialise the stack of a task to look exactly as if a call to \r
pxTopOfStack--;\r
*pxTopOfStack = 0x00000000UL; /* CTR. */\r
pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) vStartFirstTask; /* LR. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) vPortStartFirstTask; /* LR. */\r
pxTopOfStack--;\r
*pxTopOfStack = ( portSTACK_TYPE ) pxCode; /* SRR0. */\r
pxTopOfStack--;\r
*pxTopOfStack = portINITIAL_MSR;/* SRR1. */\r
pxTopOfStack--;\r
- *pxTopOfStack = ( portSTACK_TYPE ) vStartFirstTask;/* Next LR. */\r
+ *pxTopOfStack = ( portSTACK_TYPE ) vPortStartFirstTask;/* Next LR. */\r
pxTopOfStack--;\r
*pxTopOfStack = 0x00000000UL;;/* Backchain. */\r
// pxTopOfStack--;\r
XExc_Init();\r
XExc_mDisableExceptions( XEXC_NON_CRITICAL ) ; \r
\r
-// prvSetupTimerInterrupt();\r
+ prvSetupTimerInterrupt();\r
+\r
XExc_RegisterHandler( XEXC_ID_SYSTEM_CALL, ( XExceptionHandler ) vPortYield, ( void * ) 0 );\r
- XExc_mEnableExceptions( XEXC_NON_CRITICAL ) ;\r
\r
- vStartFirstTask();\r
- \r
+// XExc_mEnableExceptions( XEXC_NON_CRITICAL );\r
+\r
+ vPortStartFirstTask();\r
+\r
/* Should not get here as the tasks are now running! */\r
return pdFALSE;\r
}\r
/*\r
* Hardware initialisation to generate the RTOS tick. \r
*/\r
+static void prvTickISR( void );\r
static void prvSetupTimerInterrupt( void )\r
{\r
const unsigned portLONG ulInterval = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) - 1UL );\r
\r
- XExc_RegisterHandler( XEXC_ID_PIT_INT, ( XExceptionHandler ) prvTickISR, ( void * ) 0 );\r
+ XTime_PITClearInterrupt();\r
+ XTime_FITClearInterrupt();\r
+ XTime_WDTClearInterrupt();\r
+ XTime_WDTDisableInterrupt();\r
+ XTime_FITDisableInterrupt();\r
+\r
+ XExc_RegisterHandler( XEXC_ID_PIT_INT, ( XExceptionHandler ) vPortTickISR, ( void * ) 0 );\r
\r
XTime_PITEnableAutoReload();\r
XTime_PITSetInterval( ulInterval );\r
ulTicks = 0;\r
}\r
XTime_PITClearInterrupt();\r
- \r
- #if configUSE_PREEMPTION == 1\r
- #endif\r
}\r
/*-----------------------------------------------------------*/\r
\r
\r
.extern pxCurrentTCB\r
.extern vTaskSwitchContext\r
+ .extern vTaskIncrementTick\r
\r
- .global vStartFirstTask\r
+ .global vPortStartFirstTask\r
.global vPortYield\r
+ .global vPortTickISR\r
\r
.set portCONTEXT_SIZE, 156\r
.set portR0_OFFSET, 152\r
.endm\r
\r
\r
-vStartFirstTask:\r
+vPortStartFirstTask:\r
\r
int_epilogue\r
rfi\r
\r
-#vStartFirstTask:\r
+#vPortStartFirstTask:\r
# portRESTORE_CONTEXT\r
# rfi\r
\r
portEXIT_SWITCHING_ISR\r
blr\r
\r
- NOP\r
- NOP\r
+vPortTickISR:\r
+\r
+ portENTER_SWITCHING_ISR\r
+ bl vTaskIncrementTick\r
+ #if configUSE_PREEMPTION == 1\r
+ bl vTaskSwitchContext\r
+ #endif\r
+\r
+ # Clear the interrupt\r
+ lis R0, 2048\r
+ mttsr R0\r
+\r
+ portEXIT_SWITCHING_ISR\r
+ blr\r
+\r
+\r
#ifndef PORTMACRO_H\r
#define PORTMACRO_H\r
\r
+#include "xexception_l.h"\r
+\r
#ifdef __cplusplus\r
extern "C" {\r
#endif\r
#endif\r
/*-----------------------------------------------------------*/ \r
\r
+#define portCRITICAL_NESTING_IN_TCB 1\r
+\r
/* Interrupt control macros. */\r
-#define portDISABLE_INTERRUPTS() \r
-#define portENABLE_INTERRUPTS() \r
+#define portDISABLE_INTERRUPTS() XExc_mDisableExceptions( XEXC_NON_CRITICAL );\r
+#define portENABLE_INTERRUPTS() XExc_mEnableExceptions( XEXC_NON_CRITICAL );\r
+\r
/*-----------------------------------------------------------*/\r
\r
/* Critical section macros. */\r
-void vPortEnterCritical( void );\r
-void vPortExitCritical( void );\r
-#define portENTER_CRITICAL() \r
-#define portEXIT_CRITICAL()\r
+void vTaskEnterCritical( void );\r
+void vTaskExitCritical( void );\r
+#define portENTER_CRITICAL() vTaskEnterCritical()\r
+#define portEXIT_CRITICAL() vTaskExitCritical()\r
\r
/*-----------------------------------------------------------*/\r
\r