From 07e982df8a0e3a72a357839ec0a6ff7d462bd173 Mon Sep 17 00:00:00 2001 From: Andrew Mahone Date: Thu, 8 Jan 2009 02:49:23 +0000 Subject: cleanup for core-file-in-pluginlib compilation: wrapper C files in pluginlib renamed to the same name as the core files they wrap pluginlib-only init functions for resize and bmp moved into the wrapper files, and declared in the associated header files API() macro removed entirely, in favor of a core-only header file that redefines core function names to use a plugin_api pointer some unnecessary uses of PLUGIN in apps/recorder/bmp.c removed git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19712 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/lib/SOURCES | 5 +--- apps/plugins/lib/bmp.c | 15 +++++++++++ apps/plugins/lib/bmp.h | 5 ++++ apps/plugins/lib/core_bmp.c | 24 ----------------- apps/plugins/lib/core_resize.c | 24 ----------------- apps/plugins/lib/resize.c | 34 ++++++++++++++++++++++++ apps/plugins/lib/resize.h | 31 ++++++++++++++++++++++ apps/plugins/lib/wrappers.h | 44 ++++++++++++++++++++++++++++++++ apps/plugins/test_greylib_bitmap_scale.c | 2 ++ 9 files changed, 132 insertions(+), 52 deletions(-) delete mode 100644 apps/plugins/lib/core_bmp.c delete mode 100644 apps/plugins/lib/core_resize.c create mode 100644 apps/plugins/lib/resize.c create mode 100644 apps/plugins/lib/resize.h create mode 100644 apps/plugins/lib/wrappers.h (limited to 'apps/plugins') diff --git a/apps/plugins/lib/SOURCES b/apps/plugins/lib/SOURCES index c8c1553..b28878c 100644 --- a/apps/plugins/lib/SOURCES +++ b/apps/plugins/lib/SOURCES @@ -5,8 +5,7 @@ playback_control.c rgb_hsv.c #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH < 4) #if LCD_DEPTH == 1 -core_bmp.c -core_resize.c +resize.c #endif grey_core.c grey_draw.c @@ -34,9 +33,7 @@ picture.c xlcd_core.c xlcd_draw.c xlcd_scroll.c -#if LCD_DEPTH>1 bmp.c -#endif #ifdef HAVE_LCD_COLOR bmp_smooth_scale.c #endif diff --git a/apps/plugins/lib/bmp.c b/apps/plugins/lib/bmp.c index a8ebbff..b3e0e2b 100644 --- a/apps/plugins/lib/bmp.c +++ b/apps/plugins/lib/bmp.c @@ -8,6 +8,7 @@ * $Id$ * * Copyright (C) 2006 by Antoine Cellerier + * Copyright (C) 2009 by Andrew Mahone * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -26,6 +27,7 @@ #include "lcd.h" #include "system.h" +#if LCD_DEPTH > 1 #ifdef HAVE_LCD_COLOR #define LE16(x) (htole16(x))&0xff, ((htole16(x))>>8)&0xff #define LE32(x) (htole32(x))&0xff, ((htole32(x))>>8)&0xff, ((htole32(x))>>16)&0xff, ((htole32(x))>>24)&0xff @@ -119,3 +121,16 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst) yr += yrstep; } } + +#else +#include "wrappers.h" + +static const struct plugin_api *rb; + +#include "../../recorder/bmp.c" + +void bmp_init(const struct plugin_api *api) +{ + rb = api; +} +#endif diff --git a/apps/plugins/lib/bmp.h b/apps/plugins/lib/bmp.h index 12894f7..379a889 100644 --- a/apps/plugins/lib/bmp.h +++ b/apps/plugins/lib/bmp.h @@ -24,6 +24,7 @@ #include "lcd.h" #include "plugin.h" +#if LCD_DEPTH > 1 #ifdef HAVE_LCD_COLOR /** * Save bitmap to file @@ -43,4 +44,8 @@ void simple_resize_bitmap(struct bitmap *src, struct bitmap *dst); */ void smooth_resize_bitmap(struct bitmap *src, struct bitmap *dst); +#else +void bmp_init(const struct plugin_api *api); +#endif + #endif diff --git a/apps/plugins/lib/core_bmp.c b/apps/plugins/lib/core_bmp.c deleted file mode 100644 index 28d70b1..0000000 --- a/apps/plugins/lib/core_bmp.c +++ /dev/null @@ -1,24 +0,0 @@ -/*************************************************************************** -* __________ __ ___. -* Open \______ \ ____ ____ | | _\_ |__ _______ ___ -* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -* \/ \/ \/ \/ \/ -* $Id$ -* -* This is a wrapper for the core bmp.c -* -* 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 -#include "../../recorder/bmp.c" - diff --git a/apps/plugins/lib/core_resize.c b/apps/plugins/lib/core_resize.c deleted file mode 100644 index 099d407..0000000 --- a/apps/plugins/lib/core_resize.c +++ /dev/null @@ -1,24 +0,0 @@ -/*************************************************************************** -* __________ __ ___. -* Open \______ \ ____ ____ | | _\_ |__ _______ ___ -* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / -* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < -* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ -* \/ \/ \/ \/ \/ -* $Id$ -* -* This is a wrapper for the core bmp.c -* -* 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 -#include "../../recorder/resize.c" - diff --git a/apps/plugins/lib/resize.c b/apps/plugins/lib/resize.c new file mode 100644 index 0000000..28446e7 --- /dev/null +++ b/apps/plugins/lib/resize.c @@ -0,0 +1,34 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* Copyright (C) 2009 by Andrew Mahone +* +* This is a wrapper for the core resize.c +* +* 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 +#include "wrappers.h" + +static const struct plugin_api *rb; + +#include "../../recorder/resize.c" + +void resize_init(const struct plugin_api *api) +{ + rb = api; +} diff --git a/apps/plugins/lib/resize.h b/apps/plugins/lib/resize.h new file mode 100644 index 0000000..3674e14 --- /dev/null +++ b/apps/plugins/lib/resize.h @@ -0,0 +1,31 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* Copyright (C) 2009 by Andrew Mahone +* +* This is a header for the pluginlib extensions to the core resize.c file +* +* 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 _LIB_RESIZE_H_ +#define _LIB_RESIZE_H_ + +#if LCD_DEPTH == 1 +void resize_init(const struct plugin_api *api); +#endif + +#endif diff --git a/apps/plugins/lib/wrappers.h b/apps/plugins/lib/wrappers.h new file mode 100644 index 0000000..2eb4ea0 --- /dev/null +++ b/apps/plugins/lib/wrappers.h @@ -0,0 +1,44 @@ +/*************************************************************************** +* __________ __ ___. +* Open \______ \ ____ ____ | | _\_ |__ _______ ___ +* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / +* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < +* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ +* \/ \/ \/ \/ \/ +* $Id$ +* +* Copyright (C) 2009 by Andrew Mahone +* +* This header redefines some core functions as calls via the plugin_api, to +* allow easy compilation of core source files in the pluginlib with different +* features from the version built for the core, or when a core object file is +* not built for a particular target. +* +* 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 _LIB_WRAPPERS_H_ +#define _LIB_WRAPPERS_H_ + +#define open rb->open +#define close rb->close +#define read rb->read +#define lseek rb->lseek +#define memset rb->memset +#ifdef HAVE_ADJUSTABLE_CPU_FREQ +#define cpu_boost rb->cpu_boost +#endif +#define yield rb->yield +#if CONFIG_CODEC == SWCODEC +#define align_buffer rb->align_buffer +#endif + +#endif + diff --git a/apps/plugins/test_greylib_bitmap_scale.c b/apps/plugins/test_greylib_bitmap_scale.c index 3d6f81f..a3de006 100644 --- a/apps/plugins/test_greylib_bitmap_scale.c +++ b/apps/plugins/test_greylib_bitmap_scale.c @@ -21,6 +21,8 @@ #include "plugin.h" #include "lib/grey.h" +#include "lib/resize.h" +#include "lib/bmp.h" #if LCD_DEPTH == 1 #define BMP_LOAD read_bmp_file -- cgit v1.1