aboutsummaryrefslogtreecommitdiffstats
path: root/demos/applications
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2012-12-22 20:45:11 +0100
committerJoel Bodenmann <joel@unormal.org>2012-12-22 20:45:11 +0100
commit130d84ec16a8566cd80c83e00d0cbfdcdd6ce072 (patch)
treef72758d9c6b3f4be6bfdcba2bcc62e7703039c62 /demos/applications
parenta7eb91ace882ee5fbb23641017162bd8fe335a7d (diff)
downloaduGFX-130d84ec16a8566cd80c83e00d0cbfdcdd6ce072.tar.gz
uGFX-130d84ec16a8566cd80c83e00d0cbfdcdd6ce072.tar.bz2
uGFX-130d84ec16a8566cd80c83e00d0cbfdcdd6ce072.zip
benchmark demo update
Diffstat (limited to 'demos/applications')
-rw-r--r--demos/applications/benchmarks/gfxconf.h45
-rw-r--r--demos/applications/benchmarks/main.c157
2 files changed, 0 insertions, 202 deletions
diff --git a/demos/applications/benchmarks/gfxconf.h b/demos/applications/benchmarks/gfxconf.h
deleted file mode 100644
index b86d6425..00000000
--- a/demos/applications/benchmarks/gfxconf.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * This file has a different license to the rest of the GFX system.
- * You can copy, modify and distribute this file as you see fit.
- * You do not need to publish your source modifications to this file.
- * The only thing you are not permitted to do is to relicense it
- * under a different license.
- */
-
-#ifndef _GFXCONF_H
-#define _GFXCONF_H
-
-/* GFX sub-systems to turn on */
-#define GFX_USE_GDISP TRUE
-#define GFX_USE_GWIN FALSE
-#define GFX_USE_GEVENT FALSE
-#define GFX_USE_GTIMER FALSE
-#define GFX_USE_GINPUT FALSE
-
-/* Features for the GDISP sub-system. */
-#define GDISP_NEED_VALIDATION FALSE
-#define GDISP_NEED_CLIP TRUE
-#define GDISP_NEED_TEXT TRUE
-#define GDISP_NEED_CIRCLE TRUE
-#define GDISP_NEED_ELLIPSE FALSE
-#define GDISP_NEED_ARC FALSE
-#define GDISP_NEED_SCROLL FALSE
-#define GDISP_NEED_PIXELREAD FALSE
-#define GDISP_NEED_CONTROL TRUE
-#define GDISP_NEED_MULTITHREAD TRUE
-#define GDISP_NEED_ASYNC FALSE
-#define GDISP_NEED_MSGAPI FALSE
-
-#define GINPUT_MOUSE_USE_CUSTOM_BOARD TRUE
-/* Builtin Fonts */
-#define GDISP_INCLUDE_FONT_SMALL FALSE
-#define GDISP_INCLUDE_FONT_LARGER FALSE
-#define GDISP_INCLUDE_FONT_UI1 FALSE
-#define GDISP_INCLUDE_FONT_UI2 TRUE
-#define GDISP_INCLUDE_FONT_LARGENUMBERS TRUE
-
-/* Features for the GINPUT sub-system. */
-#define GINPUT_NEED_MOUSE FALSE
-
-#endif /* _GFXCONF_H */
-
diff --git a/demos/applications/benchmarks/main.c b/demos/applications/benchmarks/main.c
deleted file mode 100644
index a6f6d134..00000000
--- a/demos/applications/benchmarks/main.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- ChibiOS/GFX - Copyright (C) 2012
- Joel Bodenmann aka Tectu <joel@unormal.org>
-
- 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 <http://www.gnu.org/licenses/>.
-*/
-
-#include "ch.h"
-#include "hal.h"
-#include "chprintf.h"
-#include "stdlib.h"
-#include "string.h"
-#include "gfx.h"
-
-#define SCB_DEMCR (*(volatile unsigned *)0xE000EDFC)
-#define CPU_RESET_CYCLECOUNTER do { SCB_DEMCR = SCB_DEMCR | 0x01000000; \
-DWT_CYCCNT = 0; \
-DWT_CTRL = DWT_CTRL | 1 ; } while(0)
-
-int uitoa(unsigned int value, char * buf, int max) {
- int n = 0;
- int i = 0;
- unsigned int tmp = 0;
-
- if (NULL == buf)
- return -3;
-
- if (2 > max)
- return -4;
-
- i=1;
- tmp = value;
- if (0 > tmp) {
- tmp *= -1;
- i++;
- }
- for (;;) {
- tmp /= 10;
- if (0 >= tmp)
- break;
- i++;
- }
- if (i >= max) {
- buf[0] = '?';
- buf[1] = 0x0;
- return 2;
- }
-
- n = i;
- tmp = value;
- if (0 > tmp) {
- tmp *= -1;
- }
- buf[i--] = 0x0;
- for (;;) {
- buf[i--] = (tmp % 10) + '0';
- tmp /= 10;
- if (0 >= tmp) {
- break;
- }
- }
- if (-1 != i) {
- buf[i--] = '-';
- }
-
- return n;
-}
-
-static WORKING_AREA(waThread2, 2048);
-static msg_t Thread2(void *arg) {
- (void)arg;
- font_t font1;
- chRegSetThreadName("lcd");
-
- gdispSetOrientation(GDISP_ROTATE_90);
- gdispClear(Black);
-
- uint16_t width = gdispGetWidth();
- uint16_t height = gdispGetHeight();
-
- uint32_t pixels;
- uint32_t i;
- color_t random_color;
- uint16_t rx, ry, rcx, rcy;
- char pps_str[25];
- srand(DWT_CYCCNT);
-
- font1 = gdispOpenFont("UI2");
-
- while (TRUE) {
- gdispFillArea(10, 10, width-20, height-20, Grey);
- gdispFillArea(30, 30, 300, 150, Red);
- gdispFillArea(50, 50, 200, 100, Blue);
- gdispFillArea(80, 80, 150, 50, Yellow);
- gdispFillCircle(width/2, height/2, 50, White);
-
- const char *msg = "ChibiOS/GFX on SSD1289";
- gdispDrawString(width-gdispGetStringWidth(msg, font1)-3, height-24, msg, font1, White);
-
- chThdSleepMilliseconds(1000);
-
- pixels = 0;
- gdispClear(Black);
- gdispDrawString(10, height/2, "Doing 5000 random rectangles", font1, White);
- chThdSleepMilliseconds(2000);
- CPU_RESET_CYCLECOUNTER;
- for (i = 0; i < 5000; i++) {
- random_color = (rand() % 65535);
- rx = (rand() % (width-10));
- ry = (rand() % (height-10));
- rcx = (rand() % ((width-rx)-10))+10;
- rcy = (rand() % ((height-ry)-10))+10;
-
- gdispFillArea(rx, ry, rcx, rcy, random_color);
- pixels += (rcx+1)*(rcy+1);
- }
- uint32_t ms = DWT_CYCCNT / 168000;
- uint32_t pps = (float)pixels/((float)ms/1000.0f);
-
- memset (pps_str, 0, sizeof(pps_str));
- uitoa(pps, pps_str, sizeof(pps_str));
- strcat(pps_str, " Pixels/s");
-
- gdispClear(Black);
- gdispDrawString(100, height/2, pps_str, font1, White);
- chThdSleepMilliseconds(3000);
- }
-
- return 0;
-}
-
-int main(void) {
- halInit();
- chSysInit();
- gdispInit();
-
- chThdCreateStatic(waThread2, sizeof(waThread2), NORMALPRIO, Thread2, NULL);
-
- while(TRUE) {
- chThdSleepMilliseconds(500);
- }
-
- return 0;
-}