print_funcs.h File Reference

#include "../usart/usart.h"
#include <avr32/ap7000.h>

Include dependency graph for print_funcs.h:

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

Go to the source code of this file.

Functions

void init_dbg_rs232 (long cpu_hz)
int print (volatile avr32_usart_t *usart, char *str)
int print_char (volatile avr32_usart_t *usart, int c)
void print_dbg (char *str)
void print_dbg_hex (unsigned long n)
void print_dbg_ulong (unsigned long n)
void print_hex (volatile avr32_usart_t *usart, unsigned long n)
void print_ulong (volatile avr32_usart_t *usart, unsigned long n)


Function Documentation

void init_dbg_rs232 ( long  cpu_hz  ) 

Definition at line 3 of file print_funcs.c.

References usart_options_t::baudrate, usart_options_t::channelmode, usart_options_t::charlength, usart_options_t::paritytype, usart_options_t::stopbits, usart0, USART_1_STOPBIT, usart_init_rs232(), USART_NO_PARITY, and USART_NORMAL_CHMODE.

00004 {
00005         struct usart_options_t usart_opt;
00006 
00007         avr32_pio_t *pio = (void *) AVR32_PIOB_ADDRESS;
00008         avr32_usart_t *usart0 = (void *) AVR32_USART0_ADDRESS;
00009 
00010         /* Set correct PIO for USART0*/
00011         pio->pdr = 0x00000300;
00012         pio->asr = 0x00000300;
00013 
00014         /* Options for USART debugging */
00015         usart_opt.baudrate = 115200;
00016         usart_opt.charlength = 8;
00017         usart_opt.paritytype = USART_NO_PARITY;
00018         usart_opt.stopbits = USART_1_STOPBIT;
00019         usart_opt.channelmode = USART_NORMAL_CHMODE;
00020 
00021         /* Initialize it in RS232 mode */
00022         usart_init_rs232(usart0, &usart_opt, cpu_hz);
00023 }

Here is the call graph for this function:

int print ( volatile avr32_usart_t *  usart,
char *  str 
)

Definition at line 43 of file print_funcs.c.

References usart_putchar().

00044 {
00045         while (*str != '\0')
00046                 usart_putchar(usart, *str++);
00047         return 0;
00048 }

Here is the call graph for this function:

int print_char ( volatile avr32_usart_t *  usart,
int  c 
)

Definition at line 50 of file print_funcs.c.

References usart_putchar().

Referenced by usart_int_handler().

00051 {
00052         usart_putchar(usart, c);
00053         return 0;
00054 }

Here is the call graph for this function:

void print_dbg ( char *  str  ) 

Definition at line 25 of file print_funcs.c.

References print(), and usart0.

00026 {
00027         avr32_usart_t *usart0 = (void *) AVR32_USART0_ADDRESS;
00028         print(usart0, str);
00029 }

Here is the call graph for this function:

void print_dbg_hex ( unsigned long  n  ) 

Definition at line 37 of file print_funcs.c.

References print_hex(), and usart0.

00038 {
00039         avr32_usart_t *usart0 = (void *) AVR32_USART0_ADDRESS;
00040         print_hex(usart0, n);
00041 }

Here is the call graph for this function:

void print_dbg_ulong ( unsigned long  n  ) 

Definition at line 31 of file print_funcs.c.

References print_ulong(), and usart0.

00032 {
00033         avr32_usart_t *usart0 = (void *) AVR32_USART0_ADDRESS;
00034         print_ulong(usart0, n);
00035 }

Here is the call graph for this function:

void print_hex ( volatile avr32_usart_t *  usart,
unsigned long  n 
)

Definition at line 71 of file print_funcs.c.

References print().

Referenced by print_dbg_hex(), and usart_int_handler().

00072 {
00073   char tmp[9];
00074   int i;
00075 
00076   for (i = 0; i < 8; i++) {
00077     unsigned long nibble;
00078 
00079     nibble = (n >> (28 - 4 * i)) & 0xf;
00080     if (nibble < 10)
00081       tmp[i] = nibble + '0';
00082     else
00083       tmp[i] = nibble - 10 + 'a';
00084   }
00085   tmp[8] = 0;
00086 
00087   print(usart, tmp);
00088 }

Here is the call graph for this function:

void print_ulong ( volatile avr32_usart_t *  usart,
unsigned long  n 
)

Definition at line 57 of file print_funcs.c.

References print().

Referenced by print_dbg_ulong(), and print_pm_stats().

00058 {
00059   char tmp[16];
00060   int i = sizeof(tmp) - 1;
00061 
00062   tmp[i] = 0;
00063   do {
00064     tmp[--i] = (n % 10) + '0';
00065     n /= 10;
00066   } while (n);
00067 
00068   print(usart, tmp + i);
00069 }

Here is the call graph for this function:


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