Example #1
0
/**
* Disable Exceptions.
*
* @param    None.
*
* @return   None.
*
* @note     None.
*
******************************************************************************/
void Xil_ExceptionDisable(void)
{
#ifdef MICROBLAZE_EXCEPTIONS_ENABLED
	microblaze_disable_exceptions();
#endif
	microblaze_disable_interrupts();
}
Example #2
0
int main(void)
{
	microblaze_disable_interrupts();

	#if defined( XPAR_MICROBLAZE_USE_ICACHE ) && ( XPAR_MICROBLAZE_USE_ICACHE != 0 )
	{
		Xil_ICacheInvalidate();
		Xil_ICacheEnable();
	}
	#endif

	#if defined( XPAR_MICROBLAZE_USE_DCACHE ) && ( XPAR_MICROBLAZE_USE_DCACHE != 0 )
	{
		Xil_DCacheInvalidate();
		Xil_DCacheEnable();
	}
	#endif

	// Before a queue is used it must be explicitly created. The queue is
	// created to hold a maximum of 5 character pointers.
	xPrintQueue = xQueueCreate(5, sizeof(char*));

	// The tasks are going to use a pseudo random delay, seed the random number
	// generator.
	srand(567);

	// Check the queue was created successfully.
	if (xPrintQueue != NULL)
	{
		// Create two instances of the tasks that send messages to the gatekeeper.
		// The index to the string the task uses is passed to the task via the
		// task parameter (the 4th parameter to xTaskCreate()). The tasks are
		// created at different priorities so the higher priority task will
		// occasionally preempt the lower priority task.
		xTaskCreate(prvPrintTask, "Print1", configMINIMAL_STACK_SIZE, (void*)0,
			tskIDLE_PRIORITY+1, NULL);
		xTaskCreate(prvPrintTask, "Print2", configMINIMAL_STACK_SIZE, (void*)1,
			tskIDLE_PRIORITY+2, NULL);

		// Create the gatekeeper task. This is the only task that is permitted
		// to directly access standard out.
		xTaskCreate(prvStdioGatekeeperTask, "Gatekeeper", configMINIMAL_STACK_SIZE,
			NULL, tskIDLE_PRIORITY, NULL);

		// Start the scheduler so the created tasks start executing.
		vTaskStartScheduler();
	}

	// If all is well then main() will never reach here as the scheduler will
	// now be running the tasks. If main() does reach here then it is likely
	// that there was insufficient heap memory available for the idle task
	// to be created. Chapter 5 provides more information on memory management.
	for (;;);

	return 0;
}
Example #3
0
int main(void)
{
    microblaze_disable_interrupts();

    #if defined( XPAR_MICROBLAZE_USE_ICACHE ) && ( XPAR_MICROBLAZE_USE_ICACHE != 0 )
    {
        Xil_ICacheInvalidate();
        Xil_ICacheEnable();
    }
    #endif

    #if defined( XPAR_MICROBLAZE_USE_DCACHE ) && ( XPAR_MICROBLAZE_USE_DCACHE != 0 )
    {
        Xil_DCacheInvalidate();
        Xil_DCacheEnable();
    }
    #endif

	// The queue is created to hold a maximum of 3 structures of type xData.
	xQueue = xQueueCreate(3, sizeof(xData));

	if (xQueue != NULL)
	{
		// Create two instances of the task that will write to the queue. The
		// parameter is used to pass the structure that the task will write to
		// the queue, so one task will continuously send xStructsToSend[0] to
		// the queue while the other task will continuously send xStructsSend[1].
		// Both tasks are created at priority 2 which is above the priority of
		// the receiver.
		xTaskCreate(vSenderTask, "Sender1", configMINIMAL_STACK_SIZE,
			(void*)&xStructsToSend[0], tskIDLE_PRIORITY+2, NULL);
		xTaskCreate(vSenderTask, "Sender2", configMINIMAL_STACK_SIZE,
			(void*)&xStructsToSend[1], tskIDLE_PRIORITY+2, NULL);

		// Create the task that will read from the queue. The task is created
		// with priority 1, so below the priority of the sender tasks.
		xTaskCreate(vReceiverTask, "Receiver", configMINIMAL_STACK_SIZE,
			NULL, tskIDLE_PRIORITY+1, NULL);

		// Start the scheduler so the created tasks start executing.
		vTaskStartScheduler();
	}
	else
	{
		// The queue could not be created.
	}

	// If all is well then main() will never reach here as the scheduler will
	// now be running the tasks. If main() does reach here then it is likely
	// that there was insufficient heap memory available for the idle task to
	// be created. Chapter 5 provides more information on memory management.
	for (;;);

	return 0;
}
Example #4
0
void system_end(void)
{
	clear_screen();
	XTft_DisableDisplay(&g_tft);
	XIntc_MasterDisable(XPAR_INTC_0_BASEADDR);
	system_disable_caches();
	microblaze_disable_interrupts();
	system_stop_network();
	sound_stop();
	htmlParserCleanup();
}
Example #5
0
int main()
{
	RESULT * rs;
	int * iptr1, * iptr2;
	int i, j;
	int len1, len2;

    init_platform();

    print("\n\r************"); xil_printf("%s %s", __DATE__, __TIME__); print("************\n\r");

    microblaze_disable_interrupts();

    len1 = 0;
    len2 = 0;
    len1 = len1 / 4 + 1;
    len2 = len2 / 4 + 1;

    iptr1 = (int *)DDR2;
    iptr2 = iptr1 + len1 + 10;
    iptr3 = iptr2 + len2 + 10;
    tmp = 0;
    items = 0;
    running = 1;

    i = j = 0;
    while(i<len1 || j<len2)
    {
    	if(i < len1) { putfsl_interruptible(iptr1[i++], 0);}
    	if(j < len2) { putfsl_interruptible(iptr2[j++], 1);}
    	if(running == 0) break;
    }

    while(tmp < items)
    {
    	bsw_0_has_data_handler();
    }

    rs = (RESULT *) iptr3;
    for(i=0; i<(items>>1); i++)
    {
    	xil_printf("%d[%d, %d] \r\n", rs[i].score, rs[i].phase, rs[i].index);
    }

    print("\n\r************ END ************\n\r");
    cleanup_platform();

    return 0;
}
Example #6
0
int main(void)
{
    microblaze_disable_interrupts();

    #if defined( XPAR_MICROBLAZE_USE_ICACHE ) && ( XPAR_MICROBLAZE_USE_ICACHE != 0 )
    {
        Xil_ICacheInvalidate();
        Xil_ICacheEnable();
    }
    #endif

    #if defined( XPAR_MICROBLAZE_USE_DCACHE ) && ( XPAR_MICROBLAZE_USE_DCACHE != 0 )
    {
        Xil_DCacheInvalidate();
        Xil_DCacheEnable();
    }
    #endif

	// Create the first task at priority 2. The task parameter is not used
	// and set to NULL. The task handle is also not used so is also set to NULL.
	xTaskCreate(vTask1, "Task 1", configMINIMAL_STACK_SIZE, NULL, 
							tskIDLE_PRIORITY+2, NULL);
	// The task is created at priority 2-----^

	// Create the second task at priority 1 - which is lower than the priority
	// given to Task 1. Again the task parameter is not used so is set to NULL -
	// BUT this time the task handle is required so the address of xTask2Handle
	// is passed int the last parameter.
	xTaskCreate(vTask2, "Task 2", configMINIMAL_STACK_SIZE, NULL,
							tskIDLE_PRIORITY+1, &xTask2Handle);
	// The task handle is the last parameter ___^^^^^^^^^^^^^

	// Start the scheduler so the tasks start executing.
	vTaskStartScheduler();

	// If all is well the main() will never reach here as the scheduler will
	// now be running the tasks. If main() does reach here then it is likely
	// that there was insufficient heap memory available for the idle task to
	// be created. Chapter 5 provides more information on memory management.
	for (;;);

	return 0;
}
Example #7
0
int main (void) {
	int old_count = 0;
	
	gpio_init();
	XGpio_DiscreteWrite(&led,1,0);
	XGpio_DiscreteWrite(&ledPush,1,0x1);
	xil_printf("-- Entering main() --\r\n");
	XTmrCtr_Initialize(&XTC, XPAR_OPB_TIMER_1_DEVICE_ID );
	XTmrCtr_SetOptions(&XTC, 0, XTC_DOWN_COUNT_OPTION | XTC_INT_MODE_OPTION |
    XTC_AUTO_RELOAD_OPTION );
	XTmrCtr_SetHandler(&XTC, TimerCounterHandler, &XTC);
  microblaze_register_handler( (XInterruptHandler)XTmrCtr_InterruptHandler,
    &XTC );
 	microblaze_enable_interrupts();
	XTmrCtr_SetResetValue ( &XTC, 0, 50*1000000L );
	XTmrCtr_Start( &XTC, 0 );
	XGpio_DiscreteWrite(&ledPush,1,0x3);
	while(1) {
	  if (gpio_check()) break;
	  if ( old_count != intr_count ) {
		  xil_printf("  TmrCtr update %d\r\n", intr_count );
		  XGpio_DiscreteWrite(&led,1,3);
		  XGpio_DiscreteWrite(&ledPush,1,0x10 | (intr_count&0xF));
		  old_count = intr_count;
		}
	}
  if ( XTmrCtr_IsExpired( &XTC, 0 ) ) {
		xil_printf("  TmrCtr Timed out\r\n" );
  } else {
	 xil_printf("  TmrCtr un-Timeout\r\n" );
  }
	XTmrCtr_Stop(&XTC, 0 );
	microblaze_disable_interrupts();
    XGpio_DiscreteWrite(&ledPush,1,0x10);
    xil_printf("-- Exiting main() --\r\n");
    return 0;
}
Example #8
0
int main( void )
{
    microblaze_disable_interrupts();

    #if defined( XPAR_MICROBLAZE_USE_ICACHE ) && ( XPAR_MICROBLAZE_USE_ICACHE != 0 )
    {
        Xil_ICacheInvalidate();
        Xil_ICacheEnable();
    }
    #endif

    #if defined( XPAR_MICROBLAZE_USE_DCACHE ) && ( XPAR_MICROBLAZE_USE_DCACHE != 0 )
    {
        Xil_DCacheInvalidate();
        Xil_DCacheEnable();
    }
    #endif

	// Start the two tasks
	xTaskCreate(prvHelloWorld, "HW", configMINIMAL_STACK_SIZE, NULL,
				mainHELLO_WORLD_TASK_PRIORITY, NULL);
	xTaskCreate(prvGoodBye, "GB", configMINIMAL_STACK_SIZE, NULL,
				mainGOOD_BYE_TASK_PRIORITY, NULL);

	// Start the tasks and timer running
	vTaskStartScheduler();

	// If all is well, the scheduler will now be running, and the following line
	// will never be reached. If the following line does execute, then there was
	// insufficient FreeRTOS heap memory available for the idle and/or timer
	// tasks to be created. See the memory management section on the FreeRTOS
	// web site for more details.
	for (;;);
	
	return 0;
}
//---------------------------------------------------------------------------
//
// Function:    disableInterrupts
//
// Description: disable the microblaze interrupt
//
// Parameters:  void
//
// Returns:     void
//
// State:
//
//---------------------------------------------------------------------------
void disableInterrupts(void)
{
    //disable microblaze interrupts
    microblaze_disable_interrupts();
}
Example #10
0
/****************************************************************************
 *
 * FUNCTION:
 *
 * main
 *
 * DESCRIPTION:
 *
 * This is the entry point for the example.  The embedded system automatically
 * calls main.
 *
 * ARGUMENTS:
 *
 * None.
 *
 * RETURN VALUE:
 *
 * None.
 *
 * NOTES:
 *
 * None.
 *
 ****************************************************************************/
int main() {
	XStatus Status;
	int PreviousCount = 0;

	/* Using printf with the UART Lite assumes that the layer 0 device
	 * driver was selected for the UART Lite in the XPS and the standard
	 * I/O peripheral in XPS was set to the UART Lite
	 */printf("\n\rStarting the Application\n\r");

	/*************************** GPIO Setup *******************************/

	/* The second GPIO example uses the higher level (layer 1) driver to
	 * blink the LEDs, First initialize the GPIO component
	 */
	Status = XGpio_Initialize(&Gpio, XPAR_AXI_GPIO_0_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		printf("GPIO initialization error\n\r\r");
	}
	/* Set the direction for all signals to be inputs except the LED
	 * outputs
	 */
	XGpio_SetDataDirection(&Gpio, 1, ~LED);

	/************************* Timer Setup ********************************/

	/* Initialize the timer counter so that it's ready to use,
	 * specify the device ID that is generated in xparameters.h
	 */
	Status = XTmrCtr_Initialize(&TimerCounter, XPAR_AXI_TIMER_0_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		printf("Timer counter initialization error\n\r\r");
	}

	/* Perform a self-test to ensure that the hardware was built
	 * correctly, use the 1st timer in the device (0)
	 */
	Status = XTmrCtr_SelfTest(&TimerCounter, TIMER_COUNTER_0);
	if (Status != XST_SUCCESS) {
		printf("Timer counter self-test error\n\r");
	}

	/* Setup the handler for the timer counter that will be called from the
	 * interrupt context when the timer expires, specify a pointer to the
	 * timer counter driver instance as the callback reference so the handler
	 * is able to access the instance data
	 */
	XTmrCtr_SetHandler(&TimerCounter, TimerCounterHandler, &TimerCounter);

	/* Enable the interrupt of the timer counter so interrupts will occur
	 * and use auto reload mode such that the timer counter will reload
	 * itself automatically and continue repeatedly, without this option
	 * it would expire once only
	 */
	XTmrCtr_SetOptions(&TimerCounter, TIMER_COUNTER_0,
			XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION);

	/* Set a reset value for the timer counter such that it will expire
	 * earlier than letting it roll over from 0, the reset value is loaded
	 * into the timer counter when it is started
	 */
	XTmrCtr_SetResetValue(&TimerCounter, TIMER_COUNTER_0, resetTime /*RESET_VALUE*/);

	/* Start the timer counter such that it's incrementing
	 */
	XTmrCtr_Start(&TimerCounter, TIMER_COUNTER_0);

	/********************** Interrupt Controller Setup *********************/
	/*
	 * Initialize the interrupt controller driver so that it's ready to use,
	 * using the device ID that is generated in xparameters.h
	 */
	Status = XIntc_Initialize(&InterruptController, XPAR_AXI_INTC_0_DEVICE_ID);
	if (Status != XST_SUCCESS) {
		printf("Interrupt controller initialization error\n\r");
	}

	/*
	 * Connect the device driver handler that will be called when an interrupt
	 * for the device occurs, the device driver handler performs the specific
	 * interrupt processing for the device
	 */
	Status = XIntc_Connect(&InterruptController,
			XPAR_AXI_INTC_0_AXI_TIMER_0_INTERRUPT_INTR, // we don't know what this is, but it's probably 0
			(XInterruptHandler) XTmrCtr_InterruptHandler, &TimerCounter);
	if (Status != XST_SUCCESS) {
		printf("Interrupt controller connect error\n\r");
	}

	/*
	 * Start the interrupt controller so interrupts are enabled for all
	 * devices that cause interrupts. Specify real mode so that the timer
	 * counter can cause interrupts through the interrupt controller.
	 */
	Status = XIntc_Start(&InterruptController, XIN_REAL_MODE);
	if (Status != XST_SUCCESS) {
		printf("Interrupt controller start error\n\r");
	}

	/* Enable the interrupt for the timer counter and enable interrupts in
	 * the microblaze processor
	 */
	XIntc_Enable(&InterruptController,
			XPAR_AXI_INTC_0_AXI_TIMER_0_INTERRUPT_INTR);

	microblaze_enable_interrupts();

	/********************** Application Processing *********************/

	/* Insert foreground processing here, interrupts will handle
	 * processing in the background
	 */
	while (1) {
		char get = (char)*(volatile int *)(XPAR_RS232_UART_1_BASEADDR);
		if (get >= ' ' && get <= '~')
			break;
	}
	// stop the timer
	microblaze_disable_interrupts();
	// break out of the while look

	/* The application should not ever execute the following code, but it is
	 * present to indicate if the application does exit because of an error
	 */printf("Exiting the Application\n\r");
}