<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src}""/>\r
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/FreeRTOS_Source/portable/GCC/ARM_CA9}""/>\r
</option>\r
- <option id="xilinx.gnu.compiler.misc.other.591008063" name="Other flags" superClass="xilinx.gnu.compiler.misc.other" value="-c -fmessage-length=0" valueType="string"/>\r
+ <option id="xilinx.gnu.compiler.misc.other.591008063" name="Other flags" superClass="xilinx.gnu.compiler.misc.other" value="-c -fmessage-length=0 -Wextra" valueType="string"/>\r
<inputType id="xilinx.gnu.arm.c.compiler.input.1279195555" name="C source files" superClass="xilinx.gnu.arm.c.compiler.input"/>\r
</tool>\r
<tool id="xilinx.gnu.arm.cxx.toolchain.compiler.debug.309485210" name="ARM g++ compiler" superClass="xilinx.gnu.arm.cxx.toolchain.compiler.debug">\r
<listOptionValue builtIn="false" value="-Wl,--start-group,-lxil,-lgcc,-lc,--end-group"/>\r
</option>\r
<option id="xilinx.gnu.c.linker.option.lscript.609053533" name="Linker Script" superClass="xilinx.gnu.c.linker.option.lscript" value="../src/lscript.ld" valueType="string"/>\r
- <option id="xilinx.gnu.c.link.option.ldflags.1670905029" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
- <option id="xilinx.gnu.c.link.option.other.1460714584" superClass="xilinx.gnu.c.link.option.other" valueType="stringList">\r
+ <option id="xilinx.gnu.c.link.option.ldflags.1670905029" name="Linker Flags" superClass="xilinx.gnu.c.link.option.ldflags" value="" valueType="string"/>\r
+ <option id="xilinx.gnu.c.link.option.other.1460714584" name="Other options (-XLinker [option])" superClass="xilinx.gnu.c.link.option.other" valueType="stringList">\r
<listOptionValue builtIn="false" value="-Map=rtosdemo.map"/>\r
</option>\r
<inputType id="xilinx.gnu.linker.input.1414431390" superClass="xilinx.gnu.linker.input">\r
#define INCLUDE_vTaskDelayUntil 1\r
#define INCLUDE_vTaskDelay 1\r
#define INCLUDE_eTaskGetState 1\r
-#define INCLUDE_xTimerPendFunctionCallFromISR 1\r
+#define INCLUDE_xTimerPendFunctionCall 1\r
\r
/* This demo makes use of one or more example stats formatting functions. These\r
format the raw data provided by the uxTaskGetSystemState() function in to human\r
#include "xscutimer.h"\r
#include "xscugic.h"\r
\r
-#define XSCUTIMER_CLOCK_HZ XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ/2\r
-\r
-static XScuTimer Timer; /* A9 timer counter */\r
+#define XSCUTIMER_CLOCK_HZ ( XPAR_CPU_CORTEXA9_0_CPU_CLK_FREQ_HZ / 2UL )\r
\r
/*\r
* The application must provide a function that configures a peripheral to\r
* create the FreeRTOS tick interrupt, then define configSETUP_TICK_INTERRUPT()\r
* in FreeRTOSConfig.h to call the function. This file contains a function\r
- * that is suitable for use on the Renesas RZ MPU.\r
+ * that is suitable for use on the Zynq SoC.\r
*/\r
void vConfigureTickInterrupt( void )\r
{\r
-static XScuGic InterruptController; /* Interrupt controller instance */\r
-int Status;\r
+static XScuGic xInterruptController; /* Interrupt controller instance */\r
+BaseType_t xStatus;\r
extern void FreeRTOS_Tick_Handler( void );\r
-XScuTimer_Config *ScuConfig;\r
-XScuGic_Config *IntcConfig;\r
-\r
- IntcConfig = XScuGic_LookupConfig(XPAR_SCUGIC_SINGLE_DEVICE_ID);\r
- Status = XScuGic_CfgInitialize(&InterruptController, IntcConfig, IntcConfig->CpuBaseAddress );\r
- configASSERT( Status == XST_SUCCESS );\r
-\r
- /*\r
- * Connect to the interrupt controller\r
- */\r
- Status = XScuGic_Connect(&InterruptController, XPAR_SCUTIMER_INTR, (Xil_ExceptionHandler) FreeRTOS_Tick_Handler, (void *)&Timer);\r
- configASSERT( Status == XST_SUCCESS );\r
-\r
- /*\r
- * Initialize the A9Timer driver.\r
- */\r
- ScuConfig = XScuTimer_LookupConfig(XPAR_SCUTIMER_DEVICE_ID);\r
-\r
- Status = XScuTimer_CfgInitialize(&Timer, ScuConfig, ScuConfig->BaseAddr);\r
-\r
- configASSERT( Status == XST_SUCCESS );\r
-\r
- /*\r
- * Enable Auto reload mode.\r
- */\r
- XScuTimer_EnableAutoReload(&Timer);\r
-\r
- /*\r
- * Load the timer counter register.\r
- */\r
- XScuTimer_LoadTimer(&Timer, XSCUTIMER_CLOCK_HZ / configTICK_RATE_HZ);\r
-\r
- /*\r
- * Start the timer counter and then wait for it\r
- * to timeout a number of times.\r
- */\r
- XScuTimer_Start(&Timer);\r
-\r
- /*\r
- * Enable the interrupt for the Timer in the interrupt controller\r
- */\r
- XScuGic_Enable(&InterruptController, XPAR_SCUTIMER_INTR);\r
-\r
- /*\r
- * Enable the timer interrupts for timer mode.\r
- */\r
- XScuTimer_EnableInterrupt(&Timer);\r
-\r
- /*\r
- * Do NOT enable interrupts in the ARM processor here.\r
- * This happens when the scheduler is started.\r
- */\r
+XScuTimer_Config *pxTimerConfig;\r
+XScuGic_Config *pxGICConfig;\r
+XScuTimer xTimer;\r
+\r
+ /* This function is called with the IRQ interrupt disabled, and the IRQ\r
+ interrupt should be left disabled. It is enabled automatically when the\r
+ scheduler is started. */\r
+\r
+ /* Ensure XScuGic_CfgInitialize() has been called. In this demo it has\r
+ already been called from prvSetupHardware() in main(). */\r
+ pxGICConfig = XScuGic_LookupConfig( XPAR_SCUGIC_SINGLE_DEVICE_ID );\r
+ xStatus = XScuGic_CfgInitialize( &xInterruptController, pxGICConfig, pxGICConfig->CpuBaseAddress );\r
+ configASSERT( xStatus == XST_SUCCESS );\r
+\r
+ /* Install the FreeRTOS tick handler. */\r
+ xStatus = XScuGic_Connect(&xInterruptController, XPAR_SCUTIMER_INTR, (Xil_ExceptionHandler) FreeRTOS_Tick_Handler, (void *)&xTimer);\r
+ configASSERT( xStatus == XST_SUCCESS );\r
+\r
+ /* Initialise the timer. */\r
+ pxTimerConfig = XScuTimer_LookupConfig( XPAR_SCUTIMER_DEVICE_ID );\r
+ xStatus = XScuTimer_CfgInitialize( &xTimer, pxTimerConfig, pxTimerConfig->BaseAddr );\r
+ configASSERT( xStatus == XST_SUCCESS );\r
+\r
+ /* Enable Auto reload mode. */\r
+ XScuTimer_EnableAutoReload( &xTimer );\r
+\r
+ /* Load the timer counter register. */\r
+ XScuTimer_LoadTimer( &xTimer, XSCUTIMER_CLOCK_HZ / configTICK_RATE_HZ );\r
+\r
+ /* Start the timer counter and then wait for it to timeout a number of\r
+ times. */\r
+ XScuTimer_Start( &xTimer );\r
+\r
+ /* Enable the interrupt for the xTimer in the interrupt controller. */\r
+ XScuGic_Enable( &xInterruptController, XPAR_SCUTIMER_INTR );\r
+\r
+ /* Enable the interrupt in the xTimer itself. */\r
+ XScuTimer_EnableInterrupt( &xTimer );\r
}\r
/*-----------------------------------------------------------*/\r
\r
}\r
/*-----------------------------------------------------------*/\r
\r
-extern XScuGic_Config XScuGic_ConfigTable[];\r
-static const XScuGic_Config *CfgPtr = &XScuGic_ConfigTable[ XPAR_SCUGIC_SINGLE_DEVICE_ID ];\r
void vApplicationIRQHandler( uint32_t ulICCIAR )\r
{\r
+extern const XScuGic_Config XScuGic_ConfigTable[];\r
+static const XScuGic_VectorTableEntry *pxVectorTable = XScuGic_ConfigTable[ XPAR_SCUGIC_SINGLE_DEVICE_ID ].HandlerTable;\r
uint32_t ulInterruptID;\r
-XScuGic_VectorTableEntry *TablePtr;\r
-//XScuGic_Config *CfgPtr;\r
-//extern XScuGic_Config XScuGic_ConfigTable[];\r
-\r
-// CfgPtr = &XScuGic_ConfigTable[ XPAR_SCUGIC_SINGLE_DEVICE_ID ];\r
+const XScuGic_VectorTableEntry *pxVectorEntry;\r
\r
/* Re-enable interrupts. */\r
__asm ( "cpsie i" );\r
\r
- /* The ID of the interrupt can be obtained by bitwise anding the ICCIAR value\r
+ /* The ID of the interrupt is obtained by bitwise anding the ICCIAR value\r
with 0x3FF. */\r
ulInterruptID = ulICCIAR & 0x3FFUL;\r
-\r
configASSERT( ulInterruptID < XSCUGIC_MAX_NUM_INTR_INPUTS );\r
- /* Call the function installed in the array of installed handler functions. */\r
- TablePtr = &(CfgPtr->HandlerTable[ ulInterruptID ]);\r
- TablePtr->Handler(TablePtr->CallBackRef);\r
\r
-// intc_func_table[ ulInterruptID ]( 0 );\r
+ /* Call the function installed in the array of installed handler functions. */\r
+ pxVectorEntry = &( pxVectorTable[ ulInterruptID ] );\r
+ pxVectorEntry->Handler( pxVectorEntry->CallBackRef );\r
}\r
\r
\r
/* Demo includes. */\r
#include "partest.h"\r
\r
+/* Xilinx includes. */\r
+#include "xgpiops.h"\r
+\r
+#define partstNUM_LEDS ( 1 )\r
+#define partstDIRECTION_OUTPUT ( 1 )\r
+#define partstOUTPUT_ENABLED ( 1 )\r
+#define partstLED_OUTPUT ( 10 )\r
+\r
+/*-----------------------------------------------------------*/\r
+\r
+static XGpioPs xGpio;\r
+\r
/*-----------------------------------------------------------*/\r
\r
void vParTestInitialise( void )\r
{\r
+XGpioPs_Config *pxConfigPtr;\r
+BaseType_t xStatus;\r
+\r
+ /* Initialise the GPIO driver. */\r
+ pxConfigPtr = XGpioPs_LookupConfig( XPAR_XGPIOPS_0_DEVICE_ID );\r
+ xStatus = XGpioPs_CfgInitialize( &xGpio, pxConfigPtr, pxConfigPtr->BaseAddr );\r
+ configASSERT( xStatus == XST_SUCCESS );\r
+\r
+ /* Enable outputs and set low. */\r
+ XGpioPs_SetDirectionPin( &xGpio, partstLED_OUTPUT, partstDIRECTION_OUTPUT );\r
+ XGpioPs_SetOutputEnablePin( &xGpio, partstLED_OUTPUT, partstOUTPUT_ENABLED );\r
+ XGpioPs_WritePin( &xGpio, partstLED_OUTPUT, 0x0 );\r
}\r
/*-----------------------------------------------------------*/\r
\r
-void vParTestSetLED( unsigned portBASE_TYPE uxLED, signed portBASE_TYPE xValue )\r
+void vParTestSetLED( UBaseType_t uxLED, BaseType_t xValue )\r
{\r
+ ( void ) uxLED;\r
+ XGpioPs_WritePin( &xGpio, partstLED_OUTPUT, xValue );\r
}\r
/*-----------------------------------------------------------*/\r
\r
void vParTestToggleLED( unsigned portBASE_TYPE uxLED )\r
{\r
+BaseType_t xLEDState;\r
+\r
+ ( void ) uxLED;\r
+\r
+ xLEDState = XGpioPs_ReadPin( &xGpio, partstLED_OUTPUT );\r
+ XGpioPs_WritePin( &xGpio, partstLED_OUTPUT, !xLEDState );\r
}\r
\r
\r
void vApplicationStackOverflowHook( xTaskHandle pxTask, char *pcTaskName );
void vApplicationTickHook( void );
-/*
- * Creates and verifies different files on the volume, demonstrating the use of
- * various different API functions.
- */
-extern void vCreateAndVerifySampleFiles( void );
-
/*-----------------------------------------------------------*/
int main( void )
static void prvSetupHardware( void )
{
-int Status;
-XScuGic InterruptController; /* Interrupt controller instance */
-extern void FreeRTOS_IRQ_Handler( void );
-extern void FreeRTOS_SWI_Handler( void );
-
- __asm volatile ( "cpsid i" );
- Xil_ExceptionInit();
-
- XScuGic_Config *IntcConfig; /* The configuration parameters of the
- interrupt controller */
- /*
- * Initialize the interrupt controller driver
- */
- IntcConfig = XScuGic_LookupConfig(XPAR_SCUGIC_SINGLE_DEVICE_ID);
- configASSERT( IntcConfig );
- configASSERT( IntcConfig->CpuBaseAddress == ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ) );
- configASSERT( IntcConfig->DistBaseAddress == configINTERRUPT_CONTROLLER_BASE_ADDRESS );
-
- Status = XScuGic_CfgInitialize(&InterruptController, IntcConfig, IntcConfig->CpuBaseAddress );
- configASSERT( Status == XST_SUCCESS );
-
-// Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_IRQ_INT, (Xil_ExceptionHandler)FreeRTOS_IRQ_Handler, &InterruptController);
-// Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_SWI_INT, (Xil_ExceptionHandler)FreeRTOS_SWI_Handler, &InterruptController);
-
-// Xil_ExceptionEnableMask( XIL_EXCEPTION_ALL );
-// Xil_ExceptionEnable();
-
- /*
- * Connect the interrupt controller interrupt handler to the hardware
- * interrupt handling logic in the ARM processor.
- */
-#if 0
- Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_UNDEFINED_INT,
- (Xil_ExceptionHandler)FreeRTOS_ExHandler,
- (void *)4);
-
- Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_PREFETCH_ABORT_INT,
- (Xil_ExceptionHandler)FreeRTOS_ExHandler,
- (void *)4);
-
- Xil_ExceptionRegisterHandler(XIL_EXCEPTION_ID_DATA_ABORT_INT,
- (Xil_ExceptionHandler)FreeRTOS_ExHandler,
- (void *)8);
-#endif
+BaseType_t xStatus;
+XScuGic_Config *pxGICConfig;
+XScuGic xInterruptController;
+
+ /* Ensure no interrupts execute while the scheduler is in an inconsistent
+ state. Interrupts are automatically enabled when the scheduler is
+ started. */
+ portDISABLE_INTERRUPTS();
+
+ /* Obtain the configuration of the GIC. */
+ pxGICConfig = XScuGic_LookupConfig( XPAR_SCUGIC_SINGLE_DEVICE_ID );
+
+ /* Sanity check the FreeRTOSConfig.h settings are correct for the
+ hardware. */
+ configASSERT( pxGICConfig );
+ configASSERT( pxGICConfig->CpuBaseAddress == ( configINTERRUPT_CONTROLLER_BASE_ADDRESS + configINTERRUPT_CONTROLLER_CPU_INTERFACE_OFFSET ) );
+ configASSERT( pxGICConfig->DistBaseAddress == configINTERRUPT_CONTROLLER_BASE_ADDRESS );
+
+ /* Install a default handler for each GIC interrupt. */
+ xStatus = XScuGic_CfgInitialize( &xInterruptController, pxGICConfig, pxGICConfig->CpuBaseAddress );
+ configASSERT( xStatus == XST_SUCCESS );
+
+ /* Initialise the LED port. */
+ vParTestInitialise();
}
/*-----------------------------------------------------------*/
void main_blinky( void )\r
{\r
/* Create the queue. */\r
- xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( unsigned long ) );\r
+ xQueue = xQueueCreate( mainQUEUE_LENGTH, sizeof( uint32_t ) );\r
\r
if( xQueue != NULL )\r
{\r