This file contains basic pio driver functions.
Definition in file pio.c.
#include "pio.h"
Go to the source code of this file.
Functions | |
| void | pio_enable_module (avr32_piomap_t piomap, int size) |
| int | pio_setup_pin (int pin, int function) |
| volatile avr32_pio_t * | pioGetHandle (int port) |
| void pio_enable_module | ( | avr32_piomap_t | piomap, | |
| int | size | |||
| ) |
This function will enable a module pin for a given set of pins and respective modules
| *piomap | A list of pins and pio connectivity | |
| size | The number of pins in *piomap |
Definition at line 102 of file pio.c.
References pio_setup_pin().
Referenced by init_spiMaster(), init_uart_a(), lcd_pio_config(), and lcdc_pio_config().
00103 { 00104 int i; 00105 00106 for(i=0; i<size; i++){ 00107 pio_setup_pin(**piomap, *(*piomap+1) ); 00108 piomap++; 00109 } 00110 }
| int pio_setup_pin | ( | int | pin, | |
| int | function | |||
| ) |
This function will put a single pin under a module's control
| *pin | The pin number | |
| *function | The PIO module which to enable |
Definition at line 79 of file pio.c.
References PIO_INVALID_ARGUMENT, PIO_SUCCESS, and pioGetHandle().
Referenced by pio_enable_module().
00080 { 00081 volatile avr32_pio_t *pio = pioGetHandle(pin/32); 00082 00083 00084 /* Disable pio control */ 00085 pio->pdr |= (1<<(pin%32)); 00086 pio->pudr |= (1<<(pin%32)); 00087 00088 /* Enable the correct function */ 00089 switch(function){ 00090 case 0: 00091 pio->asr |= (1<<(pin%32)); 00092 break; 00093 case 1: 00094 pio->bsr |= (1<<(pin%32)); 00095 break; 00096 default: 00097 return PIO_INVALID_ARGUMENT; 00098 } 00099 return PIO_SUCCESS; 00100 }
| volatile avr32_pio_t* pioGetHandle | ( | int | port | ) |
This function will return the baseaddress for a port
| *port | The port number |
Definition at line 60 of file pio.c.
Referenced by pio_setup_pin().
00061 { 00062 switch (port) { 00063 case 0: 00064 return &AVR32_PIOA; 00065 case 1: 00066 return &AVR32_PIOB; 00067 case 2: 00068 return &AVR32_PIOC; 00069 case 3: 00070 return &AVR32_PIOD; 00071 case 4: 00072 return &AVR32_PIOE; 00073 default : 00074 break; 00075 } 00076 return (avr32_pio_t *) -1; 00077 }
1.5.3-20071008