annotate gcc/testsuite/gcc.c-torture/compile/20090907-1.c @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 struct platform_device;
kono
parents:
diff changeset
2 typedef unsigned long __kernel_size_t;
kono
parents:
diff changeset
3 typedef unsigned short __u16;
kono
parents:
diff changeset
4 typedef unsigned int __u32;
kono
parents:
diff changeset
5 typedef unsigned char u8;
kono
parents:
diff changeset
6 typedef unsigned short u16;
kono
parents:
diff changeset
7 typedef __kernel_size_t size_t;
kono
parents:
diff changeset
8 typedef __u32 uint32_t;
kono
parents:
diff changeset
9 static inline __attribute__ ((always_inline))
kono
parents:
diff changeset
10 uint32_t __attribute__ ((pure)) bfin_dspid (void)
kono
parents:
diff changeset
11 {
kono
parents:
diff changeset
12 return ( {
kono
parents:
diff changeset
13 uint32_t __v; __v;}
kono
parents:
diff changeset
14 );
kono
parents:
diff changeset
15 }
kono
parents:
diff changeset
16 struct list_head {
kono
parents:
diff changeset
17 struct list_head *next, *prev;
kono
parents:
diff changeset
18 };
kono
parents:
diff changeset
19 struct page {
kono
parents:
diff changeset
20 union {
kono
parents:
diff changeset
21 };
kono
parents:
diff changeset
22 struct list_head lru;
kono
parents:
diff changeset
23 };
kono
parents:
diff changeset
24 struct device_driver {
kono
parents:
diff changeset
25 const char *name;
kono
parents:
diff changeset
26 struct module *owner;
kono
parents:
diff changeset
27 };
kono
parents:
diff changeset
28 struct fb_info {
kono
parents:
diff changeset
29 struct device *dev;
kono
parents:
diff changeset
30 };
kono
parents:
diff changeset
31 struct platform_driver {
kono
parents:
diff changeset
32 int (*probe) (struct platform_device *);
kono
parents:
diff changeset
33 int (*remove) (struct platform_device *);
kono
parents:
diff changeset
34 struct device_driver driver;
kono
parents:
diff changeset
35 };
kono
parents:
diff changeset
36 struct firmware {
kono
parents:
diff changeset
37 size_t size;
kono
parents:
diff changeset
38 const u8 *data;
kono
parents:
diff changeset
39 };
kono
parents:
diff changeset
40 struct metronomefb_par {
kono
parents:
diff changeset
41 struct fb_info *info;
kono
parents:
diff changeset
42 };
kono
parents:
diff changeset
43 struct waveform_hdr {
kono
parents:
diff changeset
44 u8 trc;
kono
parents:
diff changeset
45 };
kono
parents:
diff changeset
46 static u8 calc_cksum (int start, int end, u8 * mem)
kono
parents:
diff changeset
47 {
kono
parents:
diff changeset
48 u8 tmp = 0;
kono
parents:
diff changeset
49 int i;
kono
parents:
diff changeset
50 for (i = start; i < end; i++)
kono
parents:
diff changeset
51 tmp += mem[i];
kono
parents:
diff changeset
52 return tmp;
kono
parents:
diff changeset
53 }
kono
parents:
diff changeset
54 extern struct waveform_hdr *wfm_hdr;
kono
parents:
diff changeset
55 extern int wmta;
kono
parents:
diff changeset
56
kono
parents:
diff changeset
57 static int
kono
parents:
diff changeset
58 load_waveform (u8 * mem, size_t size, int m, int t, struct metronomefb_par *par)
kono
parents:
diff changeset
59 {
kono
parents:
diff changeset
60 int tta;
kono
parents:
diff changeset
61 int trn = 0;
kono
parents:
diff changeset
62 int i;
kono
parents:
diff changeset
63 u8 cksum;
kono
parents:
diff changeset
64 int cksum_idx;
kono
parents:
diff changeset
65 struct device *dev = par->info->dev;
kono
parents:
diff changeset
66 for (i = 0; i <= sizeof (*wfm_hdr) + wfm_hdr->trc; i++) {
kono
parents:
diff changeset
67 if (mem[i] > t) {
kono
parents:
diff changeset
68 trn = i - sizeof (*wfm_hdr) - 1;
kono
parents:
diff changeset
69 }
kono
parents:
diff changeset
70 }
kono
parents:
diff changeset
71 tta = * (mem + wmta + m * 4) & 0x00FFFFFF;
kono
parents:
diff changeset
72 cksum_idx = tta + trn * 4 + 3;
kono
parents:
diff changeset
73 cksum = calc_cksum (cksum_idx - 3, cksum_idx, mem);
kono
parents:
diff changeset
74 if (cksum != mem[cksum_idx]) {
kono
parents:
diff changeset
75 abort();
kono
parents:
diff changeset
76 }
kono
parents:
diff changeset
77 }
kono
parents:
diff changeset
78 extern struct firmware *fw_entry;
kono
parents:
diff changeset
79 extern struct metronomefb_par *par;
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 int metronomefb_probe (struct platform_device *dev)
kono
parents:
diff changeset
82 {
kono
parents:
diff changeset
83 return load_waveform ((u8 *) fw_entry->data, fw_entry->size, 3, 31, par);
kono
parents:
diff changeset
84 }