Remove 64bit warning by using C99 fixed width format specifier.
[maemo-rb.git] / utils / samsungtools / samsung.h
blob70ac9c770c75542cb37ac652889044b88307fe8c
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 __SAMSUNG_H__
22 #define __SAMSUNG_H__
24 #include <stdint.h>
25 #include <stdbool.h>
27 /**
28 * Low-Level
31 struct yp_header_t
33 char signature[12];
34 uint32_t pad;
35 char version[8];
36 char region[4];
37 char extra[4];
38 char model[20];
39 uint32_t datasize;
40 } __attribute__((packed));
42 struct yp_md5_t
44 uint8_t md5[16];
45 } __attribute__((packed));
47 #define YP_SIGNATURE "SAMSUNG YEPP"
49 /**
50 * API
53 struct samsung_firmware_t
55 char version[8];
56 char region[4];
57 char extra[4];
58 char model[20];
59 void *data;
60 int data_size;
63 enum samsung_error_t
65 SAMSUNG_SUCCESS = 0,
66 SAMSUNG_READ_ERROR = -1,
67 SAMSUNG_FORMAT_ERROR = -2,
68 SAMSUNG_MD5_ERROR = -3,
69 SAMSUNG_WRITE_ERROR = -4,
72 typedef int (*samsung_read_t)(void *user, int offset, void *buffer, int size);
73 typedef int (*samsung_write_t)(void *user, int offset, void *buffer, int size);
74 typedef void (*samsung_printf_t)(void *user, bool error, const char *fmt, ...);
76 struct samsung_firmware_t *samsung_read(samsung_read_t read,
77 samsung_printf_t printf, void *user, enum samsung_error_t *err);
78 enum samsung_error_t samsung_write(samsung_write_t write, samsung_printf_t printf,
79 void *user, struct samsung_firmware_t *fw);
80 void samsung_free(struct samsung_firmware_t *fw);
82 #endif /* __SAMSUNG_H__ */