forked from len0rd/rockbox
Agptek Rocker: Initial commit
Change-Id: I26b51106c7b1c36a603fba6d521e917d79b5a95b
This commit is contained in:
parent
beef52c5f0
commit
d55680993d
50 changed files with 2343 additions and 74 deletions
|
@ -315,4 +315,6 @@ keymaps/keymap-ihifi.c
|
||||||
keymaps/keymap-ypr1.c
|
keymaps/keymap-ypr1.c
|
||||||
#elif CONFIG_KEYPAD == DX50_PAD
|
#elif CONFIG_KEYPAD == DX50_PAD
|
||||||
keymaps/keymap-dx50.c
|
keymaps/keymap-dx50.c
|
||||||
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
||||||
|
keymaps/keymap-agptekrocker.c
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -13,7 +13,7 @@ rockboxlogo.112x30x1.bmp
|
||||||
rockboxlogo.96x30x16.bmp
|
rockboxlogo.96x30x16.bmp
|
||||||
#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2)
|
#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 2)
|
||||||
rockboxlogo.128x42x2.bmp
|
rockboxlogo.128x42x2.bmp
|
||||||
#elif (LCD_WIDTH == 128) && (LCD_DEPTH == 16)
|
#elif (LCD_WIDTH == 128) && (LCD_DEPTH >= 16)
|
||||||
rockboxlogo.128x40x16.bmp
|
rockboxlogo.128x40x16.bmp
|
||||||
#elif (LCD_WIDTH == 132) && (LCD_DEPTH >= 16)
|
#elif (LCD_WIDTH == 132) && (LCD_DEPTH >= 16)
|
||||||
rockboxlogo.132x40x16.bmp
|
rockboxlogo.132x40x16.bmp
|
||||||
|
@ -40,9 +40,15 @@ rockboxlogo.640x198x16.bmp
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The Sony NWZ linux bootloader needs icons to display a menu */
|
/* The Sony NWZ linux bootloader needs icons to display a menu */
|
||||||
#if defined(BOOTLOADER) && defined(SONY_NWZ_LINUX)
|
#if defined(BOOTLOADER)
|
||||||
|
#if defined(SONY_NWZ_LINUX)
|
||||||
rockboxicon.130x130x16.bmp
|
rockboxicon.130x130x16.bmp
|
||||||
toolsicon.130x130x16.bmp
|
toolsicon.130x130x16.bmp
|
||||||
|
#elif defined(AGPTEK_ROCKER)
|
||||||
|
hibyicon.70x70x16.bmp
|
||||||
|
rockboxicon.70x70x16.bmp
|
||||||
|
toolsicon.70x70x16.bmp
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef BOOTLOADER /* We don't need these for the bootloader */
|
#ifndef BOOTLOADER /* We don't need these for the bootloader */
|
||||||
|
|
BIN
apps/bitmaps/native/hibyicon.70x70x16.bmp
Normal file
BIN
apps/bitmaps/native/hibyicon.70x70x16.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
apps/bitmaps/native/rockboxicon.70x70x16.bmp
Normal file
BIN
apps/bitmaps/native/rockboxicon.70x70x16.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
apps/bitmaps/native/toolsicon.70x70x16.bmp
Normal file
BIN
apps/bitmaps/native/toolsicon.70x70x16.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
254
apps/keymaps/keymap-agptekrocker.c
Normal file
254
apps/keymaps/keymap-agptekrocker.c
Normal file
|
@ -0,0 +1,254 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "action.h"
|
||||||
|
#include "button.h"
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
/* {Action Code, Button code, Prereq button code } */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The format of the list is as follows
|
||||||
|
* { Action Code, Button code, Prereq button code }
|
||||||
|
* if there's no need to check the previous button's value, use BUTTON_NONE
|
||||||
|
* Insert LAST_ITEM_IN_LIST at the end of each mapping
|
||||||
|
*/
|
||||||
|
static const struct button_mapping button_context_standard[] = {
|
||||||
|
{ ACTION_STD_PREV, BUTTON_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
{ ACTION_STD_NEXT, BUTTON_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
|
||||||
|
{ ACTION_STD_OK, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
|
||||||
|
{ ACTION_STD_OK, BUTTON_RIGHT, BUTTON_NONE },
|
||||||
|
|
||||||
|
{ ACTION_STD_CANCEL, BUTTON_LEFT, BUTTON_NONE },
|
||||||
|
|
||||||
|
{ ACTION_STD_CONTEXT, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
|
||||||
|
|
||||||
|
{ ACTION_STD_MENU, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
|
||||||
|
// ACTION_STD_QUICKSCREEN,
|
||||||
|
// ACTION_STD_KEYLOCK
|
||||||
|
// ACTION_STD_REC
|
||||||
|
// ACTION_STD_HOTKEY
|
||||||
|
|
||||||
|
// { ACTION_STD_QUICKSCREEN, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_standard */
|
||||||
|
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_wps[] = {
|
||||||
|
// { ACTION_WPS_BROWSE, BUTTON_UP|BUTTON_REPEAT, BUTTON_UP },
|
||||||
|
{ ACTION_WPS_PLAY, BUTTON_SELECT|BUTTON_REL, BUTTON_SELECT },
|
||||||
|
{ ACTION_WPS_SEEKBACK, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_SEEKFWD, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_STOPSEEK, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT|BUTTON_REPEAT },
|
||||||
|
{ ACTION_WPS_STOPSEEK, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT|BUTTON_REPEAT },
|
||||||
|
{ ACTION_WPS_SKIPNEXT, BUTTON_RIGHT|BUTTON_REL, BUTTON_RIGHT },
|
||||||
|
{ ACTION_WPS_SKIPPREV, BUTTON_LEFT|BUTTON_REL, BUTTON_LEFT },
|
||||||
|
{ ACTION_WPS_STOP, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
|
||||||
|
{ ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_VOLDOWN, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_VOLUP, BUTTON_VOLUP, BUTTON_NONE },
|
||||||
|
{ ACTION_WPS_VOLUP, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
// ACTION_WPS_PITCHSCREEN optional
|
||||||
|
// ACTION_WPS_ID3SCREEN optional
|
||||||
|
{ ACTION_WPS_CONTEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_DOWN },
|
||||||
|
{ ACTION_WPS_QUICKSCREEN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_DOWN }, // optional
|
||||||
|
{ ACTION_WPS_MENU, BUTTON_UP|BUTTON_REL, BUTTON_UP }, /*this should be the same as ACTION_STD_MENU */
|
||||||
|
// ACTION_WPS_VIEW_PLAYLIST
|
||||||
|
// ACTION_WPS_LIST_BOOKMARKS,/* optional */
|
||||||
|
// ACTION_WPS_CREATE_BOOKMARK,/* optional */
|
||||||
|
|
||||||
|
{ ACTION_STD_KEYLOCK, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_wps */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_settings[] = {
|
||||||
|
{ ACTION_SETTINGS_INC, BUTTON_VOLUP, BUTTON_NONE },
|
||||||
|
{ ACTION_SETTINGS_INCREPEAT,BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
// ACTION_SETTINGS_INCBIGSTEP
|
||||||
|
{ ACTION_SETTINGS_DEC, BUTTON_VOLDOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_SETTINGS_DECREPEAT,BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
// ACTION_SETTINGS_DECBIGSTEP
|
||||||
|
{ ACTION_SETTINGS_RESET, BUTTON_SELECT|BUTTON_REPEAT, BUTTON_SELECT },
|
||||||
|
// ACTION_SETTINGS_SET, /* Used by touchscreen targets */
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
|
||||||
|
}; /* button_context_settings */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_list[] = {
|
||||||
|
// ACTION_LISTTREE_PGUP,/* optional */
|
||||||
|
// ACTION_LISTTREE_PGDOWN,/* optional */
|
||||||
|
|
||||||
|
#ifdef HAVE_VOLUME_IN_LIST
|
||||||
|
{ ACTION_LIST_VOLUP, BUTTON_VOL_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_LIST_VOLUP, BUTTON_VOL_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_LIST_VOLDOWN, BUTTON_VOL_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
#endif
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD)
|
||||||
|
}; /* button_context_list */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_tree[] = {
|
||||||
|
// ACTION_TREE_ROOT_INIT,
|
||||||
|
// ACTION_TREE_PGLEFT,/* optional */
|
||||||
|
// ACTION_TREE_PGRIGHT,/* optional */
|
||||||
|
// ACTION_TREE_STOP,
|
||||||
|
// ACTION_TREE_WPS,
|
||||||
|
// ACTION_TREE_HOTKEY,
|
||||||
|
|
||||||
|
{ ACTION_TREE_WPS, BUTTON_UP|BUTTON_REL, BUTTON_UP },
|
||||||
|
// { ACTION_TREE_STOP, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
|
||||||
|
// { ACTION_TREE_HOTKEY, BUTTON_REC|BUTTON_REL, BUTTON_REC },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||||
|
}; /* button_context_tree */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_yesno[] = {
|
||||||
|
{ ACTION_YESNO_ACCEPT, BUTTON_SELECT, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
|
||||||
|
}; /* button_context_settings_yesno */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_quickscreen[] = {
|
||||||
|
{ ACTION_QS_TOP, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_QS_TOP, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_QS_DOWN, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_QS_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_QS_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
|
||||||
|
}; /* button_context_quickscreen */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_settings_time[] = {
|
||||||
|
{ ACTION_STD_PREV, BUTTON_UP|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_PREVREPEAT, BUTTON_UP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_NEXT, BUTTON_DOWN|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_STD_NEXTREPEAT, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_SETTINGS)
|
||||||
|
}; /* button_context_settings_time */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_pitchscreen[] = {
|
||||||
|
{ ACTION_PS_INC_SMALL, BUTTON_VOLUP, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_INC_BIG, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_DEC_SMALL, BUTTON_VOLDOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_DEC_BIG, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_NUDGE_LEFT, BUTTON_LEFT, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_NUDGE_LEFTOFF, BUTTON_LEFT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_NUDGE_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_NUDGE_RIGHTOFF, BUTTON_RIGHT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
// { ACTION_PS_TOGGLE_MODE, BUTTON_REC, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_RESET, BUTTON_SELECT, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_EXIT, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_EXIT, BUTTON_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_SLOWER, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_PS_FASTER, BUTTON_RIGHT|BUTTON_REPEAT,BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_STD),
|
||||||
|
}; /* button_context_pitchscreen */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_keyboard[] = {
|
||||||
|
{ ACTION_KBD_LEFT, BUTTON_LEFT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_LEFT, BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_RIGHT, BUTTON_RIGHT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_RIGHT, BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
{ ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_CURSOR_LEFT, BUTTON_POWER|BUTTON_LEFT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_CURSOR_RIGHT, BUTTON_POWER|BUTTON_RIGHT|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
|
||||||
|
{ ACTION_KBD_UP, BUTTON_VOLDOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_UP, BUTTON_VOLDOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_DOWN, BUTTON_VOLUP, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_DOWN, BUTTON_VOLUP|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_PAGE_FLIP, BUTTON_POWER|BUTTON_SELECT, BUTTON_POWER },
|
||||||
|
{ ACTION_KBD_BACKSPACE, BUTTON_DOWN, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_BACKSPACE, BUTTON_DOWN|BUTTON_REPEAT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_SELECT, BUTTON_SELECT, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_DONE, BUTTON_UP, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_ABORT, BUTTON_POWER, BUTTON_NONE },
|
||||||
|
{ ACTION_KBD_MORSE_INPUT, BUTTON_POWER|BUTTON_REL, BUTTON_POWER },
|
||||||
|
{ ACTION_KBD_MORSE_SELECT, BUTTON_SELECT|BUTTON_REL, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST
|
||||||
|
}; /* button_context_keyboard */
|
||||||
|
|
||||||
|
static const struct button_mapping button_context_bmark[] = {
|
||||||
|
{ ACTION_BMS_DELETE, BUTTON_LEFT, BUTTON_NONE },
|
||||||
|
|
||||||
|
LAST_ITEM_IN_LIST__NEXTLIST(CONTEXT_LIST),
|
||||||
|
}; /* button_context_bmark */
|
||||||
|
|
||||||
|
/* get_context_mapping returns a pointer to one of the above defined arrays depending on the context */
|
||||||
|
const struct button_mapping* get_context_mapping(int context)
|
||||||
|
{
|
||||||
|
switch (context)
|
||||||
|
{
|
||||||
|
case CONTEXT_STD:
|
||||||
|
return button_context_standard;
|
||||||
|
|
||||||
|
case CONTEXT_WPS:
|
||||||
|
return button_context_wps;
|
||||||
|
|
||||||
|
case CONTEXT_LIST:
|
||||||
|
return button_context_list;
|
||||||
|
|
||||||
|
case CONTEXT_CUSTOM|CONTEXT_TREE:
|
||||||
|
return button_context_tree;
|
||||||
|
|
||||||
|
case CONTEXT_SETTINGS:
|
||||||
|
case CONTEXT_SETTINGS_EQ:
|
||||||
|
return button_context_settings;
|
||||||
|
|
||||||
|
case CONTEXT_SETTINGS_TIME:
|
||||||
|
return button_context_settings_time;
|
||||||
|
|
||||||
|
case CONTEXT_YESNOSCREEN:
|
||||||
|
return button_context_yesno;
|
||||||
|
|
||||||
|
case CONTEXT_BOOKMARKSCREEN:
|
||||||
|
return button_context_bmark;
|
||||||
|
|
||||||
|
case CONTEXT_QUICKSCREEN:
|
||||||
|
return button_context_quickscreen;
|
||||||
|
|
||||||
|
case CONTEXT_PITCHSCREEN:
|
||||||
|
return button_context_pitchscreen;
|
||||||
|
|
||||||
|
case CONTEXT_KEYBOARD:
|
||||||
|
case CONTEXT_MORSE_INPUT:
|
||||||
|
return button_context_keyboard;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return button_context_standard;
|
||||||
|
}
|
||||||
|
return button_context_standard;
|
||||||
|
}
|
|
@ -670,7 +670,7 @@ int read_bmp_fd(int fd,
|
||||||
/* Check if this fits the buffer */
|
/* Check if this fits the buffer */
|
||||||
if (totalsize > maxsize) {
|
if (totalsize > maxsize) {
|
||||||
DEBUGF("read_bmp_fd: Bitmap too large for buffer: "
|
DEBUGF("read_bmp_fd: Bitmap too large for buffer: "
|
||||||
"%d bytes.\n", totalsize);
|
"%d bytes (%d max).\n", totalsize, maxsize);
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,8 @@ show_logo.c
|
||||||
mpio_hd200_hd300.c
|
mpio_hd200_hd300.c
|
||||||
#elif defined(SONY_NWZ_LINUX)
|
#elif defined(SONY_NWZ_LINUX)
|
||||||
nwz_linux.c
|
nwz_linux.c
|
||||||
|
#elif defined(AGPTEK_ROCKER)
|
||||||
|
rocker_linux.c
|
||||||
#elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \
|
#elif defined(RK27_GENERIC) || defined(HM60X) || defined(HM801) \
|
||||||
|| defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) \
|
|| defined(MA9) || defined(MA9C) || defined(MA8) || defined(MA8C) \
|
||||||
|| defined(IHIFI760) || defined(IHIFI960)
|
|| defined(IHIFI760) || defined(IHIFI960)
|
||||||
|
|
546
bootloader/rocker_linux.c
Normal file
546
bootloader/rocker_linux.c
Normal file
|
@ -0,0 +1,546 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 by Amaury Pouly
|
||||||
|
* 2018 by Marcin Bukat
|
||||||
|
*
|
||||||
|
* Based on Rockbox iriver bootloader by Linus Nielsen Feltzing
|
||||||
|
* and the ipodlinux bootloader by Daniel Palffy and Bernard Leach
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "system.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "backlight.h"
|
||||||
|
#include "button-target.h"
|
||||||
|
#include "button.h"
|
||||||
|
#include "../kernel/kernel-internal.h"
|
||||||
|
#include "core_alloc.h"
|
||||||
|
#include "filesystem-app.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "power.h"
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <dirent.h>
|
||||||
|
#include <sys/wait.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include "version.h"
|
||||||
|
|
||||||
|
/* all images must have the following size */
|
||||||
|
#define ICON_WIDTH 70
|
||||||
|
#define ICON_HEIGHT 70
|
||||||
|
|
||||||
|
/* images */
|
||||||
|
#include "bitmaps/rockboxicon.h"
|
||||||
|
#include "bitmaps/hibyicon.h"
|
||||||
|
#include "bitmaps/toolsicon.h"
|
||||||
|
|
||||||
|
/* don't issue an error when parsing the file for dependencies */
|
||||||
|
#if defined(BMPWIDTH_rockboxicon) && (BMPWIDTH_rockboxicon != ICON_WIDTH || \
|
||||||
|
BMPHEIGHT_rockboxicon != ICON_HEIGHT)
|
||||||
|
#error rockboxicon has the wrong resolution
|
||||||
|
#endif
|
||||||
|
#if defined(BMPWIDTH_hibyicon) && (BMPWIDTH_hibyicon != ICON_WIDTH || \
|
||||||
|
BMPHEIGHT_hibyicon != ICON_HEIGHT)
|
||||||
|
#error hibyicon has the wrong resolution
|
||||||
|
#endif
|
||||||
|
#if defined(BMPWIDTH_toolsicon) && (BMPWIDTH_toolsicon != ICON_WIDTH || \
|
||||||
|
BMPHEIGHT_toolsicon != ICON_HEIGHT)
|
||||||
|
#error toolsicon has the wrong resolution
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUTTON_REW
|
||||||
|
#define BUTTON_REW BUTTON_LEFT
|
||||||
|
#endif
|
||||||
|
#ifndef BUTTON_FF
|
||||||
|
#define BUTTON_FF BUTTON_RIGHT
|
||||||
|
#endif
|
||||||
|
#ifndef BUTTON_PLAY
|
||||||
|
#define BUTTON_PLAY BUTTON_SELECT
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* return icon y position (x is always centered) */
|
||||||
|
static int get_icon_y(void)
|
||||||
|
{
|
||||||
|
int h;
|
||||||
|
lcd_getstringsize("X", NULL, &h);
|
||||||
|
return ((LCD_HEIGHT - ICON_HEIGHT)/2) - h;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Important Note: this bootloader is carefully written so that in case of
|
||||||
|
* error, the OF is run. This seems like the safest option since the OF is
|
||||||
|
* always there and might do magic things. */
|
||||||
|
|
||||||
|
enum boot_mode
|
||||||
|
{
|
||||||
|
BOOT_ROCKBOX,
|
||||||
|
BOOT_TOOLS,
|
||||||
|
BOOT_OF,
|
||||||
|
BOOT_COUNT,
|
||||||
|
BOOT_USB, /* special */
|
||||||
|
BOOT_STOP, /* power down/suspend */
|
||||||
|
};
|
||||||
|
|
||||||
|
static void display_text_center(int y, const char *text)
|
||||||
|
{
|
||||||
|
int width;
|
||||||
|
lcd_getstringsize(text, &width, NULL);
|
||||||
|
lcd_putsxy(LCD_WIDTH / 2 - width / 2, y, text);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void display_text_centerf(int y, const char *format, ...)
|
||||||
|
{
|
||||||
|
char buf[1024];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
|
||||||
|
vsnprintf(buf, sizeof(buf), format, ap);
|
||||||
|
display_text_center(y, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get timeout before taking action if the user doesn't touch the device */
|
||||||
|
static int get_inactivity_tmo(void)
|
||||||
|
{
|
||||||
|
#if defined(HAS_BUTTON_HOLD)
|
||||||
|
if(button_hold())
|
||||||
|
return 5 * HZ; /* Inactivity timeout when on hold */
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return 10 * HZ; /* Inactivity timeout when not on hold */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* return action on idle timeout */
|
||||||
|
static enum boot_mode inactivity_action(enum boot_mode cur_selection)
|
||||||
|
{
|
||||||
|
#if defined(HAS_BUTTON_HOLD)
|
||||||
|
if(button_hold())
|
||||||
|
return BOOT_STOP; /* power down/suspend */
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return cur_selection; /* return last choice */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* we store the boot mode in a file in /tmp so we can reload it between 'boots'
|
||||||
|
* (since the mostly suspends instead of powering down) */
|
||||||
|
static enum boot_mode load_boot_mode(enum boot_mode mode)
|
||||||
|
{
|
||||||
|
int fd = open("/data/rb_bl_mode.txt", O_RDONLY);
|
||||||
|
if(fd >= 0)
|
||||||
|
{
|
||||||
|
read(fd, &mode, sizeof(mode));
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void save_boot_mode(enum boot_mode mode)
|
||||||
|
{
|
||||||
|
int fd = open("/data/rb_bl_mode.txt", O_RDWR | O_CREAT | O_TRUNC);
|
||||||
|
if(fd >= 0)
|
||||||
|
{
|
||||||
|
write(fd, &mode, sizeof(mode));
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static enum boot_mode get_boot_mode(void)
|
||||||
|
{
|
||||||
|
/* load previous mode, or start with rockbox if none */
|
||||||
|
enum boot_mode init_mode = load_boot_mode(BOOT_ROCKBOX);
|
||||||
|
/* wait for user action */
|
||||||
|
enum boot_mode mode = init_mode;
|
||||||
|
int last_activity = current_tick;
|
||||||
|
#if defined(HAS_BUTTON_HOLD)
|
||||||
|
bool hold_status = button_hold();
|
||||||
|
#endif
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
/* on usb detect, return to usb
|
||||||
|
* FIXME this is a hack, we need proper usb detection */
|
||||||
|
if(power_input_status() & POWER_INPUT_USB_CHARGER)
|
||||||
|
{
|
||||||
|
/* save last choice */
|
||||||
|
save_boot_mode(mode);
|
||||||
|
return BOOT_USB;
|
||||||
|
}
|
||||||
|
/* inactivity detection */
|
||||||
|
int timeout = last_activity + get_inactivity_tmo();
|
||||||
|
if(TIME_AFTER(current_tick, timeout))
|
||||||
|
{
|
||||||
|
/* save last choice */
|
||||||
|
save_boot_mode(mode);
|
||||||
|
return inactivity_action(mode);
|
||||||
|
}
|
||||||
|
/* redraw */
|
||||||
|
lcd_clear_display();
|
||||||
|
/* display top text */
|
||||||
|
#if defined(HAS_BUTTON_HOLD)
|
||||||
|
if(button_hold())
|
||||||
|
{
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
|
||||||
|
display_text_center(0, "ON HOLD!");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
|
||||||
|
display_text_center(0, "SELECT PLAYER");
|
||||||
|
}
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
|
||||||
|
/* display icon */
|
||||||
|
const struct bitmap *icon = (mode == BOOT_OF) ? &bm_hibyicon :
|
||||||
|
(mode == BOOT_ROCKBOX) ? &bm_rockboxicon : &bm_toolsicon;
|
||||||
|
lcd_bmp(icon, (LCD_WIDTH - ICON_WIDTH) / 2, get_icon_y());
|
||||||
|
/* display bottom description */
|
||||||
|
const char *desc = (mode == BOOT_OF) ? "HIBY PLAYER" :
|
||||||
|
(mode == BOOT_ROCKBOX) ? "ROCKBOX" : "TOOLS";
|
||||||
|
|
||||||
|
int desc_height;
|
||||||
|
lcd_getstringsize(desc, NULL, &desc_height);
|
||||||
|
display_text_center(LCD_HEIGHT - 3*desc_height, desc);
|
||||||
|
|
||||||
|
/* display arrows */
|
||||||
|
int arrow_width, arrow_height;
|
||||||
|
lcd_getstringsize("<", &arrow_width, &arrow_height);
|
||||||
|
int arrow_y = get_icon_y() + ICON_HEIGHT / 2 - arrow_height / 2;
|
||||||
|
lcd_putsxy(arrow_width / 2, arrow_y, "<");
|
||||||
|
lcd_putsxy(LCD_WIDTH - 3 * arrow_width / 2, arrow_y, ">");
|
||||||
|
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(0, 255, 0));
|
||||||
|
display_text_centerf(LCD_HEIGHT - arrow_height * 3 / 2, "timeout in %d sec",
|
||||||
|
(timeout - current_tick + HZ - 1) / HZ);
|
||||||
|
|
||||||
|
lcd_update();
|
||||||
|
|
||||||
|
/* wait for a key */
|
||||||
|
int btn = button_get_w_tmo(HZ / 10);
|
||||||
|
|
||||||
|
#if defined(HAS_BUTTON_HOLD)
|
||||||
|
/* record action, changing HOLD counts as action */
|
||||||
|
if(btn & BUTTON_MAIN || hold_status != button_hold())
|
||||||
|
last_activity = current_tick;
|
||||||
|
|
||||||
|
hold_status = button_hold();
|
||||||
|
#else
|
||||||
|
if(btn & BUTTON_MAIN)
|
||||||
|
last_activity = current_tick;
|
||||||
|
#endif
|
||||||
|
/* ignore release, allow repeat */
|
||||||
|
if(btn & BUTTON_REL)
|
||||||
|
continue;
|
||||||
|
if(btn & BUTTON_REPEAT)
|
||||||
|
btn &= ~BUTTON_REPEAT;
|
||||||
|
/* play -> stop loop and return mode */
|
||||||
|
if(btn == BUTTON_PLAY)
|
||||||
|
break;
|
||||||
|
/* left/right/up/down: change mode */
|
||||||
|
if(btn == BUTTON_LEFT || btn == BUTTON_DOWN || btn == BUTTON_REW)
|
||||||
|
mode = (mode + BOOT_COUNT - 1) % BOOT_COUNT;
|
||||||
|
if(btn == BUTTON_RIGHT || btn == BUTTON_UP || btn == BUTTON_FF)
|
||||||
|
mode = (mode + 1) % BOOT_COUNT;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* save mode */
|
||||||
|
save_boot_mode(mode);
|
||||||
|
return mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
void error_screen(const char *msg)
|
||||||
|
{
|
||||||
|
lcd_clear_display();
|
||||||
|
lcd_putsf(0, 0, msg);
|
||||||
|
lcd_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
int choice_screen(const char *title, bool center, int nr_choices, const char *choices[])
|
||||||
|
{
|
||||||
|
int choice = 0;
|
||||||
|
int max_len = 0;
|
||||||
|
int h;
|
||||||
|
lcd_getstringsize("x", NULL, &h);
|
||||||
|
for(int i = 0; i < nr_choices; i++)
|
||||||
|
{
|
||||||
|
int len = strlen(choices[i]);
|
||||||
|
if(len > max_len)
|
||||||
|
max_len = len;
|
||||||
|
}
|
||||||
|
char *buf = malloc(max_len + 10);
|
||||||
|
int top_y = 2 * h;
|
||||||
|
int nr_lines = (LCD_HEIGHT - top_y) / h;
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
/* make sure choice is visible */
|
||||||
|
int offset = choice - nr_lines / 2;
|
||||||
|
if(offset < 0)
|
||||||
|
offset = 0;
|
||||||
|
lcd_clear_display();
|
||||||
|
/* display top text */
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
|
||||||
|
display_text_center(0, title);
|
||||||
|
int line = 0;
|
||||||
|
for(int i = 0; i < nr_choices && line < nr_lines; i++)
|
||||||
|
{
|
||||||
|
if(i < offset)
|
||||||
|
continue;
|
||||||
|
if(i == choice)
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
|
||||||
|
else
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
|
||||||
|
sprintf(buf, "%s", choices[i]);
|
||||||
|
if(center)
|
||||||
|
display_text_center(top_y + h * line, buf);
|
||||||
|
else
|
||||||
|
lcd_putsxy(0, top_y + h * line, buf);
|
||||||
|
line++;
|
||||||
|
}
|
||||||
|
|
||||||
|
lcd_update();
|
||||||
|
|
||||||
|
/* wait for a key */
|
||||||
|
int btn = button_get_w_tmo(HZ / 10);
|
||||||
|
/* ignore release, allow repeat */
|
||||||
|
if(btn & BUTTON_REL)
|
||||||
|
continue;
|
||||||
|
if(btn & BUTTON_REPEAT)
|
||||||
|
btn &= ~BUTTON_REPEAT;
|
||||||
|
/* play -> stop loop and return mode */
|
||||||
|
if(btn == BUTTON_PLAY || btn == BUTTON_LEFT)
|
||||||
|
{
|
||||||
|
free(buf);
|
||||||
|
return btn == BUTTON_PLAY ? choice : -1;
|
||||||
|
}
|
||||||
|
/* left/right/up/down: change mode */
|
||||||
|
if(btn == BUTTON_UP)
|
||||||
|
choice = (choice + nr_choices - 1) % nr_choices;
|
||||||
|
if(btn == BUTTON_DOWN)
|
||||||
|
choice = (choice + 1) % nr_choices;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void run_file(const char *name)
|
||||||
|
{
|
||||||
|
char *dirname = "/mnt/sd_0/";
|
||||||
|
char *buf = malloc(strlen(dirname) + strlen(name) + 1);
|
||||||
|
sprintf(buf, "%s%s", dirname, name);
|
||||||
|
|
||||||
|
lcd_clear_display();
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
|
||||||
|
lcd_putsf(0, 0, "Running %s", name);
|
||||||
|
lcd_update();
|
||||||
|
|
||||||
|
pid_t pid = fork();
|
||||||
|
if(pid == 0)
|
||||||
|
{
|
||||||
|
execlp("sh", "sh", buf, NULL);
|
||||||
|
_exit(42);
|
||||||
|
}
|
||||||
|
int status;
|
||||||
|
waitpid(pid, &status, 0);
|
||||||
|
if(WIFEXITED(status))
|
||||||
|
{
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
|
||||||
|
lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
|
||||||
|
lcd_putsf(0, 1, "an error occured: %x", status);
|
||||||
|
}
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
|
||||||
|
lcd_putsf(0, 3, "Press any key or wait");
|
||||||
|
lcd_update();
|
||||||
|
/* wait a small time */
|
||||||
|
sleep(HZ);
|
||||||
|
/* ignore event */
|
||||||
|
while(button_get(false) != 0) {}
|
||||||
|
/* wait for any key or timeout */
|
||||||
|
button_get_w_tmo(4 * HZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
void run_script_menu(void)
|
||||||
|
{
|
||||||
|
const char **entries = NULL;
|
||||||
|
int nr_entries = 0;
|
||||||
|
DIR *dir = opendir("/mnt/sd_0");
|
||||||
|
struct dirent *ent;
|
||||||
|
while((ent = readdir(dir)))
|
||||||
|
{
|
||||||
|
if(ent->d_type != DT_REG)
|
||||||
|
continue;
|
||||||
|
entries = realloc(entries, (nr_entries + 1) * sizeof(const char *));
|
||||||
|
entries[nr_entries++] = strdup(ent->d_name);
|
||||||
|
}
|
||||||
|
closedir(dir);
|
||||||
|
int idx = choice_screen("RUN SCRIPT", false, nr_entries, entries);
|
||||||
|
if(idx >= 0)
|
||||||
|
run_file(entries[idx]);
|
||||||
|
for(int i = 0; i < nr_entries; i++)
|
||||||
|
free((char *)entries[i]);
|
||||||
|
free(entries);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void adb(int start)
|
||||||
|
{
|
||||||
|
pid_t pid = fork();
|
||||||
|
if(pid == 0)
|
||||||
|
{
|
||||||
|
execlp("/etc/init.d/K90adb", "K90adb", start ? "start" : "stop", NULL);
|
||||||
|
_exit(42);
|
||||||
|
}
|
||||||
|
int status;
|
||||||
|
waitpid(pid, &status, 0);
|
||||||
|
#if 0
|
||||||
|
if(WIFEXITED(status))
|
||||||
|
{
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 201, 0));
|
||||||
|
lcd_putsf(0, 1, "program returned %d", WEXITSTATUS(status));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lcd_set_foreground(LCD_RGBPACK(255, 0, 0));
|
||||||
|
lcd_putsf(0, 1, "an error occured: %x", status);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
static void tools_screen(void)
|
||||||
|
{
|
||||||
|
const char *choices[] = {"ADB start", "ADB stop", "Run script", "Restart", "Shutdown"};
|
||||||
|
int choice = choice_screen("TOOLS MENU", true, 5, choices);
|
||||||
|
if(choice == 0)
|
||||||
|
{
|
||||||
|
/* run service menu */
|
||||||
|
printf("Starting ADB service...\n");
|
||||||
|
fflush(stdout);
|
||||||
|
adb(1);
|
||||||
|
}
|
||||||
|
else if(choice == 1)
|
||||||
|
{
|
||||||
|
printf("Stopping ADB service...\n");
|
||||||
|
fflush(stdout);
|
||||||
|
adb(0);
|
||||||
|
}
|
||||||
|
else if(choice == 2)
|
||||||
|
{
|
||||||
|
run_script_menu();
|
||||||
|
}
|
||||||
|
// else if(choice == 2)
|
||||||
|
// nwz_power_restart();
|
||||||
|
else if(choice == 4)
|
||||||
|
power_off();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* open log file */
|
||||||
|
static int open_log(void)
|
||||||
|
{
|
||||||
|
/* open regular log file */
|
||||||
|
int fd = open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND);
|
||||||
|
/* get its size */
|
||||||
|
struct stat stat;
|
||||||
|
if(fstat(fd, &stat) != 0)
|
||||||
|
return fd; /* on error, don't do anything */
|
||||||
|
/* if file is too large, rename it and start a new log file */
|
||||||
|
if(stat.st_size < 1000000)
|
||||||
|
return fd;
|
||||||
|
close(fd);
|
||||||
|
/* move file */
|
||||||
|
rename("/mnt/sd_0/rockbox.log", "/mnt_sd0/rockbox.log.1");
|
||||||
|
/* re-open the file, truncate in case the move was unsuccessful */
|
||||||
|
return open("/mnt/sd_0/rockbox.log", O_RDWR | O_CREAT | O_APPEND | O_TRUNC);
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
(void) argc;
|
||||||
|
(void) argv;
|
||||||
|
/* redirect stdout and stderr to have error messages logged somewhere on the
|
||||||
|
* user partition */
|
||||||
|
int fd = open_log();
|
||||||
|
if(fd >= 0)
|
||||||
|
{
|
||||||
|
dup2(fd, fileno(stdout));
|
||||||
|
dup2(fd, fileno(stderr));
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
/* print version */
|
||||||
|
printf("Rockbox boot loader\n");
|
||||||
|
printf("Version: %s\n", rbversion);
|
||||||
|
printf("%s\n", MODEL_NAME);
|
||||||
|
|
||||||
|
system_init();
|
||||||
|
core_allocator_init();
|
||||||
|
kernel_init();
|
||||||
|
paths_init();
|
||||||
|
lcd_init();
|
||||||
|
font_init();
|
||||||
|
button_init();
|
||||||
|
backlight_init();
|
||||||
|
backlight_set_brightness(DEFAULT_BRIGHTNESS_SETTING);
|
||||||
|
// /* try to load the extra font we install on the device */
|
||||||
|
// int font_id = font_load("/usr/local/share/rockbox/bootloader.fnt");
|
||||||
|
// if(font_id >= 0)
|
||||||
|
// lcd_setfont(font_id);
|
||||||
|
|
||||||
|
/* run all tools menu */
|
||||||
|
while(true)
|
||||||
|
{
|
||||||
|
enum boot_mode mode = get_boot_mode();
|
||||||
|
if(mode == BOOT_USB || mode == BOOT_OF)
|
||||||
|
{
|
||||||
|
fflush(stdout);
|
||||||
|
fflush(stderr);
|
||||||
|
close(fileno(stdout));
|
||||||
|
close(fileno(stderr));
|
||||||
|
/* for now the only way we have to trigger USB mode it to run the OF */
|
||||||
|
/* boot OF */
|
||||||
|
execvp("/usr/bin/hiby_player", argv);
|
||||||
|
error_screen("Cannot boot OF");
|
||||||
|
sleep(5 * HZ);
|
||||||
|
}
|
||||||
|
else if(mode == BOOT_TOOLS)
|
||||||
|
{
|
||||||
|
tools_screen();
|
||||||
|
}
|
||||||
|
else if(mode == BOOT_ROCKBOX)
|
||||||
|
{
|
||||||
|
/* Rockbox expects /.rockbox to contain themes, rocks, etc, but we
|
||||||
|
* cannot easily create this symlink because the root filesystem is
|
||||||
|
* mounted read-only. Although we could remount it read-write temporarily,
|
||||||
|
* this is neededlessly complicated and we defer this job to the dualboot
|
||||||
|
* install script */
|
||||||
|
fflush(stdout);
|
||||||
|
execl("/mnt/sd_0/.rockbox/rockbox.rocker", "rockbox.rocker", NULL);
|
||||||
|
printf("execvp failed: %s\n", strerror(errno));
|
||||||
|
/* fallback to OF in case of failure */
|
||||||
|
error_screen("Cannot boot Rockbox");
|
||||||
|
sleep(5 * HZ);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("suspend\n");
|
||||||
|
// nwz_power_suspend();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* if we reach this point, everything failed, so return an error so that
|
||||||
|
* sysmgrd knows something is wrong */
|
||||||
|
return 1;
|
||||||
|
}
|
|
@ -96,10 +96,6 @@ target/hosted/samsungypr/radio-ypr.c
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR)
|
#if defined(SONY_NWZ_LINUX) && !defined(SIMULATOR)
|
||||||
target/hosted/backtrace-glibc.c
|
|
||||||
target/hosted/kernel-unix.c
|
|
||||||
target/hosted/filesystem-unix.c
|
|
||||||
target/hosted/lc-unix.c
|
|
||||||
target/hosted/sonynwz/lcd-nwz.c
|
target/hosted/sonynwz/lcd-nwz.c
|
||||||
target/hosted/sonynwz/button-nwz.c
|
target/hosted/sonynwz/button-nwz.c
|
||||||
target/hosted/sonynwz/system-nwz.c
|
target/hosted/sonynwz/system-nwz.c
|
||||||
|
@ -113,6 +109,23 @@ target/hosted/sonynwz/nvp-nwz.c
|
||||||
target/hosted/sonynwz/nwz-db.c
|
target/hosted/sonynwz/nwz-db.c
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(AGPTEK_ROCKER) && !defined(SIMULATOR)
|
||||||
|
target/hosted/backtrace-glibc.c
|
||||||
|
target/hosted/kernel-unix.c
|
||||||
|
target/hosted/filesystem-unix.c
|
||||||
|
target/hosted/lc-unix.c
|
||||||
|
target/hosted/alsa-controls.c
|
||||||
|
target/hosted/pcm-alsa.c
|
||||||
|
target/hosted/agptek/sysfs.c
|
||||||
|
target/hosted/agptek/backlight-agptek.c
|
||||||
|
target/hosted/agptek/button-agptek.c
|
||||||
|
target/hosted/agptek/debug-agptek.c
|
||||||
|
target/hosted/agptek/lcd-agptek.c
|
||||||
|
target/hosted/agptek/power-agptek.c
|
||||||
|
target/hosted/agptek/powermgmt-agptek.c
|
||||||
|
target/hosted/agptek/system-agptek.c
|
||||||
|
#endif
|
||||||
|
|
||||||
#if defined(SAMSUNG_YPR0) && !defined(SIMULATOR)
|
#if defined(SAMSUNG_YPR0) && !defined(SIMULATOR)
|
||||||
drivers/adc-as3514.c
|
drivers/adc-as3514.c
|
||||||
#if (CONFIG_RTC == RTC_AS3514)
|
#if (CONFIG_RTC == RTC_AS3514)
|
||||||
|
@ -250,7 +263,7 @@ drivers/lcd-16bit-vert.c
|
||||||
#else
|
#else
|
||||||
drivers/lcd-16bit.c
|
drivers/lcd-16bit.c
|
||||||
#endif
|
#endif
|
||||||
#elif LCD_DEPTH == 24
|
#elif (LCD_DEPTH == 24) || (LCD_PIXELFORMAT == XRGB8888)
|
||||||
drivers/lcd-24bit.c
|
drivers/lcd-24bit.c
|
||||||
#endif /* LCD_DEPTH */
|
#endif /* LCD_DEPTH */
|
||||||
common/diacritic.c
|
common/diacritic.c
|
||||||
|
@ -470,6 +483,8 @@ target/hosted/pcm-alsa.c
|
||||||
drivers/audio/nwzlinux-codec.c
|
drivers/audio/nwzlinux-codec.c
|
||||||
target/hosted/alsa-controls.c
|
target/hosted/alsa-controls.c
|
||||||
target/hosted/pcm-alsa.c
|
target/hosted/pcm-alsa.c
|
||||||
|
#elif defined(HAVE_ROCKER_CODEC)
|
||||||
|
drivers/audio/rocker_codec.c
|
||||||
#elif defined(HAVE_SDL_AUDIO)
|
#elif defined(HAVE_SDL_AUDIO)
|
||||||
drivers/audio/sdl.c
|
drivers/audio/sdl.c
|
||||||
#if CONFIG_CODEC == SWCODEC
|
#if CONFIG_CODEC == SWCODEC
|
||||||
|
@ -1618,10 +1633,10 @@ target/arm/s5l8700/ipodnano2g/piezo-nano2g.c
|
||||||
|
|
||||||
#ifdef IPOD_6G
|
#ifdef IPOD_6G
|
||||||
target/arm/ipod/button-clickwheel.c
|
target/arm/ipod/button-clickwheel.c
|
||||||
target/arm/s5l8702/ipod6g/storage_ata-6g.c
|
target/arm/s5l8702/ipod6g/storage_ata-ipod6g.c
|
||||||
target/arm/s5l8702/ipod6g/backlight-6g.c
|
target/arm/s5l8702/ipod6g/backlight-ipod6g.c
|
||||||
target/arm/s5l8702/ipod6g/powermgmt-6g.c
|
target/arm/s5l8702/ipod6g/powermgmt-ipod6g.c
|
||||||
target/arm/s5l8702/ipod6g/power-6g.c
|
target/arm/s5l8702/ipod6g/power-ipod6g.c
|
||||||
target/arm/s5l8702/kernel-s5l8702.c
|
target/arm/s5l8702/kernel-s5l8702.c
|
||||||
target/arm/s5l8702/system-s5l8702.c
|
target/arm/s5l8702/system-s5l8702.c
|
||||||
target/arm/s5l8702/timer-s5l8702.c
|
target/arm/s5l8702/timer-s5l8702.c
|
||||||
|
@ -1629,28 +1644,28 @@ target/arm/s5l8702/gpio-s5l8702.c
|
||||||
target/arm/s5l8702/pl080.c
|
target/arm/s5l8702/pl080.c
|
||||||
target/arm/s5l8702/dma-s5l8702.c
|
target/arm/s5l8702/dma-s5l8702.c
|
||||||
target/arm/s5l8702/clocking-s5l8702.c
|
target/arm/s5l8702/clocking-s5l8702.c
|
||||||
target/arm/s5l8702/ipod6g/lcd-6g.c
|
target/arm/s5l8702/ipod6g/lcd-ipod6g.c
|
||||||
target/arm/s5l8702/ipod6g/lcd-asm-6g.S
|
target/arm/s5l8702/ipod6g/lcd-asm-ipod6g.S
|
||||||
target/arm/s5l8702/ipod6g/piezo-6g.c
|
target/arm/s5l8702/ipod6g/piezo-ipod6g.c
|
||||||
#if 0 //TODO
|
#if 0 //TODO
|
||||||
target/arm/s5l8702/postmortemstub.S
|
target/arm/s5l8702/postmortemstub.S
|
||||||
#endif
|
#endif
|
||||||
target/arm/s5l8702/ipod6g/pmu-6g.c
|
target/arm/s5l8702/ipod6g/pmu-ipod6g.c
|
||||||
target/arm/s5l8702/ipod6g/rtc-6g.c
|
target/arm/s5l8702/ipod6g/rtc-ipod6g.c
|
||||||
target/arm/s5l8702/ipod6g/adc-6g.c
|
target/arm/s5l8702/ipod6g/adc-ipod6g.c
|
||||||
#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
|
#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
|
||||||
target/arm/s5l8702/usb-s5l8702.c
|
target/arm/s5l8702/usb-s5l8702.c
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_SERIAL
|
#ifdef HAVE_SERIAL
|
||||||
target/arm/uc870x.c
|
target/arm/uc870x.c
|
||||||
target/arm/s5l8702/uart-s5l8702.c
|
target/arm/s5l8702/uart-s5l8702.c
|
||||||
target/arm/s5l8702/ipod6g/serial-6g.c
|
target/arm/s5l8702/ipod6g/serial-ipod6g.c
|
||||||
#endif
|
#endif
|
||||||
#ifndef BOOTLOADER
|
#ifndef BOOTLOADER
|
||||||
target/arm/s5l8702/debug-s5l8702.c
|
target/arm/s5l8702/debug-s5l8702.c
|
||||||
target/arm/s5l8702/pcm-s5l8702.c
|
target/arm/s5l8702/pcm-s5l8702.c
|
||||||
target/arm/s5l8702/ipod6g/audio-6g.c
|
target/arm/s5l8702/ipod6g/audio-ipod6g.c
|
||||||
target/arm/s5l8702/ipod6g/cscodec-6g.c
|
target/arm/s5l8702/ipod6g/cscodec-ipod6g.c
|
||||||
#else
|
#else
|
||||||
target/arm/s5l8702/spi-s5l8702.c
|
target/arm/s5l8702/spi-s5l8702.c
|
||||||
target/arm/s5l8702/crypto-s5l8702.c
|
target/arm/s5l8702/crypto-s5l8702.c
|
||||||
|
|
|
@ -15,9 +15,9 @@ mempcpy.c
|
||||||
defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \
|
defined(CREATIVE_ZVx) || defined(SANSA_CONNECT) || defined(SANSA_FUZEPLUS) || \
|
||||||
defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \
|
defined(COWON_D2) || defined(MINI2440) || defined(SAMSUNG_YPR0) || \
|
||||||
defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \
|
defined(SAMSUNG_YPR1) || defined(DX50) || defined(DX90) || (defined(MROBE_500) && !defined(LCD_USE_DMA)) || \
|
||||||
defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX)) && \
|
defined(CREATIVE_ZEN) || defined(CREATIVE_ZENXFI) || defined(SONY_NWZ_LINUX) || defined(AGPTEK_ROCKER)) && \
|
||||||
!defined(SIMULATOR)
|
!defined(SIMULATOR)
|
||||||
#if LCD_DEPTH == 24
|
#if LCD_DEPTH >= 24
|
||||||
lcd-as-memframe-24bit.c
|
lcd-as-memframe-24bit.c
|
||||||
#else
|
#else
|
||||||
lcd-as-memframe.c
|
lcd-as-memframe.c
|
||||||
|
|
|
@ -26,24 +26,23 @@
|
||||||
*---------------------------------------------------------------------------
|
*---------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void start_thread(void); /* Provide C access to ASM label */
|
static void USED_ATTR start_thread(void *addr)
|
||||||
static void USED_ATTR _start_thread(void)
|
|
||||||
{
|
{
|
||||||
/* t1 = context */
|
|
||||||
asm volatile (
|
asm volatile (
|
||||||
"start_thread: \n"
|
|
||||||
".set noreorder \n"
|
".set noreorder \n"
|
||||||
".set noat \n"
|
".set noat \n"
|
||||||
"lw $8, 4($9) \n" /* Fetch thread function pointer ($8 = t0, $9 = t1) */
|
"lw $t9, 4(%0) \n" /* Fetch thread function pointer ($25 = t9) */
|
||||||
"lw $29, 36($9) \n" /* Set initial sp(=$29) */
|
"lw $sp, 40(%0) \n" /* Set initial sp(=$29) */
|
||||||
"jalr $8 \n" /* Start the thread */
|
"jalr $t9 \n" /* Start the thread */
|
||||||
"sw $0, 44($9) \n" /* Clear start address */
|
"sw $zero, 48(%0) \n" /* Clear start address */
|
||||||
".set at \n"
|
".set at \n"
|
||||||
".set reorder \n"
|
".set reorder \n"
|
||||||
|
: : "r" (addr) : "t9"
|
||||||
);
|
);
|
||||||
thread_exit();
|
thread_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Place context pointer in s0 slot, function pointer in s1 slot, and
|
/* Place context pointer in s0 slot, function pointer in s1 slot, and
|
||||||
* start_thread pointer in context_start */
|
* start_thread pointer in context_start */
|
||||||
#define THREAD_STARTUP_INIT(core, thread, function) \
|
#define THREAD_STARTUP_INIT(core, thread, function) \
|
||||||
|
@ -60,17 +59,18 @@ static inline void store_context(void* addr)
|
||||||
asm volatile (
|
asm volatile (
|
||||||
".set noreorder \n"
|
".set noreorder \n"
|
||||||
".set noat \n"
|
".set noat \n"
|
||||||
"sw $16, 0(%0) \n" /* s0 */
|
"sw $s0, 0(%0) \n" /* s0 */
|
||||||
"sw $17, 4(%0) \n" /* s1 */
|
"sw $s1, 4(%0) \n" /* s1 */
|
||||||
"sw $18, 8(%0) \n" /* s2 */
|
"sw $s2, 8(%0) \n" /* s2 */
|
||||||
"sw $19, 12(%0) \n" /* s3 */
|
"sw $s3, 12(%0) \n" /* s3 */
|
||||||
"sw $20, 16(%0) \n" /* s4 */
|
"sw $s4, 16(%0) \n" /* s4 */
|
||||||
"sw $21, 20(%0) \n" /* s5 */
|
"sw $s5, 20(%0) \n" /* s5 */
|
||||||
"sw $22, 24(%0) \n" /* s6 */
|
"sw $s6, 24(%0) \n" /* s6 */
|
||||||
"sw $23, 28(%0) \n" /* s7 */
|
"sw $s7, 28(%0) \n" /* s7 */
|
||||||
"sw $30, 32(%0) \n" /* fp */
|
"sw $gp, 32(%0) \n" /* gp */
|
||||||
"sw $29, 36(%0) \n" /* sp */
|
"sw $fp, 36(%0) \n" /* fp */
|
||||||
"sw $31, 40(%0) \n" /* ra */
|
"sw $sp, 40(%0) \n" /* sp */
|
||||||
|
"sw $ra, 44(%0) \n" /* ra */
|
||||||
".set at \n"
|
".set at \n"
|
||||||
".set reorder \n"
|
".set reorder \n"
|
||||||
: : "r" (addr)
|
: : "r" (addr)
|
||||||
|
@ -86,26 +86,27 @@ static inline void load_context(const void* addr)
|
||||||
asm volatile (
|
asm volatile (
|
||||||
".set noat \n"
|
".set noat \n"
|
||||||
".set noreorder \n"
|
".set noreorder \n"
|
||||||
"lw $8, 44(%0) \n" /* Get start address ($8 = t0) */
|
"lw $t9, 48(%0) \n" /* Get start address ($8 = t0) */
|
||||||
"beqz $8, running \n" /* NULL -> already running */
|
"beqz $t9, running \n" /* NULL -> already running */
|
||||||
"nop \n"
|
"nop \n"
|
||||||
"jr $8 \n"
|
"jr $t9 \n"
|
||||||
"move $9, %0 \n" /* t1 = context */
|
"move $a0, %0 \n" /* a0 = context branch delay slot anyway */
|
||||||
"running: \n"
|
"running: \n"
|
||||||
"lw $16, 0(%0) \n" /* s0 */
|
"lw $s0, 0(%0) \n" /* s0 */
|
||||||
"lw $17, 4(%0) \n" /* s1 */
|
"lw $s1, 4(%0) \n" /* s1 */
|
||||||
"lw $18, 8(%0) \n" /* s2 */
|
"lw $s2, 8(%0) \n" /* s2 */
|
||||||
"lw $19, 12(%0) \n" /* s3 */
|
"lw $s3, 12(%0) \n" /* s3 */
|
||||||
"lw $20, 16(%0) \n" /* s4 */
|
"lw $s4, 16(%0) \n" /* s4 */
|
||||||
"lw $21, 20(%0) \n" /* s5 */
|
"lw $s5, 20(%0) \n" /* s5 */
|
||||||
"lw $22, 24(%0) \n" /* s6 */
|
"lw $s6, 24(%0) \n" /* s6 */
|
||||||
"lw $23, 28(%0) \n" /* s7 */
|
"lw $s7, 28(%0) \n" /* s7 */
|
||||||
"lw $30, 32(%0) \n" /* fp */
|
"lw $gp, 32(%0) \n" /* gp */
|
||||||
"lw $29, 36(%0) \n" /* sp */
|
"lw $fp, 36(%0) \n" /* fp */
|
||||||
"lw $31, 40(%0) \n" /* ra */
|
"lw $sp, 40(%0) \n" /* sp */
|
||||||
|
"lw $ra, 44(%0) \n" /* ra */
|
||||||
".set at \n"
|
".set at \n"
|
||||||
".set reorder \n"
|
".set reorder \n"
|
||||||
: : "r" (addr) : "t0", "t1"
|
: : "r" (addr) : "t9"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,24 @@
|
||||||
*
|
*
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* index offset register
|
||||||
|
* 0 0 $16 s0
|
||||||
|
* 1 4 $17 s1
|
||||||
|
* 2 8 $18 s2
|
||||||
|
* 3 12 $19 s3
|
||||||
|
* 4 16 $20 s4
|
||||||
|
* 5 20 $21 s5
|
||||||
|
* 6 24 $22 s6
|
||||||
|
* 7 28 $23 s7
|
||||||
|
* 8 32 $28 gp
|
||||||
|
* 9 36 $30 s8 (s8)
|
||||||
|
* 10 40 $29 sp
|
||||||
|
* 11 44 $31 ra
|
||||||
|
* 12 48 start
|
||||||
|
*/
|
||||||
struct regs
|
struct regs
|
||||||
{
|
{
|
||||||
uint32_t r[9]; /* 0-32 - Registers s0-s7, fp */
|
uint32_t r[10]; /* 0-32 - Registers s0-s7, gp, fp */
|
||||||
uint32_t sp; /* 36 - Stack pointer */
|
uint32_t sp; /* 36 - Stack pointer */
|
||||||
uint32_t ra; /* 40 - Return address */
|
uint32_t ra; /* 40 - Return address */
|
||||||
uint32_t start; /* 44 - Thread start address, or NULL when started */
|
uint32_t start; /* 44 - Thread start address, or NULL when started */
|
||||||
|
|
77
firmware/drivers/audio/rocker_codec.c
Normal file
77
firmware/drivers/audio/rocker_codec.c
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Copyright (c) 2018 Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "audio.h"
|
||||||
|
#include "audiohw.h"
|
||||||
|
#include "system.h"
|
||||||
|
#include "panic.h"
|
||||||
|
#include "alsa-controls.h"
|
||||||
|
|
||||||
|
static int fd_hw;
|
||||||
|
|
||||||
|
static void hw_open(void)
|
||||||
|
{
|
||||||
|
fd_hw = open("/dev/snd/controlC0", O_RDWR);
|
||||||
|
if(fd_hw < 0)
|
||||||
|
panicf("Cannot open '/dev/snd/controlC0'");
|
||||||
|
}
|
||||||
|
|
||||||
|
static void hw_close(void)
|
||||||
|
{
|
||||||
|
close(fd_hw);
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_preinit(void)
|
||||||
|
{
|
||||||
|
long int hp = 2;
|
||||||
|
|
||||||
|
alsa_controls_init();
|
||||||
|
hw_open();
|
||||||
|
|
||||||
|
/* Output port switch set to Headphones */
|
||||||
|
alsa_controls_set_ints("Output Port Switch", 1, &hp);
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_postinit(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_close(void)
|
||||||
|
{
|
||||||
|
hw_close();
|
||||||
|
alsa_controls_close();
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_set_frequency(int fsel)
|
||||||
|
{
|
||||||
|
(void)fsel;
|
||||||
|
}
|
||||||
|
|
||||||
|
void audiohw_set_volume(int vol_l, int vol_r)
|
||||||
|
{
|
||||||
|
long int vol_l_hw = -vol_l/5;
|
||||||
|
long int vol_r_hw = -vol_r/5;
|
||||||
|
|
||||||
|
alsa_controls_set_ints("Left Playback Volume", 1, &vol_l_hw);
|
||||||
|
alsa_controls_set_ints("Right Playback Volume", 1, &vol_r_hw);
|
||||||
|
}
|
|
@ -189,7 +189,8 @@ void lcd_fillrect(int x, int y, int width, int height)
|
||||||
enum fill_opt fillopt = OPT_NONE;
|
enum fill_opt fillopt = OPT_NONE;
|
||||||
fb_data *dst, *dst_end;
|
fb_data *dst, *dst_end;
|
||||||
int len, step;
|
int len, step;
|
||||||
fb_data bits = { 0, 0, 0 };
|
fb_data bits; // = { 0, 0, 0 };
|
||||||
|
memset(&bits, 0, sizeof(fb_data));
|
||||||
|
|
||||||
/******************** In viewport clipping **********************/
|
/******************** In viewport clipping **********************/
|
||||||
/* nothing to draw? */
|
/* nothing to draw? */
|
||||||
|
|
|
@ -216,6 +216,8 @@ struct sound_settings_info
|
||||||
#include "codec-dx50.h"
|
#include "codec-dx50.h"
|
||||||
#elif defined(DX90)
|
#elif defined(DX90)
|
||||||
#include "codec-dx90.h"
|
#include "codec-dx90.h"
|
||||||
|
#elif defined(HAVE_ROCKER_CODEC)
|
||||||
|
#include "rocker_codec.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* convert caps into defines */
|
/* convert caps into defines */
|
||||||
|
|
|
@ -166,6 +166,7 @@
|
||||||
#define SAMSUNG_YH92X_PAD 62
|
#define SAMSUNG_YH92X_PAD 62
|
||||||
#define DX50_PAD 63
|
#define DX50_PAD 63
|
||||||
#define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */
|
#define SONY_NWZA860_PAD 64 /* The NWZ-A860 is too different (touchscreen) */
|
||||||
|
#define AGPTEK_ROCKER_PAD 65
|
||||||
|
|
||||||
/* CONFIG_REMOTE_KEYPAD */
|
/* CONFIG_REMOTE_KEYPAD */
|
||||||
#define H100_REMOTE 1
|
#define H100_REMOTE 1
|
||||||
|
@ -279,6 +280,7 @@
|
||||||
#define LCD_CREATIVEZENXFISTYLE 61 /* as used by Creative Zen X-Fi Style */
|
#define LCD_CREATIVEZENXFISTYLE 61 /* as used by Creative Zen X-Fi Style */
|
||||||
#define LCD_SAMSUNGYPR1 62 /* as used by Samsung YP-R1 */
|
#define LCD_SAMSUNGYPR1 62 /* as used by Samsung YP-R1 */
|
||||||
#define LCD_NWZ_LINUX 63 /* as used in the Linux-based NWZ series */
|
#define LCD_NWZ_LINUX 63 /* as used in the Linux-based NWZ series */
|
||||||
|
#define LCD_INGENIC_LINUX 64
|
||||||
|
|
||||||
/* LCD_PIXELFORMAT */
|
/* LCD_PIXELFORMAT */
|
||||||
#define HORIZONTAL_PACKING 1
|
#define HORIZONTAL_PACKING 1
|
||||||
|
@ -288,6 +290,7 @@
|
||||||
#define RGB565 565
|
#define RGB565 565
|
||||||
#define RGB565SWAPPED 3553
|
#define RGB565SWAPPED 3553
|
||||||
#define RGB888 888
|
#define RGB888 888
|
||||||
|
#define XRGB8888 8888
|
||||||
|
|
||||||
/* LCD_STRIDEFORMAT */
|
/* LCD_STRIDEFORMAT */
|
||||||
#define VERTICAL_STRIDE 1
|
#define VERTICAL_STRIDE 1
|
||||||
|
@ -601,6 +604,8 @@ Lyre prototype 1 */
|
||||||
#include "config/sonynwzs750.h"
|
#include "config/sonynwzs750.h"
|
||||||
#elif defined(SONY_NWZE350)
|
#elif defined(SONY_NWZE350)
|
||||||
#include "config/sonynwze350.h"
|
#include "config/sonynwze350.h"
|
||||||
|
#elif defined(AGPTEK_ROCKER)
|
||||||
|
#include "config/agptekrocker.h"
|
||||||
#else
|
#else
|
||||||
/* no known platform */
|
/* no known platform */
|
||||||
#endif
|
#endif
|
||||||
|
|
119
firmware/export/config/agptekrocker.h
Normal file
119
firmware/export/config/agptekrocker.h
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
/*
|
||||||
|
* This config file is for the Agptek Rocket
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* For Rolo and boot loader */
|
||||||
|
#define MODEL_NUMBER 103//???
|
||||||
|
|
||||||
|
#define MODEL_NAME "Agptek Rocker"
|
||||||
|
|
||||||
|
/* LCD dimensions */
|
||||||
|
#define LCD_WIDTH 128
|
||||||
|
#define LCD_HEIGHT 160
|
||||||
|
/* sqrt(128^2 + 160^2) / 2 = 102. */
|
||||||
|
#define LCD_DPI 102
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
#define CONFIG_PLATFORM (PLATFORM_HOSTED)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* define this if you have a bitmap LCD display */
|
||||||
|
#define HAVE_LCD_BITMAP
|
||||||
|
|
||||||
|
/* define this if you have a colour LCD */
|
||||||
|
#define HAVE_LCD_COLOR
|
||||||
|
|
||||||
|
/* Define this if the LCD can shut down */
|
||||||
|
//#define HAVE_LCD_SHUTDOWN
|
||||||
|
|
||||||
|
/* define this if you want album art for this target */
|
||||||
|
#define HAVE_ALBUMART
|
||||||
|
|
||||||
|
/* define this to enable bitmap scaling */
|
||||||
|
#define HAVE_BMP_SCALING
|
||||||
|
|
||||||
|
/* define this to enable JPEG decoding */
|
||||||
|
#define HAVE_JPEG
|
||||||
|
|
||||||
|
/* define this if you have access to the quickscreen */
|
||||||
|
#define HAVE_QUICKSCREEN
|
||||||
|
|
||||||
|
/* define this if you would like tagcache to build on this target */
|
||||||
|
#define HAVE_TAGCACHE
|
||||||
|
|
||||||
|
#define LCD_DEPTH 32
|
||||||
|
/* Check that but should not matter */
|
||||||
|
#define LCD_PIXELFORMAT XRGB8888
|
||||||
|
|
||||||
|
#define HAVE_BACKLIGHT
|
||||||
|
#define HAVE_BACKLIGHT_BRIGHTNESS
|
||||||
|
|
||||||
|
/* Main LCD backlight brightness range and defaults: the backlight driver
|
||||||
|
* has levels from 0 to 2555. But 0 is off so start at 1.
|
||||||
|
*/
|
||||||
|
#define MIN_BRIGHTNESS_SETTING 1
|
||||||
|
#define MAX_BRIGHTNESS_SETTING 255
|
||||||
|
#define DEFAULT_BRIGHTNESS_SETTING 70
|
||||||
|
|
||||||
|
/* Which backlight fading type? */
|
||||||
|
#define CONFIG_BACKLIGHT_FADING BACKLIGHT_FADING_SW_SETTING
|
||||||
|
|
||||||
|
/* define this if you have a real-time clock */
|
||||||
|
#define CONFIG_RTC 0
|
||||||
|
|
||||||
|
/* The number of bytes reserved for loadable codecs */
|
||||||
|
#define CODEC_SIZE 0x80000
|
||||||
|
|
||||||
|
/* The number of bytes reserved for loadable plugins */
|
||||||
|
#define PLUGIN_BUFFER_SIZE 0x100000
|
||||||
|
|
||||||
|
/* Define this if you do software codec */
|
||||||
|
#define CONFIG_CODEC SWCODEC
|
||||||
|
#define HAVE_ROCKER_CODEC
|
||||||
|
|
||||||
|
#define HAVE_HEADPHONE_DETECTION
|
||||||
|
|
||||||
|
/* KeyPad configuration for plugins */
|
||||||
|
#define CONFIG_KEYPAD AGPTEK_ROCKER_PAD
|
||||||
|
|
||||||
|
#ifndef SIMULATOR
|
||||||
|
/* We have usb power and can detect usb but it is handled by Linux */
|
||||||
|
#define HAVE_USB_POWER
|
||||||
|
#define USB_NONE
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define CONFIG_BATTERY_MEASURE VOLTAGE_MEASURE
|
||||||
|
|
||||||
|
/* Linux controlls charging, we can monitor */
|
||||||
|
#define CONFIG_CHARGING CHARGING_MONITOR
|
||||||
|
|
||||||
|
/* define this if the hardware can be powered off while charging */
|
||||||
|
#define HAVE_POWEROFF_WHILE_CHARGING
|
||||||
|
|
||||||
|
/* same dimensions as gigabeats */
|
||||||
|
#define CONFIG_LCD LCD_INGENIC_LINUX
|
||||||
|
|
||||||
|
/* Define this if you have a software controlled poweroff */
|
||||||
|
#define HAVE_SW_POWEROFF
|
||||||
|
|
||||||
|
/* Define this to the CPU frequency */
|
||||||
|
#define CPU_FREQ 532000000
|
||||||
|
|
||||||
|
/* No special storage */
|
||||||
|
#define CONFIG_STORAGE (STORAGE_HOSTFS)//|STORAGE_SD)
|
||||||
|
//#define MULTIDRIVE_DIR "/mnt/sd_0"
|
||||||
|
//#define NUM_DRIVES 1
|
||||||
|
//#define HAVE_HOTSWAP
|
||||||
|
#define HAVE_STORAGE_FLUSH
|
||||||
|
|
||||||
|
/* Battery */
|
||||||
|
#define BATTERY_TYPES_COUNT 1
|
||||||
|
|
||||||
|
/* Audio codec */
|
||||||
|
#define HAVE_ROCKER_CODEC
|
||||||
|
|
||||||
|
/* Battery */
|
||||||
|
#define BATTERY_CAPACITY_DEFAULT 600 /* default battery capacity */
|
||||||
|
#define BATTERY_CAPACITY_MIN 600 /* min. capacity selectable */
|
||||||
|
#define BATTERY_CAPACITY_MAX 600 /* max. capacity selectable */
|
||||||
|
#define BATTERY_CAPACITY_INC 0 /* capacity increment */
|
|
@ -41,7 +41,8 @@
|
||||||
#endif /* def __PCTOOL__ */
|
#endif /* def __PCTOOL__ */
|
||||||
|
|
||||||
#if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \
|
#if !defined(APPLICATION) || defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || \
|
||||||
defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX)
|
defined(DX50) || defined(DX90) || defined(SONY_NWZ_LINUX) || \
|
||||||
|
defined(AGPTEK_ROCKER)
|
||||||
|
|
||||||
#if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1)
|
#if defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1)
|
||||||
#define HOME_DIR "/mnt/media0"
|
#define HOME_DIR "/mnt/media0"
|
||||||
|
@ -50,6 +51,8 @@
|
||||||
#elif defined(DX50) || defined(DX90)
|
#elif defined(DX50) || defined(DX90)
|
||||||
/* Where to put save files like recordings, playlists, screen dumps ...*/
|
/* Where to put save files like recordings, playlists, screen dumps ...*/
|
||||||
#define HOME_DIR "/mnt/sdcard"
|
#define HOME_DIR "/mnt/sdcard"
|
||||||
|
#elif defined(AGPTEK_ROCKER)
|
||||||
|
#define HOME_DIR "/mnt/sd_0"
|
||||||
#else
|
#else
|
||||||
#define HOME_DIR "/"
|
#define HOME_DIR "/"
|
||||||
#endif
|
#endif
|
||||||
|
|
6
firmware/export/rocker_codec.h
Normal file
6
firmware/export/rocker_codec.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef __ROCKER_CODEC__
|
||||||
|
#define __ROCKER_CODEC__
|
||||||
|
|
||||||
|
#define AUDIOHW_CAPS 0
|
||||||
|
AUDIOHW_SETTING(VOLUME, "dB", 1, 5, -1020, 0, -300, )
|
||||||
|
#endif
|
|
@ -44,6 +44,7 @@
|
||||||
/** Iterators **/
|
/** Iterators **/
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <limits.h>
|
||||||
|
|
||||||
#if (defined(CPU_ARM) && ARM_ARCH >= 5) || UINT32_MAX < UINT_MAX
|
#if (defined(CPU_ARM) && ARM_ARCH >= 5) || UINT32_MAX < UINT_MAX
|
||||||
#define __BITARRAY_CTZ(wval) __builtin_ctz(wval)
|
#define __BITARRAY_CTZ(wval) __builtin_ctz(wval)
|
||||||
|
|
|
@ -37,6 +37,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include "core_alloc.h"
|
#include "core_alloc.h"
|
||||||
|
|
||||||
|
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
||||||
|
#include <errno.h>
|
||||||
|
#endif
|
||||||
/* Define THREAD_EXTRA_CHECKS as 1 to enable additional state checks */
|
/* Define THREAD_EXTRA_CHECKS as 1 to enable additional state checks */
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define THREAD_EXTRA_CHECKS 1 /* Always 1 for DEBUG */
|
#define THREAD_EXTRA_CHECKS 1 /* Always 1 for DEBUG */
|
||||||
|
|
|
@ -234,8 +234,8 @@ void screen_dump(void)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
while (dst < dst_end);
|
while (dst < dst_end);
|
||||||
#elif LCD_DEPTH == 24
|
#elif LCD_DEPTH >= 24
|
||||||
dst_end = dst + LCD_WIDTH*3;
|
dst_end = dst + LCD_WIDTH*sizeof(fb_data);
|
||||||
src = FBADDR(0, y);
|
src = FBADDR(0, y);
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
0
firmware/target/hosted/agptek/adc-target.h
Normal file
0
firmware/target/hosted/agptek/adc-target.h
Normal file
64
firmware/target/hosted/agptek/backlight-agptek.c
Normal file
64
firmware/target/hosted/agptek/backlight-agptek.c
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "config.h"
|
||||||
|
#include "backlight-target.h"
|
||||||
|
#include "sysfs.h"
|
||||||
|
#include "panic.h"
|
||||||
|
|
||||||
|
static const char * const sysfs_bl_brightness =
|
||||||
|
"/sys/class/backlight/pwm-backlight.0/brightness";
|
||||||
|
|
||||||
|
static const char * const sysfs_bl_power =
|
||||||
|
"/sys/class/backlight/pwm-backlight.0/bl_power";
|
||||||
|
|
||||||
|
bool backlight_hw_init(void)
|
||||||
|
{
|
||||||
|
backlight_hw_on();
|
||||||
|
backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void backlight_hw_on(void)
|
||||||
|
{
|
||||||
|
sysfs_set_int(sysfs_bl_power, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void backlight_hw_off(void)
|
||||||
|
{
|
||||||
|
sysfs_set_int(sysfs_bl_power, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void backlight_hw_brightness(int brightness)
|
||||||
|
{
|
||||||
|
/* cap range, just in case */
|
||||||
|
if (brightness > MAX_BRIGHTNESS_SETTING)
|
||||||
|
brightness = MAX_BRIGHTNESS_SETTING;
|
||||||
|
if (brightness < MIN_BRIGHTNESS_SETTING)
|
||||||
|
brightness = MIN_BRIGHTNESS_SETTING;
|
||||||
|
|
||||||
|
sysfs_set_int(sysfs_bl_brightness, brightness);
|
||||||
|
}
|
36
firmware/target/hosted/agptek/backlight-target.h
Normal file
36
firmware/target/hosted/agptek/backlight-target.h
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef _BACKLIGHT_TARGET_H_
|
||||||
|
#define _BACKLIGHT_TARGET_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
|
||||||
|
/* See backlight.c */
|
||||||
|
bool backlight_hw_init(void);
|
||||||
|
void backlight_hw_on(void);
|
||||||
|
void backlight_hw_off(void);
|
||||||
|
void backlight_hw_brightness(int brightness);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
149
firmware/target/hosted/agptek/button-agptek.c
Normal file
149
firmware/target/hosted/agptek/button-agptek.c
Normal file
|
@ -0,0 +1,149 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include <poll.h>
|
||||||
|
//#include <dir.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <linux/input.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#include "sysfs.h"
|
||||||
|
#include "button.h"
|
||||||
|
#include "button-target.h"
|
||||||
|
#include "panic.h"
|
||||||
|
|
||||||
|
#define NR_POLL_DESC 2
|
||||||
|
static struct pollfd poll_fds[NR_POLL_DESC];
|
||||||
|
|
||||||
|
static int button_map(int keycode)
|
||||||
|
{
|
||||||
|
switch(keycode)
|
||||||
|
{
|
||||||
|
case KEY_LEFT:
|
||||||
|
return BUTTON_LEFT;
|
||||||
|
|
||||||
|
case KEY_RIGHT:
|
||||||
|
return BUTTON_RIGHT;
|
||||||
|
|
||||||
|
case KEY_UP:
|
||||||
|
return BUTTON_UP;
|
||||||
|
|
||||||
|
case KEY_DOWN:
|
||||||
|
return BUTTON_DOWN;
|
||||||
|
|
||||||
|
case KEY_PLAYPAUSE:
|
||||||
|
return BUTTON_SELECT;
|
||||||
|
|
||||||
|
case KEY_VOLUMEUP:
|
||||||
|
return BUTTON_VOLUP;
|
||||||
|
|
||||||
|
case KEY_VOLUMEDOWN:
|
||||||
|
return BUTTON_VOLDOWN;
|
||||||
|
|
||||||
|
case KEY_POWER:
|
||||||
|
return BUTTON_POWER;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void button_init_device(void)
|
||||||
|
{
|
||||||
|
const char * const input_devs[] = {
|
||||||
|
"/dev/input/event0",
|
||||||
|
"/dev/input/event1"
|
||||||
|
};
|
||||||
|
|
||||||
|
for(int i = 0; i < NR_POLL_DESC; i++)
|
||||||
|
{
|
||||||
|
int fd = open(input_devs[i], O_RDWR);
|
||||||
|
|
||||||
|
if(fd < 0)
|
||||||
|
{
|
||||||
|
panicf("Cannot open input device: %s\n", input_devs[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
poll_fds[i].fd = fd;
|
||||||
|
poll_fds[i].events = POLLIN;
|
||||||
|
poll_fds[i].revents = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int button_read_device(void)
|
||||||
|
{
|
||||||
|
static int button_bitmap = 0;
|
||||||
|
struct input_event event;
|
||||||
|
|
||||||
|
/* check if there are any events pending and process them */
|
||||||
|
while(poll(poll_fds, NR_POLL_DESC, 0))
|
||||||
|
{
|
||||||
|
for(int i = 0; i < NR_POLL_DESC; i++)
|
||||||
|
{
|
||||||
|
/* read only if non-blocking */
|
||||||
|
if(poll_fds[i].revents & POLLIN)
|
||||||
|
{
|
||||||
|
int size = read(poll_fds[i].fd, &event, sizeof(event));
|
||||||
|
if(size == (int)sizeof(event))
|
||||||
|
{
|
||||||
|
int keycode = event.code;
|
||||||
|
/* event.value == 0x10000 means press
|
||||||
|
* event.value == 0 means release
|
||||||
|
*/
|
||||||
|
bool press = event.value ? true : false;
|
||||||
|
|
||||||
|
/* map linux event code to rockbox button bitmap */
|
||||||
|
if(press)
|
||||||
|
{
|
||||||
|
button_bitmap |= button_map(keycode);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
button_bitmap &= ~button_map(keycode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return button_bitmap;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool headphones_inserted(void)
|
||||||
|
{
|
||||||
|
int status = 0;
|
||||||
|
const char * const sysfs_hp_switch = "/sys/devices/switch/headset/status";
|
||||||
|
sysfs_get_int(sysfs_hp_switch, &status);
|
||||||
|
|
||||||
|
return status ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void button_close_device(void)
|
||||||
|
{
|
||||||
|
/* close descriptors */
|
||||||
|
for(int i = 0; i < NR_POLL_DESC; i++)
|
||||||
|
{
|
||||||
|
close(poll_fds[i].fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
43
firmware/target/hosted/agptek/button-target.h
Normal file
43
firmware/target/hosted/agptek/button-target.h
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 by Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef _BUTTON_TARGET_H_
|
||||||
|
#define _BUTTON_TARGET_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
/* Main unit's buttons */
|
||||||
|
#define BUTTON_LEFT 0x00000001
|
||||||
|
#define BUTTON_RIGHT 0x00000002
|
||||||
|
#define BUTTON_UP 0x00000004
|
||||||
|
#define BUTTON_DOWN 0x00000008
|
||||||
|
#define BUTTON_SELECT 0x00000010
|
||||||
|
#define BUTTON_VOLDOWN 0x00000020
|
||||||
|
#define BUTTON_VOLUP 0x00000040
|
||||||
|
#define BUTTON_POWER 0x00000080
|
||||||
|
|
||||||
|
#define BUTTON_MAIN 0x000000ff
|
||||||
|
|
||||||
|
/* Software power-off */
|
||||||
|
#define POWEROFF_BUTTON BUTTON_POWER
|
||||||
|
#define POWEROFF_COUNT 10
|
||||||
|
|
||||||
|
#endif /* _BUTTON_TARGET_H_ */
|
||||||
|
|
6
firmware/target/hosted/agptek/debug-agptek.c
Normal file
6
firmware/target/hosted/agptek/debug-agptek.c
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
bool debug_hw_info(void)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
111
firmware/target/hosted/agptek/lcd-agptek.c
Normal file
111
firmware/target/hosted/agptek/lcd-agptek.c
Normal file
|
@ -0,0 +1,111 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
* Copyright (C) 2016 Amaury Pouly
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <linux/fb.h>
|
||||||
|
#include <sys/mman.h>
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include "lcd.h"
|
||||||
|
#include "lcd-target.h"
|
||||||
|
#include "backlight-target.h"
|
||||||
|
#include "panic.h"
|
||||||
|
|
||||||
|
static int fd = -1;
|
||||||
|
static struct fb_var_screeninfo vinfo;
|
||||||
|
fb_data *framebuffer = 0; /* global variable, see lcd-target.h */
|
||||||
|
|
||||||
|
void lcd_init_device(void)
|
||||||
|
{
|
||||||
|
const char * const fb_dev = "/dev/fb0";
|
||||||
|
fd = open(fb_dev, O_RDWR);
|
||||||
|
if(fd < 0)
|
||||||
|
{
|
||||||
|
panicf("Cannot open framebuffer: %s\n", fb_dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* get fixed and variable information */
|
||||||
|
struct fb_fix_screeninfo finfo;
|
||||||
|
if(ioctl(fd, FBIOGET_FSCREENINFO, &finfo) < 0)
|
||||||
|
{
|
||||||
|
panicf("Cannot read framebuffer fixed information");
|
||||||
|
}
|
||||||
|
|
||||||
|
if(ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) < 0)
|
||||||
|
{
|
||||||
|
panicf("Cannot read framebuffer variable information");
|
||||||
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* check resolution and framebuffer size */
|
||||||
|
if(vinfo.xres != LCD_WIDTH || vinfo.yres != LCD_HEIGHT || vinfo.bits_per_pixel != LCD_DEPTH)
|
||||||
|
{
|
||||||
|
panicf("Unexpected framebuffer resolution: %dx%dx%d\n", vinfo.xres,
|
||||||
|
vinfo.yres, vinfo.bits_per_pixel);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
/* Note: we use a framebuffer size of width*height*bbp. We cannot trust the
|
||||||
|
* values returned by the driver for line_length */
|
||||||
|
|
||||||
|
/* map framebuffer */
|
||||||
|
framebuffer = mmap(0, FRAMEBUFFER_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
|
if((void *)framebuffer == MAP_FAILED)
|
||||||
|
{
|
||||||
|
panicf("Cannot map framebuffer");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static void redraw(void)
|
||||||
|
{
|
||||||
|
ioctl(fd, FBIOPAN_DISPLAY, &vinfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
extern void lcd_copy_buffer_rect(fb_data *dst, const fb_data *src,
|
||||||
|
int width, int height);
|
||||||
|
|
||||||
|
void lcd_update(void)
|
||||||
|
{
|
||||||
|
/* Copy the Rockbox framebuffer to the second framebuffer */
|
||||||
|
lcd_copy_buffer_rect(LCD_FRAMEBUF_ADDR(0, 0), FBADDR(0,0),
|
||||||
|
LCD_WIDTH*LCD_HEIGHT, 1);
|
||||||
|
redraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
void lcd_update_rect(int x, int y, int width, int height)
|
||||||
|
{
|
||||||
|
fb_data *dst = LCD_FRAMEBUF_ADDR(x, y);
|
||||||
|
fb_data * src = FBADDR(x,y);
|
||||||
|
|
||||||
|
/* Copy part of the Rockbox framebuffer to the second framebuffer */
|
||||||
|
if (width < LCD_WIDTH)
|
||||||
|
{
|
||||||
|
/* Not full width - do line-by-line */
|
||||||
|
lcd_copy_buffer_rect(dst, src, width, height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Full width - copy as one line */
|
||||||
|
lcd_copy_buffer_rect(dst, src, LCD_WIDTH*height, 1);
|
||||||
|
}
|
||||||
|
redraw();
|
||||||
|
}
|
26
firmware/target/hosted/agptek/lcd-target.h
Normal file
26
firmware/target/hosted/agptek/lcd-target.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2016 Amaury Pouly
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef __LCD_TARGET_H__
|
||||||
|
#define __LCD_TARGET_H__
|
||||||
|
|
||||||
|
extern fb_data *framebuffer; /* see lcd-nwz.c */
|
||||||
|
#define LCD_FRAMEBUF_ADDR(col, row) (framebuffer + (row)*LCD_WIDTH + (col))
|
||||||
|
#endif /* __LCD_TARGET_H__ */
|
59
firmware/target/hosted/agptek/power-agptek.c
Normal file
59
firmware/target/hosted/agptek/power-agptek.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 by Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "system.h"
|
||||||
|
#include "power-agptek.h"
|
||||||
|
#include "power.h"
|
||||||
|
#include "panic.h"
|
||||||
|
#include "sysfs.h"
|
||||||
|
|
||||||
|
const char * const sysfs_bat_voltage =
|
||||||
|
"/sys/class/power_supply/battery/voltage_now";
|
||||||
|
|
||||||
|
const char * const sysfs_bat_status =
|
||||||
|
"/sys/class/power_supply/battery/status";
|
||||||
|
|
||||||
|
unsigned int agptek_power_get_status(void)
|
||||||
|
{
|
||||||
|
char buf[12] = {0};
|
||||||
|
sysfs_get_string(sysfs_bat_status, buf, sizeof(buf));
|
||||||
|
|
||||||
|
if (strncmp(buf, "Charging", 8) == 0)
|
||||||
|
{
|
||||||
|
return POWER_INPUT_USB_CHARGER;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return POWER_INPUT_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned int agptek_power_get_battery_voltage(void)
|
||||||
|
{
|
||||||
|
int battery_voltage;
|
||||||
|
sysfs_get_int(sysfs_bat_voltage, &battery_voltage);
|
||||||
|
|
||||||
|
return battery_voltage/1000;
|
||||||
|
}
|
29
firmware/target/hosted/agptek/power-agptek.h
Normal file
29
firmware/target/hosted/agptek/power-agptek.h
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 by Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef _POWER_AGPTEK_H_
|
||||||
|
#define _POWER_AGPTEK_H_
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
unsigned int agptek_power_get_status(void);
|
||||||
|
unsigned int agptek_power_get_battery_voltage(void);
|
||||||
|
#endif /* _POWER_AGPTEK_H_ */
|
||||||
|
|
63
firmware/target/hosted/agptek/powermgmt-agptek.c
Normal file
63
firmware/target/hosted/agptek/powermgmt-agptek.c
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include "powermgmt.h"
|
||||||
|
#include "power.h"
|
||||||
|
#include "power-agptek.h"
|
||||||
|
|
||||||
|
const unsigned short battery_level_dangerous[BATTERY_TYPES_COUNT] =
|
||||||
|
{
|
||||||
|
3470
|
||||||
|
};
|
||||||
|
|
||||||
|
/* the OF shuts down at this voltage */
|
||||||
|
const unsigned short battery_level_shutoff[BATTERY_TYPES_COUNT] =
|
||||||
|
{
|
||||||
|
3400
|
||||||
|
};
|
||||||
|
|
||||||
|
/* voltages (millivolt) of 0%, 10%, ... 100% when charging disabled
|
||||||
|
* NOTE: not calibrated simple linear scale for now
|
||||||
|
*/
|
||||||
|
const unsigned short percent_to_volt_discharge[BATTERY_TYPES_COUNT][11] =
|
||||||
|
{
|
||||||
|
{ 3400, 3480, 3560, 3640, 3720, 3800, 3880, 3960, 4040, 4120, 4200 }
|
||||||
|
};
|
||||||
|
|
||||||
|
/* voltages (millivolt) of 0%, 10%, ... 100% when charging enabled */
|
||||||
|
const unsigned short const percent_to_volt_charge[11] =
|
||||||
|
{
|
||||||
|
3450, 3670, 3721, 3751, 3782, 3821, 3876, 3941, 4034, 4125, 4200
|
||||||
|
};
|
||||||
|
|
||||||
|
unsigned int power_input_status(void)
|
||||||
|
{
|
||||||
|
/* POWER_INPUT_USB_CHARGER, POWER_INPUT_NONE */
|
||||||
|
return agptek_power_get_status();
|
||||||
|
}
|
||||||
|
|
||||||
|
int _battery_voltage(void)
|
||||||
|
{
|
||||||
|
return agptek_power_get_battery_voltage();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool charging_state(void)
|
||||||
|
{
|
||||||
|
return agptek_power_get_status() == POWER_INPUT_USB_CHARGER;
|
||||||
|
}
|
48
firmware/target/hosted/agptek/rocker.make
Normal file
48
firmware/target/hosted/agptek/rocker.make
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
# __________ __ ___.
|
||||||
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
# \/ \/ \/ \/ \/
|
||||||
|
# $Id$
|
||||||
|
#
|
||||||
|
|
||||||
|
INCLUDES += -I$(FIRMDIR)/include -I$(FIRMDIR)/export $(TARGET_INC) -I$(BUILDDIR) -I$(APPSDIR)
|
||||||
|
|
||||||
|
SIMFLAGS += $(INCLUDES) $(DEFINES) -DHAVE_CONFIG_H $(GCCOPTS)
|
||||||
|
|
||||||
|
# bootloader build is sligtly different
|
||||||
|
ifneq (,$(findstring bootloader,$(APPSDIR)))
|
||||||
|
|
||||||
|
SRC += $(call preprocess, $(APPSDIR)/SOURCES)
|
||||||
|
CLEANOBJS += $(BUILDDIR)/bootloader.*
|
||||||
|
|
||||||
|
endif #bootloader
|
||||||
|
|
||||||
|
.SECONDEXPANSION: # $$(OBJ) is not populated until after this
|
||||||
|
|
||||||
|
ifneq (,$(findstring bootloader,$(APPSDIR)))
|
||||||
|
# bootloader build
|
||||||
|
|
||||||
|
$(BUILDDIR)/bootloader.elf : $$(OBJ) $(FIRMLIB) $(CORE_LIBS)
|
||||||
|
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \
|
||||||
|
-L$(BUILDDIR)/firmware -lfirmware \
|
||||||
|
-L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \
|
||||||
|
$(LDOPTS) $(GLOBAL_LDOPTS) -Wl,--gc-sections -Wl,-Map,$(BUILDDIR)/bootloader.map
|
||||||
|
|
||||||
|
$(BUILDDIR)/$(BINARY): $(BUILDDIR)/bootloader.elf
|
||||||
|
|
||||||
|
else
|
||||||
|
# rockbox app build
|
||||||
|
|
||||||
|
$(BUILDDIR)/rockbox.elf : $$(OBJ) $(FIRMLIB) $(VOICESPEEXLIB) $(CORE_LIBS)
|
||||||
|
$(call PRINTS,LD $(@F))$(CC) $(GCCOPTS) -Os -o $@ $(OBJ) \
|
||||||
|
-L$(BUILDDIR)/firmware -lfirmware \
|
||||||
|
-L$(RBCODEC_BLD)/codecs $(call a2lnk, $(VOICESPEEXLIB)) \
|
||||||
|
-L$(BUILDDIR)/lib $(call a2lnk,$(CORE_LIBS)) \
|
||||||
|
$(LDOPTS) $(GLOBAL_LDOPTS) -Wl,-Map,$(BUILDDIR)/rockbox.map
|
||||||
|
|
||||||
|
$(BUILDDIR)/rockbox.rocker : $(BUILDDIR)/rockbox.elf
|
||||||
|
$(call PRINTS,OC $(@F))$(call objcopy,$^,$@)
|
||||||
|
|
||||||
|
endif
|
186
firmware/target/hosted/agptek/sysfs.c
Normal file
186
firmware/target/hosted/agptek/sysfs.c
Normal file
|
@ -0,0 +1,186 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50
|
||||||
|
* Copyright (C) 2014 by Mario Basister: iBasso DX90 port
|
||||||
|
* Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features
|
||||||
|
* Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "debug.h"
|
||||||
|
#include "sysfs.h"
|
||||||
|
|
||||||
|
|
||||||
|
static FILE* open_read(const char *file_name)
|
||||||
|
{
|
||||||
|
FILE *f = fopen(file_name, "r");
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Can not open %s for reading.", __func__, file_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static FILE* open_write(const char* file_name)
|
||||||
|
{
|
||||||
|
FILE *f = fopen(file_name, "w");
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Can not open %s for writing.", __func__, file_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool sysfs_get_int(const char *path, int *value)
|
||||||
|
{
|
||||||
|
*value = -1;
|
||||||
|
|
||||||
|
FILE *f = open_read(path);
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
if(fscanf(f, "%d", value) == EOF)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Read failed for %s.", __func__, path);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool sysfs_set_int(const char *path, int value)
|
||||||
|
{
|
||||||
|
FILE *f = open_write(path);
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
if(fprintf(f, "%d", value) < 1)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Write failed for %s.", __func__, path);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool sysfs_get_char(const char *path, char *value)
|
||||||
|
{
|
||||||
|
*value = '\0';
|
||||||
|
FILE *f = open_read(path);
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
if(fscanf(f, "%c", value) == EOF)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Read failed for %s.", __func__, path);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool sysfs_set_char(const char *path, char value)
|
||||||
|
{
|
||||||
|
FILE *f = open_write(path);
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
if(fprintf(f, "%c", value) < 1)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Write failed for %s.", __func__, path);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool sysfs_get_string(const char *path, char *value, int size)
|
||||||
|
{
|
||||||
|
value[0] = '\0';
|
||||||
|
FILE *f = open_read(path);
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
if(fgets(value, size, f) == NULL)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Read failed for %s.", __func__, path);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size_t length = strlen(value);
|
||||||
|
if((length > 0) && value[length - 1] == '\n')
|
||||||
|
{
|
||||||
|
value[length - 1] = '\0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool sysfs_set_string(const char *path, char *value)
|
||||||
|
{
|
||||||
|
FILE *f = open_write(path);
|
||||||
|
if(f == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool success = true;
|
||||||
|
if(fprintf(f, "%s", value) < 1)
|
||||||
|
{
|
||||||
|
DEBUGF("ERROR %s: Write failed for %s.", __func__, path);
|
||||||
|
success = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose(f);
|
||||||
|
return success;
|
||||||
|
}
|
31
firmware/target/hosted/agptek/sysfs.h
Normal file
31
firmware/target/hosted/agptek/sysfs.h
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 by Ilia Sergachev: Initial Rockbox port to iBasso DX50
|
||||||
|
* Copyright (C) 2014 by Mario Basister: iBasso DX90 port
|
||||||
|
* Copyright (C) 2014 by Simon Rothen: Initial Rockbox repository submission, additional features
|
||||||
|
* Copyright (C) 2014 by Udo Schläpfer: Code clean up, additional features
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
bool sysfs_get_int(const char *path, int *value);
|
||||||
|
bool sysfs_set_int(const char *path, int value);
|
||||||
|
bool sysfs_get_char(const char *path, char *value);
|
||||||
|
bool sysfs_set_char(const char *path, char value);
|
||||||
|
bool sysfs_get_string(const char *path, char *value, int size);
|
||||||
|
bool sysfs_set_string(const char *path, char *value);
|
184
firmware/target/hosted/agptek/system-agptek.c
Normal file
184
firmware/target/hosted/agptek/system-agptek.c
Normal file
|
@ -0,0 +1,184 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
* Copyright (C) 2016 Amaury Pouly
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <signal.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <ucontext.h>
|
||||||
|
#include <backtrace.h>
|
||||||
|
|
||||||
|
#include "system.h"
|
||||||
|
#include "mv.h"
|
||||||
|
#include "font.h"
|
||||||
|
#include "power.h"
|
||||||
|
#include "button.h"
|
||||||
|
#include "backlight-target.h"
|
||||||
|
#include "lcd.h"
|
||||||
|
|
||||||
|
/* to make thread-internal.h happy */
|
||||||
|
uintptr_t *stackbegin;
|
||||||
|
uintptr_t *stackend;
|
||||||
|
|
||||||
|
static void sig_handler(int sig, siginfo_t *siginfo, void *context)
|
||||||
|
{
|
||||||
|
/* safe guard variable - we call backtrace() only on first
|
||||||
|
* UIE call. This prevent endless loop if backtrace() touches
|
||||||
|
* memory regions which cause abort
|
||||||
|
*/
|
||||||
|
static bool triggered = false;
|
||||||
|
|
||||||
|
lcd_set_backdrop(NULL);
|
||||||
|
lcd_set_drawmode(DRMODE_SOLID);
|
||||||
|
lcd_set_foreground(LCD_BLACK);
|
||||||
|
lcd_set_background(LCD_WHITE);
|
||||||
|
unsigned line = 0;
|
||||||
|
|
||||||
|
lcd_setfont(FONT_SYSFIXED);
|
||||||
|
lcd_set_viewport(NULL);
|
||||||
|
lcd_clear_display();
|
||||||
|
|
||||||
|
/* get context info */
|
||||||
|
ucontext_t *uc = (ucontext_t *)context;
|
||||||
|
unsigned long pc = uc->uc_mcontext.pc;
|
||||||
|
unsigned long sp = uc->uc_mcontext.gregs[29];
|
||||||
|
|
||||||
|
lcd_putsf(0, line++, "%s at %08x", strsignal(sig), pc);
|
||||||
|
|
||||||
|
if(sig == SIGILL || sig == SIGFPE || sig == SIGSEGV || sig == SIGBUS || sig == SIGTRAP)
|
||||||
|
lcd_putsf(0, line++, "address 0x%08x", siginfo->si_addr);
|
||||||
|
|
||||||
|
if(!triggered)
|
||||||
|
{
|
||||||
|
triggered = true;
|
||||||
|
rb_backtrace(pc, sp, &line);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef ROCKBOX_HAS_LOGF
|
||||||
|
lcd_putsf(0, line++, "logf:");
|
||||||
|
logf_panic_dump(&line);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lcd_update();
|
||||||
|
|
||||||
|
system_exception_wait(); /* If this returns, try to reboot */
|
||||||
|
system_reboot();
|
||||||
|
while (1); /* halt */
|
||||||
|
}
|
||||||
|
|
||||||
|
void power_off(void)
|
||||||
|
{
|
||||||
|
system("/sbin/poweroff");
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_init(void)
|
||||||
|
{
|
||||||
|
int *s;
|
||||||
|
/* fake stack, to make thread-internal.h happy */
|
||||||
|
stackbegin = stackend = (uintptr_t*)&s;
|
||||||
|
/* catch some signals for easier debugging */
|
||||||
|
struct sigaction sa;
|
||||||
|
sigfillset(&sa.sa_mask);
|
||||||
|
sa.sa_flags = SA_SIGINFO;
|
||||||
|
sa.sa_sigaction = &sig_handler;
|
||||||
|
sigaction(SIGILL, &sa, NULL);
|
||||||
|
sigaction(SIGABRT, &sa, NULL);
|
||||||
|
sigaction(SIGFPE, &sa, NULL);
|
||||||
|
sigaction(SIGSEGV, &sa, NULL);
|
||||||
|
sigaction(SIGPIPE, &sa, NULL);
|
||||||
|
sigaction(SIGTERM, &sa, NULL);
|
||||||
|
sigaction(SIGBUS, &sa, NULL);
|
||||||
|
sigaction(SIGTERM, &sa, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_reboot(void)
|
||||||
|
{
|
||||||
|
system("/sbin/reboot");
|
||||||
|
}
|
||||||
|
|
||||||
|
void system_exception_wait(void)
|
||||||
|
{
|
||||||
|
backlight_hw_on();
|
||||||
|
backlight_hw_brightness(DEFAULT_BRIGHTNESS_SETTING);
|
||||||
|
/* wait until button press and release */
|
||||||
|
while(button_read_device() != 0) {}
|
||||||
|
while(button_read_device() == 0) {}
|
||||||
|
while(button_read_device() != 0) {}
|
||||||
|
while(button_read_device() == 0) {}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hostfs_removable(IF_MD_NONVOID(int drive))
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MULTIDRIVE
|
||||||
|
if (drive > 0) /* Active LOW */
|
||||||
|
return true;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return false; /* internal: always present */
|
||||||
|
}
|
||||||
|
|
||||||
|
bool hostfs_present(IF_MD_NONVOID(int drive))
|
||||||
|
{
|
||||||
|
#ifdef HAVE_MULTIDRIVE
|
||||||
|
if (drive > 0) /* Active LOW */
|
||||||
|
return true; //FIXME
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return true; /* internal: always present */
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_MULTIDRIVE
|
||||||
|
int volume_drive(int drive)
|
||||||
|
{
|
||||||
|
return drive;
|
||||||
|
}
|
||||||
|
#endif /* HAVE_MULTIDRIVE */
|
||||||
|
|
||||||
|
#ifdef CONFIG_STORAGE_MULTI
|
||||||
|
int hostfs_driver_type(int drive)
|
||||||
|
{
|
||||||
|
return drive > 0 ? STORAGE_SD_NUM : STORAGE_HOSTFS_NUM;
|
||||||
|
}
|
||||||
|
#endif /* CONFIG_STORAGE_MULTI */
|
||||||
|
|
||||||
|
int hostfs_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hostfs_flush(void)
|
||||||
|
{
|
||||||
|
sync();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_HOTSWAP
|
||||||
|
bool volume_removable(int volume)
|
||||||
|
{
|
||||||
|
/* don't support more than one partition yet, so volume == drive */
|
||||||
|
return hostfs_removable(volume);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool volume_present(int volume)
|
||||||
|
{
|
||||||
|
/* don't support more than one partition yet, so volume == drive */
|
||||||
|
return hostfs_present(volume);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
28
firmware/target/hosted/agptek/system-target.h
Normal file
28
firmware/target/hosted/agptek/system-target.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2017 Marcin Bukat
|
||||||
|
* Copyright (C) 2016 Amaury Pouly
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#ifndef __SYSTEM_TARGET_H__
|
||||||
|
#define __SYSTEM_TARGET_H__
|
||||||
|
|
||||||
|
#include "kernel-unix.h"
|
||||||
|
#include "system-hosted.h"
|
||||||
|
|
||||||
|
#define NEED_GENERIC_BYTESWAPS
|
||||||
|
#endif /* __SYSTEM_TARGET_H__ */
|
|
@ -3,7 +3,7 @@
|
||||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Amaury Pouly
|
* Copyright (C) 2016 Amaury Pouly
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
<<<<<<< 9a9c7f2b7c63a9db203084a3485988c07f17b86c
|
||||||
* __________ __ ___.
|
* __________ __ ___.
|
||||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
* \/ \/ \/ \/ \/
|
* \/ \/ \/ \/ \/
|
||||||
|
=======
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
>>>>>>> Agptek rocker port initial commit
|
||||||
*
|
*
|
||||||
* Copyright (C) 2016 Amaury Pouly
|
* Copyright (C) 2016 Amaury Pouly
|
||||||
*
|
*
|
||||||
|
|
|
@ -48,7 +48,8 @@ static const char rbhome[] = HOME_DIR;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \
|
#if !(defined(SAMSUNG_YPR0) || defined(SAMSUNG_YPR1) || defined(DX50) || \
|
||||||
defined(SONY_NWZ_LINUX) || defined(DX90)) && !defined(__PCTOOL__)
|
defined(SONY_NWZ_LINUX) || defined(DX90) || defined(AGPTEK_ROCKER)) && \
|
||||||
|
!defined(__PCTOOL__)
|
||||||
/* Special dirs are user-accessible (and user-writable) dirs which take priority
|
/* Special dirs are user-accessible (and user-writable) dirs which take priority
|
||||||
* over the ones where Rockbox is installed to. Classic example would be
|
* over the ones where Rockbox is installed to. Classic example would be
|
||||||
* $HOME/.config/rockbox.org vs /usr/share/rockbox */
|
* $HOME/.config/rockbox.org vs /usr/share/rockbox */
|
||||||
|
|
|
@ -515,6 +515,12 @@
|
||||||
#define UI_LCD_POSX 78
|
#define UI_LCD_POSX 78
|
||||||
#define UI_LCD_POSY 92
|
#define UI_LCD_POSY 92
|
||||||
|
|
||||||
|
#elif defined(AGPTEK_ROCKER)
|
||||||
|
#define UI_TITLE "Agptek Rocker"
|
||||||
|
#define UI_WIDTH 186
|
||||||
|
#define UI_HEIGHT 380
|
||||||
|
#define UI_LCD_POSX 29
|
||||||
|
#define UI_LCD_POSY 25
|
||||||
#elif defined(SIMULATOR)
|
#elif defined(SIMULATOR)
|
||||||
#error no UI defines
|
#error no UI defines
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,8 @@ MADFLAGS += -UDEBUG -DNDEBUG -DHAVE_LIMITS_H -DHAVE_ASSERT_H
|
||||||
ifeq ($(ARCH),arch_arm)
|
ifeq ($(ARCH),arch_arm)
|
||||||
MADFLAGS += -O1
|
MADFLAGS += -O1
|
||||||
else
|
else
|
||||||
MADFLAGS += -O2
|
# MADFLAGS += -O2
|
||||||
|
MADFLAGS += -O0 -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# MPEGplayer
|
# MPEGplayer
|
||||||
|
|
47
tools/configure
vendored
47
tools/configure
vendored
|
@ -867,6 +867,26 @@ androidndkcc()
|
||||||
prefixtools $gcctarget
|
prefixtools $gcctarget
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mipsellinuxcc () {
|
||||||
|
GCCOPTS=`echo $CCOPTS | sed -e s/-ffreestanding// -e s/-nostdlib//`
|
||||||
|
GCCOPTS="$GCCOPTS -march=mips32r2 -mno-mips16 -mno-long-calls -Umips -fPIC"
|
||||||
|
GCCOPTIMIZE=''
|
||||||
|
LDOPTS="-lasound -lpthread -lm -ldl -lrt $LDOPTS"
|
||||||
|
GLOBAL_LDOPTS="$GLOBAL_LDOPTS -Wl,-z,defs"
|
||||||
|
SHARED_LDFLAG="-shared"
|
||||||
|
SHARED_CFLAGS='-fPIC -fvisibility=hidden'
|
||||||
|
endian="little"
|
||||||
|
app_type="rocker"
|
||||||
|
thread_support="HAVE_SIGALTSTACK_THREADS"
|
||||||
|
|
||||||
|
# Include path
|
||||||
|
GCCOPTS="$GCCOPTS -D_GNU_SOURCE=1 -U_FORTIFY_SOURCE -D_REENTRANT"
|
||||||
|
|
||||||
|
# Set up compiler
|
||||||
|
gccchoice="4.9.4"
|
||||||
|
prefixtools "mipsel-rockbox-linux-gnu-"
|
||||||
|
}
|
||||||
|
|
||||||
whichadvanced () {
|
whichadvanced () {
|
||||||
atype=`echo "$1" | cut -c 2-`
|
atype=`echo "$1" | cut -c 2-`
|
||||||
##################################################################
|
##################################################################
|
||||||
|
@ -1511,8 +1531,8 @@ cat <<EOF
|
||||||
207) Android x86 230) 760 223) NWZ-E460 series
|
207) Android x86 230) 760 223) NWZ-E460 series
|
||||||
208) Samsung YP-R1 231) 960 224) NWZ-E470 series
|
208) Samsung YP-R1 231) 960 224) NWZ-E470 series
|
||||||
225) NWZ-E580 series
|
225) NWZ-E580 series
|
||||||
==iBasso== 226) NWZ-A10 series
|
==iBasso== ==Agptek== 226) NWZ-A10 series
|
||||||
232) DX50 227) NW-A20 series
|
232) DX50 240) Rocker 227) NW-A20 series
|
||||||
233) DX90 228) NWZ-A860 series
|
233) DX90 228) NWZ-A860 series
|
||||||
229) NWZ-S750 series
|
229) NWZ-S750 series
|
||||||
EOF
|
EOF
|
||||||
|
@ -4173,6 +4193,29 @@ fi
|
||||||
t_model="dx90"
|
t_model="dx90"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
240|agptekrocker)
|
||||||
|
application="yes"
|
||||||
|
target_id=97
|
||||||
|
modelname="agptekrocker"
|
||||||
|
target="AGPTEK_ROCKER"
|
||||||
|
memory=6
|
||||||
|
tool="cp "
|
||||||
|
boottool="cp "
|
||||||
|
bmp2rb_mono="$rootdir/tools/bmp2rb -f 0"
|
||||||
|
bmp2rb_native="$rootdir/tools/bmp2rb -f 10"
|
||||||
|
output="rockbox.rocker"
|
||||||
|
bootoutput="bootloader.rocker"
|
||||||
|
appextra="recorder:gui:hosted"
|
||||||
|
plugins=""
|
||||||
|
swcodec="yes"
|
||||||
|
# architecture, manufacturer and model for the target-tree build
|
||||||
|
t_cpu="hosted"
|
||||||
|
t_manufacturer="agptek"
|
||||||
|
t_model="rocker"
|
||||||
|
rbdir='/mnt/sd_0/.rockbox'
|
||||||
|
mipsellinuxcc
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Please select a supported target platform!"
|
echo "Please select a supported target platform!"
|
||||||
exit 7
|
exit 7
|
||||||
|
|
|
@ -103,6 +103,8 @@ endif
|
||||||
ifneq (,$(findstring bootloader,$(APPSDIR)))
|
ifneq (,$(findstring bootloader,$(APPSDIR)))
|
||||||
ifneq (,$(findstring sonynwz,$(APP_TYPE)))
|
ifneq (,$(findstring sonynwz,$(APP_TYPE)))
|
||||||
include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
|
include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
|
||||||
|
else ifneq (,$(findstring rocker,$(APP_TYPE)))
|
||||||
|
include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make
|
||||||
else
|
else
|
||||||
include $(APPSDIR)/bootloader.make
|
include $(APPSDIR)/bootloader.make
|
||||||
endif
|
endif
|
||||||
|
@ -143,6 +145,10 @@ else # core
|
||||||
include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
|
include $(ROOTDIR)/firmware/target/hosted/sonynwz/sonynwz.make
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifneq (,$(findstring rocker,$(APP_TYPE)))
|
||||||
|
include $(ROOTDIR)/firmware/target/hosted/agptek/rocker.make
|
||||||
|
endif
|
||||||
|
|
||||||
ifneq (,$(findstring android_ndk, $(APP_TYPE)))
|
ifneq (,$(findstring android_ndk, $(APP_TYPE)))
|
||||||
include $(ROOTDIR)/firmware/target/hosted/ibasso/android_ndk.make
|
include $(ROOTDIR)/firmware/target/hosted/ibasso/android_ndk.make
|
||||||
else
|
else
|
||||||
|
|
BIN
uisimulator/bitmaps/UI-agptekrocker.bmp
Normal file
BIN
uisimulator/bitmaps/UI-agptekrocker.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 276 KiB |
|
@ -83,5 +83,7 @@ samsung-ypr0.c
|
||||||
creative-zen.c
|
creative-zen.c
|
||||||
#elif CONFIG_KEYPAD == SONY_NWZA860_PAD
|
#elif CONFIG_KEYPAD == SONY_NWZA860_PAD
|
||||||
sony-nwza860.c
|
sony-nwza860.c
|
||||||
|
#elif CONFIG_KEYPAD == AGPTEK_ROCKER_PAD
|
||||||
|
agptek-rocker.c
|
||||||
#endif
|
#endif
|
||||||
#endif /* SIMULATOR */
|
#endif /* SIMULATOR */
|
||||||
|
|
80
uisimulator/buttonmap/agptek-rocker.c
Normal file
80
uisimulator/buttonmap/agptek-rocker.c
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 by Amaury Pouly
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#include <SDL.h>
|
||||||
|
#include "button.h"
|
||||||
|
#include "buttonmap.h"
|
||||||
|
|
||||||
|
int key_to_button(int keyboard_button)
|
||||||
|
{
|
||||||
|
int new_btn = BUTTON_NONE;
|
||||||
|
switch (keyboard_button)
|
||||||
|
{
|
||||||
|
case SDLK_KP4:
|
||||||
|
case SDLK_LEFT:
|
||||||
|
new_btn = BUTTON_LEFT;
|
||||||
|
break;
|
||||||
|
case SDLK_KP6:
|
||||||
|
case SDLK_RIGHT:
|
||||||
|
new_btn = BUTTON_RIGHT;
|
||||||
|
break;
|
||||||
|
case SDLK_KP8:
|
||||||
|
case SDLK_UP:
|
||||||
|
new_btn = BUTTON_UP;
|
||||||
|
break;
|
||||||
|
case SDLK_KP2:
|
||||||
|
case SDLK_DOWN:
|
||||||
|
new_btn = BUTTON_DOWN;
|
||||||
|
break;
|
||||||
|
case SDLK_ESCAPE:
|
||||||
|
new_btn = BUTTON_POWER;
|
||||||
|
break;
|
||||||
|
case SDLK_KP_PLUS:
|
||||||
|
case SDLK_EQUALS:
|
||||||
|
new_btn = BUTTON_VOLUP;
|
||||||
|
break;
|
||||||
|
case SDLK_KP_MINUS:
|
||||||
|
case SDLK_MINUS:
|
||||||
|
new_btn = BUTTON_VOLDOWN;
|
||||||
|
break;
|
||||||
|
case SDLK_KP_ENTER:
|
||||||
|
case SDLK_RETURN:
|
||||||
|
case SDLK_SPACE:
|
||||||
|
case SDLK_INSERT:
|
||||||
|
case SDLK_KP5:
|
||||||
|
new_btn = BUTTON_SELECT;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return new_btn;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct button_map bm[] = {
|
||||||
|
{ SDLK_LEFT, 38, 296, 20, "Left" },
|
||||||
|
{ SDLK_RIGHT, 146, 295, 20, "Right" },
|
||||||
|
{ SDLK_UP, 93, 241, 20, "Up" },
|
||||||
|
{ SDLK_DOWN, 93, 348, 20, "Down" },
|
||||||
|
{ SDLK_ESCAPE, 2, 45, 20, "Power" },
|
||||||
|
{ SDLK_RETURN, 93, 295, 40, "Select" },
|
||||||
|
{ SDLK_KP_MINUS, 182, 100, 30, "Volume -" },
|
||||||
|
{ SDLK_KP_PLUS, 182, 45, 30, "Volume +" },
|
||||||
|
{ 0, 0, 0, 0, "None" }
|
||||||
|
};
|
12
wps/WPSLIST
12
wps/WPSLIST
|
@ -95,7 +95,7 @@ wps.160x128x1: cabbiev2.160x128x1.wps
|
||||||
wps.138x110x2: cabbiev2.138x110x2.wps
|
wps.138x110x2: cabbiev2.138x110x2.wps
|
||||||
wps.128x128x(16|24): cabbiev2.128x128x16.wps
|
wps.128x128x(16|24): cabbiev2.128x128x16.wps
|
||||||
wps.128x128x2: cabbiev2.128x128x2.wps
|
wps.128x128x2: cabbiev2.128x128x2.wps
|
||||||
wps.128x160x(16|24): cabbiev2.128x160x16.wps
|
wps.128x160x(16|24|32): cabbiev2.128x160x16.wps
|
||||||
wps.132x80x(16|24): cabbiev2.132x80x16.wps
|
wps.132x80x(16|24): cabbiev2.132x80x16.wps
|
||||||
wps.128x96x(16|24): cabbiev2.128x96x16.wps
|
wps.128x96x(16|24): cabbiev2.128x96x16.wps
|
||||||
wps.128x96x2: cabbiev2.128x96x2.wps
|
wps.128x96x2: cabbiev2.128x96x2.wps
|
||||||
|
@ -124,7 +124,7 @@ Font.160x128x1: 12-Adobe-Helvetica.fnt
|
||||||
Font.138x110x2: 12-Adobe-Helvetica.fnt
|
Font.138x110x2: 12-Adobe-Helvetica.fnt
|
||||||
Font.128x128x(16|24): 12-Adobe-Helvetica.fnt
|
Font.128x128x(16|24): 12-Adobe-Helvetica.fnt
|
||||||
Font.128x128x2: 12-Adobe-Helvetica.fnt
|
Font.128x128x2: 12-Adobe-Helvetica.fnt
|
||||||
Font.128x160x(16|24): 12-Adobe-Helvetica.fnt
|
Font.128x160x(16|24|32): 12-Adobe-Helvetica.fnt
|
||||||
Font.132x80x(16|24): 11-Sazanami-Mincho.fnt
|
Font.132x80x(16|24): 11-Sazanami-Mincho.fnt
|
||||||
Font.128x96x(16|24): 08-Rockfont.fnt
|
Font.128x96x(16|24): 08-Rockfont.fnt
|
||||||
Font.128x96x2: 12-Adobe-Helvetica.fnt
|
Font.128x96x2: 12-Adobe-Helvetica.fnt
|
||||||
|
@ -148,7 +148,7 @@ backdrop.320x480x(16|24): backdrops/cabbiev2.320x480x16.bmp
|
||||||
backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp
|
backdrop.320x240x(16|24): backdrops/cabbiev2.320x240x16.bmp
|
||||||
backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp
|
backdrop.128x128x(16|24): backdrops/cabbiev2.128x128x16.bmp
|
||||||
backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp
|
backdrop.128x128x2: backdrops/cabbiev2.128x128x2.bmp
|
||||||
backdrop.128x160x(16|24): backdrops/cabbiev2.128x160x16.bmp
|
backdrop.128x160x(16|24|32): backdrops/cabbiev2.128x160x16.bmp
|
||||||
backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp
|
backdrop.132x80x(16|24): backdrops/cabbiev2.132x80x16.bmp
|
||||||
backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp
|
backdrop.138x110x2: backdrops/cabbiev2.138x110x2.bmp
|
||||||
backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp
|
backdrop.160x128x(16|24): backdrops/cabbiev2.160x128x16.bmp
|
||||||
|
@ -173,9 +173,9 @@ iconset.400x240x(16|24): icons/tango_icons.16x16.bmp
|
||||||
iconset.320x480x(16|24): icons/tango_icons.24x24.bmp
|
iconset.320x480x(16|24): icons/tango_icons.24x24.bmp
|
||||||
iconset.320x240x(16|24): icons/tango_icons.16x16.bmp
|
iconset.320x240x(16|24): icons/tango_icons.16x16.bmp
|
||||||
iconset.128x128x(16|24): icons/tango_icons.12x12.bmp
|
iconset.128x128x(16|24): icons/tango_icons.12x12.bmp
|
||||||
iconset.128x160x(16|24): icons/tango_icons.12x12.bmp
|
iconset.128x160x(16|24|32): icons/tango_icons.12x12.bmp
|
||||||
iconset.132x80x(16|24): icons/tango_icons.12x12.bmp
|
iconset.132x80x(16|24): icons/tango_icons.12x12.bmp
|
||||||
iconset.160x128x(16|24): icons/tango_icons.12x12.bmp
|
iconset.160x128x(16|24|32): icons/tango_icons.12x12.bmp
|
||||||
iconset.176x132x(16|24): icons/tango_icons.12x12.bmp
|
iconset.176x132x(16|24): icons/tango_icons.12x12.bmp
|
||||||
iconset.176x220x(16|24): icons/tango_icons.12x12.bmp
|
iconset.176x220x(16|24): icons/tango_icons.12x12.bmp
|
||||||
iconset.220x176x(16|24): icons/tango_icons.12x12.bmp
|
iconset.220x176x(16|24): icons/tango_icons.12x12.bmp
|
||||||
|
@ -194,7 +194,7 @@ viewers iconset.320x240x(16|24): icons/tango_icons_viewers.16x16.bmp
|
||||||
viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp
|
viewers iconset.128x128x(16|24): icons/tango_icons_viewers.12x12.bmp
|
||||||
viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp
|
viewers iconset.128x160x(16|24): icons/tango_icons_viewers.12x12.bmp
|
||||||
viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp
|
viewers iconset.132x80x(16|24): icons/tango_icons_viewers.12x12.bmp
|
||||||
viewers iconset.160x128x(16|24): icons/tango_icons_viewers.12x12.bmp
|
viewers iconset.160x128x(16|24|32): icons/tango_icons_viewers.12x12.bmp
|
||||||
viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp
|
viewers iconset.176x132x(16|24): icons/tango_icons_viewers.12x12.bmp
|
||||||
viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp
|
viewers iconset.176x220x(16|24): icons/tango_icons_viewers.12x12.bmp
|
||||||
viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp
|
viewers iconset.220x176x(16|24): icons/tango_icons_viewers.12x12.bmp
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue