pio.h File Reference

#include <avr32/io.h>
#include "pio.h"

Include dependency graph for 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

int pio_disable_module (avr32_piomap_t piomap, int size)
int pio_disable_pio_pin (int pin)
int pio_enable_module (avr32_piomap_t piomap, int size)
int pio_enable_module_pin (int pin, int function)
int pio_enable_pio (avr32_piomap_t piomap, int size)
int pio_enable_pio_pin (int pin)
int pioGetHandle (int port)


Define Documentation

#define PIO_INVALID_ARGUMENT   -1

Definition at line 8 of file pio.h.

Referenced by pio_enable_module_pin(), pioGetHandle(), and rgb_leds().

#define PIO_SUCCESS   0

Definition at line 9 of file pio.h.

Referenced by pio_disable_module(), pio_disable_pio_pin(), pio_enable_module(), pio_enable_module_pin(), pio_enable_pio(), and pio_enable_pio_pin().


Typedef Documentation

typedef char avr32_piomap_t[][2]

Definition at line 6 of file pio.h.


Function Documentation

int pio_disable_module ( avr32_piomap_t  piomap,
int  size 
)

Definition at line 81 of file pio.c.

References pio_disable_pio_pin(), and PIO_SUCCESS.

00082 {
00083         int i,status=PIO_SUCCESS;
00084 
00085         for(i=0; i<size; i++){
00086                         status |= pio_disable_pio_pin(**piomap);
00087                         piomap++;
00088         }
00089 
00090         return status;
00091 }

Here is the call graph for this function:

int pio_disable_pio_pin ( int  pin  ) 

Definition at line 93 of file pio.c.

References PIO_SUCCESS, and pioGetHandle().

Referenced by pio_disable_module().

00094 {
00095         avr32_pio_t *pio = (void *) pioGetHandle(pin/32);
00096 
00097         pio->pdr |= (1<<(pin%32));
00098 
00099         return PIO_SUCCESS;
00100 }

Here is the call graph for this function:

int pio_enable_module ( avr32_piomap_t  piomap,
int  size 
)

Definition at line 22 of file pio.c.

References pio_enable_module_pin(), and PIO_SUCCESS.

00023 {
00024         int i,status=PIO_SUCCESS;
00025 
00026         for(i=0; i<size; i++){
00027                         status |= pio_enable_module_pin(**piomap, *(*piomap+1) );
00028                         piomap++;
00029         }
00030 
00031         return status;
00032 }

Here is the call graph for this function:

int pio_enable_module_pin ( int  pin,
int  function 
)

Definition at line 34 of file pio.c.

References PIO_INVALID_ARGUMENT, PIO_SUCCESS, and pioGetHandle().

Referenced by pio_enable_module().

00035 {
00036         avr32_pio_t *pio = (void *) pioGetHandle(pin/32);
00037 
00038 
00039         /* Disable pio control */
00040         pio->pdr |= (1<<(pin%32));
00041 
00042         /* Enable the correct function */
00043         switch(function){
00044                 case 0:
00045                         pio->asr |= (1<<(pin%32));
00046                         break;
00047                 case 1:
00048                         pio->bsr |= (1<<(pin%32));
00049                         break;
00050                 default:
00051                         return PIO_INVALID_ARGUMENT;
00052         }
00053         return PIO_SUCCESS;
00054 }

Here is the call graph for this function:

int pio_enable_pio ( avr32_piomap_t  piomap,
int  size 
)

Definition at line 58 of file pio.c.

References pio_enable_pio_pin(), and PIO_SUCCESS.

00059 {
00060         int i,status=PIO_SUCCESS;
00061 
00062         for(i=0; i<size; i++){
00063                         status |= pio_enable_pio_pin(**piomap);
00064                         piomap++;
00065         }
00066 
00067         return status;
00068 }

Here is the call graph for this function:

int pio_enable_pio_pin ( int  pin  ) 

Definition at line 70 of file pio.c.

References PIO_SUCCESS, and pioGetHandle().

Referenced by pio_enable_pio().

00071 {
00072         avr32_pio_t *pio = (void *) pioGetHandle(pin/32);
00073 
00074         pio->per |= (1<<(pin%32));
00075 
00076         return PIO_SUCCESS;
00077 }

Here is the call graph for this function:

int pioGetHandle ( int  port  ) 

Definition at line 3 of file pio.c.

References PIO_INVALID_ARGUMENT.

Referenced by pio_disable_pio_pin(), pio_enable_module_pin(), and pio_enable_pio_pin().

00004 {
00005         switch (port) {
00006                 case 0:
00007                         return AVR32_PIOA_ADDRESS;
00008                 case 1:
00009                         return AVR32_PIOB_ADDRESS;
00010                 case 2:
00011                         return AVR32_PIOC_ADDRESS;
00012                 case 3:
00013                         return AVR32_PIOD_ADDRESS;
00014                 case 4:
00015                         return AVR32_PIOE_ADDRESS;
00016                 default :
00017                         break;
00018         }
00019         return PIO_INVALID_ARGUMENT;
00020 }


Generated on Thu May 10 14:14:48 2007 for AVR321000 Communication with the AVR32 USART by  doxygen 1.5.1