Esempio n. 1
0
//----------------------------------------------------
// MAIN FUNCTION
//----------------------------------------------------
int main (void)
{

  printf("Animation Test\n\r");
  int status;
  char c;
  //----------------------------------------------------
  // INITIALIZE THE PERIPHERALS & SET DIRECTIONS OF GPIO
  //----------------------------------------------------
  // Initialize Push Buttons
  status = XGpio_Initialize(&BTNInst, BTNS_DEVICE_ID);
  if(status != XST_SUCCESS) return XST_FAILURE;

  // Set all buttons direction to inputs
  XGpio_SetDataDirection(&BTNInst, 1, 0xFF);

  //----------------------------------------------------
  // SETUP THE TIMER
  //----------------------------------------------------
  status = XTmrCtr_Initialize(&TMRInst, TMR_DEVICE_ID);
  if(status != XST_SUCCESS) return XST_FAILURE;
  XTmrCtr_SetHandler(&TMRInst, TMR_Intr_Handler, &TMRInst);
  XTmrCtr_SetOptions(&TMRInst, 0, XTC_INT_MODE_OPTION | XTC_AUTO_RELOAD_OPTION);
  XTmrCtr_SetResetValue(&TMRInst, 0, TMR_LOAD);
  XTmrCtr_Start(&TMRInst,0);


  // Initialize interrupt controller
  status = IntcInitFunction(INTC_DEVICE_ID, &TMRInst, &BTNInst,&DmaInstance);
  if(status != XST_SUCCESS) return XST_FAILURE;

  //Lab7 addition starts  here
  //Initialize DMA controller
 // XDma_Config(DMA_DEVICE_ID);
  //Lab7 addition ends  here
  while(1){
// Infinite loop - Do nothing
       }

  // Never reached on normal execution
  return (0);
  }
Esempio n. 2
0
int main(void){
	// Initialize SpeedInst, SteeringInst, SpeeddutyInst, SteeringdutyInst, MuxInst;
	int status;
	  status = XGpio_Initialize(&SpeedInst, SPEED_DEVICE_ID);
	  if(status != XST_SUCCESS) return XST_FAILURE;
	  
	  status = XGpio_Initialize(&SteeringInst, STEERING_DEVICE_ID);
	  if(status != XST_SUCCESS) return XST_FAILURE;
	  
	  status = XGpio_Initialize(&SpeeddutyInst, SPEEDDUTY_DEVICE_ID);
	  if(status != XST_SUCCESS) return XST_FAILURE;
	  
	  status = XGpio_Initialize(&SteeringdutyInst, STEERINGDUTY_DEVICE_ID);
	  if(status != XST_SUCCESS) return XST_FAILURE;
	  
	  status = XGpio_Initialize(&MuxInst, MUX_DEVICE_ID);
	  if(status != XST_SUCCESS) return XST_FAILURE;

	  // Set GPIO data directions
	  XGpio_SetDataDirection(&SpeedInst, 1, 0xFF);
	  
	  XGpio_SetDataDirection(&SteeringInst, 1, 0xFF);
	  
	  XGpio_SetDataDirection(&SpeeddutyInst, 1, 0x00);
	  
	  XGpio_SetDataDirection(&SteeringdutyInst, 1, 0x00);
	  
	  XGpio_SetDataDirection(&MuxInst, 1, 0x00);		
		
	  // Initialize interrupt controller
	  status = IntcInitFunction(INTC_DEVICE_ID, &SwitchInst);
	  if(status != XST_SUCCESS) return XST_FAILURE;

	// Code to control the car to drive from the remote and sample speed/steering duty cycles
	while (1){
		 XGpio_DiscreteWrite(&MuxInst, 1, 0);
	}

	return 0;
}