Subversion Repositories Kolibri OS

Rev

Rev 1412 | Rev 5270 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1412 serge 1
 
2
#include 
3
#include 
4
#include 
5
6
 
7
extern struct builtin_fw __end_builtin_fw[];
8
9
 
10
   drivers which would benefit from using separate records which are
11
   longer than that, so we extend to 16 bits of length */
12
struct ihex_binrec {
13
    __be32      addr;
14
    __be16      len;
15
    uint8_t     data[0];
16
} __attribute__((packed));
17
18
 
19
static inline const struct ihex_binrec *
20
ihex_next_binrec(const struct ihex_binrec *rec)
21
{
22
    int next = ((be16_to_cpu(rec->len) + 5) & ~3) - 2;
23
    rec = (void *)&rec->data[next];
24
25
 
26
}
27
28
 
29
request_firmware(const struct firmware **firmware_p, const char *name,
30
                 struct device *device)
31
{
32
33
 
34
    struct builtin_fw *builtin;
35
    const struct ihex_binrec *rec;
36
    unsigned int size;
37
38
 
39
40
 
41
        return -EINVAL;
42
43
 
44
    if (!firmware) {
45
        dbgprintf("%s: kmalloc(struct firmware) failed\n", __func__);
46
        return  -ENOMEM;
47
    }
48
49
 
50
         builtin++)
51
    {
52
        uint8_t  *pfw;
53
54
 
55
            continue;
56
        dbgprintf("firmware: using built-in firmware %s\n", name);
57
58
 
1413 serge 59
        size = 0;
1412 serge 60
        for (rec = (const struct ihex_binrec *)builtin->data;
61
             rec; rec = ihex_next_binrec(rec))
62
        {
63
            size += be16_to_cpu(rec->len);
64
        }
65
        dbgprintf("firmware size %d\n", size);
66
67
 
68
            return -EINVAL;
69
70
 
71
 
72
73
 
74
            return -ENOMEM;
75
76
 
77
        firmware->data = pfw;
78
79
 
80
             rec; rec = ihex_next_binrec(rec))
81
        {
82
            unsigned int src_size;
83
84
 
85
            memcpy(pfw, rec->data, src_size);
86
            pfw+= src_size;
87
        };
88
#else
1413 serge 89
        dbgprintf("firmware size %d\n", builtin->size);
90
91
 
92
        firmware->data = builtin->data;
93
#endif
94
        return 0;
1412 serge 95
    }
96
97
 
98
    *firmware_p = NULL;
99
100
 
101
};
102
103
 
104
release_firmware(const struct firmware *fw)
105
{
106
    if (fw) {
107
        kfree((void*)fw);
108
    }
109
}
110
111
 
112
platform_device_register_simple(const char* c, int id, void *r, unsigned int i)
113
{
114
    static struct platform_device pd;
115
116
 
117
};
118