eq settings: fix the lang string used for the center band string
[maemo-rb.git] / utils / nwztools / emmctools / nvp.h
blobc24d0a6375ad9f6790ffbebb2da2964587ac3d76
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2012 Amaury Pouly
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
21 #ifndef __NVP_H__
22 #define __NVP_H__
24 #include <stdint.h>
25 #include <stdbool.h>
26 #include "misc.h"
28 #define NVP_AREA_LARGE_KIND 1
29 #define NVP_AREA_SMALL_KIND 2
31 #define NVP_SMALL_AREA_MAX_CLUSTER 128
32 #define NVP_LARGE_AREA_MAX_CLUSTER 256
33 #define NVP_AREA_TABLE_SIZE 512
35 #define NVP_SECTOR_SIZE 512
36 #define NVP_TABLE_SECTOR 16
37 #define NVP_DATA_SECTOR_MIN 64
38 #define NVP_DATA_SECTOR_MAX 32767
39 #define NVP_SECTOR_PER_CLUSTER 16
40 #define NVP_CLUSTER_SIZE (NVP_SECTOR_SIZE * NVP_SECTOR_PER_CLUSTER)
42 #define NVP_LARGE_AREA_SIZE NVP_CLUSTER_SIZE
43 #define NVP_SMALL_AREA_SIZE NVP_SECTOR_SIZE
45 struct nvp_zone_info_entry_t
47 int node;
48 int start; // in 4 unit
49 int count; // in 512 unit for kind 2 and in 8192 for kind 1
50 int size;
51 int res0, res1, res2, res3;
52 const char *name;
55 struct nvp_area_info_entry_t
57 int kind;
58 struct nvp_zone_info_entry_t *zone_info;
59 int nr_zones;
60 int res0, res1, res2, res3;
61 const char *name;
64 struct nvp_node_info_t
66 int area;
67 int zone;
70 #define NVP_NR_AREAS 16
72 extern struct nvp_area_info_entry_t nvp_area_info[NVP_NR_AREAS];
74 typedef int (*nvp_read_fn_t)(uint32_t offset, uint32_t size, void *buf);
76 int nvp_init(int nvp_size, nvp_read_fn_t read, bool debug);
77 bool nvp_is_valid_node(int node);
78 struct nvp_node_info_t nvp_get_node_info(int node);
79 int nvp_get_node_size(int node);
80 const char *nvp_get_node_name(int node);
81 const char *nvp_get_area_name(int node);
82 int nvp_read_node(int node, int offset, void *buffer, int size);
84 int nvp_info(void);
86 int nvp_get_cluster_status(int cluster);
87 int nvp_set_cluster_status(int cluster, int status);
88 int nvp_get_sector_status(int sector);
89 int nvp_set_sector_status(int sector, int status);
90 int nvp_get_cluster_number(int shadow, int area, int zone, int index);
91 int nvp_get_sector_number(int shadow, int area, int zone, int index);
92 /* returns amount of read data or -1 */
93 int nvp_read_data(int shadow, int area, int zone, int offset, void *buffer, int size);
95 #endif /* __NVP_H__ */