pio.h File Reference


Detailed Description

pio driver functions

This file contains basic pio driver functions.

Author:
Atmel Corporation: http://www.atmel.com
Support email: avr32@atmel.com
Name
Revision
1.5
RCSfile
pio.h,v
Date
2006/05/10 12:01:41

Definition in file pio.h.

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define PIO_INVALID_ARGUMENT   -1
#define PIO_SUCCESS   0

Typedefs

typedef char avr32_piomap_t [][2]

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)


Define Documentation

#define PIO_INVALID_ARGUMENT   -1

Definition at line 75 of file pio.h.

Referenced by pio_setup_pin().

#define PIO_SUCCESS   0

Definition at line 76 of file pio.h.

Referenced by pio_setup_pin().


Typedef Documentation

typedef char avr32_piomap_t[][2]

A type definitions of pins and module connectivity. First column is the pin number, the second is pio connectivity

Definition at line 73 of file pio.h.


Function Documentation

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

Parameters:
*piomap A list of pins and pio connectivity
size The number of pins in *piomap
Returns:
nothing

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 }

Here is the call graph for this function:

int pio_setup_pin ( int  pin,
int  function 
)

This function will put a single pin under a module's control

Parameters:
*pin The pin number
*function The PIO module which to enable
Returns:
PIO_SUCCESS or PIO_INVALID_ARGUMENT

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 }

Here is the call graph for this function:

volatile avr32_pio_t* pioGetHandle ( int  port  ) 

This function will return the baseaddress for a port

Parameters:
*port The port number
Returns:
The port's baseaddress

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 }


Generated on Wed May 7 16:03:17 2008 for AVR32114 Using the AVR32 LCD Controller by  doxygen 1.5.3-20071008