~ubuntu-branches/ubuntu/karmic/avr-libc/karmic

« back to all changes in this revision

Viewing changes to tests/simulate/regression/bug-31644.c

  • Committer: Bazaar Package Importer
  • Author(s): Hakan Ardo
  • Date: 2008-08-10 09:59:16 UTC
  • mfrom: (1.1.7 upstream) (4.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080810095916-wwyigh3vt0e9s7ud
Tags: 1:1.6.2.cvs20080610-2
Added build-depends on texlive-extra-utils (closes: #493454)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GCC bug #31644: [avr] can't find a register in class 'BASE_POINTER_REGS'
 
2
   while reloading 'asm'
 
3
   This is compile-time bug.
 
4
   $Id: bug-31644.c,v 1.1.2.2 2008/03/08 22:37:57 dmix Exp $    */
 
5
 
 
6
#ifndef __AVR__
 
7
int main ()     { return 0; }
 
8
#else
 
9
 
 
10
#include <avr/eeprom.h>
 
11
 
 
12
uint8_t pwm_tab_1[126];
 
13
 
 
14
static uint16_t ee_chan_1_min EEMEM = 140,
 
15
    ee_chan_1_cent EEMEM = 188,
 
16
    ee_chan_1_max EEMEM = 240,
 
17
    ee_chan_1_forw_min EEMEM = 20,
 
18
    ee_chan_1_forw_max EEMEM = 90,
 
19
    ee_chan_1_back_max EEMEM = 80;
 
20
 
 
21
void fill_pwm_table(int8_t chan_num,
 
22
                    uint8_t pwm[],
 
23
                    int16_t forward_max,
 
24
                    int16_t center,
 
25
                    int16_t reverse_min,
 
26
                    int16_t forward_high,
 
27
                    int16_t forward_low,
 
28
                    int16_t reverse_high)
 
29
{
 
30
    pwm[0] = chan_num;
 
31
    pwm[1] = forward_max;
 
32
    pwm[2] = center;
 
33
    pwm[3] = reverse_min;
 
34
    pwm[4] = forward_high;
 
35
    pwm[5] = forward_low;
 
36
    pwm[6] = reverse_high;
 
37
}
 
38
 
 
39
void build_pwm_table (void)
 
40
{
 
41
    int16_t center_1,
 
42
            forward_max_1,
 
43
            reverse_min_1,
 
44
            forward_high_1,
 
45
            forward_low_1,
 
46
            reverse_high_1;
 
47
 
 
48
    center_1 = eeprom_read_word (&ee_chan_1_cent);
 
49
 
 
50
    forward_max_1 = eeprom_read_word (&ee_chan_1_max);
 
51
    reverse_min_1 = eeprom_read_word (&ee_chan_1_min);
 
52
    forward_high_1 = eeprom_read_word (&ee_chan_1_forw_max);
 
53
    forward_low_1 = eeprom_read_word (&ee_chan_1_forw_min);
 
54
    reverse_high_1 = eeprom_read_word (&ee_chan_1_back_max);
 
55
 
 
56
    fill_pwm_table (1, pwm_tab_1, forward_max_1, center_1,
 
57
                    reverse_min_1,
 
58
                    forward_high_1, forward_low_1, reverse_high_1);
 
59
 
 
60
    fill_pwm_table (1, pwm_tab_1, forward_max_1, center_1,
 
61
                    reverse_min_1,
 
62
                    forward_high_1, forward_low_1, reverse_high_1);
 
63
}
 
64
 
 
65
int main ()
 
66
{
 
67
    build_pwm_table ();
 
68
    return 0;
 
69
}
 
70
#endif