Howto set DIO on MPC-5200 Lite

Josu Onandia jonandia at aotek.es
Tue Mar 20 00:18:20 EST 2007


Some sample code. Hope this helps.

Regards

Josu Onandia

//   PSC2_0  ---->  J20 pin 2
//   PSC2_1  ---->  J20 pin 4
//   PSC2_2  ---->  J20 pin 6
//   PSC2_3  ---->  J20 pin 8
//
//   GND ---- J20 pins 15,17,19,20

static void psc2_configure_pins(void)
{
	struct mpc5xxx_gpio *gpio;
	
	gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
	
	gpio->port_config &= ~(0x00000070);
	gpio->simple_gpioe |= 0x000000F0;
	gpio->simple_ode &= ~0x000000F0;
	gpio->simple_ddr |= 0x000000F0;
}
/* PSC2   0 to 3 pins */
static inline void psc2_pin_on(int pin)
{
	struct mpc5xxx_gpio *gpio;
	
	if((pin < 0) || (pin > 3))
		return;
	gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
	gpio->simple_dvo |= (1 << (pin + 4));
}
static inline void psc2_pin_off(int pin)
{
	struct mpc5xxx_gpio *gpio;
	
	if((pin < 0) || (pin > 3))
		return;
	
	gpio = (struct mpc5xxx_gpio*) MPC5xxx_GPIO;
	
	gpio->simple_dvo &= ~ (1 << (pin + 4));
}



-----Mensaje original-----
De: linuxppc-embedded-bounces+jonandia=aotek.es at ozlabs.org en nombre de Matthias Fechner
Enviado el: lun 19/03/2007 8:31
Para: linuxppc-embedded at ozlabs.org
Asunto: Howto set DIO on MPC-5200 Lite
 
Hi,

how can I set the DIO ports from a MPC-5200 Lite?


Best regards,
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook
_______________________________________________
Linuxppc-embedded mailing list
Linuxppc-embedded at ozlabs.org
https://ozlabs.org/mailman/listinfo/linuxppc-embedded

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/ms-tnef
Size: 3239 bytes
Desc: not available
Url : http://ozlabs.org/pipermail/linuxppc-embedded/attachments/20070319/0f5bcf1f/attachment.bin 


More information about the Linuxppc-embedded mailing list