int main(void)
{
	// Input and output variables
	uint8_t In = 0;
	uint8_t Out = 0;

	// Initialize PLL to 80MHz
	Init_PLL(4);

	// GPIO Initialization
	SYSCTL_RCGCGPIO_R |= 0x00000020;	// Activate clock for Port F
	__asm("nop; nop; nop;");			// Three clock cycle delay for clock to start
	GPIO_PORTF_LOCK_R = GPIO_LOCK_KEY;	// Unlock GPIO Port F
	GPIO_PORTF_CR_R = 0x01;				// Allow changes to PF0
	GPIO_PORTF_DIR_R = 0x0E;			// PF4,0 in | PF3-1 out
	GPIO_PORTF_PUR_R = 0x11;			// Enable pull-up on switches
	GPIO_PORTF_DEN_R = 0x1F;			// Enable digital IO on PF4-0

	// Main While Loop
	while(1)
	{
		In = GPIO_PORTF_DATA_R & 0x10;	// Read Sw1
		In >>= 2;
		Out = GPIO_PORTF_DATA_R;
		Out = Out & 0xFB;
		GPIO_PORTF_DATA_R = Out | In;
	}
}
Beispiel #2
0
void bsp_start( void )
{
  /* BSP Hardware Initialization*/
  Init_RTC();   /* Blackfin Real Time Clock initialization */
  Init_PLL();   /* PLL initialization */
  Init_EBIU();  /* EBIU initialization */
  Init_Flags(); /* GPIO initialization */

  int i=0;
  for (i=5;i<16;i++) {
    set_vector((rtems_isr_entry)null_isr, i, 1);
  }
}
Beispiel #3
0
void bsp_start( void )
{
  /* BSP Hardware Initialization*/
  Init_RTC();   /* Blackfin Real Time Clock initialization */  
  Init_PLL();   /* PLL initialization */
  Init_EBIU();  /* EBIU initialization */
  Init_Flags(); /* GPIO initialization */

  /*
   *  Allocate the memory for the RTEMS Work Space.  This can come from
   *  a variety of places: hard coded address, malloc'ed from outside
   *  RTEMS world (e.g. simulator or primitive memory manager), or (as
   *  typically done by stock BSPs) by subtracting the required amount
   *  of work space from the last physical address on the CPU board.
   */
  int i=0;
  for (i=5;i<16;i++) {
    set_vector((rtems_isr_entry)null_isr, i, 1);
  }
  
}
int main(void)
{	
	
	SECTORLOCATION *pSectorInfo;
    ERROR_CODE Result;							// result
	
    Init_PLL();
	
    // setup the device so the DSP can access it
	if (SetupForFlash() != NO_ERR)
		return FALSE;
		
    /* open flash driver */
	AFP_Error = m29w320_Open();
	
	// get flash manufacturer & device codes, title & desc
	if( AFP_Error == NO_ERR )
	{
		AFP_Error = GetFlashInfo();
	}

	// get the number of sectors for this device
	if( AFP_Error == NO_ERR )
	{
		AFP_Error = GetNumSectors();
	}

	if( AFP_Error == NO_ERR )
	{
		// malloc enough space to hold our start and end offsets
		pSectorInfo = (SECTORLOCATION *)malloc(AFP_NumSectors * sizeof(SECTORLOCATION));
	}

	// allocate AFP_Buffer
	if( AFP_Error == NO_ERR )
	{
		AFP_Error = AllocateAFPBuffer();
	}

	// get sector map
	if( AFP_Error == NO_ERR )
	{
		AFP_Error = GetSectorMap(pSectorInfo);
	}

	// point AFP_SectorInfo to our sector info structure
	if( AFP_Error == NO_ERR )
	{
		AFP_SectorInfo = (int*)pSectorInfo;
	}

	// command processing loop
	while ( !bExit )
	{
		// the plug-in will set a breakpoint at "AFP_BreakReady" so it knows
		// when we are ready for a new command because the DSP will halt
		//
		// the jump is used so that the label will be part of the debug
		// information in the driver image otherwise it may be left out
 		// since the label is not referenced anywhere
		asm("AFP_BreakReady:");
       		asm("nop;");
			if ( FALSE )
				asm("jump AFP_BreakReady;");

		// Make a call to the ProcessCommand
		   AFP_Error = ProcessCommand();
	} 

	// Clear the AFP_Buffer
	FreeAFPBuffer();
	
	if( pSectorInfo )
	{
		free(pSectorInfo);
		pSectorInfo = NULL;
	}

	// Close the Device
	AFP_Error = m29w320_Close();

	if (AFP_Error != NO_ERR)
		return FALSE;

	return TRUE;
}