Subversion Repositories Kolibri OS

Rev

Rev 1412 | Rev 5056 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1412 Rev 1970
1
#ifndef _LINUX_FIRMWARE_H
1
#ifndef _LINUX_FIRMWARE_H
2
#define _LINUX_FIRMWARE_H
2
#define _LINUX_FIRMWARE_H
-
 
3
 
3
 
4
#include 
4
#include 
5
#include 
5
#include 
6
#include 
6
#include 
7
#include 
7
#include 
-
 
8
 
8
 
9
#define FW_ACTION_NOHOTPLUG 0
9
#define FW_ACTION_NOHOTPLUG 0
10
#define FW_ACTION_HOTPLUG 1
10
#define FW_ACTION_HOTPLUG 1
11
 
11
 
12
struct device;
12
struct device;
13
 
13
 
14
struct platform_device
14
struct platform_device
15
{
15
{
16
	struct device dev;
16
	struct device dev;
17
};
17
};
18
 
18
 
19
struct firmware {
19
struct firmware {
20
	size_t size;
20
	size_t size;
21
	const u8 *data;
21
	const u8 *data;
22
};
22
};
23
 
23
 
24
 
24
 
25
struct builtin_fw {
25
struct builtin_fw {
26
	char *name;
26
	char *name;
27
	void *data;
27
	void *data;
28
	unsigned long size;
28
	unsigned long size;
29
};
29
};
30
 
30
 
31
/* We have to play tricks here much like stringify() to get the
31
/* We have to play tricks here much like stringify() to get the
32
   __COUNTER__ macro to be expanded as we want it */
32
   __COUNTER__ macro to be expanded as we want it */
33
#define __fw_concat1(x, y) x##y
33
#define __fw_concat1(x, y) x##y
34
#define __fw_concat(x, y) __fw_concat1(x, y)
34
#define __fw_concat(x, y) __fw_concat1(x, y)
35
 
35
 
36
#define DECLARE_BUILTIN_FIRMWARE(name, blob)				     \
36
#define DECLARE_BUILTIN_FIRMWARE(name, blob)				     \
37
	DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob))
37
	DECLARE_BUILTIN_FIRMWARE_SIZE(name, &(blob), sizeof(blob))
38
 
38
 
39
#define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size)			     \
39
#define DECLARE_BUILTIN_FIRMWARE_SIZE(name, blob, size)			     \
40
	static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
40
	static const struct builtin_fw __fw_concat(__builtin_fw,__COUNTER__) \
41
	__used __section(.builtin_fw) = { name, blob, size }
41
	__used __section(.builtin_fw) = { name, blob, size }
42
 
42
 
43
int request_firmware(const struct firmware **fw, const char *name,
43
int request_firmware(const struct firmware **fw, const char *name,
44
		     struct device *device);
44
		     struct device *device);
45
int request_firmware_nowait(
45
int request_firmware_nowait(
46
	struct module *module, int uevent,
46
	struct module *module, int uevent,
47
	const char *name, struct device *device, void *context,
47
	const char *name, struct device *device, void *context,
48
	void (*cont)(const struct firmware *fw, void *context));
48
	void (*cont)(const struct firmware *fw, void *context));
49
 
49
 
50
void release_firmware(const struct firmware *fw);
50
void release_firmware(const struct firmware *fw);
51
 
51
 
52
 
52
 
53
#define platform_device_unregister(x)
53
#define platform_device_unregister(x)
54
 
54
 
55
struct platform_device
55
struct platform_device
56
       *platform_device_register_simple(const char*, int, void*, unsigned int);
56
       *platform_device_register_simple(const char*, int, void*, unsigned int);
57
 
57
 
58
#define MAX_ERRNO   4095
58
#define MAX_ERRNO   4095
59
 
59
 
60
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
60
#define IS_ERR_VALUE(x) unlikely((x) >= (unsigned long)-MAX_ERRNO)
61
 
61
 
62
static inline long IS_ERR(const void *ptr)
62
static inline long IS_ERR(const void *ptr)
63
{
63
{
64
    return IS_ERR_VALUE((unsigned long)ptr);
64
    return IS_ERR_VALUE((unsigned long)ptr);
65
}
65
}
66
 
66
 
67
#endif
67
#endif