A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 122 lines 3.3 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2009 by Bob Cousins, Lyre Project 11 * 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. 16 * 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 * KIND, either express or implied. 19 * 20 ****************************************************************************/ 21 22/* Include Standard files */ 23#include <stdlib.h> 24#include <stdio.h> 25#include "inttypes.h" 26#include "string.h" 27#include "cpu.h" 28#include "system.h" 29#include "lcd.h" 30#include "../kernel-internal.h" 31#include "storage.h" 32#include "file_internal.h" 33#include "disk.h" 34#include "font.h" 35#include "backlight.h" 36#include "button.h" 37#include "panic.h" 38#include "power.h" 39#include "file.h" 40#include "common.h" 41#include "rb-loader.h" 42#include "loader_strerror.h" 43#include "sd.h" 44#include "backlight-target.h" 45#include "lcd-target.h" 46#include "dma-target.h" 47#include "uart-s3c2440.h" 48#include "led-mini2440.h" 49#include "version.h" 50 51 52int main(void) 53{ 54 unsigned char* loadbuffer; 55 int buffer_size; 56 int rc; 57 int(*kernel_entry)(void); 58 59 led_init(); 60 clear_leds(LED_ALL); 61 /* NB: something in system_init() prevents H-JTAG from downloading */ 62/* system_init(); */ 63 kernel_init(); 64/* enable_interrupt(IRQ_FIQ_STATUS); */ 65 lcd_init(); 66 backlight_init(); /* BUGFIX backlight_init MUST BE AFTER lcd_init */ 67 lcd_setfont(FONT_SYSFIXED); 68 button_init(); 69 dma_init(); 70 71 uart_init(); 72 uart_init_device(DEBUG_UART_PORT); 73 74/* mini2440_test(); */ 75 76 /* Show debug messages if button is pressed */ 77 int touch_data; 78 if(button_read_device(&touch_data) & BUTTON_MENU) 79 verbose = true; 80 81 printf("Rockbox boot loader"); 82 printf("Version %s", rbversion); 83 84 rc = storage_init(); 85 if(rc) 86 { 87 reset_screen(); 88 error(EATA, rc, true); 89 } 90 91 filesystem_init(); 92 rc = disk_mount_all(); 93 if (rc<=0) 94 { 95 error(EDISK,rc, true); 96 } 97 98 printf("Loading firmware"); 99 100 /* Flush out anything pending first */ 101 commit_discard_idcache(); 102 103 loadbuffer = (unsigned char*) 0x31000000; 104 buffer_size = (unsigned char*)0x31400000 - loadbuffer; 105 106 rc = load_firmware(loadbuffer, BOOTFILE, buffer_size); 107 if(rc <= 0) 108 error(EBOOTFILE, rc, true); 109 110 printf("Loaded firmware %d\n", rc); 111 112/* storage_close(); */ 113 system_prepare_fw_start(); 114 115 commit_discard_idcache(); 116 kernel_entry = (void*) loadbuffer; 117 rc = kernel_entry(); 118 119 /* end stop - should not get here */ 120 led_flash(LED_ALL, LED_NONE); 121 while (1); /* avoid warning */ 122}