mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
imx233/fuze+: implement user time api, implement a stub function, protect timrot against irq
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30437 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
333b9ed2c3
commit
2ac668e44c
7 changed files with 86 additions and 1 deletions
|
@ -513,6 +513,10 @@ target/arm/imx233/debug-imx233.c
|
||||||
#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
|
#if !defined(BOOTLOADER) || defined(HAVE_BOOTLOADER_USB_MODE)
|
||||||
target/arm/imx233/usb-imx233.c
|
target/arm/imx233/usb-imx233.c
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef BOOTLOADER
|
||||||
|
target/arm/imx233/pcm-imx233.c
|
||||||
|
target/arm/imx233/timer-imx233.c
|
||||||
|
#endif
|
||||||
#endif /* IMX233 */
|
#endif /* IMX233 */
|
||||||
|
|
||||||
#if CONFIG_CPU == AS3525 || CONFIG_CPU == AS3525v2
|
#if CONFIG_CPU == AS3525 || CONFIG_CPU == AS3525v2
|
||||||
|
|
|
@ -57,6 +57,16 @@
|
||||||
#define FRAME_PHYS_ADDR (DRAM_ORIG + DRAM_SIZE - TTB_SIZE - FRAME_SIZE)
|
#define FRAME_PHYS_ADDR (DRAM_ORIG + DRAM_SIZE - TTB_SIZE - FRAME_SIZE)
|
||||||
#define FRAME ((void *)(FRAME_PHYS_ADDR - UNCACHED_DRAM_ADDR + BUFFERED_DRAM_ADDR))
|
#define FRAME ((void *)(FRAME_PHYS_ADDR - UNCACHED_DRAM_ADDR + BUFFERED_DRAM_ADDR))
|
||||||
|
|
||||||
|
/* Timer runs at APBX speed which is derived from ref_xtal@24MHz */
|
||||||
|
#define TIMER_FREQ 24000000
|
||||||
|
|
||||||
|
#ifdef SANSA_FUZEPLUS
|
||||||
|
#define TICK_TIMER_NR 0
|
||||||
|
#define USER_TIMER_NR 1
|
||||||
|
#else
|
||||||
|
#error Select timers !
|
||||||
|
#endif
|
||||||
|
|
||||||
/* USBOTG */
|
/* USBOTG */
|
||||||
#define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(2048)))
|
#define USB_QHARRAY_ATTR __attribute__((section(".qharray"),nocommon,aligned(2048)))
|
||||||
#define USB_NUM_ENDPOINTS 5
|
#define USB_NUM_ENDPOINTS 5
|
||||||
|
|
|
@ -31,7 +31,7 @@ static void tick_timer(void)
|
||||||
void tick_start(unsigned int interval_in_ms)
|
void tick_start(unsigned int interval_in_ms)
|
||||||
{
|
{
|
||||||
/* use the 1-kHz XTAL clock source */
|
/* use the 1-kHz XTAL clock source */
|
||||||
imx233_setup_timer(0, true, interval_in_ms,
|
imx233_setup_timer(TICK_TIMER_NR, true, interval_in_ms,
|
||||||
HW_TIMROT_TIMCTRL__SELECT_1KHZ_XTAL, HW_TIMROT_TIMCTRL__PRESCALE_1,
|
HW_TIMROT_TIMCTRL__SELECT_1KHZ_XTAL, HW_TIMROT_TIMCTRL__PRESCALE_1,
|
||||||
false, &tick_timer);
|
false, &tick_timer);
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,12 @@ void system_exception_wait(void)
|
||||||
while(!button_read_device());
|
while(!button_read_device());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int system_memory_guard(int newmode)
|
||||||
|
{
|
||||||
|
(void)newmode;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void imx233_enable_interrupt(int src, bool enable)
|
void imx233_enable_interrupt(int src, bool enable)
|
||||||
{
|
{
|
||||||
if(enable)
|
if(enable)
|
||||||
|
|
60
firmware/target/arm/imx233/timer-imx233.c
Normal file
60
firmware/target/arm/imx233/timer-imx233.c
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
#include "kernel.h"
|
||||||
|
#include "timrot-imx233.h"
|
||||||
|
#include "timer.h"
|
||||||
|
|
||||||
|
static long timer_cycles = 0;
|
||||||
|
|
||||||
|
static void timer_fn()
|
||||||
|
{
|
||||||
|
if(pfn_timer)
|
||||||
|
pfn_timer();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool timer_set(long cycles, bool start)
|
||||||
|
{
|
||||||
|
timer_stop();
|
||||||
|
|
||||||
|
if(start && pfn_unregister)
|
||||||
|
{
|
||||||
|
pfn_unregister();
|
||||||
|
pfn_unregister = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
timer_cycles = cycles;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool timer_start(IF_COP_VOID(int core))
|
||||||
|
{
|
||||||
|
imx233_setup_timer(USER_TIMER_NR, true, timer_cycles,
|
||||||
|
HW_TIMROT_TIMCTRL__SELECT_TICK_ALWAYS, HW_TIMROT_TIMCTRL__PRESCALE_1,
|
||||||
|
false, &timer_fn);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void timer_stop(void)
|
||||||
|
{
|
||||||
|
imx233_setup_timer(USER_TIMER_NR, false, 0, HW_TIMROT_TIMCTRL__SELECT_NEVER_TICK,
|
||||||
|
HW_TIMROT_TIMCTRL__PRESCALE_1, false, NULL);
|
||||||
|
}
|
|
@ -39,6 +39,8 @@ define_timer_irq(3)
|
||||||
void imx233_setup_timer(unsigned timer_nr, bool reload, unsigned count,
|
void imx233_setup_timer(unsigned timer_nr, bool reload, unsigned count,
|
||||||
unsigned src, unsigned prescale, bool polarity, imx233_timer_fn_t fn)
|
unsigned src, unsigned prescale, bool polarity, imx233_timer_fn_t fn)
|
||||||
{
|
{
|
||||||
|
int oldstatus = disable_interrupt_save(IRQ_FIQ_STATUS);
|
||||||
|
|
||||||
timer_fns[timer_nr] = fn;
|
timer_fns[timer_nr] = fn;
|
||||||
|
|
||||||
HW_TIMROT_TIMCTRL(timer_nr) = src | prescale;
|
HW_TIMROT_TIMCTRL(timer_nr) = src | prescale;
|
||||||
|
@ -65,6 +67,8 @@ void imx233_setup_timer(unsigned timer_nr, bool reload, unsigned count,
|
||||||
imx233_enable_interrupt(INT_SRC_TIMER(timer_nr), false);
|
imx233_enable_interrupt(INT_SRC_TIMER(timer_nr), false);
|
||||||
/* finally update */
|
/* finally update */
|
||||||
__REG_SET(HW_TIMROT_TIMCTRL(timer_nr)) = HW_TIMROT_TIMCTRL__UPDATE;
|
__REG_SET(HW_TIMROT_TIMCTRL(timer_nr)) = HW_TIMROT_TIMCTRL__UPDATE;
|
||||||
|
|
||||||
|
restore_interrupt(oldstatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void imx233_timrot_init(void)
|
void imx233_timrot_init(void)
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#define HW_TIMROT_TIMCTRL__PRESCALE_2 (1 << 4)
|
#define HW_TIMROT_TIMCTRL__PRESCALE_2 (1 << 4)
|
||||||
#define HW_TIMROT_TIMCTRL__PRESCALE_4 (2 << 4)
|
#define HW_TIMROT_TIMCTRL__PRESCALE_4 (2 << 4)
|
||||||
#define HW_TIMROT_TIMCTRL__PRESCALE_8 (3 << 4)
|
#define HW_TIMROT_TIMCTRL__PRESCALE_8 (3 << 4)
|
||||||
|
#define HW_TIMROT_TIMCTRL__SELECT_NEVER_TICK 0
|
||||||
#define HW_TIMROT_TIMCTRL__SELECT_32KHZ_XTAL 8
|
#define HW_TIMROT_TIMCTRL__SELECT_32KHZ_XTAL 8
|
||||||
#define HW_TIMROT_TIMCTRL__SELECT_8KHZ_XTAL 9
|
#define HW_TIMROT_TIMCTRL__SELECT_8KHZ_XTAL 9
|
||||||
#define HW_TIMROT_TIMCTRL__SELECT_4KHZ_XTAL 10
|
#define HW_TIMROT_TIMCTRL__SELECT_4KHZ_XTAL 10
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue