Beispiel #1
0
Datei: port.c Projekt: fmorel/SoC
portBASE_TYPE xPortStartScheduler( void )
{
	/* Setup the hardware to generate the tick. */
	prvSetupTimer();

	/* Kick off the first task. */
	vStartFirstTask();

	/* Should not get here as the tasks are now running! */
	return pdTRUE;
}
Beispiel #2
0
BaseType_t xPortStartScheduler( void )
{
extern void ( __FreeRTOS_interrupt_handler )( void );
extern void ( vStartFirstTask )( void );


	/* Setup the FreeRTOS interrupt handler.   */
/*
	__asm__ volatile ( 	"la	r6, r0, __FreeRTOS_interrupt_handler	\n\t" \
					"swi  r6, r1, 4 								\n\t" \
					"lhui r7, r1, 4 								\n\t" \
					"ori  r7, r7, 0xB0000000						\n\t" \
					"swi  r7, r0, 0x10								\n\t" \
					"swi  r7, r0, 0x18								\n\t" \
					"andi r6, r6, 0xFFFF							\n\t" \
					"ori  r6, r6, 0xB8080000						\n\t" \
					"swi  r6, r0, 0x14 								\n\t" \
					"swi  r6, r0, 0x1C " );
*/
	volatile uint32_t *p = (volatile uint32_t *)0x10;
	uint32_t addr = (uint32_t)__FreeRTOS_interrupt_handler;
	*p++ = (0xB0000000 | (addr >> 16));
	*p++ = (0xB8080000 | (addr & 0xFFFF));
	*p++ = (0xB0000000 | (addr >> 16));
	*p++ = (0xB8080000 | (addr & 0xFFFF));


	/* Setup the hardware to generate the tick.  Interrupts are disabled when
	this function is called. */
	prvSetupTimerInterrupt();

	/* Allocate the stack to be used by the interrupt handler. */
	pulISRStack = ( uint32_t * ) pvPortMalloc( configMINIMAL_STACK_SIZE * sizeof( StackType_t ) );

	/* Restore the context of the first task that is going to run. */
	if( pulISRStack != NULL )
	{
		/* Fill the ISR stack with a known value to facilitate debugging. */
		memset( pulISRStack, portISR_STACK_FILL_VALUE, configMINIMAL_STACK_SIZE * sizeof( StackType_t ) );
		pulISRStack += ( configMINIMAL_STACK_SIZE - 1 );

		portENABLE_INTERRUPTS();

		/* Kick off the first task. */
		vStartFirstTask();
	}

	/* Should not get here as the tasks are now running! */
	return pdFALSE;
}