[X9D] Full use of the 16 grayscales.

[X9D] BMP 4bits support
[X9D] Debug driver
This commit is contained in:
bsongis
2013-01-14 20:08:34 +00:00
parent 2e747a1663
commit e41aa9fbd6
28 changed files with 325 additions and 182 deletions
+1 -1
View File
@@ -144,7 +144,7 @@ bool isAudioFileAvailable(uint32_t i, char * filename)
{
uint8_t category = (i >> 24);
#if defined(SIMU)
#if 0
printf("isAudioFileAvailable(%08x)\n", i); fflush(stdout);
#endif
+1 -1
View File
@@ -33,7 +33,7 @@
*/
#include "../open9x.h"
#include "fifo.h"
#include "../fifo.h"
void btSetBaudrate(uint32_t index)
{
+2
View File
@@ -36,6 +36,8 @@
void pwrInit();
void eepromInit();
void DEBUG_UART_Configure( uint32_t baudrate, uint32_t masterClock);
void DEBUG_UART_Stop();
uint32_t Master_frequency ;
volatile uint32_t Tenms ;
-1
View File
@@ -39,7 +39,6 @@
#include "board.h"
#include "audio_driver.h"
#include "haptic_driver.h"
#include "debug.h"
#if defined(BLUETOOTH)
#include "bluetooth.h"
-85
View File
@@ -1,85 +0,0 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny <shadow@privy.de>
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* open9x is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program 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.
*
*/
#ifndef debug_h
#define debug_h
#include <inttypes.h>
#if defined(DEBUG) && !defined(SIMU)
#ifdef __cplusplus
extern "C" {
#endif
void debugPutc(const char c);
void debugPuts(const char *string, ...);
void dump(unsigned char *data, unsigned int size);
#ifdef __cplusplus
}
#endif
#define TRACE_DEBUG(...) debugPuts("-D- " __VA_ARGS__)
#define TRACE_DEBUG_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_INFO(...) debugPuts("-I- " __VA_ARGS__)
#define TRACE_INFO_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_WARNING(...) debugPuts("-W- " __VA_ARGS__)
#define TRACE_WARNING_WP(...) debugPuts(__VA_ARGS__)
#define TRACE_ERROR(...) debugPuts("-E- " __VA_ARGS__)
#define DUMP(data, size) dump(data, size)
void DEBUG_UART_Configure( uint32_t baudrate, uint32_t masterClock);
void DEBUG_UART_Stop();
void debugTask(void* pdata);
#else
#define TRACE_DEBUG(...) { }
#define TRACE_DEBUG_WP(...) { }
#define TRACE_INFO(...) { }
#define TRACE_INFO_WP(...) { }
#define TRACE_WARNING(...) { }
#define TRACE_WARNING_WP(...) { }
#define TRACE_ERROR(...) { }
#define DUMP(...) { }
#define DEBUG_UART_Configure(...)
#define DEBUG_UART_Stop(...)
#endif
#endif
@@ -37,6 +37,8 @@
#if !defined(SIMU)
extern Fifo32 debugFifo;
/*
* Outputs a character on the UART line.
*
@@ -54,37 +56,6 @@ void debugPutc(const char c)
pUart->UART_THR = c;
}
// Outputs a string to the UART
void debugPuts(const char *format, ...)
{
va_list arglist;
char tmp[256];
va_start(arglist, format);
vsnprintf(tmp, 256, format, arglist);
va_end(arglist);
const char *t = tmp;
while (*t) {
debugPutc(*t++);
}
}
void dump(unsigned char *data, unsigned int size)
{
debugPuts("DUMP %d bytes ...\n\r", size);
unsigned int i = 0, j=0;
while (i*32+j < size) {
debugPuts("%.2X ", data[i*32+j]);
j++;
if (j==32) {
i++; j=0;
debugPuts("\n\r");
}
}
debugPuts("\n\r");
}
/**
* Configures a UART peripheral with the specified parameters.
*
@@ -128,22 +99,9 @@ void DEBUG_UART_Stop()
NVIC_DisableIRQ(UART0_IRQn) ;
}
Fifo32 debugFifo;
extern "C" void UART0_IRQHandler()
{
debugFifo.push(CONSOLE_USART->UART_RHR);
}
void debugTask(void* pdata)
{
uint8_t rxchar ;
for (;;) {
while (!debugFifo.pop(rxchar))
CoTickDelay(5); // 10ms
}
}
#endif
-72
View File
@@ -1,72 +0,0 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Jean-Pierre Parisy
* - Karl Szmutny <shadow@privy.de>
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* open9x is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program 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.
*
*/
#ifndef fifo_h
#define fifo_h
class Fifo32
{
public:
Fifo32():
widx(0),
ridx(0)
{
}
void push(uint8_t byte) {
uint32_t next = (widx+1) & 0x1f;
if (next != ridx) {
fifo[widx] = byte;
widx = next;
}
}
bool pop(uint8_t & byte) {
if (ridx == widx) {
return false;
}
else {
byte = fifo[ridx];
ridx = (ridx+1) & 0x1f;
return true;
}
}
protected:
uint8_t fifo[32];
volatile uint32_t widx;
volatile uint32_t ridx;
};
#endif
+1 -1
View File
@@ -39,7 +39,7 @@
*----------------------------------------------------------------------------*/
#include "board.h"
// #include "board.h"
#include <stdio.h>
#include <stdarg.h>