Exemple #1
0
void printDebug7(void)
{
	print_uart0("FCd7;");
	print_uart0(" to be defined by you");
	print_uart0(";00#");

}
Exemple #2
0
void printCalibCompassValues(void)
{


	print_uart0("FCc0;");

	print_uart0("%d;%d;%d;%d;",
	sysSetup.MM3.X_MIN,
	sysSetup.MM3.X_MAX,
	sysSetup.MM3.X_range,
	sysSetup.MM3.X_off);

	print_uart0("%d;%d;%d;%d;",
	sysSetup.MM3.Y_MIN,
	sysSetup.MM3.Y_MAX,
	sysSetup.MM3.Y_range,
	sysSetup.MM3.Y_off);

	print_uart0("%d;%d;%d;%d",
	sysSetup.MM3.Z_MIN,
	sysSetup.MM3.Z_MAX,
	sysSetup.MM3.Z_range,
	sysSetup.MM3.Z_off);

	print_uart0(";00#");


}
Exemple #3
0
void event_swi_handler(int taskNumber)
{
	char printable[] = { taskNumber + '0', '\0' };
	print_uart0("Task number that called the syscall : ");
	print_uart0((char *) &printable);
	print_uart0("\r\n");
}
/* trailing newline... */
void print_word_bits(uint32_t * c)
{
	int i;
	for (i = 31; i >= 0; i--)
		*c & (1 << i) ? print_uart0("1") : print_uart0("0");
	print_uart0("\n");
}
Exemple #5
0
void task2_func(void)
{
	print_uart0("task2: Executed!\r\n");
	while (1) {
		delay(100);
		print_uart0("task2: Running...\r\n");
	}
}
Exemple #6
0
// Sinusfunktion im Gradmaß
float sin_f(float winkel)
{
    signed int m,n,iwinkel;
    float sinus;





//winkel = winkel % 360;

    if (winkel >= 0)
    {
        // print_uart0("here m = 1 ;00#");
        m = 1;

    }  else {
        // print_uart0("here m = -1 ;00#");
        m = -1;
        winkel = abs(winkel);
    }

// Quadranten auswerten
    if ((winkel > 90 ) && (winkel <= 180))
    {
        winkel = 180 - winkel;
        n = 1;
    }
    else if ((winkel > 180 ) && (winkel <= 270))
    {
        winkel = winkel - 180;
        n = -1;
    }
    else if ((winkel > 270) && (winkel <= 360))
    {
        winkel = 360 - winkel;
        n = -1;
    }
    else
        n = 1; //0 - 90 Grad

    sinus = (float)sin(winkel);
//sinus = lut_sinus_f[iwinkel];

    print_uart0("sinus %d;%d;%d;%d",
                (signed int)winkel,
                (signed int)sinus * 1000,
                (signed int)m,
                (signed int)n
               );
    print_uart0(";00#");




    return (sinus*m*n);
}
Exemple #7
0
void __attribute__((interrupt)) irq_handler() {
 /* Determine the interrupt's source */
 print_uart0("Interruption raised\r\n");
	switch(*VIC_BASE_ADDR)
	{
		case 0x00000010 : print_uart0("Interruption from timer 0\r\n");
							break;
		default : print_uart0("Interruption not form timer 0\r\n");
	}
}
Exemple #8
0
/* displays 30 words (10 lines) */
void md(uint32_t * start){
	int i, j;
	uint32_t *addr = start;
	for(i = 0; i < 10; i++) {
		print_uart0("0x"); print_word_hex((uint32_t *)&addr); print_uart0(": ");
		for(j = 0; j < 3; j++) {
			print_word_hex(addr);
			print_uart0("  ");
			addr++;
		}
		print_uart0("\n");
	}
}
Exemple #9
0
int GetPartID ()
{
	IAP iap_entry = (IAP) IAP_LOCATION;
	command[0] = ReadPartID;
	iap_entry (command, result);

	if (result[0]==CMD_SUCCESS)
	{
		print_uart0("FCm0;Get Part ID: CMD_SUCCESS;00#");
		print_uart0("FCm0;0x%.8X;00#",result[1]);
	}
	return result[0];
}
Exemple #10
0
void printDebug4(void)
{
	RTCTime current_time;
	current_time = RTC_Get_Time();

	print_uart0("FCd4;");
	print_uart0("%d;%d;%d;",
		(int)current_time.RTC_Sec,
		(int)current_time.RTC_Min,
		(int)refreshCount / 10
	);
	print_uart0(";00#");
}
Exemple #11
0
int GetBootCodeVersion ()
{
	IAP iap_entry = (IAP) IAP_LOCATION;
	command[0] = ReadBootCodeVersion;
	iap_entry (command, result);

	if (result[0]==CMD_SUCCESS)
	{
		print_uart0("FCm0;Get Boot Code Version: CMD_SUCCESS;00#");
		print_uart0("FCm0;0x%.8X;00#",result[1]);
	}

	return result[0];
}
Exemple #12
0
void printDebug(void)
{

	RTCTime current_time;
	current_time = RTC_Get_Time();

	print_uart0("FCd0;");
	print_uart0("%d;%d;%d;",
		current_time.RTC_Sec,
		current_time.RTC_Min,
		refreshCount
	);
	print_uart0(";00#");
}
Exemple #13
0
void c_entry(void)
{
	int i = 0;
	task_count = 0;
	currentTask = 0;

	/* VIC Configuration */
	VIC_INT_SELECT = 0;
	VIC_ENABLE_INT = 0x00000210;	/* Enable Timer01 Interrupt and UART0 */

	unsigned int user_stacks[TASK_LIMIT][STACK_SIZE];

	/* Task initialization */
	init_task(&task[0], user_stacks[0], &task1_func);
	task_count = task_count + 1;
	init_task(&task[1], user_stacks[1], &task2_func);
	task_count = task_count + 1;
	init_task(&task[2], user_stacks[2], &task3_func);
	task_count = task_count + 1;

	print_uart0("OS: Starting...\n");
	print_uart0("OS: Scheduler implementation : round-robin\n");

	/* Timer1 Configuration */
	TIMER01_disable();
	TIMER01_LOAD_VALUE = 65535;
	TIMER01_enable();

	activate(task[currentTask].sp);

	while (i < 5) {
		TIMER01_disable();
		print_uart0("Kernel gets back control ! \n");
		print_uart0("Kernel can do some stuff...\n");
		print_uart0("Load the next task ! \n");

		/* Scheduler */
		currentTask = currentTask + 1;
		if (currentTask >= 2)
			currentTask = 0; /* We only start the first and second task */

		TIMER01_LOAD_VALUE = 65535;
		TIMER01_enable();

		activate(task[currentTask].sp);
		TIMER01_disable();
		i++;
	}

	print_uart0("Kernel is going to activate Task #3 "
	            "which will call a syscall() to return back "
	            "to kernel mode \n");
	activate(task[2].sp);
	print_uart0("Kernel gets back control ! \n");
	print_uart0("Now, the OS is about to shutdown.");

	while (1)
		/* wait */ ;
}
Exemple #14
0
void c_entry() {
	
	char timerValue[32];
	int i =0;
	print_uart0("Hello world!\n");
	
	
	// VIC Configuration
	*VIC_INT_SELECT = 0; // All interrupts are IRQ
	*VIC_ENABLE_INT = 0x00000010; // Enable Timer01 Interrupt
	
	// Timer1 Configuration
	TIMER01_disable();
	TIMER01_LOAD_VALUE = 65520;
	TIMER01_enable();
	
	while(1){
		//~ //for(i=0; i<31;i++){
			//~ timerValue[0] = '0'+ (*TIMER01_CURRENT_VALUE);
			//~ print_uart0(&timerValue[0]);
		//~ //}
		//~ print_uart0("\r\n");
		
	} 
}
Exemple #15
0
void printDebug6(void) {
	print_uart0("FCd6;");

	print_uart0("%d;%d;%d;%d;%d;%d;%d;%d;",
			(int)ADC_standStill[ADC_NICK],
			(int)ADC_standStill[ADC_ROLL],
			(int)ADC_standStill[ADC_PITCH],
			(int)ADC_standStill[ADC_ACCX],
			(int)ADC_standStill[ADC_ACCY],
			(int)ADC_standStill[ADC_ACCZ],
			(int)ADC_standStill[AIRPRESSURE],
			(int)(float)(ADC_standStill[UBAT]/ubatDivider));

	print_uart0("00#");

}
Exemple #16
0
// This start is what u-boot calls. It's just a wrapper around setting up the
// virtual memory for the kernel.
void start(uint32_t *p_bootargs)
{
	// Initialize the virtual memory
	print_uart0("Enabling MMU...\n");
	vm_init();
	os_printf("Initialized VM datastructures.\n");
	mmap(p_bootargs);
}
Exemple #17
0
void event_irq_handler(void)
{
	int src_IRQ = VIC_BASE_ADDR;

	/* Disable all interrupts and clear all flags */
	TIMER01_disable();
	TIMER01_CLEAR_INT = 1;
	VIC_CLEAR_INT = 0xFFFFFFFF;

	print_uart0("\tInterrupt raised!\n");

	switch (src_IRQ & 0x00000010) {
	case 0x00000010:
		print_uart0("Interrupt from Timer 1\t\n");
		break;
	case 0x00000800:
		print_uart0("Interrupt from UART0\t\n");
		break;
	default :
		print_uart0("Interrupt unknown\r\n");
	}

	VIC_ENABLE_INT = 0x00000010;	/* Enable Timer01 interrupt */
}
Exemple #18
0
void printTelemetrie(void)
{

	//return;

	RTCTime current_time;
	current_time = RTC_Get_Time();

	print_uart0("FCt0;");
	print_uart0("%d;%d;%d;",
		(int)current_time.RTC_Min,
		(int)current_time.RTC_Sec,
		(int)lastCycleCount / 10);


	print_uart0("%d;%d;%d;%d;%d;%d;%d;%d;",
		//( AD0DR0 >> 6 ) & 0x3FF,
		(int)((float)ADC_runtime[ADC_NICK]-ADC_drift[ADC_NICK]),
		(int)((float)ADC_runtime[ADC_ROLL]-ADC_drift[ADC_ROLL]),
		(int)((float)ADC_runtime[ADC_PITCH]+ADC_drift[ADC_PITCH]),
		//( AD0DR3 >> 6 ) & 0x3FF,
		(signed int)ADC_runtime[ADC_ACCX] - ADC_standStill[ADC_ACCX],
		(signed int)ADC_runtime[ADC_ACCY] - ADC_standStill[ADC_ACCY],
		(int)ADC_runtime[ADC_ACCZ],
		(int)ADC_runtime[AIRPRESSURE],
		(int)(ADC_runtime[UBAT]/ubatDivider));


	print_uart0("%d;%d;%d;%d;",
		(int)PWMEngOut[0],
		(int)PWMEngOut[1],
		(int)PWMEngOut[2],
		(int)PWMEngOut[3]);

	print_uart0("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d",
		(signed int)MM3_runtime.heading,
		(signed int)MM3_runtime.X_axis,
		(signed int)MM3_runtime.Y_axis,
		(signed int)MM3_runtime.Z_axis,
		(int)NMEAGPGGA.lat*10000,
		(int)NMEAGPGGA.lon*10000,
		(int)PWM_channel[PWM_N],
		(int)PWM_channel[PWM_G],
		(int)PWM_channel[PWM_POTI1],
		(int)PWM_channel[PWM_POTI2],
		//(signed int)hmcXvalue,//(int)PWM_channel[PWM_POTI2]+120,
		(int)PWM_channel[PWM_POTI3]);
	print_uart0(";00#");

}
Exemple #19
0
void printDebug1(void)
{
	//return;
	RTCTime current_time;

	current_time = RTCGetTime();

	print_uart0("FCd1;");

	print_uart0("%d;%d;%d;",
		(int)current_time.RTC_Sec,
		(int)current_time.RTC_Min,
		(int)refreshCount / 10
	);

	print_uart0("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;",
		(int)PWMEngOut[0],
		(int)PWMEngOut[1],
		(int)PWMEngOut[2],
		(int)PWMEngOut[3],
		(int)(ADC_mit[ADC_NICK]-ADC_drift[ADC_NICK]),
		(int)(ADC_mit[ADC_ROLL]-ADC_drift[ADC_ROLL]),
		(int)(ADC_mit[ADC_PITCH]+ADC_drift[ADC_PITCH]),
		(int)ADC_mit[ADC_ACCX],
		(int)ADC_mit[ADC_ACCY],
		(int)ADC_mit[ADC_ACCZ]);


	print_uart0("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;",
		(int)ADC_mit[AIRPRESSURE],
		(int)MM3_runtime.X_axis,
		(int)MM3_runtime.Y_axis,
		(int)MM3_runtime.Z_axis,
		(signed int)PWM_channel[0],
		(signed int)PWM_channel[1],
		(signed int)PWM_channel[2],
		(signed int)PWM_channel[3],
		(signed int)PWM_channel[4],
		(signed int)PWM_channel[5]);

	print_uart0("%d;%d",
		(signed int)PWM_channel[6],
		(signed int)(ADC_raw[UBAT] / ubatDivider)
	);

		print_uart0(";00#");
			//print_uart0(" \r\n");
}
Exemple #20
0
void printTelemetrie(void)
{
	RTCTime current_time;
	current_time = RTCGetTime();

	print_uart0("FCt0;");
	print_uart0("%d;%d;%d;",
			(int)current_time.RTC_Min,
			(int)current_time.RTC_Sec,
			(int)lastCycleCount / 10);

		print_uart0("%d;%d;%d;%d;%d;%d;%d;%d;",
			//( AD0DR0 >> 6 ) & 0x3FF,
			(int)(ADC_mit[ADC_NICK]-ADC_drift[ADC_NICK]),
			(int)(ADC_mit[ADC_ROLL]-ADC_drift[ADC_ROLL]),
			(int)(ADC_mit[ADC_PITCH]+ADC_drift[ADC_PITCH]),
			//( AD0DR3 >> 6 ) & 0x3FF,
			(int)ADC_mit[ADC_ACCX],
			(int)ADC_mit[ADC_ACCY],
			(int)ADC_mit[ADC_ACCZ],
			(int)ADC_mit[AIRPRESSURE],
			(int)(float)(ADC_mit[UBAT]/ubatDivider));

		print_uart0("%d;%d;%d;%d;",
			(int)PWMEngOut[0],
			(int)PWMEngOut[1],
			(int)PWMEngOut[2],
			(int)PWMEngOut[3]);

		print_uart0("%d;%d;%d;%d;%d;%d;%d;%d;%d;%d;%d",
			(int)heading,
			(int)HMC_runtime.X_axis,
			(int)HMC_runtime.Y_axis,
			(int)HMC_runtime.Z_axis,
			(int)PWM_channel[PWM_THROTTLE],
			(int)PWM_channel[PWM_R],
			(int)PWM_channel[PWM_N],
			(int)PWM_channel[PWM_G],
			(int)PWM_channel[PWM_POTI1],
			(int)PWM_channel[PWM_POTI2],
			//(signed int)hmcXvalue,//(int)PWM_channel[PWM_POTI2]+120,
			(int)PWM_channel[PWM_POTI3]);
	print_uart0(";00#");
}
Exemple #21
0
void checkIapResult(int resultValue)
{

	//print back a status of operation
	//toDo make this numbers and interpreted by base station tool

	print_uart0("FCm0;size %d;00#",sizeof(setupStore));
	if (resultValue==CMD_SUCCESS)
		print_uart0("FCm0;CMD_SUCCESS;00#");
	else if(resultValue==BUSY)
		print_uart0("FCm0;BUSY;00#");
	else if(resultValue==SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION)
		print_uart0("FCm0;SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION;00#");
	else if(resultValue==SRC_ADDR_ERROR)
		print_uart0("FCm0;SRC_ADDR_ERROR;00#");
	else if(resultValue==DST_ADDR_ERROR)
		print_uart0("FCm0;DST_ADDR_ERROR;00#");
	else if(resultValue==SRC_ADDR_NOT_MAPPED)
		print_uart0("FCm0;SRC_ADDR_NOT_MAPPED;00#");
	else if(resultValue==DST_ADDR_NOT_MAPPED)
		print_uart0("FCm0;DST_ADDR_NOT_MAPPED;00#");
	else if(resultValue==COUNT_ERROR)
		print_uart0("FCm0;COUNT_ERROR;00#");
	else if(resultValue==SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION)
		print_uart0("FCm0;Erase Sector SECTOR_NOT_PREPARED_FOR_WRITE_OPERATION;00#");
	else if(resultValue==INVALID_SECTOR)
		print_uart0("FCm0;Erase Sector INVALID_SECTOR;00#");

}
Exemple #22
0
void printSettings(void)
{

	print_uart0("FCse;");

	print_uart0("%d;%d;",
			(char)setupCache.barOn,
			(char)setupCache.compOn);

	print_uart0("%d;%d;",
			(char)setupCache.gpsOn,
			(char)setupCache.nickServoOn);

	print_uart0("%d;",
			(char)setupCache.nickServoChan);
	print_uart0("%d;%d;%d;",
			(char)setupCache.nickServoInvert,
			(char)setupCache.nickServoPos,
			(char)setupCache.nickServoForce);
	print_uart0("%d;%d;",
			(char)setupCache.nickServoMin,
			(char)setupCache.nickServoMax);

	print_uart0("%d;%d;",
			(char)setupCache.rollServoOn,
			(char)setupCache.rollServoChan);
	print_uart0("%d;%d;%d;",
			(char)setupCache.rollServoInvert,
			(char)setupCache.rollServoPos,
			(char)setupCache.rollServoForce);
	print_uart0("%d;%d;",
			(char)setupCache.rollServoMin,
			(char)setupCache.rollServoMax);




	print_uart0("%d;%d;%d;",
			(char)setupCache.pid_PitchStickFact,
			(char)setupCache.pid_throttleOffset,
			(char)setupCache.pd_PitchStickFact);
	print_uart0("%d;%d;%d;",
			(char)setupCache.pd_throttleOffset,
			(char)setupCache.sysGasMin,
			(char)setupCache.sysRcGasMax);

	print_uart0("%d;%d;%d;",
			(char)setupCache.sysEmergencyGas,
			(char)setupCache.sysEmergencyGasDuration,
			(char)setupCache.sysLowVoltage);
	print_uart0("%d;%d;%d;%d;",
			(char)setupCache.sysMainDirection,
			(char)setupCache.sysGasMax,
			(char)setupCache.PWMMode,
			(char)setupCache.BTMode);

	print_uart0("%d;%d;%d;",
			(char)setupCache.ADCModeNick,
			(char)setupCache.ADCModeRoll,
			(char)setupCache.ADCModePitch);

	print_uart0("%d;%d;%d;",
			(char)setupCache.ADCDriftNick,
			(char)setupCache.ADCDriftRoll,
			(char)setupCache.ADCDriftPitch);

	print_uart0("%d;%d;%d;",
			(char)setupCache.calcMode,
			(char)setupCache.pid_X_AccX_Fact,
			(char)setupCache.pid_X_GyroSumFact);
	print_uart0("%d;%d;%d;",
			(char)setupCache.pid_X_P,
			(char)setupCache.pid_X_D,
			(char)setupCache.pid_X_I);
	print_uart0("%d;%d;%d;%d;",
			(char)setupCache.pid_X_PitchSumFact,
			(char)setupCache.pid_X_SumFact,
			(char)setupCache.X_sensorBias,
			(char)setupCache.X_sensorBiasNeg);

	print_uart0("%d;%d;%d;",
			(char)setupCache.pid_Y_AccY_Fact,
			(char)setupCache.pid_Y_GyroSumFact,
			(char)setupCache.pid_Y_P);
	print_uart0("%d;%d;%d;",
			(char)setupCache.pid_Y_D,
			(char)setupCache.pid_Y_I,
			(char)setupCache.pid_Y_PitchSumFact);
	print_uart0("%d;%d;%d;",
			(char)setupCache.pid_Y_SumFact,
			(char)setupCache.Y_sensorBias,
			(char)setupCache.Y_sensorBiasNeg);

	print_uart0("%d;%d;%d;",
			(char)setupCache.pid_GyroPitchFact,
			(char)setupCache.pid_StickFact,
			(char)setupCache.pid_PitchP);

	print_uart0("%d;%d;%d;%d;",
			(char)setupCache.pid_PitchI,
			(char)setupCache.pid_PitchD,
			(char)setupCache.PitchSensorBias,
			(char)setupCache.PitchSensorBiasNeg);

	print_uart0("%d;%d;%d;",
			(char)setupCache.pd_X_P_Fact,
			(char)setupCache.pd_X_D_Fact,
			(char)setupCache.pd_Y_P_Fact);
	print_uart0("%d;%d;",
			(char)setupCache.pd_Y_D_Fact,
			(char)setupCache.pd_PitchP);

	print_uart0("%d;%d;%d;",
			(char)setupCache.pd_PitchD,
			(char)setupCache.pd_X_AccX_Fact,
			(char)setupCache.pd_Y_AccY_Fact);

	print_uart0("%d;%d;%d;",
			(char)setupCache.pd_X_GyroSumFact,
			(char)setupCache.pd_X_PitchSumFact,
			(char)setupCache.pd_Y_GyroSumFact);

	print_uart0("%d;%d;%d;%d;",
			(char)setupCache.pd_Y_PitchSumFact,
			(char)setupCache.pd_GyroPitchFact,
			(char)setupCache.pd_StickFact,
			(char)setupCache.settingNum);

	print_uart0("%d;%d;",
			(char)setupCache.pid_X_GyroACCFactMin,
			(char)setupCache.pid_X_GyroACCFactMax);

	print_uart0("%d;%d;",
			(char)setupCache.pid_X_IntegralMin,
			(char)setupCache.pid_X_IntegralMax);

	print_uart0("%d;%d;",
			(char)setupCache.pid_Y_GyroACCFactMin,
			(char)setupCache.pid_Y_GyroACCFactMax);

	print_uart0("%d;%d;",
			(char)setupCache.pid_Y_IntegralMin,
			(char)setupCache.pid_Y_IntegralMax);

	print_uart0("%d;%d;",
			(char)setupCache.pid_Pitch_IntegralMin,
			(char)setupCache.pid_Pitch_IntegralMax);

	print_uart0("%d;%d;",
			(char)setupCache.escType,
			(char)setupCache.escMax);

	print_uart0("%d;%d;",
			(char)setupCache.escBaseAdr,
			(char)setupCache.escAdrHop);

	print_uart0("%d;%d;",
			(char)setupCache.calcCycle,
			(char)setupCache.telemetrieCycle);

	print_uart0("%d;%d;",
			(char)setupCache.componentCycle,
			(char)setupCache.AdcClockDiv);

	print_uart0("%d;%d;%d;",
			(char)setupCache.MaxValue,
			(char)setupCache.MinValue,
			(char)setupCache.MaxMultichannel);
	print_uart0("%d;%d;",
			(char)setupCache.mcOffset,
			(char)setupCache.mcOffset2);

	print_uart0("%d;",
			(char)setupCache.scOffsetBase);


	print_uart0("%d;%d;",
			(char)setupCache.HMC5843_Mode,
			(char)setupCache.HMC5843_Bias);
	print_uart0("%d;%d;%d;",
			(char)setupCache.HMC5843_Delay,
			(char)setupCache.HMC5843_Gain,
			(char)setupCache.HMC5843_Rate);


	print_uart0("%d;%d;",
			(char)setupCache.chan[0],
			(char)setupCache.chan[1]);
	print_uart0("%d;%d;%d;",
			(char)setupCache.chan[2],
			(char)setupCache.chan[3],
			(char)setupCache.chan[4]);
	print_uart0("%d;%d;",
			(char)setupCache.chan[5],
			(char)setupCache.chan[6]);
	print_uart0("%d;%d;%d;",
			(char)setupCache.chan[7],
			(char)setupCache.chan[8],
			(char)setupCache.chan[9]);
	print_uart0("%d;%d;",
			(char)setupCache.chan[10],
			(char)setupCache.chan[11]);
	print_uart0("%d;%d;%d;%d;",
			(char)setupCache.mpOffset[0],
			(char)setupCache.mpOffset[1],
			(char)setupCache.mpOffset[2],
			(char)setupCache.mpOffset[3]);
	print_uart0("%d;%d;%d;%d;%d;",
			(char)setupCache.mpOffset[4],
			(char)setupCache.mpOffset[5],
			(char)setupCache.mpOffset[6],
			(char)setupCache.mpOffset[7],
			(char)setupCache.mpOffset[8]);


	print_uart0("%d;%d;%d;%d;%d;",
			(char)setupCache.userSetting[0],
			(char)setupCache.userSetting[1],
			(char)setupCache.userSetting[2],
			(char)setupCache.userSetting[3],
			(char)setupCache.userSetting[4]);
	print_uart0("%d;%d;%d;%d;%d;",
			(char)setupCache.userSetting[5],
			(char)setupCache.userSetting[6],
			(char)setupCache.userSetting[7],
			(char)setupCache.userSetting[8],
			(char)setupCache.userSetting[9]);

	print_uart0("%d;%d;%d;%d;%d;",
			(char)setupCache.userSetting[10],
			(char)setupCache.userSetting[11],
			(char)setupCache.userSetting[12],
			(char)setupCache.userSetting[13],
			(char)setupCache.userSetting[14]);
	print_uart0("%d;%d;%d;%d;%d;%d",
			(char)setupCache.userSetting[15],
			(char)setupCache.userSetting[16],
			(char)setupCache.userSetting[17],
			(char)setupCache.userSetting[18],
			(char)setupCache.userSetting[19],
			(char)setupCache.userSetting[20]);


	print_uart0(";00#");

}
Exemple #23
0
void main() {
  print_uart0("Hello world!\n");
}
Exemple #24
0
// This start is what starts the kernel. Note that virtual memory is enabled
// at this point (And running, also, in the kernel's VAS).
void start2(uint32_t *p_bootargs)
{
	// Setup all of the exception handlers... (hrm, interaction with VM?)
	init_vector_table();

	// Setup kmalloc...
	init_heap();

	print_uart0("\nCourseOS!\n");

	// Test stuff...
	/*int *p = (int*)0xFFFFFFF0;
	 p[0] = 1;
	 os_printf("0x%x == 1?\n", p[0]);*/

	//run_vm_tests();
	//INFO("There are %d free frames.\n", vm_count_free_frames());
	//run_mem_alloc_tests();
	//INFO("There are %d free frames.\n", vm_count_free_frames());
	//run_prq_tests();
	//run_hmap_tests();

	kfs_init(0, 0, 0);


	/*
	 4-15-15: 	#Prakash: 	What happens if we let the program load here?
	 Let's make argparse_process() do its thing

	 Note: As of 4-15-15 this fails horribly with hello.o not being
	 recognized as an ELF file and DATA ABORT HANDLER being syscalled			   
	 */

	// enable interrupt handling
	enable_interrupts();

	// initialize the timers
	initialize_timers();
	
	//assert(1==2 && "Test assert please ignore");

	init_all_processes();


	// FIXME: temporary
	os_printf("Programming the timer interrupt\n");
	start_timer_interrupts(0, 5);
	sched_init();

	argparse_process(p_bootargs);

	print_uart0("done parsing atag list\n");


	//init_kheap(31 * 0x100000);
	//init_uheap(0x100000);

	//initialize pcb table and PID
	/* init_all_processes(); */
	//print_process_state(0);
	//run_process_tests();
	//print_PID();
	// init_q();
	//main();


	SLEEP;
}
Exemple #25
0
void printDebug3(void)
{

	print_uart0("FCd3;");
	print_uart0("%X;%X;%X;%X;%X;%X;%X;%X;%X;%X;",
				setupCache.chan[0],
				setupCache.chan[1],
				setupCache.chan[2],
				setupCache.chan[3],
				setupCache.chan[4],
				setupCache.chan[5],
				setupCache.chan[6],
				setupCache.chan[7],
				setupCache.chan[8],
				setupCache.chan[9]);

		print_uart0("%X;%X;%X;%X;%X;%X;%X;%X;",
				setupCache.chan[10],
				setupCache.chan[11],
				setupCache.barOn,
				setupCache.compOn,
				setupCache.gpsOn,
				setupCache.nickServoOn,
				setupCache.rollServoOn);

	print_uart0("%X;%X;%X;%X;%X;%X;%X;%X;%X;%X;%X;%X;",
				setupCache.pid_PitchStickFact,
				setupCache.pid_throttleOffset,
				setupCache.pd_PitchStickFact,
				setupCache.pd_throttleOffset,
				setupCache.sysGasMin,
				setupCache.sysRcGasMax,
				setupCache.sysEmergencyGas,
				setupCache.sysEmergencyGasDuration,
				setupCache.sysLowVoltage,
				setupCache.sysMainDirection,
				setupCache.sysGasMax,
				setupCache.PWMMode);

	print_uart0("%X;%X;%X;%X;%X;%X;%X;%X;",
				setupCache.calcMode,
				setupCache.pid_X_AccX_Fact,
				setupCache.pid_X_GyroSumFact,
				setupCache.pid_X_P,
				setupCache.pid_X_D,
				setupCache.pid_X_I,
				setupCache.pid_X_PitchSumFact,
				setupCache.pid_X_SumFact);



	print_uart0("%X;%X;%X;%X;%X;%X;%X;",
				setupCache.pid_Y_AccY_Fact,
				setupCache.pid_Y_GyroSumFact,
				setupCache.pid_Y_P,
				setupCache.pid_Y_D,
				setupCache.pid_Y_I,
				setupCache.pid_Y_PitchSumFact,
				setupCache.pid_Y_SumFact);

	print_uart0("%X;%X;%X;%X;%X;",
				setupCache.pid_GyroPitchFact,
				setupCache.pid_StickFact,
				setupCache.pid_PitchP,
				setupCache.pid_PitchI,
				setupCache.pid_PitchD);

	print_uart0("%X;%X;%X;%X;%X;%X;%X;%X;%X;%X;%X;",
				setupCache.pd_X_P_Fact,
				setupCache.pd_X_D_Fact,
				setupCache.pd_Y_P_Fact,
				setupCache.pd_Y_D_Fact,
				setupCache.pd_PitchP,
				setupCache.pd_PitchD,
				setupCache.pd_X_AccX_Fact,
				setupCache.pd_Y_AccY_Fact,
				setupCache.pd_X_GyroSumFact,
				setupCache.pd_X_PitchSumFact,
				setupCache.pd_Y_GyroSumFact);

	print_uart0("%X;%X;%X;%X;",
				setupCache.pd_Y_PitchSumFact,
				setupCache.pd_GyroPitchFact,
				setupCache.pd_StickFact,
				setupCache.settingNum);

	print_uart0("%X;%X;%X;%X;%X;%X;%X;%X;",
				setupCache.pid_X_GyroACCFactMin,
				setupCache.pid_X_GyroACCFactMax,
				setupCache.pid_X_IntegralMin,
				setupCache.pid_X_IntegralMax,
				setupCache.pid_Y_GyroACCFactMin,
				setupCache.pid_Y_GyroACCFactMax,
				setupCache.pid_Y_IntegralMin,
				setupCache.pid_Y_IntegralMax);

	print_uart0("%X;%X;",
				setupCache.pid_Pitch_IntegralMin,
				setupCache.pid_Pitch_IntegralMax);

	print_uart0("%X;%X;%X;%X;",
				setupCache.escType,
				setupCache.escMax,
				setupCache.escBaseAdr,
				setupCache.escAdrHop);

	print_uart0("%X;%X;%X;%X;",
				setupCache.calcCycle,
				setupCache.telemetrieCycle,
				setupCache.componentCycle,
				setupCache.AdcClockDiv);

	print_uart0("%X;%X;%X;%X;%X;",
				setupCache.MaxValue,
				setupCache.MinValue,
				setupCache.MaxMultichannel,
				setupCache.mcOffset,
				setupCache.mcOffset2);
	print_uart0("%X;%X;%X;%X;%X;",
				setupCache.scOffsetBase,
				setupCache.mpOffset[0],
				setupCache.mpOffset[1],
				setupCache.mpOffset[2],
				setupCache.mpOffset[3]);

	print_uart0("%X;%X;%X;%X;%X;",
				setupCache.mpOffset[4],
				setupCache.mpOffset[5],
				setupCache.mpOffset[6],
				setupCache.mpOffset[7],
				setupCache.mpOffset[8]);

	print_uart0("%X;%X;%X;%X;%X;",
				setupCache.userSetting[0],
				setupCache.userSetting[1],
				setupCache.userSetting[2],
				setupCache.userSetting[3],
				setupCache.userSetting[4]);
	print_uart0("%X;%X;%X;%X;%X;",
				setupCache.userSetting[5],
				setupCache.userSetting[6],
				setupCache.userSetting[7],
				setupCache.userSetting[8],
				setupCache.userSetting[9]);


	print_uart0("%X;%X;%X;%X;%X;",
				setupCache.userSetting[10],
				setupCache.userSetting[11],
				setupCache.userSetting[12],
				setupCache.userSetting[13],
				setupCache.userSetting[14]);
	print_uart0("%X;%X;%X;%X;%X;%X",
				setupCache.userSetting[15],
				setupCache.userSetting[16],
				setupCache.userSetting[17],
				setupCache.userSetting[18],
				setupCache.userSetting[19],
				setupCache.userSetting[20]);


	print_uart0(";00#");
}
Exemple #26
0
void printDebug5(void)
{

	print_uart0("FCd6;");
	print_uart0("%X;%X;%X;%X;%X;",
				(int)fcSetup.chan[0],
				(int)fcSetup.chan[1],
				(int)fcSetup.chan[2],
				(int)fcSetup.chan[3],
				(int)fcSetup.chan[4]);

	print_uart0("%X;%X;%X;%X;%X;",
				(int)fcSetup.chan[5],
				(int)fcSetup.chan[6],
				(int)fcSetup.chan[7],
				(int)fcSetup.chan[8],
				(int)fcSetup.chan[9]);

	print_uart0("%X;%X;%X;%X;",
				(int)fcSetup.chan[10],
				(int)fcSetup.chan[11],
				(int)fcSetup.components[0],
				(int)fcSetup.components[1]);

	print_uart0("%X;%X;%X;",
				(int)fcSetup.components[2],
				(int)fcSetup.nickServoOn,
				(int)fcSetup.rollServoOn);

	print_uart0("%X;%X;%X;%X;",
				(int)fcSetup.pid_PitchStickFact,
				(int)fcSetup.pid_throttleOffset,
				(int)fcSetup.pd_PitchStickFact,
				(int)fcSetup.pd_throttleOffset);

	print_uart0("%X;%X;",
				(int)fcSetup.sysGasMin,
				(int)fcSetup.sysRcGasMax);

	print_uart0("%X;%X;%X;%X;",
				(int)fcSetup.sysEmergencyGas,
				(int)fcSetup.sysEmergencyGasDuration,
				(int)fcSetup.sysLowVoltage,
				(int)fcSetup.sysMainDirection);

	print_uart0("%X;%X;%X;",
				(int)fcSetup.serialControl,
				(int)fcSetup.sysGasMax,
				(int)fcSetup.PWMMode);

	print_uart0("%X;%X;%X;%X;",
				(signed int)fcSetup.pid_X_GyroACCFactMin,
				(signed int)fcSetup.pid_X_GyroACCFactMax,
				(signed int)fcSetup.pid_X_IntegralMin,
				(signed int)fcSetup.pid_X_IntegralMax);

	print_uart0("%X;%X;%X;%X;",
				(signed int)fcSetup.pid_Y_GyroACCFactMin,
				(signed int)fcSetup.pid_Y_GyroACCFactMax,
				(signed int)fcSetup.pid_Y_IntegralMin,
				(signed int)fcSetup.pid_Y_IntegralMax);

	print_uart0("%X;%X;%X;%X;",
				//fcSetup.reserved0,
				(int)fcSetup.pid_X_AccX_Fact*10,
				(int)fcSetup.pid_X_P*10,
				(int)fcSetup.pid_X_D*10,
				(signed int)(fcSetup.pid_X_PitchFact*1000));

	print_uart0("%X;%X;%X;%X;",
				(int)fcSetup.pid_Y_AccY_Fact*10,
				(int)fcSetup.pid_Y_P*10,
				(int)fcSetup.pid_Y_D*10,
				(signed int)(fcSetup.pid_Y_PitchFact*1000));

	print_uart0("%X;%X;%X;%X;",
				(signed int)(fcSetup.pid_GyroPitchFact*1000),
				(signed int)(fcSetup.pid_StickFact*1000),
				(int)(fcSetup.pid_PitchP),
				(int)(fcSetup.pid_PitchD));

	print_uart0("%X;%X;%X;%X;%X;%X;",
				(int)(fcSetup.pid_X_GyroFact*1000),
				(int)(fcSetup.pid_X_I*10000),
				(int)(fcSetup.pid_X_GyroACCFact*1000),
				(int)(fcSetup.pid_Y_GyroFact*1000),
				(int)(fcSetup.pid_Y_I*10000),
				(int)(fcSetup.pid_Y_GyroACCFact*1000));


	print_uart0("%X;%X;%X;%X;%X;",
				(int)(fcSetup.pd_X_P*100),
				(int)(fcSetup.pd_X_D*100),
				(int)(fcSetup.pd_Y_P*100),
				(int)(fcSetup.pd_Y_D*100),
				(int)(fcSetup.pd_GyroPitchFact*100));

	print_uart0("%X;%X;%X;%X;",
				(int)(fcSetup.pd_GyroStickFact*100),
				(int)(fcSetup.pd_stickFact*100),
				(int)(fcSetup.pd_X_sensorFact*100),
				(int)(fcSetup.pd_X_PitchFact*100));


	print_uart0("%X;%X;%X;%X;",
				(int)(fcSetup.pd_Y_sensorFact*100),
				(int)(fcSetup.pd_Y_PitchFact*100),
				(int)(fcSetup.pd_PitchP),
				(int)(fcSetup.pd_PitchD));

	print_uart0("%X;%X;%X;%X;",
				(int)fcSetup.escType,
				(int)fcSetup.escMax,
				(int)fcSetup.escBaseAdr,
				(int)fcSetup.escAdrHop);

	print_uart0("%X;%X;%X;%X;%X;",
				(int)sysSetup.CYCLE.calcCycle,
				(int)sysSetup.CYCLE.telemetrieCycle,
				(int)sysSetup.CYCLE.componentCycle,
				(int)sysSetup.CYCLE.AdcClockDiv,
				(int)sysSetup.PWM.MaxValue);

	print_uart0("%X;%X;%X;%X;%X;",
				(int)sysSetup.PWM.MinValue,
				(int)sysSetup.PWM.MaxMultichannel,
				(int)sysSetup.PWM.mcOffset,
				(int)sysSetup.PWM.mcOffset2,
				(int)sysSetup.PWM.scOffsetBase);


	print_uart0("%X;%X;%X;%X;%X;",
				(int)sysSetup.PWM.mpOffset[0],
				(int)sysSetup.PWM.mpOffset[1],
				(int)sysSetup.PWM.mpOffset[2],
				(int)sysSetup.PWM.mpOffset[3],
				(int)sysSetup.PWM.mpOffset[4]);

	print_uart0("%X;%X;%X;%X;",
				(int)sysSetup.PWM.mpOffset[5],
				(int)sysSetup.PWM.mpOffset[6],
				(int)sysSetup.PWM.mpOffset[7],
				(int)sysSetup.PWM.mpOffset[8]);

	print_uart0("%X;%X;%X;%X;%X;",
				(int)fcSetup.userSetting[0],
				(int)fcSetup.userSetting[1],
				(int)fcSetup.userSetting[2],
				(int)fcSetup.userSetting[3],
				(int)fcSetup.userSetting[4]);

	print_uart0("%X;%X;%X;%X;%X;",
				(int)fcSetup.userSetting[5],
				(int)fcSetup.userSetting[6],
				(int)fcSetup.userSetting[7],
				(int)fcSetup.userSetting[8],
				(int)fcSetup.userSetting[9]);

	print_uart0("%X;%X;%X;%X;%X;",
				(int)fcSetup.userSetting[10],
				(int)fcSetup.userSetting[11],
				(int)fcSetup.userSetting[12],
				(int)fcSetup.userSetting[13],
				(int)fcSetup.userSetting[14]);

	print_uart0("%X;%X;%X;%X;%X",
				(int)fcSetup.userSetting[15],
				(int)fcSetup.userSetting[16],
				(int)fcSetup.userSetting[17],
				(int)fcSetup.userSetting[18],
				(int)fcSetup.userSetting[19]);

	print_uart0(";00#");

}
Exemple #27
0
void uart_handler(void *null)
{
	print_uart0("uart0!\n");
}
Exemple #28
0
void c_entry() {
  print_uart0("Hello world!\n");
}
Exemple #29
0
void serialUI(void) {


	if (commandRetrived == 1) {

		if (commandType == 0) {
			checkCmd();
			commandRetrived = 0;
		}

		if (commandType == 1) {
			if (setCmd == 0) {								//this is to send in data. the data is not yet flashed
				led_switch(2);								//data can be send in at any time also at flight time
															//it will be used with the next cycle
				print_uart0("FCm0;storing setting  %d;00#",setupCache.settingNum);
				setToInSettings();							//fill the runtime struct with the settings
				setTempToInSetting(setupCache.settingNum);	//save settings to ram cache
				commandRetrived = 0;
			}

			if (setCmd == 1) {
				print_uart0("FCm0;flashing settings;00#");	//here we write all the settings from ram to flash
				enginesOff(); 								//this is to save some of the flashing cycles.
				led_switch(3);								//we could flash with any retrieved setting but that
				engineStatus = 0;							//just helps abusing the flash cycles so its a manual
															//step to really save to flash
				writeSetup();
				ADCStandstillValues();						//also we reset the ADCOffset
				commandRetrived = 0;
				initFCRuntime();
				ledTest();
			}
		}

		if (commandType == 2) {
			updateAcdRate();
			commandRetrived = 0;
		}
		if (commandType == 3) {
			retriveSetting();
			printSettings();
			commandRetrived = 0;
		}

		if (commandType == 4) {
			if (I2CcmdType == I2CMODE_WRITEADDRESS){
				if (updateYGE == 0) {
					I2C0Mode = I2CMODE_WRITEADDRESS;
					I2C0State = 0;
					updateYGE = 1;
					I2C0Start();
				}
			}

			if (I2CcmdType == I2CMODE_STARTUP_TARGET){
				if (updateYGE == 0) {
					I2C0Stop();
					I2C0Mode = I2CMODE_WRITEADDRESS;
					I2C0State = 0;
					updateYGE = 1;
					I2C0Start();
				}
			}
			commandRetrived = 0;
		}

	}









}
Exemple #30
0
void checkI2CResult(int resultValue, int num)
{

	//print back a status of operation
	//toDo make this numbers and interpreted by base station tool
	print_uart0("FCm0;status %X;00#",resultValue);
	if (resultValue==I2C_STARTUP_SEND)
		print_uart0("FCm0;A START condition has been transmitted");
	else if(resultValue==I2C_REPEADET_STARTUP_SEND)
		print_uart0("FCm0;A repeated START condition has been transmitted");
	else if(resultValue==I2C_SLAW_SEND_ACK)
		print_uart0("FCm0;SLA+W has been transmitted; ACK has been received");
	else if(resultValue==I2C_SLAW_SEND_NO_ACK)
		print_uart0("FCm0;SLA+W has been transmitted; NOT ACK has been received");
	else if(resultValue==I2C_DATA_SEND_ACK)
		print_uart0("FCm0;Data byte in I2DAT has been transmitted; ACK has been received");
	else if(resultValue==I2C_DATA_SEND_NO_ACK)
		print_uart0("FCm0;Data byte in I2DAT has been transmitted; NOT ACK has been received");
	else if(resultValue==I2C_ARBITRATION_LOST)
		print_uart0("FCm0;Arbitration lost in SLA+R/W or Data bytes");
	else if(resultValue==I2C_SLAR_SEND_ACK)
		print_uart0("FCm0;SLA+R has been transmitted; ACK has been received");
	else if(resultValue==I2C_SLAR_SEND_NO_ACK)
		print_uart0("FCm0;SLA+R has been transmitted; NOT ACK has been received");
	else if(resultValue==I2C_DATA_RECEIVED_SEND_ACK)
		print_uart0("FCm0;Data byte has been received; ACK has been returned");
	else if(resultValue==I2C_DATA_RECEIVED_SEND_NO_ACK)
		print_uart0("FCm0;Data byte has been received; NOT ACK has been returned");

	print_uart0(" %d;00#",num);
}