Changeset d75023e in rtems


Ignore:
Timestamp:
Feb 3, 2005, 10:52:26 PM (16 years ago)
Author:
Eric Norum <WENorum@…>
Branches:
4.10, 4.11, 4.8, 4.9, 5, master
Children:
3479b8b1
Parents:
f8ac4fc7
Message:

Add 'extended' BSP support (pseudo-VME)

Location:
c/src/lib/libbsp/m68k/uC5282
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libbsp/m68k/uC5282/ChangeLog

    rf8ac4fc7 rd75023e  
     12005-02-03  Eric Norum <norume@aps.anl.gov>
     2
     3        * include/bsp.h, startup/bspstart.c: Add 'extended' BSP support (pseudo-VME)
     4
    152005-02-02  Eric Norum <norume@aps.anl.gov>
    26
  • c/src/lib/libbsp/m68k/uC5282/README

    rf8ac4fc7 rd75023e  
    55Description: Arcturus Networks uC DIMM ColdFire 5282
    66============
    7 CPU: MCF5282, 64MHz
    8 RAM: 16M
    9 ROM: 4M
     7 CPU: MCF5282, 64MHz
     8 RAM: 16M
     9SRAM: 64k (BSP places FEC buffer descriptors here)
     10 ROM: 4M
    1011
    1112This is a credit-card sized board in a DIMM format. It is part of a family
     
    1617This BSP is based on the work of:
    1718    D. Peter Siddons
     19    Till Straumann
    1820    Brett Swimley
    1921    Jay Monkman
  • c/src/lib/libbsp/m68k/uC5282/include/bsp.h

    rf8ac4fc7 rd75023e  
    6969
    7070unsigned32 bsp_get_CPU_clock_speed(void);
    71 int bsp_allocate_interrupt(int level, int priority);
     71rtems_status_code bsp_allocate_interrupt(int level, int priority);
    7272unsigned const char *uC5282_gethwaddr(int a);
    7373const char *uC5282_getbenv(const char *a);
     
    9999#define UART2_IRQ_PRIORITY  5
    100100
     101/*
     102 * Fake VME support
     103 * This makes it easier to use EPICS driver support on this BSP.
     104 */
     105#define VME_AM_STD_SUP_ASCENDING   0x3f
     106#define VME_AM_STD_SUP_PGM         0x3e
     107#define VME_AM_STD_USR_ASCENDING   0x3b
     108#define VME_AM_STD_USR_PGM         0x3a
     109#define VME_AM_STD_SUP_DATA        0x3d
     110#define VME_AM_STD_USR_DATA        0x39
     111#define VME_AM_EXT_SUP_ASCENDING   0x0f
     112#define VME_AM_EXT_SUP_PGM         0x0e
     113#define VME_AM_EXT_USR_ASCENDING   0x0b
     114#define VME_AM_EXT_USR_PGM         0x0a
     115#define VME_AM_EXT_SUP_DATA        0x0d
     116#define VME_AM_EXT_USR_DATA        0x09
     117#define VME_AM_SUP_SHORT_IO        0x2d
     118#define VME_AM_USR_SHORT_IO        0x29
     119
     120/*
     121 * 'Extended' BSP support
     122 */
     123rtems_status_code bspExtInit(void);
     124typedef void (*BSP_VME_ISR_t)(void *usrArg, unsigned long vector);
     125BSP_VME_ISR_t BSP_getVME_isr(unsigned long vector, void **parg);
     126int BSP_installVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *usrArg);
     127int BSP_removeVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *usrArg);
     128int BSP_enableVME_int_lvl(unsigned int level);
     129int BSP_disableVME_int_lvl(unsigned int level);
     130int BSP_vme2local_adrs(unsigned am, unsigned long vmeaddr, unsigned long *plocaladdr);
     131
     132
    101133#ifdef __cplusplus
    102134}
  • c/src/lib/libbsp/m68k/uC5282/startup/bspstart.c

    rf8ac4fc7 rd75023e  
    158158void bsp_postdriver_hook(void);
    159159void bsp_libc_init( void *, unsigned32, int );
    160 void bsp_pretasking_hook(void);                 /* m68k version */
     160void bsp_pretasking_hook(void);         /* m68k version */
    161161
    162162/*
     
    171171  extern unsigned long  _M68k_Ramsize;
    172172
    173   _M68k_Ramsize = (unsigned long)_RamSize;              /* RAM size set in linker script */
     173  _M68k_Ramsize = (unsigned long)_RamSize;      /* RAM size set in linker script */
    174174
    175175  /*
     
    256256 * Interrupt controller allocation
    257257 */
    258 int bsp_allocate_interrupt(int level, int priority)
     258rtems_status_code
     259bsp_allocate_interrupt(int level, int priority)
    259260{
    260261    static char used[7];
    261262    rtems_interrupt_level l;
    262     int ret = -1;
     263    rtems_status_code ret = RTEMS_RESOURCE_IN_USE;
    263264
    264265    if ((level < 1) || (level > 7) || (priority < 0) || (priority > 7))
    265         return ret;
     266        return RTEMS_INVALID_NUMBER;
    266267    rtems_interrupt_disable(l);
    267268    if ((used[level-1] & (1 << priority)) == 0) {
    268269        used[level-1] |= (1 << priority);
    269         ret = 0;
     270        ret = RTEMS_SUCCESSFUL;
    270271    }
    271272    rtems_interrupt_enable(l);
     
    302303syscall_1(unsigned const char *, gethwaddr, int, a)
    303304syscall_1(const char *, getbenv, const char *, a)
     305
     306
     307/*
     308 * 'Extended BSP' routines
     309 * Should move to cpukit/score/cpu/m68k/cpu.c someday.
     310 */
     311
     312rtems_status_code bspExtInit(void) { return RTEMS_SUCCESSFUL; }
     313int BSP_enableVME_int_lvl(unsigned int level) { return 0; }
     314int BSP_disableVME_int_lvl(unsigned int level) { return 0; }
     315
     316/*
     317 * VME interrupt support
     318 */
     319static struct handlerTab {
     320    BSP_VME_ISR_t func;
     321    void         *arg;
     322} handlerTab[256];
     323
     324BSP_VME_ISR_t
     325BSP_getVME_isr(unsigned long vector, void **pusrArg)
     326{
     327    if (vector > 255)
     328        return (BSP_VME_ISR_t)NULL;
     329    if (pusrArg)
     330        *pusrArg = handlerTab[vector].arg;
     331    return handlerTab[vector].func;
     332}
     333
     334static rtems_isr
     335trampoline (int v)
     336{
     337    if (*handlerTab[v].func)
     338        (*handlerTab[v].func)(handlerTab[v].arg, (unsigned long)v);
     339}
     340
     341int
     342BSP_installVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *usrArg)
     343{
     344    rtems_isr_entry old_handler;
     345
     346    if (vector > 255)
     347        return -1;
     348    handlerTab[vector].func = handler;
     349    handlerTab[vector].arg = usrArg;
     350    rtems_interrupt_catch(trampoline, vector, old_handler);
     351
     352    /*
     353     * Find an unused level/priority
     354     */
     355    if ((vector >= 65) && (vector <= 127)) {
     356        int l, p;
     357        int voffset = vector - 64;
     358        rtems_interrupt_level level;
     359
     360        for (l = 1 ; l < 7 ; l++) {
     361            for (p = 0 ; p < 7 ; p++) {
     362                if (bsp_allocate_interrupt(l,p) == RTEMS_SUCCESSFUL) {
     363                    *(&MCF5282_INTC0_ICR1 + (vector - 65)) =
     364                                                       MCF5282_INTC_ICR_IL(l) |
     365                                                       MCF5282_INTC_ICR_IP(p);
     366                    rtems_interrupt_disable(level);
     367                    if (voffset >= 32)
     368                        MCF5282_INTC0_IMRH &= ~(1 << (voffset - 32));
     369                    else
     370                        MCF5282_INTC0_IMRL &= ~((1 << voffset) |
     371                                                MCF5282_INTC_IMRL_MASKALL);
     372                    rtems_interrupt_enable(level);
     373                    return 0;
     374                }
     375            }
     376        }
     377    }
     378    return -1;
     379}
     380
     381int
     382BSP_removeVME_isr(unsigned long vector, BSP_VME_ISR_t handler, void *usrArg)
     383{
     384    if (vector > 255)
     385        return -1;
     386    if ((handlerTab[vector].func != handler)
     387     || (handlerTab[vector].arg != usrArg))
     388        return -1;
     389    handlerTab[vector].func = (BSP_VME_ISR_t)NULL;
     390    return 0;
     391}
     392
     393int
     394BSP_vme2local_adrs(unsigned am, unsigned long vmeaddr, unsigned long *plocaladdr)
     395{
     396    unsigned long offset;
     397
     398    switch (am) {
     399    default:    return -1;
     400    case VME_AM_SUP_SHORT_IO: offset = 0x31000000; break; /* A16/D16 */
     401    case VME_AM_STD_SUP_DATA: offset = 0x30000000; break; /* A24/D16 */
     402    case VME_AM_EXT_SUP_DATA: return -1;                  /* A32/D32 */
     403    }
     404    *plocaladdr = vmeaddr + offset;
     405    return 0;
     406}
Note: See TracChangeset for help on using the changeset viewer.