2011-05-01 13:02:46 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 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.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2011-07-23 11:45:22 +00:00
|
|
|
#include "system.h"
|
|
|
|
#include "debug-target.h"
|
2011-10-18 22:06:02 +00:00
|
|
|
#include "dma-imx233.h"
|
|
|
|
#include "action.h"
|
|
|
|
#include "lcd.h"
|
|
|
|
#include "font.h"
|
2011-11-14 21:07:48 +00:00
|
|
|
#include "adc.h"
|
|
|
|
#include "adc-imx233.h"
|
2011-11-14 21:45:18 +00:00
|
|
|
#include "powermgmt.h"
|
2011-10-18 22:06:02 +00:00
|
|
|
|
|
|
|
static struct
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
unsigned chan;
|
|
|
|
} dbg_channels[] =
|
|
|
|
{
|
|
|
|
{ "i2c", APB_I2C },
|
|
|
|
{ "dac", APB_AUDIO_DAC },
|
|
|
|
{ "ssp1", APB_SSP(1) },
|
|
|
|
{ "ssp2", APB_SSP(2) },
|
|
|
|
};
|
|
|
|
|
|
|
|
bool dbg_hw_info_dma(void)
|
|
|
|
{
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
int button = get_action(CONTEXT_STD, HZ / 25);
|
|
|
|
switch(button)
|
|
|
|
{
|
|
|
|
case ACTION_STD_NEXT:
|
|
|
|
case ACTION_STD_PREV:
|
|
|
|
case ACTION_STD_OK:
|
|
|
|
case ACTION_STD_MENU:
|
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
return true;
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
|
|
|
lcd_putsf(0, 0, "I G F C E name bar apb ahb");
|
|
|
|
for(unsigned i = 0; i < ARRAYLEN(dbg_channels); i++)
|
|
|
|
{
|
|
|
|
struct imx233_dma_info_t info = imx233_dma_get_info(dbg_channels[i].chan, DMA_INFO_ALL);
|
|
|
|
lcd_putsf(0, i + 1, "%c %c %c %c %c %4s %x %x %x",
|
|
|
|
info.int_enabled ? 'i' : ' ',
|
|
|
|
info.gated ? 'g' : ' ',
|
|
|
|
info.freezed ? 'f' : ' ',
|
|
|
|
info.int_cmdcomplt ? 'c' : ' ',
|
|
|
|
info.int_error ? 'e' : ' ',
|
|
|
|
dbg_channels[i].name, info.bar, info.apb_bytes, info.ahb_bytes);
|
|
|
|
}
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
yield();
|
|
|
|
}
|
|
|
|
}
|
2011-07-23 11:45:22 +00:00
|
|
|
|
2011-11-14 21:07:48 +00:00
|
|
|
bool dbg_hw_info_adc(void)
|
|
|
|
{
|
|
|
|
lcd_setfont(FONT_SYSFIXED);
|
|
|
|
|
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
int button = get_action(CONTEXT_STD, HZ / 25);
|
|
|
|
switch(button)
|
|
|
|
{
|
|
|
|
case ACTION_STD_NEXT:
|
|
|
|
case ACTION_STD_PREV:
|
|
|
|
case ACTION_STD_OK:
|
|
|
|
case ACTION_STD_MENU:
|
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
return true;
|
|
|
|
case ACTION_STD_CANCEL:
|
|
|
|
lcd_setfont(FONT_UI);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
lcd_clear_display();
|
|
|
|
|
2011-11-14 21:45:18 +00:00
|
|
|
/* add battery readout in mV, this it is not the direct output of a channel */
|
|
|
|
lcd_putsf(0, 0, "Battery(mV) %d", battery_adc_voltage());
|
2011-11-14 21:07:48 +00:00
|
|
|
for(unsigned i = 0; i < NUM_ADC_CHANNELS; i++)
|
|
|
|
{
|
2011-11-14 21:45:18 +00:00
|
|
|
lcd_putsf(0, i + 1, "%s %d", imx233_adc_channel_name[i],
|
2011-11-14 21:07:48 +00:00
|
|
|
adc_read(i));
|
|
|
|
}
|
|
|
|
|
|
|
|
lcd_update();
|
|
|
|
yield();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-07-23 11:45:22 +00:00
|
|
|
bool dbg_hw_info(void)
|
|
|
|
{
|
2011-11-14 21:07:48 +00:00
|
|
|
return dbg_hw_info_dma() && dbg_hw_info_adc() && dbg_hw_target_info();
|
2011-07-23 11:45:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool dbg_ports(void)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|