From d859b69368431b52c9800dc39b3a426adec93d91 Mon Sep 17 00:00:00 2001 From: richardbarry Date: Wed, 5 Mar 2008 12:21:46 +0000 Subject: [PATCH] PPC405 work in progress. git-svn-id: https://svn.code.sf.net/p/freertos/code/trunk@232 1d2547de-c912-0410-9cb9-b8ca96c0e9e2 --- Source/portable/GCC/PPC405/port.c | 30 +++++++++++++++++++++++++- Source/portable/GCC/PPC405/portmacro.h | 4 ++++ 2 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Source/portable/GCC/PPC405/port.c b/Source/portable/GCC/PPC405/port.c index 02aedd2d5..b97444b3c 100644 --- a/Source/portable/GCC/PPC405/port.c +++ b/Source/portable/GCC/PPC405/port.c @@ -71,6 +71,8 @@ extern void vPortTickISR( void ); extern void vPortYield( void ); extern void vPortStartFirstTask( void ); +static XIntc xInterruptController; + /* * Initialise the stack of a task to look exactly as if a call to * portSAVE_CONTEXT had been made. @@ -228,7 +230,7 @@ static unsigned portLONG ulTicks = 0; } /*-----------------------------------------------------------*/ -void vPortISRHandler( void *DeviceId ) +void vPortISRHandler( void *vNullDoNotUse ) { Xuint32 IntrStatus; Xuint32 IntrMask = 1; @@ -278,3 +280,29 @@ XIntc_Config *CfgPtr;// = xInterruptController.CfgPtr; } } } +/*-----------------------------------------------------------*/ + +void vPortSetupInterruptController( void ) +{ +extern void vPortISRWrapper( void ); + + XExc_mDisableExceptions( XEXC_NON_CRITICAL ); + XExc_Init(); + XExc_RegisterHandler( XEXC_ID_NON_CRITICAL_INT, (XExceptionHandler)vPortISRWrapper, NULL ); + XIntc_Initialize( &xInterruptController, XPAR_OPB_INTC_0_DEVICE_ID ); + XIntc_Start( &xInterruptController, XIN_REAL_MODE ); +} +/*-----------------------------------------------------------*/ + +portBASE_TYPE xPortInstallInterruptHandler( unsigned portCHAR ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ) +{ +portBASE_TYPE xReturn = pdFAIL; + + if( XST_SUCCESS == XIntc_Connect( &xInterruptController, ucInterruptID, pxHandler, pvCallBackRef ) ) + { + XIntc_Enable( &xInterruptController, ucInterruptID ); + xReturn = pdPASS; + } + + return xReturn; +} diff --git a/Source/portable/GCC/PPC405/portmacro.h b/Source/portable/GCC/PPC405/portmacro.h index 461eed85f..6ba2c7f08 100644 --- a/Source/portable/GCC/PPC405/portmacro.h +++ b/Source/portable/GCC/PPC405/portmacro.h @@ -110,6 +110,10 @@ void vPortYield( void ); #define portTASK_FUNCTION_PROTO( vFunction, pvParameters ) void vFunction( void *pvParameters ) #define portTASK_FUNCTION( vFunction, pvParameters ) void vFunction( void *pvParameters ) +/* Port specific initialisation function. */ +void vPortSetupInterruptController( void ); +portBASE_TYPE xPortInstallInterruptHandler( unsigned portCHAR ucInterruptID, XInterruptHandler pxHandler, void *pvCallBackRef ); + #ifdef __cplusplus } #endif -- 2.39.5