From 1fc03db5861c232792042844c15153a7e1bcc724 Mon Sep 17 00:00:00 2001 From: Andrew Hannam Date: Thu, 17 Jan 2013 15:08:34 +1000 Subject: New Subsystems GADC, GAUDIN, GAUDOUT, GMISC Subsystem definitions and API (not fully implemented yet) --- include/gmisc/gmisc.h | 100 ++++++++++++++++++++++++++++++++++++++++++++++++ include/gmisc/options.h | 52 +++++++++++++++++++++++++ 2 files changed, 152 insertions(+) create mode 100644 include/gmisc/gmisc.h create mode 100644 include/gmisc/options.h (limited to 'include/gmisc') diff --git a/include/gmisc/gmisc.h b/include/gmisc/gmisc.h new file mode 100644 index 00000000..0cce12bd --- /dev/null +++ b/include/gmisc/gmisc.h @@ -0,0 +1,100 @@ +/* + ChibiOS/GFX - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS/GFX. + + ChibiOS/GFX 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 3 of the License, or + (at your option) any later version. + + ChibiOS/GFX is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ +/** + * @file include/gmisc/gmisc.h + * @brief GMISC - Miscellaneous Routines header file. + * + * @addtogroup GAUDIN + * + * @{ + */ + +#ifndef _GMISC_H +#define _GMISC_H + +#include "gfx.h" + +/*===========================================================================*/ +/* Type definitions */ +/*===========================================================================*/ + +/** + * @brief Sample data formats + */ +typedef enum ArrayDataFormat_e { + ARRAY_DATA_4BITUNSIGNED = 4, ARRAY_DATA_4BITSIGNED = 5, + ARRAY_DATA_8BITUNSIGNED = 8, ARRAY_DATA_8BITSIGNED = 9, + ARRAY_DATA_10BITUNSIGNED = 10, ARRAY_DATA_10BITSIGNED = 11, + ARRAY_DATA_12BITUNSIGNED = 12, ARRAY_DATA_12BITSIGNED = 13, + ARRAY_DATA_14BITUNSIGNED = 14, ARRAY_DATA_14BITSIGNED = 15, + ARRAY_DATA_16BITUNSIGNED = 16, ARRAY_DATA_16BITSIGNED = 17, + } ArrayDataFormat; + +/*===========================================================================*/ +/* External declarations. */ +/*===========================================================================*/ + +#if GFX_USE_GMISC || defined(__DOXYGEN__) + +#ifdef __cplusplus +extern "C" { +#endif + +#if GMISC_NEED_ARRAYOPS || defined(__DOXYGEN__) + /** + * @brief Convert from one array format to another array format. + * + * @param[in] srcfmt The format of the source array + * @param[in] src The source array + * @param[in] dstfmt The format of the destination array + * @param[in] dst The dstination array + * @param[in] cnt The number of array elements to convert + * + * @note Assumes the destination buffer is large enough for the resultant data. + * @note This routine is optimised to perform as fast as possible. + * + * @api + */ + void gmiscArrayConvert(ArrayDataFormat srcfmt, void *src, ArrayDataFormat dstfmt, void *dst, size_t cnt); + + #if 0 + void gmiscArrayTranslate(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int trans); + + void gmiscArrayMultiply(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int mult); + + void gmiscArrayDivide(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int mdiv); + + void gmiscArrayMultDiv(ArrayDataFormat fmt, void *src, void *dst, size_t cnt, int mult, int div); + + void gmiscArrayAdd(ArrayDataFormat fmt, void *src1, void *src2, void *dst, size_t cnt); + + void gmiscArrayAddNoOverflow(ArrayDataFormat fmt, void *src1, void *src2, void *dst, size_t cnt); + #endif +#endif + +#ifdef __cplusplus +} +#endif + +#endif /* GFX_USE_MISC */ + +#endif /* _GMISC_H */ +/** @} */ + diff --git a/include/gmisc/options.h b/include/gmisc/options.h new file mode 100644 index 00000000..d526ff84 --- /dev/null +++ b/include/gmisc/options.h @@ -0,0 +1,52 @@ +/* + ChibiOS/GFX - Copyright (C) 2012 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS/GFX. + + ChibiOS/GFX 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 3 of the License, or + (at your option) any later version. + + ChibiOS/GFX is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +/** + * @file include/gmisc/options.h + * @brief GMISC - Miscellaneous Routines options header file. + * + * @addtogroup GMISC + * @{ + */ + +#ifndef _GMISC_OPTIONS_H +#define _GMISC_OPTIONS_H + +/** + * @name GMISC Functionality to be included + * @{ + */ + /** + * @brief Include array operation functions + * @details Defaults to FALSE + */ + #ifndef GMISC_NEED_ARRAYOPS + #define GMISC_NEED_ARRAYOPS FALSE + #endif +/** + * @} + * + * @name GMISC Optional Sizing Parameters + * @{ + */ +/** @} */ + +#endif /* _GMISC_OPTIONS_H */ +/** @} */ -- cgit v1.2.3