mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-11-05 19:22:31 -05:00
Updating MicroBlaze port - work in progress.
This commit is contained in:
parent
f5b2c790a0
commit
328a8b586f
22 changed files with 12996 additions and 3 deletions
|
|
@ -113,6 +113,9 @@
|
|||
|
||||
/* BSP includes. */
|
||||
#include "xenv_standalone.h"
|
||||
#include "xtmrctr.h"
|
||||
#include "xintc.h"
|
||||
#include "xil_exception.h"
|
||||
|
||||
/* Priorities at which the tasks are created. */
|
||||
#define mainQUEUE_RECEIVE_TASK_PRIORITY ( tskIDLE_PRIORITY + 2 )
|
||||
|
|
@ -166,6 +169,11 @@ static volatile unsigned long ulGPIOState = 0UL;
|
|||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
static XTmrCtr axi_timer_0_Timer;
|
||||
static XIntc intc;
|
||||
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
int main(void)
|
||||
{
|
||||
/* Configure the NVIC, LED outputs and button inputs. */
|
||||
|
|
@ -304,8 +312,39 @@ unsigned long ulReceivedValue;
|
|||
|
||||
static void prvSetupHardware( void )
|
||||
{
|
||||
XCACHE_ENABLE_ICACHE();
|
||||
XCACHE_ENABLE_DCACHE();
|
||||
int iStatus;
|
||||
|
||||
#ifdef MICROBLAZE_EXCEPTIONS_ENABLED
|
||||
microblaze_enable_exceptions();
|
||||
#endif
|
||||
|
||||
iStatus = XIntc_Initialize( &intc, XPAR_MICROBLAZE_0_INTC_AXI_TIMER_0_INTERRUPT_INTR );
|
||||
|
||||
if( iStatus == XST_SUCCESS )
|
||||
{
|
||||
/* Sanity check on the hardware build. */
|
||||
iStatus = XIntc_SelfTest( &intc );
|
||||
}
|
||||
|
||||
if( iStatus == XST_SUCCESS )
|
||||
{
|
||||
/* Initialise the exception table. */
|
||||
Xil_ExceptionInit();
|
||||
|
||||
/* Register the interrupt controller handle that uses the exception
|
||||
table. */
|
||||
Xil_ExceptionRegisterHandler( XIL_EXCEPTION_ID_INT, (Xil_ExceptionHandler)XIntc_DeviceInterruptHandler, NULL );
|
||||
|
||||
/* Start the interrupt controller. Interrupts are enabled when the
|
||||
scheduler starts. */
|
||||
iStatus = XIntc_Start( &intc, XIN_REAL_MODE );
|
||||
|
||||
/* Ensure the compiler does not generate warnings for the unused
|
||||
iStatus valud if configASSERT() is not defined. */
|
||||
( void ) iStatus;
|
||||
}
|
||||
|
||||
configASSERT( ( iStatus == XST_SUCCESS ) )
|
||||
}
|
||||
/*-----------------------------------------------------------*/
|
||||
|
||||
|
|
@ -370,7 +409,38 @@ unsigned long ulGetRunTimeCounterValue( void )
|
|||
|
||||
void vApplicationSetupTimerInterrupt( void )
|
||||
{
|
||||
//_RB_
|
||||
int iStatus;
|
||||
const unsigned char ucTimerCounterNumber = ( unsigned char ) 0U;
|
||||
const unsigned long ulCounterValue = ( ( configCPU_CLOCK_HZ / configTICK_RATE_HZ ) + 1UL );
|
||||
extern void vTickISR( void *pvUnused, unsigned char ucUnused );
|
||||
|
||||
/* Initialise the timer/counter. */
|
||||
iStatus = XTmrCtr_Initialize( &axi_timer_0_Timer, XPAR_AXI_TIMER_0_DEVICE_ID );
|
||||
|
||||
if( iStatus == XST_SUCCESS )
|
||||
{
|
||||
/* Enable the interrupt for the timer counter. Note that interrupts
|
||||
are globally disabled when this function is called. Interrupt
|
||||
processing will not actually start until the first task is executing. */
|
||||
XIntc_Enable( &intc, XPAR_MICROBLAZE_0_INTC_AXI_TIMER_0_INTERRUPT_INTR );
|
||||
|
||||
/* Configure the timer interrupt handler. */
|
||||
XTmrCtr_SetHandler( &axi_timer_0_Timer, ( void * ) vTickISR, NULL );
|
||||
|
||||
/* Set the correct period for the timer. */
|
||||
XTmrCtr_SetResetValue( &axi_timer_0_Timer, ucTimerCounterNumber, ulCounterValue );
|
||||
|
||||
/* Enable the interrupts. Auto-reload mode is used to generate a
|
||||
periodic tick. Note that interrupts are disabled when this function is
|
||||
called, so interrupts will not start to be processed until the first
|
||||
task has started to run. */
|
||||
XTmrCtr_SetOptions( &axi_timer_0_Timer, ucTimerCounterNumber, ( XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION | XTC_DOWN_COUNT_OPTION ) );
|
||||
|
||||
/* Start the timer. */
|
||||
XTmrCtr_Start( &axi_timer_0_Timer, ucTimerCounterNumber );
|
||||
}
|
||||
|
||||
configASSERT( ( iStatus == XST_SUCCESS ) );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue