#include "timer.h"
Include dependency graph for timer_example1.c:

Go to the source code of this file.
Defines | |
| #define | CLEAR 2 |
| #define | CPU_HZ 20000000 |
| #define | FALSE 0 |
| #define | LED_MASK 0x000000ff |
| #define | NOOP 0 |
| #define | SET 1 |
| #define | TOGGLE 3 |
| #define | TRUE 1 |
Functions | |
| int | main (int argc, char *argv[]) |
| void | timer_delay (void) |
| #define CLEAR 2 |
Definition at line 47 of file timer_example1.c.
Referenced by init_timer_output(), and timer_delay().
| #define CPU_HZ 20000000 |
Definition at line 40 of file timer_example1.c.
| #define FALSE 0 |
Definition at line 52 of file timer_example1.c.
Referenced by init_timer_input(), init_timer_output(), and timer_delay().
| #define LED_MASK 0x000000ff |
| #define NOOP 0 |
Definition at line 45 of file timer_example1.c.
Referenced by init_timer_output(), and timer_delay().
| #define SET 1 |
Definition at line 46 of file timer_example1.c.
Referenced by init_timer_output(), and timer_delay().
| #define TOGGLE 3 |
Definition at line 48 of file timer_example1.c.
| #define TRUE 1 |
| int main | ( | int | argc, | |
| char * | argv[] | |||
| ) |
Definition at line 59 of file timer_example1.c.
00060 { 00061 00062 struct timer_waveform_opt_t waveform_opt; 00063 volatile struct avr32_pio_t *piob = &AVR32_PIOC; 00064 volatile struct avr32_pio_t *pioc = &AVR32_PIOC; /* used for leds */ 00065 00066 /* The channel number and instance is used in several functions */ 00067 /* It's defined as local variable for ease-of-use causes */ 00068 int channel = 1; 00069 int timer_instance = 1; 00070 00071 /* Enable Timer module on PIOB */ 00072 piob->pdr = 0x0003ffff; 00073 piob->asr = 0x0003ffff; 00074 00075 pioc->per = LED_MASK; /* pio enable */ 00076 pioc->oer = LED_MASK; /* output enable */ 00077 pioc->puer = LED_MASK; /* pull up enable */ 00078 pioc->ower = LED_MASK; /* direct writing to output register */ 00079 00080 /* Options for Waveform genration */ 00081 waveform_opt.channel = channel; 00082 waveform_opt.tcclks = TIMER_CLOCK_SOURCE_TC1; 00083 waveform_opt.clki = FALSE; 00084 waveform_opt.burst = FALSE; 00085 00086 waveform_opt.cpcstop = FALSE; 00087 waveform_opt.cpcdis = FALSE; 00088 waveform_opt.eevtedg = FALSE; 00089 waveform_opt.eevt = 0; 00090 waveform_opt.enetrg = FALSE; 00091 waveform_opt.wavsel = TIMER_WAVEFORM_SEL_UPDOWN_MODE; 00092 00093 waveform_opt.acpa = SET; 00094 waveform_opt.acpc = CLEAR; 00095 waveform_opt.aeevt = NOOP; 00096 waveform_opt.aswtrg = NOOP; 00097 00098 waveform_opt.bcpb = NOOP; 00099 waveform_opt.bcpc = NOOP; 00100 waveform_opt.beevt = NOOP; 00101 waveform_opt.bswtrg = NOOP; 00102 00103 /* Init the Timer */ 00104 timer_init_waveform(timer_instance, &waveform_opt); 00105 timer_write_ra(timer_instance, channel, 0x0400 ); 00106 timer_write_rb(timer_instance, channel, 0x0800 ); 00107 timer_write_rc(timer_instance, channel, 0xffff ); 00108 timer_start(timer_instance, channel); 00109 00110 while(1){ 00111 /* put the timer status out on the LEDS */ 00112 pioc->odsr = timer_read_tc(timer_instance,channel) >> 8; 00113 timer_delay(); 00114 } 00115 }
| void timer_delay | ( | void | ) |
Definition at line 117 of file timer_example1.c.
References timer_waveform_opt_t::acpa, timer_waveform_opt_t::acpc, timer_waveform_opt_t::aeevt, timer_waveform_opt_t::aswtrg, timer_waveform_opt_t::bcpb, timer_waveform_opt_t::bcpc, timer_waveform_opt_t::beevt, timer_waveform_opt_t::bswtrg, timer_waveform_opt_t::burst, timer_waveform_opt_t::channel, CLEAR, timer_waveform_opt_t::clki, timer_waveform_opt_t::cpcdis, timer_waveform_opt_t::cpcstop, timer_waveform_opt_t::eevt, timer_waveform_opt_t::eevtedg, timer_waveform_opt_t::enetrg, FALSE, LED_MASK, NOOP, SET, timer_waveform_opt_t::tcclks, TIMER_CLOCK_SOURCE_TC1, timer_init_waveform(), timer_read_tc(), timer_start(), TIMER_WAVEFORM_SEL_UPDOWN_MODE, timer_write_ra(), timer_write_rb(), timer_write_rc(), and timer_waveform_opt_t::wavsel.
00118 { 00119 unsigned long i; 00120 00121 for(i=0; i<CPU_HZ/40; i++); 00122 }
Here is the call graph for this function:

1.4.7