Exemple #1
0
/*-------------------------------------------------------------------------*
 * Function:  CPUEnableInterrupts
 *-------------------------------------------------------------------------*
 * Description:
 *      Enables all standard CPU interrupts (IRQ).
 *-------------------------------------------------------------------------*/
static TIAPResult IIAPCmd(TUInt8 aCmd)
{
    // Pass on the command
    G_parameters[0] = aCmd;

    // Zap results so we know if nothing happened
    G_results[0] = NOTHING_HAPPENED;

    // Execute with interrupts turned off
    CPUDisableInterrupts();

    // Before doing any IAP commands, turn off the PLL
#if CONFIG_DISABLE_PLL_ON_IAP_COMMANDS
    CPUPLLStop();
#endif

    IAPCall(G_parameters, G_results);

    // Regardless of the result, turn back on the PLL
#if CONFIG_DISABLE_PLL_ON_IAP_COMMANDS
    CPUPLLStart();
#endif

    CPUEnableInterrupts();

    return G_results[0];
}
Exemple #2
0
int main(int argc, char* agrv[]) {
	//initialize DDR and MMIO
	ps7_init();

	//Switch pin 7 to output
	GPIO->DIRECTION_0 = GPIO->DIRECTION_0 | (1 << 7);

	//Set pin 7 to on
	GPIO->MASK_DATA_LSW_0 = ((~(1<<7)) << 16) | (1 << 7);

	//disable stdout buffering
	setvbuf(stdout, 0, _IONBF, 0);

	UartInitialize(UART1, 115200);
	printf("Initialized\n");

	unsigned int id = CPUGetCoreNumber();
	printf("Running on CPU %X\n", id);

	GICInit();
	printf("GIC Initialized\n");

	GICUnmaskInterrupt(29);
	GICConnectInterrupt(29, TimerHandler);

	PrivateTimerStop(PRIVATE_TIMER);
	PrivateTimerSetPrescaler(PRIVATE_TIMER, 255);
	PrivateTimerLoad(PRIVATE_TIMER, 1302083);
	PrivateTimerEnableAutoReload(PRIVATE_TIMER, 1302083);
	PrivateTimerEnableInterrupt(PRIVATE_TIMER);
	PrivateTimerClearExpiration(PRIVATE_TIMER);
	PrivateTimerStart(PRIVATE_TIMER);

	//enable interrupts
	CPUEnableInterrupts();
	//CPUEnableFastInterrupts();

	//uint32_t foo = 0;

	while(1)
	{
		/*if(PrivateTimerIsExpired(PRIVATE_TIMER))
		{
			foo++;
			PrivateTimerClearExpiration(PRIVATE_TIMER);
		}

		if(foo % 10000 == 0)
			printf("A");*/
			
		//uint8_t foo = UartReceiveByte(UART1);
		//UartSendByte(UART1, foo);
	}

	//int* foo = malloc(0x20);
	return 0;
}