diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-11-15 10:55:02 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-11-15 10:55:02 +0000 |
commit | ddd5640ff64895e7d937bf69d8d8f8ffc507aad9 (patch) | |
tree | e05873b61dbe6b17b253c92f3d74dfbacb34aa9a /c/src/lib/libbsp/powerpc/gen5200/bestcomm/bestcomm_glue.c | |
parent | 2010-11-12 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-ddd5640ff64895e7d937bf69d8d8f8ffc507aad9.tar.bz2 |
2010-11-12 Sebastian Huber <sebastian.huber@embedded-brains.de>
* make/custom/dp2.cfg, startup/linkcmds.dp2: New files.
* Makefile.am, preinstall.am: Reflect change above. Install
<bsp/utility.h>. Install BestComm header files.
* configure.ac: Changed BSP options.
* include/mpc5200.h: Added module structures and register defines.
* bestcomm/bestcomm_api.c, bestcomm/bestcomm_api.h,
bestcomm/bestcomm_glue.c, bestcomm/bestcomm_glue.h,
bestcomm/bestcomm_priv.h, bestcomm/load_task.c,
bestcomm/tasksetup_bdtable.c, bestcomm/task_api/bestcomm_cntrl.h: C++
compatibility. Use special heap to manage the SRAM region. Use
interrupt extension API. Fixed warnings.
* console/console.c: Fixed console registration. Fixed warnings.
Added GPS module registration.
* ide/pcmcia_ide.h: Fixed clock value macros.
* ide/pcmcia_ide.c: Update for BestComm API changes.
DP2 specific initialization. Removed zero loop in PIO receive
function.
* include/bsp.h: Added DP2 variant. Removed obsolete defines.
* include/mscan-base.h, mscan/mscan-base.c: Use volatile qualifier.
Format.
* irq/irq.c: Fixed peripheral interrupt handling.
* network_5200/network.c: Update for BestComm API changes.
* start/start.S: U-Boot fixes.
* startup/cpuinit.c: Enable write-back cache strategy. Added special
memory regions.
* startup/linkcmds.brs5l: Fixed memory size.
Diffstat (limited to '')
-rw-r--r-- | c/src/lib/libbsp/powerpc/gen5200/bestcomm/bestcomm_glue.c | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/c/src/lib/libbsp/powerpc/gen5200/bestcomm/bestcomm_glue.c b/c/src/lib/libbsp/powerpc/gen5200/bestcomm/bestcomm_glue.c index d1c01336b1..db2223ea87 100644 --- a/c/src/lib/libbsp/powerpc/gen5200/bestcomm/bestcomm_glue.c +++ b/c/src/lib/libbsp/powerpc/gen5200/bestcomm/bestcomm_glue.c @@ -16,8 +16,8 @@ +-----------------------------------------------------------------+ | this file contains glue functions to the Freescale BestComm API | \*===============================================================*/ +#include <assert.h> #include <rtems.h> -#include <rtems/error.h> #include <bsp.h> #include <bsp/irq.h> #include "../include/mpc5200.h" @@ -28,6 +28,10 @@ #include "bestcomm_glue.h" #include "include/mgt5200/sdma.h" +extern const uint32 taskTableBytes; + +static Heap_Control bestcomm_heap; + /*=========================================================================*\ | Function: | \*-------------------------------------------------------------------------*/ @@ -46,15 +50,12 @@ void bestcomm_glue_irq_enable | none | \*=========================================================================*/ { - rtems_interrupt_level level; if (0 != ((1UL<<bestcomm_taskno) & SDMA_INT_BIT_IMPL)) { - rtems_interrupt_disable(level); /* * valid task number * enable interrupt in bestcomm mask */ - SDMA_INT_ENABLE(&mpc5200.IntMask,bestcomm_taskno); - rtems_interrupt_enable(level); + SDMA_INT_ENABLE(&mpc5200.sdma.IntMask,bestcomm_taskno); } } @@ -76,24 +77,21 @@ void bestcomm_glue_irq_disable | none | \*=========================================================================*/ { - rtems_interrupt_level level; if (0 != ((1UL<<bestcomm_taskno) & SDMA_INT_BIT_IMPL)) { - rtems_interrupt_disable(level); /* * valid task number * disable interrupt in bestcomm mask */ - SDMA_INT_DISABLE(&mpc5200.IntMask,bestcomm_taskno); - rtems_interrupt_enable(level); + SDMA_INT_DISABLE(&mpc5200.sdma.IntMask,bestcomm_taskno); } } typedef struct { - void (*the_handler)(rtems_irq_hdl_param); - rtems_irq_hdl_param the_param; + rtems_interrupt_handler handler; + void *arg; } bestcomm_glue_irq_handlers_t; -bestcomm_glue_irq_handlers_t bestcomm_glue_irq_handlers[32]; +static bestcomm_glue_irq_handlers_t bestcomm_glue_irq_handlers[32]; /*=========================================================================*\ | Function: | @@ -107,8 +105,8 @@ void bestcomm_glue_irq_install | Input Parameters: | \*-------------------------------------------------------------------------*/ int bestcomm_taskno, /* task number for handler */ - void (*the_handler)(rtems_irq_hdl_param), /* function to call */ - rtems_irq_hdl_param the_param + rtems_interrupt_handler handler, /* function to call */ + void *arg ) /*-------------------------------------------------------------------------*\ | Return Value: | @@ -120,8 +118,8 @@ void bestcomm_glue_irq_install * valid task number * install handler */ - bestcomm_glue_irq_handlers[bestcomm_taskno].the_handler = the_handler; - bestcomm_glue_irq_handlers[bestcomm_taskno].the_param = the_param; + bestcomm_glue_irq_handlers[bestcomm_taskno].handler = handler; + bestcomm_glue_irq_handlers[bestcomm_taskno].arg = arg; } } @@ -136,8 +134,7 @@ void bestcomm_glue_irq_dispatcher +---------------------------------------------------------------------------+ | Input Parameters: | \*-------------------------------------------------------------------------*/ - rtems_irq_hdl_param handle /* irq specific handle (not used) */ - + void *arg /* irq specific handle (not used) */ ) /*-------------------------------------------------------------------------*\ | Return Value: | @@ -147,23 +144,23 @@ void bestcomm_glue_irq_dispatcher uint32_t pending; int curr_taskno; - pending = mpc5200.IntPend & ~mpc5200.IntMask; + pending = mpc5200.sdma.IntPend & ~mpc5200.sdma.IntMask; curr_taskno = 0; while (pending != 0) { if ((pending & (1UL<<curr_taskno)) != 0) { - if (bestcomm_glue_irq_handlers[curr_taskno].the_handler == NULL) { + if (bestcomm_glue_irq_handlers[curr_taskno].handler != NULL) { /* - * This should never happen. we have a pending IRQ but no handler - * let's clear this pending bit + * call proper handler */ - SDMA_CLEAR_IEVENT(&mpc5200.IntPend,curr_taskno); + bestcomm_glue_irq_handlers[curr_taskno].handler + (bestcomm_glue_irq_handlers[curr_taskno].arg); } else { /* - * call proper handler + * This should never happen. we have a pending IRQ but no handler + * let's clear this pending bit */ - bestcomm_glue_irq_handlers[curr_taskno].the_handler - (bestcomm_glue_irq_handlers[curr_taskno].the_param); + SDMA_CLEAR_IEVENT(&mpc5200.sdma.IntPend,curr_taskno); } /* * clear this bit in our pending copy @@ -175,32 +172,6 @@ void bestcomm_glue_irq_dispatcher } } -void bestcomm_glue_on(const rtems_irq_connect_data* ptr) - { - } - - -void bestcomm_glue_isOn(const rtems_irq_connect_data* ptr) - { - /*return BSP_irq_enabled_at_cpm(ptr->name);*/ - } - - -void bestcomm_glue_off(const rtems_irq_connect_data* ptr) - { - } - -static rtems_irq_connect_data bestcomm_glue_irq_data = - { - - BSP_SIU_IRQ_SMARTCOMM, - (rtems_irq_hdl) bestcomm_glue_irq_dispatcher, - (rtems_irq_hdl_param) NULL, - (rtems_irq_enable) bestcomm_glue_on, - (rtems_irq_disable) bestcomm_glue_off, - (rtems_irq_is_enabled) bestcomm_glue_isOn - }; - static bool bestcomm_glue_is_initialized = false; /*=========================================================================*\ | Function: | @@ -224,12 +195,24 @@ void bestcomm_glue_init | none | \*=========================================================================*/ { + rtems_status_code sc = RTEMS_SUCCESSFUL; + uintptr_t heap_status = 0; + if (!bestcomm_glue_is_initialized) { bestcomm_glue_is_initialized = true; + + heap_status = _Heap_Initialize( + &bestcomm_heap, + (char *) &mpc5200.sram [0] + taskTableBytes, + sizeof(mpc5200.sram) - taskTableBytes, + 4 + ); + assert(heap_status != 0); + /* * Set task bar to begin of sram */ - mpc5200.taskBar = (uint32_t)(&(mpc5200.sram[0])); + mpc5200.sdma.taskBar = (uint32_t)(&(mpc5200.sram[0])); #if 0 /* @@ -244,18 +227,35 @@ void bestcomm_glue_init * the COMM bus. (Yes, _PE -- prefetch enable -- should probably be * named _PD.) */ - mpc5200.PtdCntrl |= SDMA_PTDCNTRL_PE; + mpc5200.sdma.PtdCntrl |= SDMA_PTDCNTRL_PE; TasksInitAPI((uint8*)&mpc5200); - TasksLoadImage( (void *)&(mpc5200.taskBar)); + TasksLoadImage( (void *)&(mpc5200.sdma.taskBar)); /* * initialize interrupt dispatcher */ - if(!BSP_install_rtems_irq_handler (&bestcomm_glue_irq_data)) { - rtems_panic ("Can't attach MPC5x00 BestComm interrupt handler\n"); - } + sc = rtems_interrupt_handler_install( + BSP_SIU_IRQ_SMARTCOMM, + "BESTCOMM", + RTEMS_INTERRUPT_UNIQUE, + bestcomm_glue_irq_dispatcher, + NULL + ); + assert(sc == RTEMS_SUCCESSFUL); + } +} +void *bestcomm_malloc(size_t size) +{ + return _Heap_Allocate(&bestcomm_heap, size); +} + +void bestcomm_free(void *ptr) +{ + if (ptr != NULL) { + bool ok = _Heap_Free(&bestcomm_heap, ptr); + assert(ok); } } |