A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 86 lines 2.7 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * 9 * Copyright (C) 2013 Lorenzo Miori 10 * 11 * This program is free software; you can redistribute it and/or 12 * modify it under the terms of the GNU General Public License 13 * as published by the Free Software Foundation; either version 2 14 * of the License, or (at your option) any later version. 15 * 16 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 17 * KIND, either express or implied. 18 * 19 ****************************************************************************/ 20 21#ifndef _COMMON_H_ 22#define _COMMON_H_ 23 24#include <stdio.h> 25#include <string.h> 26#include <stdlib.h> 27#include <stdarg.h> 28#include <getopt.h> 29#include <stdint.h> 30 31#if defined(WIN32) 32# define DIR_SEPARATOR '\\' 33#else 34# define DIR_SEPARATOR '/' 35#endif 36 37#define MAX_PATH 255 38 39/* 40 * Firmware description 41 */ 42 43#define GENERIC_HEADER_LINES 5 44#define MAX_HEADER_LEN 1000 45/* Empty space used by bootloader to store checksums */ 46#define MBOOT_CHECKSUM_OFFSET 96 47/* Length of the reserved space */ 48#define MBOOT_CHECKSUM_LENGTH 992 49 50/* In case we don't have RevisionInfo.txt file, mock values are fine */ 51#define YPR0_VERSION "Version : V1.25\n" 52#define YPR0_TARGET "Target : KR\n" 53#define YPR0_USER "User : rockbox\n" 54#define YPR0_DIR "Dir : /.rockbox\n" 55#define YPR0_TIME "BuildTime : 11/04/20 14:17:34\n" 56 57#define YPR0_COMPONENTS_COUNT 4 58 59#define MD5_DIGEST_LENGTH 16 60 61extern char* firmware_components[]; 62extern char* firmware_filenames[]; 63extern uint8_t g_yp_key[128]; 64 65struct firmware_data 66{ 67 char* component_data[YPR0_COMPONENTS_COUNT]; 68 size_t component_size[YPR0_COMPONENTS_COUNT]; 69 char component_checksum[YPR0_COMPONENTS_COUNT][MD5_DIGEST_LENGTH*2+1]; 70}; 71 72enum samsung_error_t 73{ 74 SAMSUNG_SUCCESS = 0, 75 SAMSUNG_READ_ERROR = -1, 76 SAMSUNG_FORMAT_ERROR = -2, 77 SAMSUNG_MD5_ERROR = -3, 78 SAMSUNG_WRITE_ERROR = -4, 79}; 80 81void cyclic_xor(void *data, int datasize, void *xor, int xorsize); 82size_t get_filesize(FILE* handle); 83void join_path(char* destination, char* first, char* second); 84void md5sum(char* component_checksum, char* data, unsigned long size); 85 86#endif /* _COMMON_H_ */