* Get interrupts working (but crashes after 10-30secs)
* Make current_tick increase * Convert button driver into SADC driver * Make touchscreen handling work better (still needs good calibration routine) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18240 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
4396b5b101
commit
4bf4d2bb55
|
@ -43,7 +43,8 @@ static void audiotest(void)
|
|||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
{
|
||||
cli();
|
||||
kernel_init();
|
||||
lcd_init();
|
||||
font_init();
|
||||
|
@ -55,6 +56,8 @@ int main(void)
|
|||
|
||||
ata_init();
|
||||
|
||||
sti();
|
||||
|
||||
/* To make Windows say "ding-dong".. */
|
||||
REG8(USB_REG_POWER) &= ~USB_POWER_SOFTCONN;
|
||||
|
||||
|
@ -136,12 +139,10 @@ int main(void)
|
|||
snprintf(datetime, 30, "%02d/%02d/%04d %02d:%02d:%02d", get_time()->tm_mday, get_time()->tm_mon, get_time()->tm_year,
|
||||
get_time()->tm_hour, get_time()->tm_min, get_time()->tm_sec);
|
||||
lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*strlen(datetime), LCD_HEIGHT-SYSFONT_HEIGHT, datetime);
|
||||
snprintf(datetime, 30, "%d", REG_TCU_TCNT0);
|
||||
snprintf(datetime, 30, "%d", current_tick);
|
||||
lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*strlen(datetime), LCD_HEIGHT-SYSFONT_HEIGHT*2, datetime);
|
||||
snprintf(datetime, 30, "X: %d Y: %d", touch>>16, touch & 0xFFFF);
|
||||
lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*strlen(datetime), LCD_HEIGHT-SYSFONT_HEIGHT*3, datetime);
|
||||
snprintf(datetime, 30, "%d", read_c0_count());
|
||||
lcd_putsxy(LCD_WIDTH-SYSFONT_WIDTH*strlen(datetime), LCD_HEIGHT-SYSFONT_HEIGHT*4, datetime);
|
||||
lcd_update();
|
||||
}
|
||||
|
||||
|
|
|
@ -1089,6 +1089,6 @@ drivers/nand_id.c
|
|||
|
||||
#ifdef ONDA_VX747
|
||||
target/mips/ingenic_jz47xx/onda_vx747/backlight-onda_vx747.c
|
||||
target/mips/ingenic_jz47xx/onda_vx747/button-onda_vx747.c
|
||||
target/mips/ingenic_jz47xx/onda_vx747/lcd-onda_vx747.c
|
||||
target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
|
||||
#endif
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
#include "config.h"
|
||||
#include "system.h"
|
||||
#include "kernel.h"
|
||||
#include "timer.h"
|
||||
#include "thread.h"
|
||||
#include "jz4740.h"
|
||||
|
||||
extern void (*tick_funcs[MAX_NUM_TICK_TASKS])(void);
|
||||
|
@ -35,7 +33,9 @@ void tick_start(unsigned int interval_in_ms)
|
|||
unsigned int latch;
|
||||
__cpm_start_tcu();
|
||||
|
||||
__tcu_stop_counter(0);
|
||||
__tcu_disable_pwm_output(0);
|
||||
|
||||
__tcu_mask_half_match_irq(0);
|
||||
__tcu_unmask_full_match_irq(0);
|
||||
|
||||
|
@ -49,15 +49,19 @@ void tick_start(unsigned int interval_in_ms)
|
|||
|
||||
latch = (JZ_EXTAL / 4 + (tps>>1)) / tps;
|
||||
#endif
|
||||
REG_TCU_TCNT(0) = 0;
|
||||
REG_TCU_TDFR(0) = latch;
|
||||
REG_TCU_TDHR(0) = latch;
|
||||
//REG_TCU_TDHR(0) = 0;
|
||||
|
||||
__tcu_clear_full_match_flag(0);
|
||||
__tcu_start_counter(0);
|
||||
|
||||
//printf("TCSR = 0x%04x\r\n",*(volatile u16 *)0xb000204C);
|
||||
system_enable_irq(IRQ_TCU0);
|
||||
|
||||
}
|
||||
|
||||
/* Interrupt handler */
|
||||
void TCU0(void)
|
||||
{
|
||||
int i;
|
||||
|
|
|
@ -1,131 +0,0 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by Maurus Cuelenaere
|
||||
*
|
||||
* 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 "config.h"
|
||||
#include "jz4740.h"
|
||||
#include "button-target.h"
|
||||
|
||||
#define BTN_VOL_DOWN (1 << 27)
|
||||
#define BTN_VOL_UP (1 << 0)
|
||||
#define BTN_MENU (1 << 1)
|
||||
#define BTN_OFF (1 << 29)
|
||||
#define BTN_HOLD (1 << 16)
|
||||
#define BTN_MASK (BTN_VOL_DOWN | BTN_VOL_UP \
|
||||
| BTN_MENU | BTN_OFF )
|
||||
|
||||
#define SADC_CFG_INIT ( \
|
||||
(2 << SADC_CFG_CLKOUT_NUM_BIT) | \
|
||||
SADC_CFG_XYZ1Z2 | \
|
||||
SADC_CFG_SNUM_5 | \
|
||||
(1 << SADC_CFG_CLKDIV_BIT) | \
|
||||
SADC_CFG_PBAT_HIGH | \
|
||||
SADC_CFG_CMD_INT_PEN \
|
||||
)
|
||||
|
||||
bool button_hold(void)
|
||||
{
|
||||
return (~REG_GPIO_PXPIN(3) & BTN_HOLD ? 1 : 0);
|
||||
}
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
REG_SADC_ENA = 0;
|
||||
REG_SADC_STATE &= (~REG_SADC_STATE);
|
||||
REG_SADC_CTRL = 0x1f;
|
||||
|
||||
__cpm_start_sadc();
|
||||
REG_SADC_CFG = SADC_CFG_INIT;
|
||||
|
||||
REG_SADC_SAMETIME = 1;
|
||||
REG_SADC_WAITTIME = 1000; /* per 100 HZ */
|
||||
REG_SADC_STATE &= (~REG_SADC_STATE);
|
||||
REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_TSRDYM));
|
||||
REG_SADC_ENA = SADC_ENA_TSEN; // | REG_SADC_ENA;//SADC_ENA_TSEN | SADC_ENA_PBATEN | SADC_ENA_SADCINEN;
|
||||
}
|
||||
|
||||
static int touch_to_pixels(short x, short y)
|
||||
{
|
||||
/* X:300 -> 3800 Y:300->3900 */
|
||||
x -= 300;
|
||||
y -= 300;
|
||||
|
||||
/* X & Y are switched */
|
||||
x /= 3200 / LCD_WIDTH;
|
||||
y /= 3600 / LCD_HEIGHT;
|
||||
|
||||
y = LCD_HEIGHT - y;
|
||||
|
||||
return (x << 16) | y;
|
||||
}
|
||||
|
||||
int button_read_device(int *data)
|
||||
{
|
||||
if(button_hold())
|
||||
return 0;
|
||||
|
||||
unsigned int key = ~REG_GPIO_PXPIN(3);
|
||||
int ret = 0;
|
||||
if(key & BTN_MASK)
|
||||
{
|
||||
if(key & BTN_VOL_DOWN)
|
||||
ret |= BUTTON_VOL_DOWN;
|
||||
if(key & BTN_VOL_UP)
|
||||
ret |= BUTTON_VOL_UP;
|
||||
if(key & BTN_MENU)
|
||||
ret |= BUTTON_MENU;
|
||||
if(key & BTN_OFF)
|
||||
ret |= BUTTON_POWER;
|
||||
}
|
||||
|
||||
if(REG_SADC_STATE & (SADC_CTRL_TSRDYM|SADC_STATE_PEND))
|
||||
{
|
||||
if(REG_SADC_STATE & SADC_CTRL_PENDM)
|
||||
{
|
||||
REG_SADC_CTRL &= (~(SADC_CTRL_PENUM | SADC_CTRL_TSRDYM));
|
||||
REG_SADC_CTRL |= (SADC_CTRL_PENDM);
|
||||
unsigned int dat;
|
||||
unsigned short xData,yData;
|
||||
short tszData;
|
||||
|
||||
dat = REG_SADC_TSDAT;
|
||||
|
||||
xData = (dat >> 0) & 0xfff;
|
||||
yData = (dat >> 16) & 0xfff;
|
||||
|
||||
dat = REG_SADC_TSDAT;
|
||||
tszData = (dat >> 0) & 0xfff;
|
||||
tszData = tszData - ((dat >> 16) & 0xfff);
|
||||
|
||||
*data = touch_to_pixels(xData, yData);
|
||||
|
||||
}
|
||||
REG_SADC_STATE = 0;
|
||||
//__intc_unmask_irq(IRQ_SADC);
|
||||
}
|
||||
else
|
||||
*data = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
void button_set_touch_available(void)
|
||||
{
|
||||
return;
|
||||
}
|
217
firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
Normal file
217
firmware/target/mips/ingenic_jz47xx/onda_vx747/sadc-onda_vx747.c
Normal file
|
@ -0,0 +1,217 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by Maurus Cuelenaere
|
||||
*
|
||||
* 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 "config.h"
|
||||
#include "system.h"
|
||||
#include "jz4740.h"
|
||||
#include "button-target.h"
|
||||
|
||||
#define BTN_VOL_DOWN (1 << 27)
|
||||
#define BTN_VOL_UP (1 << 0)
|
||||
#define BTN_MENU (1 << 1)
|
||||
#define BTN_OFF (1 << 29)
|
||||
#define BTN_HOLD (1 << 16)
|
||||
#define BTN_MASK (BTN_VOL_DOWN | BTN_VOL_UP \
|
||||
| BTN_MENU | BTN_OFF )
|
||||
|
||||
|
||||
#define TS_AD_COUNT 5
|
||||
#define M_SADC_CFG_SNUM ((TS_AD_COUNT - 1) << SADC_CFG_SNUM_BIT)
|
||||
|
||||
#define SADC_CFG_INIT ( \
|
||||
(2 << SADC_CFG_CLKOUT_NUM_BIT) | \
|
||||
SADC_CFG_XYZ1Z2 | \
|
||||
M_SADC_CFG_SNUM | \
|
||||
(2 << SADC_CFG_CLKDIV_BIT) | \
|
||||
SADC_CFG_PBAT_HIGH | \
|
||||
SADC_CFG_CMD_INT_PEN \
|
||||
)
|
||||
|
||||
static bool pendown_flag = false;
|
||||
static short x_pos = -1, y_pos = -1, datacount = 0;
|
||||
static short stable_x_pos = -1, stable_y_pos = -1;
|
||||
|
||||
bool button_hold(void)
|
||||
{
|
||||
return (~REG_GPIO_PXPIN(3) & BTN_HOLD ? 1 : 0);
|
||||
}
|
||||
|
||||
void button_init_device(void)
|
||||
{
|
||||
REG_SADC_ENA = 0;
|
||||
REG_SADC_STATE &= (~REG_SADC_STATE);
|
||||
REG_SADC_CTRL = 0x1f;
|
||||
|
||||
__cpm_start_sadc();
|
||||
REG_SADC_CFG = SADC_CFG_INIT;
|
||||
|
||||
system_enable_irq(IRQ_SADC);
|
||||
|
||||
REG_SADC_SAMETIME = 350;
|
||||
REG_SADC_WAITTIME = 100; /* per 10 HZ */
|
||||
REG_SADC_STATE &= (~REG_SADC_STATE);
|
||||
REG_SADC_CTRL &= (~(SADC_CTRL_PENDM | SADC_CTRL_PENUM | SADC_CTRL_TSRDYM));
|
||||
REG_SADC_ENA = (SADC_ENA_TSEN | REG_SADC_ENA); //| SADC_ENA_PBATEN | SADC_ENA_SADCINEN);
|
||||
|
||||
__gpio_port_as_input(3, 29);
|
||||
__gpio_port_as_input(3, 27);
|
||||
__gpio_port_as_input(3, 16);
|
||||
__gpio_port_as_input(3, 1);
|
||||
__gpio_port_as_input(3, 0);
|
||||
}
|
||||
|
||||
//static unsigned short touchdivider[2] = {14.5833*1000, 9*1000};
|
||||
static int touch_to_pixels(short x, short y)
|
||||
{
|
||||
/* X:300 -> 3800 Y:300->3900 */
|
||||
x -= 300;
|
||||
y -= 300;
|
||||
|
||||
x /= 3200 / LCD_WIDTH;
|
||||
y /= 3600 / LCD_HEIGHT;
|
||||
//x /= touchdivider[0];
|
||||
//y /= touchdivider[1];
|
||||
|
||||
y = LCD_HEIGHT - y;
|
||||
|
||||
return (x << 16) | y;
|
||||
}
|
||||
|
||||
int button_read_device(int *data)
|
||||
{
|
||||
if(button_hold())
|
||||
return 0;
|
||||
|
||||
unsigned int key = ~(__gpio_get_port(3));
|
||||
int ret = 0;
|
||||
if(key & BTN_MASK)
|
||||
{
|
||||
if(key & BTN_VOL_DOWN)
|
||||
ret |= BUTTON_VOL_DOWN;
|
||||
if(key & BTN_VOL_UP)
|
||||
ret |= BUTTON_VOL_UP;
|
||||
if(key & BTN_MENU)
|
||||
ret |= BUTTON_MENU;
|
||||
if(key & BTN_OFF)
|
||||
ret |= BUTTON_POWER;
|
||||
}
|
||||
|
||||
if(pendown_flag)
|
||||
{
|
||||
*data = touch_to_pixels(stable_x_pos, stable_y_pos);
|
||||
ret |= BUTTON_TOUCH;
|
||||
}
|
||||
else
|
||||
*data = 0;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void button_set_touch_available(void)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* Interrupt handler */
|
||||
void SADC(void)
|
||||
{
|
||||
unsigned char state;
|
||||
unsigned char sadcstate;
|
||||
|
||||
sadcstate = REG_SADC_STATE;
|
||||
state = REG_SADC_STATE & (~REG_SADC_CTRL);
|
||||
REG_SADC_STATE &= sadcstate;
|
||||
|
||||
if(state & SADC_CTRL_PENDM)
|
||||
{
|
||||
/* Pen down IRQ */
|
||||
REG_SADC_CTRL &= (~(SADC_CTRL_PENUM | SADC_CTRL_TSRDYM));
|
||||
REG_SADC_CTRL |= (SADC_CTRL_PENDM);// | SADC_CTRL_TSRDYM);
|
||||
pendown_flag = true;
|
||||
}
|
||||
if(state & SADC_CTRL_PENUM)
|
||||
{
|
||||
/* Pen up IRQ */
|
||||
REG_SADC_CTRL &= (~SADC_CTRL_PENDM );
|
||||
REG_SADC_CTRL |= SADC_CTRL_PENUM;
|
||||
pendown_flag = false;
|
||||
x_pos = -1;
|
||||
y_pos = -1;
|
||||
stable_x_pos = -1;
|
||||
stable_y_pos = -1;
|
||||
}
|
||||
if(state & SADC_CTRL_TSRDYM)
|
||||
{
|
||||
unsigned int dat;
|
||||
unsigned short xData, yData;
|
||||
short tsz1Data, tsz2Data;
|
||||
|
||||
dat = REG_SADC_TSDAT;
|
||||
|
||||
xData = (dat >> 0) & 0xfff;
|
||||
yData = (dat >> 16) & 0xfff;
|
||||
|
||||
dat = REG_SADC_TSDAT;
|
||||
tsz1Data = (dat >> 0) & 0xfff;
|
||||
tsz2Data = (dat >> 16) & 0xfff;
|
||||
|
||||
if(!pendown_flag)
|
||||
return ;
|
||||
|
||||
tsz1Data = tsz2Data - tsz1Data;
|
||||
|
||||
if((tsz1Data > 15) || (tsz1Data < -15))
|
||||
{
|
||||
if(x_pos == -1)
|
||||
x_pos = xData;
|
||||
else
|
||||
x_pos = (x_pos + xData) / 2;
|
||||
|
||||
if(y_pos == -1)
|
||||
y_pos = yData;
|
||||
else
|
||||
y_pos = (y_pos + yData) / 2;
|
||||
}
|
||||
|
||||
datacount++;
|
||||
|
||||
if(datacount > TS_AD_COUNT - 1)
|
||||
{
|
||||
if(x_pos != -1)
|
||||
{
|
||||
stable_x_pos = x_pos;
|
||||
stable_y_pos = y_pos;
|
||||
x_pos = -1;
|
||||
y_pos = -1;
|
||||
}
|
||||
|
||||
datacount = 0;
|
||||
}
|
||||
}
|
||||
if(state & SADC_CTRL_PBATRDYM)
|
||||
{
|
||||
/* Battery AD IRQ */
|
||||
}
|
||||
if(state & SADC_CTRL_SRDYM)
|
||||
{
|
||||
/* SADC AD IRQ */
|
||||
}
|
||||
}
|
|
@ -32,9 +32,10 @@
|
|||
#define NUM_GPIO 128
|
||||
#define IRQ_MAX (IRQ_GPIO_0 + NUM_GPIO)
|
||||
|
||||
static int irq;
|
||||
static void UIRQ(void)
|
||||
{
|
||||
panicf("Unhandled interrupt occurred\n");
|
||||
panicf("Unhandled interrupt occurred: %d\n", irq);
|
||||
}
|
||||
|
||||
#define default_interrupt(name) \
|
||||
|
@ -51,7 +52,6 @@ default_interrupt(SSI);
|
|||
default_interrupt(CIM);
|
||||
default_interrupt(AIC);
|
||||
default_interrupt(ETH);
|
||||
default_interrupt(TCU3);
|
||||
default_interrupt(TCU2);
|
||||
default_interrupt(TCU1);
|
||||
default_interrupt(TCU0);
|
||||
|
@ -197,11 +197,12 @@ default_interrupt(GPIO127);
|
|||
|
||||
static void (* const irqvector[])(void) =
|
||||
{
|
||||
I2C,EMC,UHC,UART0,SADC,MSC,RTC,SSI,
|
||||
CIM,AIC,ETH,UIRQ,TCU3,TCU2,TCU1,TCU0,
|
||||
UDC,UIRQ,UIRQ,UIRQ,UIRQ,IPU,LCD,UIRQ,
|
||||
DMA0,DMA1,DMA2,DMA3,DMA4,DMA5,UIRQ,UIRQ,
|
||||
UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,
|
||||
I2C,EMC,UHC,UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,
|
||||
UART0,UIRQ,UIRQ,SADC,UIRQ,MSC,RTC,SSI,
|
||||
CIM,AIC,ETH,UIRQ,TCU2,TCU1,TCU0,UDC,
|
||||
UIRQ,UIRQ,UIRQ,UIRQ,IPU,LCD,UIRQ,DMA0,
|
||||
DMA1,DMA2,DMA3,DMA4,DMA5,UIRQ,UIRQ,UIRQ,
|
||||
UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,UIRQ,
|
||||
GPIO0,GPIO1,GPIO2,GPIO3,GPIO4,GPIO5,GPIO6,GPIO7,
|
||||
GPIO8,GPIO9,GPIO10,GPIO11,GPIO12,GPIO13,GPIO14,GPIO15,
|
||||
GPIO16,GPIO17,GPIO18,GPIO19,GPIO20,GPIO21,GPIO22,GPIO23,
|
||||
|
@ -223,7 +224,7 @@ static void (* const irqvector[])(void) =
|
|||
static unsigned int dma_irq_mask = 0;
|
||||
static unsigned int gpio_irq_mask[4] = {0};
|
||||
|
||||
static void ena_irq(unsigned int irq)
|
||||
void system_enable_irq(unsigned int irq)
|
||||
{
|
||||
register unsigned int t;
|
||||
if ((irq >= IRQ_GPIO_0) && (irq <= IRQ_GPIO_0 + NUM_GPIO))
|
||||
|
@ -333,7 +334,7 @@ static int get_irq_number(void)
|
|||
|
||||
void intr_handler(void)
|
||||
{
|
||||
register int irq = get_irq_number();
|
||||
irq = get_irq_number();
|
||||
if(irq < 0)
|
||||
return;
|
||||
|
||||
|
@ -341,7 +342,6 @@ void intr_handler(void)
|
|||
if(irq > 0)
|
||||
irqvector[irq-1]();
|
||||
|
||||
printf("Interrupt!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -558,18 +558,11 @@ void system_main(void)
|
|||
|
||||
__dcache_writeback_all();
|
||||
__icache_invalidate_all();
|
||||
|
||||
//set_c0_status(1 << 22); /* Enable Boot Exception Vectors */
|
||||
|
||||
/* Init interrupt handlers */
|
||||
/* Init interrupt handling */
|
||||
ipl = 0;
|
||||
for(i=0;i<IRQ_MAX;i++)
|
||||
{
|
||||
if(irqvector[i] == UIRQ)
|
||||
dis_irq(i);
|
||||
else
|
||||
ena_irq(i);
|
||||
}
|
||||
dis_irq(i);
|
||||
|
||||
sti();
|
||||
|
||||
|
|
|
@ -94,8 +94,11 @@ void __dcache_invalidate_all(void);
|
|||
void __icache_invalidate_all(void);
|
||||
void __flush_dcache_line(unsigned long addr);
|
||||
void dma_cache_wback_inv(unsigned long addr, unsigned long size);
|
||||
void system_enable_irq(unsigned int irq);
|
||||
void sti(void);
|
||||
void cli(void);
|
||||
void udelay(unsigned int usec);
|
||||
void mdelay(unsigned int msec);
|
||||
|
||||
#endif /* __SYSTEM_TARGET_H_ */
|
||||
|
||||
|
|
28
firmware/target/mips/ingenic_jz47xx/timer-jz4740.c
Normal file
28
firmware/target/mips/ingenic_jz47xx/timer-jz4740.c
Normal file
|
@ -0,0 +1,28 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by Maurus Cuelenaere
|
||||
*
|
||||
* 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 "config.h"
|
||||
#include "jz4740.h"
|
||||
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_register(void);
|
||||
void __timer_unregister(void);
|
41
firmware/target/mips/ingenic_jz47xx/timer-target.h
Normal file
41
firmware/target/mips/ingenic_jz47xx/timer-target.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2008 by Maurus Cuelenaere
|
||||
*
|
||||
* 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 __TIMER_H_
|
||||
#define __TIMER_H_
|
||||
|
||||
#define TIMER_FREQ (27000000)
|
||||
|
||||
bool __timer_set(long cycles, bool set);
|
||||
bool __timer_register(void);
|
||||
void __timer_unregister(void);
|
||||
|
||||
#define __TIMER_SET(cycles, set) \
|
||||
__timer_set(cycles, set)
|
||||
|
||||
#define __TIMER_REGISTER(reg_prio, unregister_callback, cycles, \
|
||||
int_prio, timer_callback) \
|
||||
__timer_register()
|
||||
|
||||
#define __TIMER_UNREGISTER(...) \
|
||||
__timer_unregister()
|
||||
|
||||
#endif /* __TIMER_H_ */
|
Loading…
Reference in New Issue
Block a user