Index: current/cdl/hal_v85x_ceb_v850.cdl =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/v85x/ceb_v850/current/cdl/hal_v85x_ceb_v850.cdl,v retrieving revision 1.12 diff -u -5 -r1.12 hal_v85x_ceb_v850.cdl --- current/cdl/hal_v85x_ceb_v850.cdl 23 May 2002 23:05:37 -0000 1.12 +++ current/cdl/hal_v85x_ceb_v850.cdl 30 Mar 2003 15:51:07 -0000 @@ -360,6 +360,34 @@ i.e. applications will be loaded into RAM on the board, and this ROM monitor may process exceptions or interrupts generated from the application. This enables features such as utilizing a separate interrupt stack when exceptions are generated." } + + cdl_component CYGPKG_REDBOOT_HAL_OPTIONS { + display "Redboot HAL options" + flavor none + no_define + parent CYGPKG_REDBOOT + active_if CYGPKG_REDBOOT + description " + This option lists the target's requirements for a valid Redboot + configuration." + + cdl_option CYGBLD_BUILD_REDBOOT_BIN { + display "Build Redboot ROM binary image" + active_if CYGBLD_BUILD_REDBOOT + default_value 1 + no_define + description "This option enables the conversion of the Redboot ELF + image to a binary image suitable for ROM programming." + + compile -library=libextras.a + + make -priority 325 { + /bin/redboot.srec : /bin/redboot.elf + $(OBJCOPY) --strip-all $< $(@:.srec=.img) + $(OBJCOPY) -O srec $< $@ + } + } + } } Index: current/include/plf_intr.h =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/v85x/ceb_v850/current/include/plf_intr.h,v retrieving revision 1.6 diff -u -5 -r1.6 plf_intr.h --- current/include/plf_intr.h 23 May 2002 23:05:39 -0000 1.6 +++ current/include/plf_intr.h 30 Mar 2003 15:51:07 -0000 @@ -58,10 +58,13 @@ // //####DESCRIPTIONEND#### // //========================================================================== -// Nothing to do here. Handled by default variant code. +// Microsecond delay function provided in plf_misc.c +externC void hal_delay_us(int us); + +#define HAL_DELAY_US(n) hal_delay_us(n) //-------------------------------------------------------------------------- #endif // ifndef CYGONCE_HAL_PLF_INTR_H // End of plf_intr.h Index: current/src/plf_misc.c =================================================================== RCS file: /cvs/ecos/ecos/packages/hal/v85x/ceb_v850/current/src/plf_misc.c,v retrieving revision 1.6 diff -u -5 -r1.6 plf_misc.c --- current/src/plf_misc.c 23 May 2002 23:05:40 -0000 1.6 +++ current/src/plf_misc.c 30 Mar 2003 15:51:08 -0000 @@ -72,10 +72,18 @@ extern void show_led(int p); void cyg_hal_platform_hardware_init(void) { + +#ifdef CYGPKG_REDBOOT + // Start the timer device if we are in a RedBoot + // configuration. + + HAL_CLOCK_INITIALIZE(CYGNUM_HAL_RTC_PERIOD); +#endif + hal_if_init(); // Initialize GDB[ROM]/eCos interfaces show_led(' '); show_led(' '); } @@ -300,11 +308,62 @@ { volatile unsigned short *timer = (volatile unsigned short *)V850_REG_TM1; return (cyg_uint32)*timer; } - +// +// Delay for a us microseconds +// +void +hal_delay_us(int us) +{ + volatile unsigned short *timer = (volatile unsigned short *)V850_REG_TM1; + cyg_uint32 val1, val2; + int diff; + long usticks; + long ticks; + + // Calculate the number of counter register ticks per microsecond. + usticks = (CYGNUM_HAL_RTC_PERIOD * CYGNUM_HAL_RTC_DENOMINATOR) / 1000000; + + // Make sure that the value is not zero. + if (usticks == 0) + usticks = 1; + + while (us > 0) + { + int us1 = us; + + // Wait in bursts of less than 10000us to avoid any overflow + // problems in the multiply. + if (us1 > 10000) + us1 = 10000; + + us -= us1; + + ticks = us1 * usticks; + + val1 = *timer; + + while (ticks > 0) + { + do + { + val2 = *timer; + } + while (val1 == val2); + + diff = val2 - val1; + + if (diff < 0) + diff += CYGNUM_HAL_RTC_PERIOD; + ticks -= diff; + val1 = val2; + } + } +} + extern void _hal_thread_load_context(HAL_SavedRegisters **to) CYGBLD_ATTRIB_NORET; extern void _hal_thread_switch_context(HAL_SavedRegisters **to, HAL_SavedRegisters **from); void hal_thread_load_context(CYG_ADDRESS to)