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