-
Notifications
You must be signed in to change notification settings - Fork 115
/
esp_file.h
68 lines (52 loc) · 1.87 KB
/
esp_file.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (c) 2010 -2014 Espressif System.
*
* file operation in kernel space
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _ESP_FILE_H_
#define _ESP_FILE_H_
#include <linux/version.h>
#include <linux/firmware.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
#define GET_INODE_FROM_FILEP(filp) \
(filp)->f_path.dentry->d_inode
#else
#define GET_INODE_FROM_FILEP(filp) \
(filp)->f_dentry->d_inode
#endif
#define E_ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
int esp_readwrite_file(const char *filename, char *rbuf, const char *wbuf, size_t length);
int esp_request_firmware(const struct firmware **firmware_p, const char *name, struct device *device);
void esp_release_firmware(const struct firmware *firmware);
#ifdef INIT_DATA_CONF
#define INIT_CONF_FILE "init_data.conf"
#endif /* def INIT_DATA_CONF */
#define CONF_ATTR_LEN 24
#define CONF_VAL_LEN 3
#define MAX_ATTR_NUM 24
#define MAX_FIX_ATTR_NUM 16
#define MAX_BUF_LEN ((CONF_ATTR_LEN + CONF_VAL_LEN + 2) * MAX_ATTR_NUM + 2)
struct esp_init_table_elem {
char attr[CONF_ATTR_LEN];
int offset;
short value;
};
int request_init_conf(void);
void fix_init_data(u8 *init_data_buf, int buf_size);
#ifdef ESP_ANDROID_LOGGER
extern int logger_write( const unsigned char prio,
const char __kernel * const tag,
const char __kernel * const fmt,
...);
#endif
#endif /* _ESP_FILE_H_ */