Subversion Repositories Kolibri OS

Rev

Rev 5270 | Details | Compare with Previous | Last modification | View Log | RSS feed

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