#include <avr32/io.h>
#include <sys/interrupts.h>
#include "usart.h"
#include "../pio/pio.h"
#include "../debug/print_funcs.h"
#include "../inc/macro.h"
#include "../power_manager/pm.h"
#include "../running_lights/running_lights.h"
#include <avr32/intc.h>
Include dependency graph for usart_backup.c:
Go to the source code of this file.
Functions | |
| int | main (void) |
| void | set_irq_handler (void *) |
| __int_handler * | usart_endrx () |
| __int_handler * | usart_endtx () |
| __int_handler * | usart_rxbrk () |
| __int_handler * | usart_rxbuff () |
| __int_handler * | usart_rxrdy () |
| __int_handler * | usart_txbfe () |
| __int_handler * | usart_txrdy () |
| int main | ( | void | ) |
Definition at line 69 of file usart_backup.c.
References usart_options_t::baudrate, usart_options_t::channelmode, usart_options_t::charlength, usart_options_t::paritytype, usart_options_t::stopbits, USART_1_STOPBIT, usart_init_rs232(), USART_NO_PARITY, USART_NORMAL_CHMODE, and usart_rxrdy().
00070 { 00071 int cpu_hz = 20000000; 00072 struct usart_options_t opt; 00073 00074 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00075 00076 avr32_piomap_t usart0_piomap = { \ 00077 {AVR32_USART0_RXD_0_PIN, AVR32_USART0_RXD_0_FUNCTION}, \ 00078 {AVR32_USART0_TXD_0_PIN, AVR32_USART0_TXD_0_FUNCTION}, \ 00079 {AVR32_USART0_CLK_0_PIN, AVR32_USART0_CLK_0_FUNCTION}, \ 00080 {AVR32_USART0_CTS_0_PIN, AVR32_USART0_CTS_0_FUNCTION}, \ 00081 {AVR32_USART0_RTS_0_PIN, AVR32_USART0_RTS_0_FUNCTION} \ 00082 }; 00083 00084 /* Set 12 MHz clock */ 00085 00086 00087 00088 /* Set options for the USART */ 00089 opt.baudrate = 19200; 00090 opt.charlength = 8; 00091 opt.paritytype = USART_NO_PARITY; 00092 opt.stopbits = USART_1_STOPBIT; 00093 opt.channelmode = USART_NORMAL_CHMODE; 00094 00095 /* Initialize it in RS232 mode */ 00096 usart_init_rs232(usart, &opt, cpu_hz); 00097 00098 /* Setup pio for USART */ 00099 pio_setup_port(usart0_piomap, 2); 00100 00101 /* Setup interrupts */ 00102 set_interrupts_base( (void *) AVR32_INTC_ADDRESS ); 00103 init_interrupts(); 00104 /* Add handlers here */ 00105 register_interrupt( (__int_handler) (usart_rxrdy), AVR32_USART0_IRQ/32, AVR32_USART0_IRQ % 32, INT0); 00106 00107 /* Enable usasrt interrupts here */ 00108 usart->ier = 0x00FFffff; 00109 // (1<<INT_RXRDY) | (1<<INT_TXRDY) | (1<<INT_RXBRK) | (1<<INT_ENDRX) | (1<<INT_ENDTX) | (1<<INT_TXBUFE) | (1<<INT_RXBUFF); 00110 00111 while(1); 00112 00113 return 42; 00114 }
Here is the call graph for this function:
| void set_irq_handler | ( | void * | ) |
| __int_handler* usart_endrx | ( | ) |
Definition at line 40 of file usart_backup.c.
References print().
00041 { 00042 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00043 print(usart, "ENDRX interrupt\n\r"); 00044 return (void *) AVR32_RAR_SUP; 00045 }
Here is the call graph for this function:
| __int_handler* usart_endtx | ( | ) |
Definition at line 47 of file usart_backup.c.
References print().
00048 { 00049 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00050 print(usart, "ENDTX interrupt\n\r"); 00051 return (void *) AVR32_RAR_SUP; 00052 }
Here is the call graph for this function:
| __int_handler* usart_rxbrk | ( | ) |
Definition at line 33 of file usart_backup.c.
References print().
00034 { 00035 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00036 print(usart, "RXBRK interrupt\n\r"); 00037 return (void *) AVR32_RAR_SUP; 00038 }
Here is the call graph for this function:
| __int_handler* usart_rxbuff | ( | ) |
Definition at line 61 of file usart_backup.c.
References print().
00062 { 00063 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00064 print(usart, "RXBUFF interrupt\n\r"); 00065 return (void *) AVR32_RAR_SUP; 00066 }
Here is the call graph for this function:
| __int_handler* usart_rxrdy | ( | ) |
Definition at line 17 of file usart_backup.c.
References print().
Referenced by main().
00018 { 00019 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00020 // usart_write_char( usart, usart_getchar(usart) ); 00021 print(usart, "RXRDY interrupt\n\r"); 00022 // print_ulong(usart,pm_read_mclk() ); 00023 return (void *) AVR32_RAR_SUP; 00024 }
Here is the call graph for this function:
| __int_handler* usart_txbfe | ( | ) |
Definition at line 54 of file usart_backup.c.
References print().
00055 { 00056 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00057 print(usart, "TXBUFE interrupt\n\r"); 00058 return (void *) AVR32_RAR_SUP; 00059 }
Here is the call graph for this function:
| __int_handler* usart_txrdy | ( | ) |
Definition at line 26 of file usart_backup.c.
References print().
00027 { 00028 volatile avr32_usart_t * usart = (void *) AVR32_USART0_ADDRESS; 00029 print(usart, "TXRDY interrupt\n\r"); 00030 return (void *) AVR32_RAR_SUP; 00031 }
Here is the call graph for this function:
1.5.1