blob: 33ddf55952be8e8597962e98af522465a02fd664 [file] [log] [blame]
Reut Zysmanff6bab92016-02-09 14:06:31 +02001/* Copyright (c) 2015-2016, The Linux Foundation. All rights reserved.
2
3 * Redistribution and use in source and binary forms, with or without
4 * modification, are permitted provided that the following conditions are
5 * met:
6 * * Redistributions of source code must retain the above copyright
7 * notice, this list of conditions and the following disclaimer.
8 * * Redistributions in binary form must reproduce the above
9 * copyright notice, this list of conditions and the following
10 * disclaimer in the documentation and/or other materials provided
11 * with the distribution.
12 * * Neither the name of The Linux Foundation nor the names of its
13 * contributors may be used to endorse or promote products derived
14 * from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29#ifndef MDTP_FS_H
30#define MDTP_FS_H
31
32#define MAX_IMAGES (40)
33#define MDTP_HEADER_LEN (4096)
34#define META_DATA_PARTITION_LEN (2048)
35#define MAX_PARAMS (512)
36/*
37MDTP header layout:
38-The mdtp_img header is a fixed length of 4096 Bytes.
39-The mdtp_img header is devided into 2 partitions:
40 1.MDTP parameters (eFuse, digit-space, etc..)
41 2.Images meta-data (offset, width, height)
42-Each partition size is 2048 Bytes.
43-Each parameter is 4 Bytes long, 512 params MAX.
44-Each meta-data part (offset/width/height) is 4 Bytes long.
45*/
46
47
48/* Standalone parameters */
49typedef struct mdtp_image_params {
50 uint32_t offset;
51 uint32_t width;
52 uint32_t height;
53} mdtp_image_params_t;
54
55/* Image parameters */
56typedef struct mdtp_meta_data {
57 uint32_t params[MAX_PARAMS];
58 mdtp_image_params_t image_params[MAX_IMAGES];
59} mdtp_meta_data_t;
60
61/*To make sure the header len is exactly MDTP_HEADER */
62typedef union mdtp_image {
63 mdtp_meta_data_t meta_data;
64 uint8_t header[MDTP_HEADER_LEN];
65} mdtp_image_t;
66
67
68typedef enum{ACCEPTEDIT_TEXT = 0, ALERT_MESSAGE = 1, BTN_OK_OFF = 2,
69 BTN_OK_ON = 3, MAINTEXT_5SECONDS = 4, MAINTEXT_ENTERPIN = 5,
70 MAINTEXT_INCORRECTPIN = 6, PINTEXT = 7,
71 PIN_SELECTED_0 = 8, PIN_SELECTED_1 = 9, PIN_SELECTED_2 = 10, PIN_SELECTED_3 = 11,
72 PIN_SELECTED_4 = 12, PIN_SELECTED_5 = 13, PIN_SELECTED_6 = 14,
73 PIN_SELECTED_7 = 15, PIN_SELECTED_8 = 16, PIN_SELECTED_9 = 17,
74 PIN_UNSELECTED_0 = 18, PIN_UNSELECTED_1 = 19, PIN_UNSELECTED_2 = 20,
75 PIN_UNSELECTED_3 = 21, PIN_UNSELECTED_4 = 22, PIN_UNSELECTED_5 = 23,
76 PIN_UNSELECTED_6 = 24, PIN_UNSELECTED_7 = 25,
77 PIN_UNSELECTED_8 = 26, PIN_UNSELECTED_9 = 27} mdtp_image_id_t;
78
79typedef enum {VIRTUAL_FUSE = 0, DIGIT_SPACE = 1} mdtp_parameter_id_t ;
80
81/*---------------------------------------------------------
82 * External Functions
83 *-------------------------------------------------------*/
84
85/**
86 * Returns an image offset
87 */
88uint32_t get_image_offset(mdtp_image_id_t img);
89
90/**
91 * Returns an image width
92 */
93uint32_t get_image_width(mdtp_image_id_t img);
94
95/**
96 * Returns an image height
97 */
98uint32_t get_image_height(mdtp_image_id_t img);
99
100/**
101 * returns a parameter value
102 */
103uint32_t mdtp_fs_get_param(mdtp_parameter_id_t param);
104
105/**
106 * Loads MDTP image meta data from EMMC
107 */
108int mdtp_fs_init();
109
110#endif /* MDTP_FS_H */