Use static partition node
[platform/core/system/initrd-flash.git] / src / dfu.h
1 /*
2  * flash-manager - Tizen kernel-level image flashing solution
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef __DFU_H
18 #define __DFU_H
19
20 #include <sys/queue.h>
21 #include "tfm.h"
22
23 #define DFU_DELIMITER           " :,\t\n"
24 #define DFU_INFO_NUM            100
25 #define DFU_MOUNT_PATH          "/mnt/tfm-temp"
26
27 #define DFU_INFO_MODE_PARTITION 'p'
28 #define DFU_INFO_MODE_FILE      'f'
29
30 enum dfu_info_entry {
31         DFU_INFO_MODE = 0,
32         DFU_INFO_PARTITION,
33         DFU_INFO_NAME,
34         DFU_INFO_PATH,
35         DFU_INFO_MAX,
36 };
37
38 enum dfu_thread_state {
39         DFU_THREAD_STATE_ERROR = -1,
40         DFU_THREAD_STATE_IDLE,
41         DFU_THREAD_STATE_FLASHING,
42 };
43
44 struct dfu_frame {
45         void *buf;
46         unsigned long len;
47         TAILQ_ENTRY(dfu_frame) entry;
48 };
49
50 void *dfu_get_buffer(unsigned long size);
51 void dfu_put_buffer(void *ptr);
52 int dfu_init(struct tfm_context *ctx, const char *dfu_info_file);
53 void dfu_exit(struct tfm_context *ctx);
54 int dfu_start(struct tfm_context *ctx, const char *entity);
55 int dfu_request_io(struct tfm_context *ctx, unsigned long len);
56 void dfu_sync(struct tfm_context *ctx);
57
58 #endif