示例#1
0
void vLedTask(void *pvParameters)
{
	unsigned led    = 0;
	unsigned count  = 0;
	unsigned colour = 0;

	/* Initalise the IO ports that drive the LEDs */
	gioSetDirection(hetPORT, 0xFFFFFFFF);
	/* switch all leds off */
	gioSetPort(hetPORT, 0x08110034);

	for(;;)
	{
		/* toggle on/off */
		led ^= 1;
		/* switch TOP row */
		gioSetBit(hetPORT, 25, led);
		gioSetBit(hetPORT, 18, led);
		gioSetBit(hetPORT, 29, led);
		/* switch BOTTOM row */
		gioSetBit(hetPORT, 17, led ^ 1);
		gioSetBit(hetPORT, 31, led ^ 1);
		gioSetBit(hetPORT,  0, led ^ 1);
		vTaskDelay(500);

		if (++count > 5)
		{
			count = 0;
			/* both leds to off */
			gioSetBit(hetPORT, 2, 1);  gioSetBit(hetPORT,  5, 1);  gioSetBit(hetPORT, 20, 1);
			gioSetBit(hetPORT, 4, 1);  gioSetBit(hetPORT, 27, 1);  gioSetBit(hetPORT, 16, 1);
			switch(colour)
			{
			case 0:
				gioSetBit(hetPORT, 2, 0);  /* red */
				gioSetBit(hetPORT, 4, 0);
				colour++;
				continue;
			case 1:
				gioSetBit(hetPORT,  5, 0);  /* blue */
				gioSetBit(hetPORT, 27, 0);
				colour++;
				continue;
			case 2:
				gioSetBit(hetPORT, 20, 0);  /* green */
				gioSetBit(hetPORT, 16, 0);
				colour++;
				continue;
			}
			colour = 0;
		}
	}
}
示例#2
0
static void user_thread_entry(void *p)
{
    int i;

    gioSetDirection(hetPORT1, 0xFFFFFFFF);

    for(i = 0; ;i++)
    {
        gioSetBit(hetPORT1, 17, gioGetBit(hetPORT1, 17) ^ 1);
        rt_thread_delay(100);
    }
}
示例#3
0
void vParTestInitialise( void )
{
unsigned long ul;

	/* Initalise the IO ports that drive the LEDs */
	gioSetDirection( hetPORT, 0xFFFFFFFF );

	/* Turn all the LEDs off. */
	for( ul = 0; ul < ulNumLEDs; ul++ )
	{
		gioSetBit( hetPORT, ulLEDBits[ ul ], !ulOnStates[ ul ] );
	}
}
示例#4
0
void esmHighLevelInterrupt(void)
{
    /* too indicate we are in the ESM interrupt light up the BLUE leds */

    /* Initalise the IO ports that drive the LEDs */
    gioSetDirection(hetPORT, 0xFFFFFFFF);
    /* switch all leds off */
    gioSetPort(hetPORT, 0x08110034);
    /* switch on blue leds */
    gioSetBit(hetPORT,  5, 0);
    gioSetBit(hetPORT, 27, 0);

    for(;;);
}
示例#5
0
void main(void)
{
/* USER CODE BEGIN (3) */

	// Some declarations
	unsigned int vol_num, num_trigs, trig_time, m, n;
	FILE *TMS_data_file;

	// Initialize some variables used in ISRs and initialize hardware state.
	irq_count = 0;
	train_count = 0;
	trig_in_train_count = 0;
	TMS_trig_in_progress = 0;

	// Read data from a file containing all the TMS delivery information.
    TMS_data_file = fopen("C:\\Users\\BIC\\workspace_v6_0\\Blinky\\TMS_trig_files\\TMS_trig_data","r");
    if(TMS_data_file == NULL){
      printf("\n Can't open TMS_trig_data \n");
      fflush(stdout);
      exit (1);
    }

    m = 0;
    while(fscanf(TMS_data_file, "%u %u", &vol_num, &num_trigs) != EOF){
      // Read the volume number for trigger train and the number of triggers in the train.
      TMS[m].trig_image_vol = vol_num;
      TMS[m].num_trigs_in_train = num_trigs;
      for(n=0; n<num_trigs; n++){
        fscanf(TMS_data_file, "%u", &trig_time);
        TMS[m].trig_time[n] = trig_time - TRIG_TO_TMS_PULSE_DELAY;  // Account for TMS unit delays. See TMS_scanner_synch.h
                                                                    // for more detail about this delay.

      }
      m = m + 1;
    }
    fclose(TMS_data_file);
    printf ("Ready to send triggers to TMS unit. \n");
    fflush(stdout);

	// Initialize rti, gio and associated hardware interrupts.
	rtiInit();
	gioInit();
	gioSetDirection(hetPORT1, 0xFFFFFFFF);

	/* The following line sets pins A0 and A2 of GIO PORTA to output and pin A7 of
    GIO PORTA to input. A0 is used for output to the TMS unit. A7 is used for input
	from the MRI TTL pulse. A2 controls an LED, used for testing, on the board. */
	gioSetDirection(gioPORTA, 0x00000005);

	rtiEnableNotification(rtiNOTIFICATION_COMPARE0);
	_enable_interrupt_();
	_enable_IRQ();

	// Start the rti counter.
	rtiStartCounter(rtiCOUNTER_BLOCK0);  // !!!!! Wont need this since I will be starting the counter in the gioNotification ISR
	                                     // and since the counter must be stopped before the reset done in the gioNotification ISR.

	// Initialize hardware state.
	gioSetPort(hetPORT1, 0x00000000); // Set output to D11 LED initially to low.

	// Initialize prescaler so that time units will be microseconds. Using 99 sets
	// the base frequency to 100th of the 100MHz operating frequency. See above
	// lines which set pulse_length and scanner_irq_to_gio_out_delay times.
	rtiREG1->CNT[0U].CPUCx = 99;
	//printf ("RTICPUC0: %d \n", rtiREG1->CNT[0U].CPUCx);

	while(1);

/* USER CODE END */
}