www.pudn.com > TMS320F2812_SCI.rar > F2812_GPIO.c


 
#include "F2812_GPIO.h" 
//--------------------------------------------------------------------------- 
// InitGpio:  
//--------------------------------------------------------------------------- 
// This function initializes the Gpio to a known state. 
 
 
#if PERIPHERAL == F2812_GPIO 
 
void GPIOinit(void) 
{ 
	 
// Set GPIO A port pins,AL(Bits 7:0)(input)-AH(Bits 15:8) (output) 8bits 
// Input Qualifier =0, none 
     asm(" EALLOW"); 
      
     GpioMuxRegs.GPAMUX.all=0x0000;      
     GpioMuxRegs.GPADIR.all=0xFFFF;    	// as output 
     GpioMuxRegs.GPAQUAL.all=0x0000;	// Input qualifier disabled 
 
     GpioMuxRegs.GPBMUX.all=0x0000;      
     GpioMuxRegs.GPBDIR.all=0xFFFF;    	// as output 
     GpioMuxRegs.GPBQUAL.all=0x0000;	// Input qualifier disabled 
     
     GpioMuxRegs.GPDMUX.all=0x0000;      
     GpioMuxRegs.GPDDIR.all=0xFFFF;    	// as output 
     GpioMuxRegs.GPDQUAL.all=0x0000;	// Input qualifier disabled 
      
     GpioMuxRegs.GPEMUX.all=0x0000;      
     GpioMuxRegs.GPEDIR.all=0xFFFF;    	// as output 
     GpioMuxRegs.GPEQUAL.all=0x0000;	// Input qualifier disabled 
      
     GpioMuxRegs.GPFMUX.all=0x0000;      
     GpioMuxRegs.GPFDIR.all=0xFFFF;    	// as output 
     
     GpioMuxRegs.GPGMUX.all=0x0000;      
     GpioMuxRegs.GPGDIR.all=0xFFFF;    	// as output 
	 
     asm(" EDIS"); 
} 
 
//#elif PERIPHERAL == F2812_NOTGPIO 
#else 
void GPIOInit(void) 
{ 
 
// Set GPIO A port pins,AL(Bits 7:0)(input)-AH(Bits 15:8) (output) 8bits 
// Input Qualifier =0, none 
     asm(" EALLOW"); 
     GpioMuxRegs.GPAMUX.all=0x0000;      
     GpioMuxRegs.GPADIR.all=0xFF00;    	// upper byte as output/low byte as input 
     GpioMuxRegs.GPAQUAL.all=0x0000;	// Input qualifier disabled 
 
// Set GPIO B port pins, configured as EVB signals 
// Input Qualifier =0, none 
// Set bits to 1 to configure peripherals signals on the pins 
     GpioMuxRegs.GPBMUX.all=0xFFFF;    
     GpioMuxRegs.GPBQUAL.all=0x0000;	// Input qualifier disabled 
      
//set GPIO F port pins,configured as scia & spi 
	 GpioMuxRegs.GPFMUX.all=0x003f; 
	 
//set GPIO g port pins,configured as scib 
     GpioMuxRegs.GPGMUX.all=0x0030; 
	 
     asm(" EDIS"); 
 
} 
 
#endif