Changeset e2d79559 in rtems


Ignore:
Timestamp:
Apr 9, 1997, 2:05:50 PM (23 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Branches:
4.10, 4.11, 4.8, 4.9, master
Children:
48d6de3
Parents:
bed475e
Message:

Added ka9q tcpip stack and network driver for the gen68360. This effort
was done based on the 3.6.0 release and had to be autoconf'ed locally.
It is turned on is the bsp enables it and it is not explicitly disabled
via the configure option --disable-tcpip. As many warnings as possible
were removed locally after the code was merged. Only the gen68360
and mvme136 bsps were compiled this way.

The ka9q port and network driver were submitted by Eric Norum
(eric@…).

The network demo programs are not included in the tree at this point.

Files:
3 added
39 edited

Legend:

Unmodified
Added
Removed
  • Makefile.in

    rbed475e re2d79559  
    4242PROJECT_ROOT = @PROJECT_ROOT@
    4343RTEMS_HAS_POSIX_API = @RTEMS_HAS_POSIX_API@
     44RTEMS_HAS_KA9Q = @RTEMS_HAS_KA9Q@
    4445RTEMS_USE_MACROS = @RTEMS_USE_MACROS@
    4546
     
    8485            \"PROJECT_ROOT=$(PROJECT_ROOT)\" \
    8586            \"RTEMS_HAS_POSIX_API=$(RTEMS_HAS_POSIX_API)\" \
     87            \"RTEMS_HAS_KA9Q=$(RTEMS_HAS_KA9Q)\" \
    8688            \"RTEMS_USE_MACROS=$(RTEMS_USE_MACROS)\" \
    8789            \"AWK=$(AWK)\" $@" ; \
  • c/ACKNOWLEDGEMENTS

    rbed475e re2d79559  
    9393  autoconf.  This effort is greatly appreciated.
    9494
     95+ Eric Norum (eric@skatter.usask.ca) of the Saskatchewan Accelerator
     96  Laboratory submitted the port of the ka9q tcp/ip stack to rtems
     97  and a network driver for the `gen68360' BSP.
     98
    9599Finally, the RTEMS project would like to thank those who have contributed
    96100to the other free software efforts which RTEMS utilizes.  The primary RTEMS
  • c/Makefile.in

    rbed475e re2d79559  
    2828SUB_DIRS=build-tools src
    2929
     30# We only make the ka9q install point if it is enabled.
     31LIBKA9Q_yes_V = include/ka9q
     32LIBKA9Q = $(LIBKA9Q_$(HAS_KA9Q)_V)
     33
    3034# directories to be created in install point
    3135CREATE_DIRS =   include include/sys \
    3236    include/rtems include/rtems/score include/rtems/rtems include/rtems/posix \
    33                 include/libc include/libc/sys \
     37                include/netinet include/libc include/libc/sys \
     38                $(LIBKA9Q) \
    3439                lib \
    3540                bin \
  • c/src/exec/libcsupport/include/rtems/libio.h

    rbed475e re2d79559  
    100100int __rtems_isatty(int _fd);
    101101
     102/*
     103 * External I/O handlers
     104 */
     105typedef struct {
     106    int (*open)(const char  *pathname, unsigned32 flag, unsigned32 mode);
     107    int (*close)(int  fd);
     108    int (*read)(int fd, void *buffer, unsigned32 count);
     109    int (*write)(int fd, const void *buffer, unsigned32 count);
     110    int (*ioctl)(int fd, unsigned32  command, void *buffer);
     111    int (*lseek)(int fd, rtems_libio_offset_t offset, int whence);
     112} rtems_libio_handler_t;
     113
     114void rtems_register_libio_handler(int handler_flag,
     115                                 const rtems_libio_handler_t *handler);
     116
     117#define RTEMS_FILE_DESCRIPTOR_TYPE_FILE         0x0000
     118#define RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET       0x1000
     119#define rtems_make_file_descriptor(fd,flags)    ((fd)|(flags))
     120#define rtems_file_descriptor_base(fd)          ((fd) & 0x0FFF)
     121#define rtems_file_descriptor_type(fd)          ((fd) & 0xF000)
     122#define rtems_file_descriptor_type_index(fd)    ((((fd) & 0xF000) >> 12) - 1)
     123
    102124#endif /* _RTEMS_LIBIO_H */
  • c/src/exec/libcsupport/src/libio.c

    rbed475e re2d79559  
    8080    } while (0)
    8181
     82/*
     83 * External I/O handlers
     84 *
     85 * Space for all possible handlers is preallocated
     86 * to speed up dispatch to external handlers.
     87 */
     88
     89static rtems_libio_handler_t handlers[15];
     90
     91void
     92rtems_register_libio_handler(
     93    int                         handler_flag,
     94    const rtems_libio_handler_t *handler
     95)
     96{
     97  int handler_index = rtems_file_descriptor_type_index(handler_flag);
     98
     99  if ((handler_index < 0) || (handler_index >= 15))
     100    rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER );
     101  handlers[handler_index] = *handler;
     102}
     103
    82104
    83105void
     
    85107    rtems_configuration_table *config,
    86108    unsigned32                 max_fds
    87   )
     109)
    88110{
    89111    rtems_libio_number_iops = max_fds;
     
    254276    rtems_libio_open_close_args_t args;
    255277
    256     if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) {
    257 /*
    258       if ( rc == RTEMS_UNSATISFIED ) {
    259         puts( "open -- ENOSYS case" );
    260         assert( 0 );
    261       }
    262 */
     278    /*
     279     * Additional external I/O handlers would be supported by
     280     * adding code to pick apart the pathname appropriately.
     281     * The networking code does not require changes here since
     282     * network file descriptors are obtained using socket(), not
     283     * open().
     284     */
     285
     286    if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL)
    263287        goto done;
    264     }
    265288
    266289    iop = rtems_libio_allocate();
     
    300323    rtems_status_code rc;
    301324    rtems_driver_name_t *np;
    302     rtems_libio_t *iop = rtems_libio_iop(fd);
     325    rtems_libio_t *iop;
    303326    rtems_libio_open_close_args_t args;
    304327
     328    if (rtems_file_descriptor_type(fd)) {
     329        int (*fp)(int fd);
     330
     331        fp = handlers[rtems_file_descriptor_type_index(fd)].close;
     332        if (fp == NULL) {
     333            errno = EBADF;
     334            return -1;
     335        }
     336        return (*fp)(fd);
     337    }
     338    iop = rtems_libio_iop(fd);
    305339    rtems_libio_check_fd(fd);
    306340
     
    327361    rtems_status_code rc;
    328362    rtems_driver_name_t *np;
    329     rtems_libio_t *iop = rtems_libio_iop(fd);
     363    rtems_libio_t *iop;
    330364    rtems_libio_rw_args_t args;
    331365
     366    if (rtems_file_descriptor_type(fd)) {
     367        int (*fp)(int fd, void *buffer, unsigned32 count);
     368
     369        fp = handlers[rtems_file_descriptor_type_index(fd)].read;
     370        if (fp == NULL) {
     371            errno = EBADF;
     372            return -1;
     373        }
     374        return (*fp)(fd, buffer, count);
     375    }
     376    iop = rtems_libio_iop(fd);
    332377    rtems_libio_check_fd(fd);
    333378    rtems_libio_check_buffer(buffer);
     
    363408    rtems_status_code rc;
    364409    rtems_driver_name_t *np;
    365     rtems_libio_t *iop = rtems_libio_iop(fd);
     410    rtems_libio_t *iop;
    366411    rtems_libio_rw_args_t args;
    367412
     413    if (rtems_file_descriptor_type(fd)) {
     414        int (*fp)(int fd, const void *buffer, unsigned32 count);
     415
     416        fp = handlers[rtems_file_descriptor_type_index(fd)].write;
     417        if (fp == NULL) {
     418            errno = EBADF;
     419            return -1;
     420        }
     421        return (*fp)(fd, buffer, count);
     422    }
     423    iop = rtems_libio_iop(fd);
    368424    rtems_libio_check_fd(fd);
    369425    rtems_libio_check_buffer(buffer);
     
    398454    rtems_status_code rc;
    399455    rtems_driver_name_t *np;
    400     rtems_libio_t *iop = rtems_libio_iop(fd);
     456    rtems_libio_t *iop;
    401457    rtems_libio_ioctl_args_t args;
    402458
     459    if (rtems_file_descriptor_type(fd)) {
     460        int (*fp)(int fd, unsigned32 command, void *buffer);
     461
     462        fp = handlers[rtems_file_descriptor_type_index(fd)].ioctl;
     463        if (fp == NULL) {
     464            errno = EBADF;
     465            return -1;
     466        }
     467        return (*fp)(fd, command, buffer);
     468    }
     469    iop = rtems_libio_iop(fd);
    403470    rtems_libio_check_fd(fd);
    404471
     
    429496  )   
    430497{
    431     rtems_libio_t *iop = rtems_libio_iop(fd);
    432 
     498    rtems_libio_t *iop;
     499
     500    if (rtems_file_descriptor_type(fd)) {
     501        int (*fp)(int fd, rtems_libio_offset_t offset, int whence);
     502
     503        fp = handlers[rtems_file_descriptor_type_index(fd)].lseek;
     504        if (fp == NULL) {
     505            errno = EBADF;
     506            return -1;
     507        }
     508        return (*fp)(fd, offset, whence);
     509    }
     510    iop = rtems_libio_iop(fd);
    433511    rtems_libio_check_fd(fd);
    434512
  • c/src/exec/score/cpu/a29k/cpu.h

    rbed475e re2d79559  
    296296
    297297#define CPU_STRUCTURE_ALIGNMENT
     298
     299/*
     300 *  Define what is required to specify how the network to host conversion
     301 *  routines are handled.
     302 *
     303 */
     304
     305#error "Check these definitions!!!"
     306
     307#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     308#define CPU_BIG_ENDIAN                           TRUE
     309#define CPU_LITTLE_ENDIAN                        FALSE
    298310
    299311/*
  • c/src/exec/score/cpu/hppa1.1/cpu.h

    rbed475e re2d79559  
    6464#define CPU_STACK_GROWS_UP               TRUE
    6565#define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((__aligned__ (32)))
     66
     67/*
     68 *  Define what is required to specify how the network to host conversion
     69 *  routines are handled.
     70 */
     71
     72#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     73#define CPU_BIG_ENDIAN                           TRUE
     74#define CPU_LITTLE_ENDIAN                        FALSE
    6675
    6776/* constants */
  • c/src/exec/score/cpu/i386/cpu.h

    rbed475e re2d79559  
    5858#define CPU_STACK_GROWS_UP               FALSE
    5959#define CPU_STRUCTURE_ALIGNMENT
     60
     61/*
     62 *  Define what is required to specify how the network to host conversion
     63 *  routines are handled.
     64 */
     65
     66#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     67#define CPU_BIG_ENDIAN                           FALSE
     68#define CPU_LITTLE_ENDIAN                        TRUE
    6069
    6170/* structures */
  • c/src/exec/score/cpu/i960/cpu.h

    rbed475e re2d79559  
    6161#define CPU_STACK_GROWS_UP               TRUE
    6262#define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((aligned (16)))
     63
     64/*
     65 *  Define what is required to specify how the network to host conversion
     66 *  routines are handled.
     67 */
     68
     69#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     70#define CPU_BIG_ENDIAN                           TRUE
     71#define CPU_LITTLE_ENDIAN                        FALSE
     72
    6373
    6474/* structures */
  • c/src/exec/score/cpu/m68k/cpu.h

    rbed475e re2d79559  
    7575#define CPU_STACK_GROWS_UP               FALSE
    7676#define CPU_STRUCTURE_ALIGNMENT
     77
     78/*
     79 *  Define what is required to specify how the network to host conversion
     80 *  routines are handled.
     81 */
     82
     83#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     84#define CPU_BIG_ENDIAN                           TRUE
     85#define CPU_LITTLE_ENDIAN                        FALSE
    7786
    7887#ifndef ASM
  • c/src/exec/score/cpu/mips64orion/cpu.h

    rbed475e re2d79559  
    290290#define CPU_STRUCTURE_ALIGNMENT
    291291#endif
     292
     293/*
     294 *  Define what is required to specify how the network to host conversion
     295 *  routines are handled.
     296 */
     297
     298#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     299#define CPU_BIG_ENDIAN                           TRUE
     300#define CPU_LITTLE_ENDIAN                        FALSE
    292301
    293302/*
  • c/src/exec/score/cpu/no_cpu/cpu.h

    rbed475e re2d79559  
    259259
    260260#define CPU_STRUCTURE_ALIGNMENT
     261
     262/*
     263 *  Define what is required to specify how the network to host conversion
     264 *  routines are handled.
     265 */
     266
     267#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     268#define CPU_BIG_ENDIAN                           TRUE
     269#define CPU_LITTLE_ENDIAN                        FALSE
    261270
    262271/*
  • c/src/exec/score/cpu/powerpc/cpu.h

    rbed475e re2d79559  
    285285 */
    286286
    287 #define CPU_STRUCTURE_ALIGNMENT    __attribute__ ((aligned (PPC_CACHE_ALIGNMENT)))
     287#define CPU_STRUCTURE_ALIGNMENT \
     288   __attribute__ ((aligned (PPC_CACHE_ALIGNMENT)))
     289
     290/*
     291 *  Define what is required to specify how the network to host conversion
     292 *  routines are handled.
     293 */
     294
     295#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     296#define CPU_BIG_ENDIAN                           TRUE
     297#define CPU_LITTLE_ENDIAN                        FALSE
    288298
    289299/*
  • c/src/exec/score/cpu/sparc/cpu.h

    rbed475e re2d79559  
    184184
    185185#define CPU_STRUCTURE_ALIGNMENT          __attribute__ ((aligned (16)))
     186
     187/*
     188 *  Define what is required to specify how the network to host conversion
     189 *  routines are handled.
     190 */
     191
     192#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     193#define CPU_BIG_ENDIAN                           TRUE
     194#define CPU_LITTLE_ENDIAN                        FALSE
    186195
    187196/*
  • c/src/exec/score/cpu/unix/cpu.h

    rbed475e re2d79559  
    283283#else
    284284#define CPU_STRUCTURE_ALIGNMENT
     285#endif
     286
     287/*
     288 *  Define what is required to specify how the network to host conversion
     289 *  routines are handled.
     290 */
     291
     292#if defined(hppa1_1) || defined(sparc)
     293#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     294#define CPU_BIG_ENDIAN                           TRUE
     295#define CPU_LITTLE_ENDIAN                        FALSE
     296#elif defined(i386) || defined(__i386__)
     297#define CPU_CPU_HAS_OWN_HOST_TO_NETWORK_ROUTINES FALSE
     298#define CPU_BIG_ENDIAN                           FALSE
     299#define CPU_LITTLE_ENDIAN                        TRUE
     300#else
     301#error "Unknown CPU!!!"
    285302#endif
    286303
  • c/src/exec/score/headers/Makefile.in

    rbed475e re2d79559  
    1111H_PIECES= address apiext bitfield chain context copyrt coremsg coremutex \
    1212    coresem heap interr isr mpci mppkt object objectmp \
    13     priority stack states sysstate system thread threadmp threadq \
     13    priority stack states sysstate thread threadmp threadq \
    1414    tod tqdata userext watchdog wkspace
    1515H_FILES=$(H_PIECES:%=$(srcdir)/%.h)
     
    2020
    2121# H_FILES that get installed at the top level
    22 # system.h is handled specially
    2322EXTERNAL_H_PIECES =
    2423EXTERNAL_H_FILES=$(EXTERNAL_H_PIECES:%=$(srcdir)/%.h)
     24
     25NET_H_PIECES = in
     26NET_H_FILES=$(NET_H_PIECES:%=$(srcdir)/%.h)
    2527
    2628SRCS=$(H_FILES) $(SAPI_H_FILES) $(EXTERNAL_H_FILES)
     
    4244        $(INSTALL) -m 444 ${H_FILES} ${PROJECT_RELEASE}/include/rtems/score
    4345        $(INSTALL) -m 444 ${SAPI_H_FILES} ${PROJECT_RELEASE}/include/rtems/
     46        $(INSTALL) -m 444 ${NET_H_FILES} ${PROJECT_RELEASE}/include/netinet
    4447#       $(INSTALL) -m 444 ${EXTERNAL_H_FILES} ${PROJECT_RELEASE}/include
  • c/src/exec/score/include/rtems/score/Makefile.in

    rbed475e re2d79559  
    1111H_PIECES= address apiext bitfield chain context copyrt coremsg coremutex \
    1212    coresem heap interr isr mpci mppkt object objectmp \
    13     priority stack states sysstate system thread threadmp threadq \
     13    priority stack states sysstate thread threadmp threadq \
    1414    tod tqdata userext watchdog wkspace
    1515H_FILES=$(H_PIECES:%=$(srcdir)/%.h)
     
    2020
    2121# H_FILES that get installed at the top level
    22 # system.h is handled specially
    2322EXTERNAL_H_PIECES =
    2423EXTERNAL_H_FILES=$(EXTERNAL_H_PIECES:%=$(srcdir)/%.h)
     24
     25NET_H_PIECES = in
     26NET_H_FILES=$(NET_H_PIECES:%=$(srcdir)/%.h)
    2527
    2628SRCS=$(H_FILES) $(SAPI_H_FILES) $(EXTERNAL_H_FILES)
     
    4244        $(INSTALL) -m 444 ${H_FILES} ${PROJECT_RELEASE}/include/rtems/score
    4345        $(INSTALL) -m 444 ${SAPI_H_FILES} ${PROJECT_RELEASE}/include/rtems/
     46        $(INSTALL) -m 444 ${NET_H_FILES} ${PROJECT_RELEASE}/include/netinet
    4447#       $(INSTALL) -m 444 ${EXTERNAL_H_FILES} ${PROJECT_RELEASE}/include
  • c/src/lib/Makefile.in

    rbed475e re2d79559  
    1111include $(PROJECT_ROOT)/make/directory.cfg
    1212
    13 SUB_DIRS=start include libmisc libc libcpu libbsp wrapup
     13# We only build the ka9q library if HAS_KA9Q was defined
     14LIBKA9Q_yes_V = libka9q
     15LIBKA9Q = $(LIBKA9Q_$(HAS_KA9Q)_V)
     16
     17SUB_DIRS=start include libmisc libc libcpu libbsp $(LIBKA9Q) wrapup
  • c/src/lib/include/Makefile.in

    rbed475e re2d79559  
    88VPATH=@srcdir@
    99
    10 H_FILES=console.h clockdrv.h iosupp.h ringbuf.h \
    11    spurious.h timerdrv.h vmeintr.h z8036.h z8530.h z8536.h
     10H_PIECES=console clockdrv iosupp ringbuf \
     11   spurious timerdrv vmeintr z8036 z8530 z8536
     12H_FILES=$(H_PIECES:%=$(srcdir)/%.h)
    1213
    13 HH_FILES=$(H_FILES:%=$(srcdir)/%)
     14KA9Q_H_PIECES= arp asy ax25 ax25mail bootp cmdparse commands config \
     15  daemon dialer domain enet ftp ftpcli global hardware icmp iface \
     16  internet ip kiss lapb lzw mailbox mbuf netuser nospc nr4 nr4mail \
     17  nrs ping pktdrvr ppp proc rip rtems_ka9q sb session slhc slip smtp \
     18  sockaddr socket tcp telnet tftp timer tipmail trace udp usock
     19KA9Q_H_FILES=$(KA9Q_H_PIECES:%=$(srcdir)/ka9q/%.h)
    1420
    1521SYS_H_FILES=
    1622
    17 SRCS=$(HH_FILES) $(SYS_H_FILES)
     23SRCS=$(H_FILES) $(SYS_H_FILES)
    1824
    1925include $(RTEMS_CUSTOM)
     
    2430
    2531all:    $(SRCS)
    26         $(INSTALL) -m 444 $(HH_FILES) ${PROJECT_RELEASE}/include
     32        $(INSTALL) -m 444 $(H_FILES) ${PROJECT_RELEASE}/include
    2733        $(INSTALL) -m 444 $(SYS_H_FILES) ${PROJECT_RELEASE}/include/sys
    28 
     34ifeq ($(HAS_KA9Q),yes)
     35        $(INSTALL) -m 444 $(KA9Q_H_FILES) ${PROJECT_RELEASE}/include/ka9q
     36endif
  • c/src/lib/include/rtems/libio.h

    rbed475e re2d79559  
    100100int __rtems_isatty(int _fd);
    101101
     102/*
     103 * External I/O handlers
     104 */
     105typedef struct {
     106    int (*open)(const char  *pathname, unsigned32 flag, unsigned32 mode);
     107    int (*close)(int  fd);
     108    int (*read)(int fd, void *buffer, unsigned32 count);
     109    int (*write)(int fd, const void *buffer, unsigned32 count);
     110    int (*ioctl)(int fd, unsigned32  command, void *buffer);
     111    int (*lseek)(int fd, rtems_libio_offset_t offset, int whence);
     112} rtems_libio_handler_t;
     113
     114void rtems_register_libio_handler(int handler_flag,
     115                                 const rtems_libio_handler_t *handler);
     116
     117#define RTEMS_FILE_DESCRIPTOR_TYPE_FILE         0x0000
     118#define RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET       0x1000
     119#define rtems_make_file_descriptor(fd,flags)    ((fd)|(flags))
     120#define rtems_file_descriptor_base(fd)          ((fd) & 0x0FFF)
     121#define rtems_file_descriptor_type(fd)          ((fd) & 0xF000)
     122#define rtems_file_descriptor_type_index(fd)    ((((fd) & 0xF000) >> 12) - 1)
     123
    102124#endif /* _RTEMS_LIBIO_H */
  • c/src/lib/libbsp/m68k/gen68360/Makefile.in

    rbed475e re2d79559  
    1313SRCS=README
    1414
     15# We only build the ka9q device driver if HAS_KA9Q was defined
     16LIBKA9Q_yes_V = network
     17LIBKA9Q = $(LIBKA9Q_$(HAS_KA9Q)_V)
     18
    1519all: $(SRCS)
    1620
    1721# wrapup is the one that actually builds and installs the library
    1822#  from the individual .rel files built in other directories
    19 SUB_DIRS=include start360 startup clock console timer wrapup
     23SUB_DIRS=include start360 startup clock console timer $(LIBKA9Q) wrapup
  • c/src/lib/libbsp/m68k/gen68360/README

    rbed475e re2d79559  
    44
    55#
    6 # This package requires a version of GCC that has been modified
     6# This package works best with a version of GCC that has been modified
    77# to support the `-mcpu32' argument.  I have submitted the required
    88# changes to the GCC maintainers.
     
    2020#
    2121
     22#
     23# This board support package works with several different versions of
     24# MC68360 systems.  The choice of hardware is made at the final link-edit
     25# phase by setting the Makefile LDFLAGS definition appropriately.
     26#
     27# Decisions to be made a link-edit time include:
     28#       - The version of hardware on which the application is to run.
     29#         This is selected by defining the MC68360HardwareType variable.
     30#         Supported values are:
     31#                       MC68360HardwareTypeMotorolaGeneric (default)
     32#                       MC68360HardwareTypeAtlasHSB
     33#         To select the Atlas Computer Equipment HSB,
     34#               --defsym MC68360HardwareType=MC68360HardwareTypeAtlasHSB
     35#
     36#       - The amount of dynamic RAM in the system.  This value applies
     37#         only to hardware versions which support different sizes of RAM.
     38#         The default value is 4 Mbytes.  To specify 16 Mbytes of memory,
     39#               --defsym RamSize=0x1000000
     40#
     41#       - The size of the memory allocator heap.  The default value is
     42#         64 kbytes.  If the KA9Q network package is used the heap
     43#         should be at least 256 kbytes.  If your network is large, or
     44#         busy, the heap should be even larger.
     45#         To choose a heap size of 256 kbytes,
     46#               --defsym HeapSize=0x40000
     47#         
     48
    2249BSP NAME:           gen68360
    23 BOARD:              home-built
     50BOARD:              Generic 68360 as described in Motorola MC68360 User's Manual
     51BOARD:              Atlas Computer Equipment Inc. High Speed Bridge (HSB)
     52BOARD:              Atlas Computer Equipment Inc. Advanced Communication Engine (ACE)
    2453BUS:                none
    2554CPU FAMILY:         Motorola CPU32+
     
    6493bus width:      8-bit PROM, 32-bit DRAM
    6594ROM:            To 1 MByte, 180 nsec (3 wait states), chip select 0
    66 RAM:            4 MByte DRAM SIMM, 60 nsec (0 wait states), parity
     95RAM:            1 to 64 MByte DRAM SIMM, 60 nsec (0 wait states), parity or nonparity
    6796
    6897Host System
     
    253282This board support package is written for a 68360 system similar to that
    254283described in chapter 9 of the Motorola MC68360 Quad Integrated Communication
    255 Processor Users' Manual.  The salient details of this hardware are:
     284Processor Users' Manual.  The salient features of this hardware are:
    256285
    257286        25 MHz external clock
     
    260289        4 MBytes of 60 nsec parity DRAM (1Mx36) to RAS1*/CAS1*
    261290        Console serial port on SMC1
     291        Ethernet interface on SCC1
    262292
    263293The board support package has been tested with a home-built board and with an
  • c/src/lib/libbsp/m68k/gen68360/console/console.c

    rbed475e re2d79559  
    4343
    4444/*
    45  * Place buffer descriptors at end of User Data/BD space in dual-port RAM
    46  */
    47 #define consoleRxBd ((volatile m360BufferDescriptor_t *)((char *)m360.dpram1 + \
    48                 (sizeof(m360.dpram2) - 2*sizeof(m360BufferDescriptor_t))))
    49 #define consoleTxBd ((volatile m360BufferDescriptor_t *)((char *)m360.dpram1 + \
    50                 (sizeof(m360.dpram2) - sizeof(m360BufferDescriptor_t))))
    51 
    52 /*
    5345 * I/O buffers can be in ordindary RAM
    5446 */
    5547static volatile char rxBuf, txBuf;
     48static volatile m360BufferDescriptor_t *consoleRxBd, *consoleTxBd;
    5649
    5750rtems_device_driver console_initialize(
     
    6255{
    6356        rtems_status_code status;
     57
     58        /*
     59         * Allocate buffer descriptors
     60         */
     61        consoleRxBd = M360AllocateBufferDescriptors (1);
     62        consoleTxBd = M360AllocateBufferDescriptors (1);
    6463
    6564        /*
     
    122121         * Send "Init parameters" command
    123122         */
    124         m360.cr = M360_CR_OP_INIT_RX_TX | M360_CR_CHAN_SMC1 | M360_CR_FLG;
    125         while (m360.cr & M360_CR_FLG)
    126                 continue;
     123        M360ExecuteRISC (M360_CR_OP_INIT_RX_TX | M360_CR_CHAN_SMC1);
    127124
    128125        /*
  • c/src/lib/libbsp/m68k/gen68360/include/bsp.h

    rbed475e re2d79559  
    120120
    121121void M360ExecuteRISC( rtems_unsigned16 command );
     122void *M360AllocateBufferDescriptors( int count );
     123void *M360AllocateRiscTimers( int count );
    122124
    123125m68k_isr_entry set_vector(
     
    127129);
    128130
     131/*
     132 * Values assigned by link editor
     133 */
     134extern void *_RomBase, *_RamBase, *_RamSize;
     135extern void *_MC68360HardwareType;
     136extern void *_MC68360HardwareTypeMotorolaGeneric;
     137extern void *_MC68360HardwareTypeAtlasHSB;
     138
     139/*
     140 * Definitions for Atlas Computer Equipment Inc. High Speed Bridge (HSB)
     141 */
     142#define ATLASHSB_ESR    0x20010000L
     143#define ATLASHSB_USICR  0x20010001L
     144#define ATLASHSB_DSRR   0x20010002L
     145#define ATLASHSB_LED4   0x20010004L
     146#define ATLASHSB_ROM_U6 0xFF080000L     /* U6 flash ROM socket */
     147
    129148#ifdef __cplusplus
    130149}
  • c/src/lib/libbsp/m68k/gen68360/start/start360.s

    rbed475e re2d79559  
    5757        .long   uhoh                    |  22:
    5858        .long   uhoh                    |  23:
    59         .long   uhoh                    |  24: Spurious interrupt
     59        .long   spurious_interrupt      |  24: Spurious interrupt
    6060        .long   uhoh                    |  25: Level 1 interrupt autovector
    6161        .long   uhoh                    |  26: Level 2 interrupt autovector
     
    299299
    300300/*
     301 * Log, but otherwise ignore, spurious interrupts
     302 */
     303spurious_interrupt:
     304        addql   #1,SYM(_M68kSpuriousInterruptCount)
     305        rte
     306
     307/*
    301308 * Place the low-order 3 octets of the board's ethernet address at
    302309 * a `well-known' fixed location relative to the beginning of ROM.
     
    308315 * Initial PC
    309316 */
    310         .global start
     317         .global start
    311318start: 
    312319        /*
     
    387394                                        | Should this just force a reset?
    388395mainDone:       nop                     | Leave spot for breakpoint
     396        movew   #1,a7                   | Force a double bus error
     397        movel   d0,a7@-                 | This should cause a RESET
    389398        stop    #0x2700                 | Stop with interrupts disabled
    390399        bra.s   mainDone                | Stuck forever
     
    399408END_CODE
    400409
    401 BEGIN_BSS
     410BEGIN_DATA_DCL
    402411        .align 2
    403412        PUBLIC (environ)
    404413SYM (environ):
    405414        .long   0
     415        PUBLIC (_M68kSpuriousInterruptCount)
     416SYM (_M68kSpuriousInterruptCount):
     417        .long   0
     418END_DATA_DCL
     419
    406420END
  • c/src/lib/libbsp/m68k/gen68360/start360/start360.s

    rbed475e re2d79559  
    5757        .long   uhoh                    |  22:
    5858        .long   uhoh                    |  23:
    59         .long   uhoh                    |  24: Spurious interrupt
     59        .long   spurious_interrupt      |  24: Spurious interrupt
    6060        .long   uhoh                    |  25: Level 1 interrupt autovector
    6161        .long   uhoh                    |  26: Level 2 interrupt autovector
     
    299299
    300300/*
     301 * Log, but otherwise ignore, spurious interrupts
     302 */
     303spurious_interrupt:
     304        addql   #1,SYM(_M68kSpuriousInterruptCount)
     305        rte
     306
     307/*
    301308 * Place the low-order 3 octets of the board's ethernet address at
    302309 * a `well-known' fixed location relative to the beginning of ROM.
     
    308315 * Initial PC
    309316 */
    310         .global start
     317         .global start
    311318start: 
    312319        /*
     
    387394                                        | Should this just force a reset?
    388395mainDone:       nop                     | Leave spot for breakpoint
     396        movew   #1,a7                   | Force a double bus error
     397        movel   d0,a7@-                 | This should cause a RESET
    389398        stop    #0x2700                 | Stop with interrupts disabled
    390399        bra.s   mainDone                | Stuck forever
     
    399408END_CODE
    400409
    401 BEGIN_BSS
     410BEGIN_DATA_DCL
    402411        .align 2
    403412        PUBLIC (environ)
    404413SYM (environ):
    405414        .long   0
     415        PUBLIC (_M68kSpuriousInterruptCount)
     416SYM (_M68kSpuriousInterruptCount):
     417        .long   0
     418END_DATA_DCL
     419
    406420END
  • c/src/lib/libbsp/m68k/gen68360/startup/Makefile.in

    rbed475e re2d79559  
    1111
    1212# C source names, if any, go here -- minus the .c
    13 C_PIECES=bspstart bspclean init68360 sbrk setvec
     13C_PIECES=alloc360 bspstart bspclean init68360 sbrk setvec
    1414C_FILES=$(C_PIECES:%=%.c)
    1515C_O_FILES=$(C_PIECES:%=${ARCH}/%.o)
     
    1717H_FILES=
    1818
    19 SRCS=$(srcdir)/linkcmds $(srcdir)/linkcmds.prom $(C_FILES) $(H_FILES)
     19SRCS=$(srcdir)/linkcmds $(srcdir)/linkcmds.prom $(srcdir)/linkcmds.bootp \
     20     $(C_FILES) $(H_FILES)
    2021OBJS=$(C_O_FILES) $(CC_O_FILES)
    2122
  • c/src/lib/libbsp/m68k/gen68360/startup/init68360.c

    rbed475e re2d79559  
    3737{
    3838        int i;
    39         extern void *_RomBase, *_RamBase;
     39        unsigned long l;
    4040        m68k_isr_entry *vbr;
    4141        extern void _CopyDataClearBSSAndStart (void);
     
    5959         */
    6060        m360.clkocr = 0x8F;     /* No more writes, no clock outputs */
    61         m360.pllcr = 0xD000;    /* PLL, no writes, no prescale,  */
    62                                         /* no LPSTOP slowdown, PLL X1 */
     61        m360.pllcr = 0xD000;    /* PLL, no writes, no prescale,
     62                                  no LPSTOP slowdown, PLL X1 */
    6363        m360.cdvcr = 0x8000;    /* No more writes, no clock division */
    6464
     
    6767         *      Disable watchdog FIXME: Should use watchdog!!!!
    6868         *      Watchdog causes system reset
    69          *      Fastest watchdog timeout
     69         *      Slowest watchdog timeout
    7070         *      Enable double bus fault monitor
    7171         *      Enable bus monitor external
    7272         *      128 clocks for external timeout
    7373         */
    74         m360.sypcr = 0x4F;
     74        m360.sypcr = 0x7F;
    7575
    7676        /*
     
    9090         *      CF1MODE=00 (CONFIG1 input)
    9191         *      RAS1* double drive
    92          *      A31-A28
     92         *      WE0* - WE3*
    9393         *      OE* output
    94          *      CAS2* / CAS3*
    95          *      CAS0* / CAS1*
     94         *      CAS2* - CAS3*
     95         *      CAS0* - CAS1*
    9696         *      CS7*
    9797         *      AVEC*
     
    100100         *      (static RAM, external address multiplexing, etc).
    101101         */
    102         m360.pepar = 0x0100;
     102        m360.pepar = 0x0180;
    103103
    104104        /*
    105105         * Step 11: Remap Chip Select 0 (CS0*), set up GMR
    106          *      1024 addresses per DRAM page (1M DRAM chips)
    107          *      60 nsec DRAM
    108          *      180 nsec ROM (3 wait states)
    109          * HARDWARE:
    110          *      Change if you are using a different memory configuration
    111          */
    112         m360.gmr = M360_GMR_RCNT(24) | M360_GMR_RFEN | M360_GMR_RCYC(0) |
    113                         M360_GMR_PGS(3) | M360_GMR_DPS_32BIT | M360_GMR_NCS |
    114                         M360_GMR_GAMX;
    115         m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
    116                                                         M360_MEMC_BR_V;
    117         m360.memc[0].or = M360_MEMC_OR_WAITS(3) | M360_MEMC_OR_512KB |
     106         */
     107        if (&_MC68360HardwareType == &_MC68360HardwareTypeAtlasHSB) {
     108                m360.gmr = M360_GMR_RCNT(12) | M360_GMR_RFEN |
     109                                M360_GMR_RCYC(0) | M360_GMR_PGS(1) |
     110                                M360_GMR_DPS_32BIT | M360_GMR_DWQ |
     111                                M360_GMR_GAMX;
     112                m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
     113                                                                M360_MEMC_BR_V;
     114                m360.memc[0].or = M360_MEMC_OR_WAITS(3) | M360_MEMC_OR_1MB |
    118115                                                        M360_MEMC_OR_8BIT;
     116        }
     117        else {
     118                /*
     119                 * 1024/2048/4096 addresses per DRAM page (1M/4M/16M DRAM chips)
     120                 * 60 nsec DRAM
     121                 * 180 nsec ROM (3 wait states)
     122                 */
     123                switch ((unsigned long)&_RamSize) {
     124                default:
     125                case 4*1024*1024:
     126                        m360.gmr = M360_GMR_RCNT(24) | M360_GMR_RFEN |
     127                                        M360_GMR_RCYC(0) | M360_GMR_PGS(3) |
     128                                        M360_GMR_DPS_32BIT | M360_GMR_NCS |
     129                                        M360_GMR_GAMX;
     130                        break;
     131
     132                case 16*1024*1024:
     133                        m360.gmr = M360_GMR_RCNT(24) | M360_GMR_RFEN |
     134                                        M360_GMR_RCYC(0) | M360_GMR_PGS(5) |
     135                                        M360_GMR_DPS_32BIT | M360_GMR_NCS |
     136                                        M360_GMR_GAMX;
     137                        break;
     138
     139                case 64*1024*1024:
     140                        m360.gmr = M360_GMR_RCNT(24) | M360_GMR_RFEN |
     141                                        M360_GMR_RCYC(0) | M360_GMR_PGS(7) |
     142                                        M360_GMR_DPS_32BIT | M360_GMR_NCS |
     143                                        M360_GMR_GAMX;
     144                        break;
     145                }
     146                m360.memc[0].br = (unsigned long)&_RomBase | M360_MEMC_BR_WP |
     147                                                                M360_MEMC_BR_V;
     148                m360.memc[0].or = M360_MEMC_OR_WAITS(3) | M360_MEMC_OR_1MB |
     149                                                        M360_MEMC_OR_8BIT;
     150        }
    119151
    120152        /*
    121153         * Step 12: Initialize the system RAM
    122          *      Set up option/base registers
    123          *              4 MB DRAM
    124          *              60 nsec DRAM
    125          *      Wait for chips to power up
    126          *      Perform 8 read cycles
    127          *      Set all parity bits to correct state
    128          *      Enable parity checking
    129          * HARDWARE:
    130          *      Change if you are using a different memory configuration
    131          */
    132         m360.memc[1].or = M360_MEMC_OR_TCYC(0) | M360_MEMC_OR_4MB |
    133                                 M360_MEMC_OR_DRAM;
    134         m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V;
    135         for (i = 0; i < 50000; i++)
    136                 continue;
    137         for (i = 0; i < 8; ++i)
    138                 *((volatile unsigned long *)(unsigned long)&_RamBase);
    139         for (i = 0 ; i < 4*1024*1024 ; i += sizeof (unsigned long)) {
    140                 volatile unsigned long *lp;
    141                 lp = (unsigned long *)((unsigned char *)&_RamBase + i);
    142                 *lp = *lp;
    143         }
    144         m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_PAREN |
     154         */
     155        if (&_MC68360HardwareType == &_MC68360HardwareTypeAtlasHSB) {
     156                /* first bank 1MByte DRAM */
     157                m360.memc[1].or = M360_MEMC_OR_TCYC(2) | M360_MEMC_OR_1MB |
     158                                        M360_MEMC_OR_PGME | M360_MEMC_OR_DRAM;
     159                m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V;
     160
     161                /* second bank 1MByte DRAM */
     162                m360.memc[2].or = M360_MEMC_OR_TCYC(2) | M360_MEMC_OR_1MB |
     163                                        M360_MEMC_OR_PGME | M360_MEMC_OR_DRAM;
     164                m360.memc[2].br = ((unsigned long)&_RamBase + 0x100000) |
     165                                        M360_MEMC_BR_V;
     166
     167                /* flash rom socket U6 on CS5 */
     168                m360.memc[5].br = (unsigned long)ATLASHSB_ROM_U6 | M360_MEMC_BR_WP |
    145169                                                                M360_MEMC_BR_V;
     170                m360.memc[5].or = M360_MEMC_OR_WAITS(2) | M360_MEMC_OR_512KB |
     171                                                                M360_MEMC_OR_8BIT;
     172
     173                /* CSRs on CS7 */
     174                m360.memc[7].or = M360_MEMC_OR_TCYC(4) | M360_MEMC_OR_64KB |
     175                                        M360_MEMC_OR_8BIT;
     176                m360.memc[7].br = ATLASHSB_ESR | 0x01;
     177                for (i = 0; i < 50000; i++)
     178                        continue;
     179                for (i = 0; i < 8; ++i)
     180                        *((volatile unsigned long *)(unsigned long)&_RamBase);
     181        }
     182        else {
     183                /*
     184                 *      Set up option/base registers
     185                 *              4M/16M/64M DRAM
     186                 *              60 nsec DRAM
     187                 *      Wait for chips to power up
     188                 *      Perform 8 read cycles
     189                 *      Set all parity bits to correct state
     190                 *      Enable parity checking
     191                 */
     192                switch ((unsigned long)&_RamSize) {
     193                default:
     194                case 4*1024*1024:
     195                        m360.memc[1].or = M360_MEMC_OR_TCYC(0) |
     196                                                M360_MEMC_OR_4MB |
     197                                                M360_MEMC_OR_DRAM;
     198                        break;
     199
     200                case 16*1024*1024:
     201                        m360.memc[1].or = M360_MEMC_OR_TCYC(0) |
     202                                                M360_MEMC_OR_16MB |
     203                                                M360_MEMC_OR_DRAM;
     204                        break;
     205
     206                case 64*1024*1024:
     207                        m360.memc[1].or = M360_MEMC_OR_TCYC(0) |
     208                                                M360_MEMC_OR_64MB |
     209                                                M360_MEMC_OR_DRAM;
     210                        break;
     211                }
     212                m360.memc[1].br = (unsigned long)&_RamBase | M360_MEMC_BR_V;
     213                for (i = 0; i < 50000; i++)
     214                        continue;
     215                for (i = 0; i < 8; ++i)
     216                        *((volatile unsigned long *)(unsigned long)&_RamBase);
     217                for (l = 0 ; l < (unsigned long)&_RamSize ; l += sizeof (unsigned long)) {
     218                        volatile unsigned long *lp;
     219                        lp = (unsigned long *)((unsigned char *)&_RamBase + i);
     220                        *lp = *lp;
     221                }
     222                m360.memc[1].br = (unsigned long)&_RamBase |
     223                                        M360_MEMC_BR_PAREN | M360_MEMC_BR_V;
     224        }
    146225
    147226        /*
     
    156235         * Step 14: More system initialization
    157236         * SDCR (Serial DMA configuration register)
     237         *      Disable SDMA during FREEZE
    158238         *      Give SDMA priority over all interrupt handlers
    159239         *      Set DMA arbiration level to 4
     
    168248         *      SCCs priority grouped at top of table
    169249         */
    170         m360.sdcr = M360_SDMA_SISM_7 | M360_SDMA_SAID_4;
     250        m360.sdcr = M360_SDMA_FREEZE | M360_SDMA_SISM_7 | M360_SDMA_SAID_4;
    171251        m360.cicr = (3 << 22) | (2 << 20) | (1 << 18) | (0 << 16) |
    172252                                                (4 << 13) | (0x1F << 8) | (128);
     
    179259         *      No show cycles
    180260         *      User/supervisor access
    181          *      Bus clear interupt service level 7
     261         *      Bus clear interrupt service level 7
    182262         *      SIM60 interrupt sources higher priority than CPM
    183263         */
  • c/src/lib/libbsp/m68k/gen68360/startup/linkcmds

    rbed475e re2d79559  
    11/*
    2  *  This file contains GNU linker directives for a generic MC68360 board.
     2 * This file contains GNU linker directives for a generic MC68360 board.
     3 * Variations in hardware type and dynamic memory size can be made
     4 * by overriding some values with linker command-line arguments.
    35 *
    46 * Saskatchewan Accelerator Laboratory
     
    1113
    1214/*
    13  * Declare on-board memory
     15 * Declare some sizes.
     16 * XXX: The assignment of ". += XyzSize;" fails in older gld's if the
     17 *      number used there is not constant.  If this happens to you, edit
     18 *      the lines marked XXX below to use a constant value.
     19 */
     20RamSize = DEFINED(RamSize) ? RamSize : 4M;
     21HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
     22StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
     23
     24/*
     25 * Declare hardware type
     26 */
     27MC68360HardwareTypeMotorolaGeneric = 0;
     28MC68360HardwareTypeAtlasHSB = 1;
     29MC68360HardwareType = DEFINED(MC68360HardwareType) ? MC68360HardwareType : 0;
     30
     31/*
     32 * Declare on-board memory.
     33 * It would be nice if the ram length could be given as
     34 * LENGTH=RamSize, but gld doesn't allow non-constant
     35 * values in the LENGTH expression. 
    1436 */
    1537MEMORY {
    16           ram : ORIGIN = 0x00000000, LENGTH = 4M
     38          ram : ORIGIN = 0x00000000, LENGTH = 64M
    1739          rom : ORIGIN = 0xFF000000, LENGTH = 1M
    1840        dpram : ORIGIN = 0xFE000000, LENGTH = 8k
     
    2042
    2143/*
    22  * Declare some sizes
    23  * XXX: The assignment of ". += XyzSize;" fails in older gld's if the
    24  *      number used there is not constant.  If this happens to you, edit
    25  *      the lines marked below to use a constant value.
     44 * Declare low-order three octets of Ethernet address.
    2645 */
    27 HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
    28 StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
     46ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
    2947
    3048/*
    31  * Declare low-order three octets of Ethernet address
     49 * Declare hardware type.
     50 * Acceptable values are:
     51 *      0 - Generic system as described in the MC68360 User's Manual
     52 *          (MC68360UM/AD Rev. 1).
     53 *      1 - ATLAS Computer Equipment Incorporated ACE360/HSB.
    3254 */
    33 ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
     55MC68360HardwareType = DEFINED(MC68360HardwareType) ? MC68360HardwareType : 0;
    3456
    3557/*
     
    3759 */
    3860SECTIONS {
     61        /*
     62         * Hardware variations
     63         */
     64        _RamSize = RamSize;
     65        __RamSize = RamSize;
     66        _MC68360HardwareType = MC68360HardwareType;
     67        __MC68360HardwareType = MC68360HardwareType;
     68        _MC68360HardwareTypeMotorolaGeneric = MC68360HardwareTypeMotorolaGeneric;
     69        __MC68360HardwareTypeMotorolaGeneric = MC68360HardwareTypeMotorolaGeneric;
     70        _MC68360HardwareTypeAtlasHSB = MC68360HardwareTypeAtlasHSB;
     71        __MC68360HardwareTypeAtlasHSB = MC68360HardwareTypeAtlasHSB;
     72
    3973        /*
    4074         * Boot PROM
  • c/src/lib/libbsp/m68k/gen68360/startup/linkcmds.prom

    rbed475e re2d79559  
    11/*
    22 * This file contains GNU linker directives for a generic MC68360 board.
    3  * These linker directives are for producing a PROM version..
    4  * To create the PROM image from the linkter output you must use objcopy
     3 * Variations in hardware type and dynamic memory size can be made
     4 * by overriding some values with linker command-line arguments.
     5 *
     6 * These linker directives are for producing a BOOTP PROM.
     7 * To create the PROM image from the linker output you must use objcopy
    58 * (--adjust-section-vma) to place the data segment at the end of the text
    69 * segment in the PROM.  The start-up code takes care of copying this region
     
    2124
    2225/*
    23  * Declare on-board memory
     26 * Declare some sizes.
     27 * XXX: The assignment of ". += XyzSize;" fails in older gld's if the
     28 *      number used there is not constant.  If this happens to you, edit
     29 *      the lines marked XXX below to use a constant value.
     30 */
     31RamSize = DEFINED(RamSize) ? RamSize : 4M;
     32HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
     33StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
     34
     35/*
     36 * Declare hardware type
     37 */
     38MC68360HardwareTypeMotorolaGeneric = 0;
     39MC68360HardwareTypeAtlasHSB = 1;
     40MC68360HardwareType = DEFINED(MC68360HardwareType) ? MC68360HardwareType : 0;
     41
     42/*
     43 * Declare on-board memory.
     44 * It would be nice if the ram length could be given as
     45 * LENGTH=RamSize, but gld doesn't allow non-constant
     46 * values in the LENGTH expression. 
    2447 */
    2548MEMORY {
    26           ram : ORIGIN = 0x00000000, LENGTH = 4M
     49          ram : ORIGIN = 0x00000000, LENGTH = 64M
    2750          rom : ORIGIN = 0xFF000000, LENGTH = 1M
    2851        dpram : ORIGIN = 0xFE000000, LENGTH = 8k
     
    3053
    3154/*
    32  * Declare some sizes
     55 * Declare low-order three octets of Ethernet address.
    3356 */
    34 HeapSize = DEFINED(HeapSize) ? HeapSize : 0x10000;
    35 StackSize = DEFINED(StackSize) ? StackSize : 0x1000;
     57ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
    3658
    3759/*
    38  * Declare low-order three octets of Ethernet address
     60 * Declare hardware type.
     61 * Acceptable values are:
     62 *      0 - Generic system as described in the MC68360 User's Manual
     63 *          (MC68360UM/AD Rev. 1).
     64 *      1 - ATLAS Computer Equipment Incorporated ACE360/HSB.
    3965 */
    40 ETHERNET_ADDRESS = DEFINED(ETHERNET_ADDRESS) ? ETHERNET_ADDRESS : 0xDEAD12;
     66MC68360HardwareType = DEFINED(MC68360HardwareType) ? MC68360HardwareType : 0;
    4167
    4268/*
     
    4470 */
    4571SECTIONS {
     72        /*
     73         * Hardware variations
     74         */
     75        _RamSize = RamSize;
     76        __RamSize = RamSize;
     77        _MC68360HardwareType = MC68360HardwareType;
     78        __MC68360HardwareType = MC68360HardwareType;
     79        _MC68360HardwareTypeMotorolaGeneric = MC68360HardwareTypeMotorolaGeneric;
     80        __MC68360HardwareTypeMotorolaGeneric = MC68360HardwareTypeMotorolaGeneric;
     81        _MC68360HardwareTypeAtlasHSB = MC68360HardwareTypeAtlasHSB;
     82        __MC68360HardwareTypeAtlasHSB = MC68360HardwareTypeAtlasHSB;
     83
    4684        /*
    4785         * Boot PROM
     
    89127                _HeapStart = .;
    90128                __HeapStart = .;
    91                 . += HeapSize;
    92                 . += StackSize;
     129                . += HeapSize;  /* XXX -- Old gld can't handle this */
     130                . += StackSize; /* XXX -- Old gld can't handle this */
     131                /* . += 0x10000; */ /* HeapSize for old gld */
     132                /* . += 0x1000;  */ /* StackSize for old gld */
    93133                . = ALIGN (16);
    94134                stack_init = .;
     
    108148
    109149        } >dpram
    110 
    111150}
  • c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile.in

    rbed475e re2d79559  
    88VPATH=@srcdir@
    99
    10 BSP_PIECES=startup clock console timer
     10# We only build the ka9q device driver if HAS_KA9Q was defined
     11LIBKA9Q_yes_V = network
     12LIBKA9Q = $(LIBKA9Q_$(HAS_KA9Q)_V)
     13
     14BSP_PIECES=startup clock console $(LIBKA9Q) timer
     15CPU_PIECES=
    1116GENERIC_PIECES=
    1217
    1318# bummer; have to use $foreach since % pattern subst rules only replace 1x
    1419OBJS=$(foreach piece, $(BSP_PIECES), ../$(piece)/$(ARCH)/$(piece).rel) \
     20     $(foreach piece, $(CPU_PIECES), \
     21         ../../../../libcpu/$(RTEMS_CPU)/$(piece)/$(ARCH)/$(piece).rel) \
    1522     $(foreach piece, $(GENERIC_PIECES), ../../../$(piece)/$(ARCH)/$(piece).rel)
    1623LIB=$(ARCH)/libbsp.a
  • c/src/lib/libc/libio.c

    rbed475e re2d79559  
    8080    } while (0)
    8181
     82/*
     83 * External I/O handlers
     84 *
     85 * Space for all possible handlers is preallocated
     86 * to speed up dispatch to external handlers.
     87 */
     88
     89static rtems_libio_handler_t handlers[15];
     90
     91void
     92rtems_register_libio_handler(
     93    int                         handler_flag,
     94    const rtems_libio_handler_t *handler
     95)
     96{
     97  int handler_index = rtems_file_descriptor_type_index(handler_flag);
     98
     99  if ((handler_index < 0) || (handler_index >= 15))
     100    rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER );
     101  handlers[handler_index] = *handler;
     102}
     103
    82104
    83105void
     
    85107    rtems_configuration_table *config,
    86108    unsigned32                 max_fds
    87   )
     109)
    88110{
    89111    rtems_libio_number_iops = max_fds;
     
    254276    rtems_libio_open_close_args_t args;
    255277
    256     if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) {
    257 /*
    258       if ( rc == RTEMS_UNSATISFIED ) {
    259         puts( "open -- ENOSYS case" );
    260         assert( 0 );
    261       }
    262 */
     278    /*
     279     * Additional external I/O handlers would be supported by
     280     * adding code to pick apart the pathname appropriately.
     281     * The networking code does not require changes here since
     282     * network file descriptors are obtained using socket(), not
     283     * open().
     284     */
     285
     286    if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL)
    263287        goto done;
    264     }
    265288
    266289    iop = rtems_libio_allocate();
     
    300323    rtems_status_code rc;
    301324    rtems_driver_name_t *np;
    302     rtems_libio_t *iop = rtems_libio_iop(fd);
     325    rtems_libio_t *iop;
    303326    rtems_libio_open_close_args_t args;
    304327
     328    if (rtems_file_descriptor_type(fd)) {
     329        int (*fp)(int fd);
     330
     331        fp = handlers[rtems_file_descriptor_type_index(fd)].close;
     332        if (fp == NULL) {
     333            errno = EBADF;
     334            return -1;
     335        }
     336        return (*fp)(fd);
     337    }
     338    iop = rtems_libio_iop(fd);
    305339    rtems_libio_check_fd(fd);
    306340
     
    327361    rtems_status_code rc;
    328362    rtems_driver_name_t *np;
    329     rtems_libio_t *iop = rtems_libio_iop(fd);
     363    rtems_libio_t *iop;
    330364    rtems_libio_rw_args_t args;
    331365
     366    if (rtems_file_descriptor_type(fd)) {
     367        int (*fp)(int fd, void *buffer, unsigned32 count);
     368
     369        fp = handlers[rtems_file_descriptor_type_index(fd)].read;
     370        if (fp == NULL) {
     371            errno = EBADF;
     372            return -1;
     373        }
     374        return (*fp)(fd, buffer, count);
     375    }
     376    iop = rtems_libio_iop(fd);
    332377    rtems_libio_check_fd(fd);
    333378    rtems_libio_check_buffer(buffer);
     
    363408    rtems_status_code rc;
    364409    rtems_driver_name_t *np;
    365     rtems_libio_t *iop = rtems_libio_iop(fd);
     410    rtems_libio_t *iop;
    366411    rtems_libio_rw_args_t args;
    367412
     413    if (rtems_file_descriptor_type(fd)) {
     414        int (*fp)(int fd, const void *buffer, unsigned32 count);
     415
     416        fp = handlers[rtems_file_descriptor_type_index(fd)].write;
     417        if (fp == NULL) {
     418            errno = EBADF;
     419            return -1;
     420        }
     421        return (*fp)(fd, buffer, count);
     422    }
     423    iop = rtems_libio_iop(fd);
    368424    rtems_libio_check_fd(fd);
    369425    rtems_libio_check_buffer(buffer);
     
    398454    rtems_status_code rc;
    399455    rtems_driver_name_t *np;
    400     rtems_libio_t *iop = rtems_libio_iop(fd);
     456    rtems_libio_t *iop;
    401457    rtems_libio_ioctl_args_t args;
    402458
     459    if (rtems_file_descriptor_type(fd)) {
     460        int (*fp)(int fd, unsigned32 command, void *buffer);
     461
     462        fp = handlers[rtems_file_descriptor_type_index(fd)].ioctl;
     463        if (fp == NULL) {
     464            errno = EBADF;
     465            return -1;
     466        }
     467        return (*fp)(fd, command, buffer);
     468    }
     469    iop = rtems_libio_iop(fd);
    403470    rtems_libio_check_fd(fd);
    404471
     
    429496  )   
    430497{
    431     rtems_libio_t *iop = rtems_libio_iop(fd);
    432 
     498    rtems_libio_t *iop;
     499
     500    if (rtems_file_descriptor_type(fd)) {
     501        int (*fp)(int fd, rtems_libio_offset_t offset, int whence);
     502
     503        fp = handlers[rtems_file_descriptor_type_index(fd)].lseek;
     504        if (fp == NULL) {
     505            errno = EBADF;
     506            return -1;
     507        }
     508        return (*fp)(fd, offset, whence);
     509    }
     510    iop = rtems_libio_iop(fd);
    433511    rtems_libio_check_fd(fd);
    434512
  • c/src/lib/libc/libio.h

    rbed475e re2d79559  
    100100int __rtems_isatty(int _fd);
    101101
     102/*
     103 * External I/O handlers
     104 */
     105typedef struct {
     106    int (*open)(const char  *pathname, unsigned32 flag, unsigned32 mode);
     107    int (*close)(int  fd);
     108    int (*read)(int fd, void *buffer, unsigned32 count);
     109    int (*write)(int fd, const void *buffer, unsigned32 count);
     110    int (*ioctl)(int fd, unsigned32  command, void *buffer);
     111    int (*lseek)(int fd, rtems_libio_offset_t offset, int whence);
     112} rtems_libio_handler_t;
     113
     114void rtems_register_libio_handler(int handler_flag,
     115                                 const rtems_libio_handler_t *handler);
     116
     117#define RTEMS_FILE_DESCRIPTOR_TYPE_FILE         0x0000
     118#define RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET       0x1000
     119#define rtems_make_file_descriptor(fd,flags)    ((fd)|(flags))
     120#define rtems_file_descriptor_base(fd)          ((fd) & 0x0FFF)
     121#define rtems_file_descriptor_type(fd)          ((fd) & 0xF000)
     122#define rtems_file_descriptor_type_index(fd)    ((((fd) & 0xF000) >> 12) - 1)
     123
    102124#endif /* _RTEMS_LIBIO_H */
  • c/src/lib/wrapup/Makefile.in

    rbed475e re2d79559  
    1818     $(PROJECT_HOME)/lib/librtems$(LIB_VARIANT).a \
    1919     $(wildcard $(PROJECT_HOME)/lib/libposix$(LIB_VARIANT).a) \
     20     $(wildcard $(PROJECT_HOME)/lib/libka9q$(LIB_VARIANT).a) \
    2021     $(PROJECT_HOME)/lib/libcsupport$(LIB_VARIANT).a \
    2122     $(wildcard $(PROJECT_HOME)/lib/rtems-ctor$(LIB_VARIANT).o) \
  • c/src/wrapup/Makefile.in

    rbed475e re2d79559  
    1818     $(PROJECT_HOME)/lib/librtems$(LIB_VARIANT).a \
    1919     $(wildcard $(PROJECT_HOME)/lib/libposix$(LIB_VARIANT).a) \
     20     $(wildcard $(PROJECT_HOME)/lib/libka9q$(LIB_VARIANT).a) \
    2021     $(PROJECT_HOME)/lib/libcsupport$(LIB_VARIANT).a \
    2122     $(wildcard $(PROJECT_HOME)/lib/rtems-ctor$(LIB_VARIANT).o) \
  • configure

    rbed475e re2d79559  
    1717\
    1818  --disable-posix                   disable posix interface"
     19ac_help="$ac_help
     20\
     21  --disable-tcpip                   disable KA9Q TCP/IP stack"
    1922ac_help="$ac_help
    2023\
     
    616619c/src/lib/libbsp/m68k/gen68360/startup/Makefile \
    617620c/src/lib/libbsp/m68k/gen68360/timer/Makefile \
     621c/src/lib/libbsp/m68k/gen68360/network/Makefile \
    618622c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile \
    619623c/src/lib/libbsp/m68k/idp/Makefile \
     
    754758c/src/lib/libbsp/unix/posix/timer/Makefile \
    755759c/src/lib/libbsp/unix/posix/wrapup/Makefile"
     760
     761tcpip_mk="c/src/lib/libka9q/Makefile"
    756762
    757763tests_mk="c/src/tests/Makefile \
     
    900906
    901907echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
    902 echo "configure:903: checking whether ${MAKE-make} sets \${MAKE}" >&5
     908echo "configure:909: checking whether ${MAKE-make} sets \${MAKE}" >&5
    903909set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
    904910if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
     
    973979
    974980echo $ac_n "checking host system type""... $ac_c" 1>&6
    975 echo "configure:976: checking host system type" >&5
     981echo "configure:982: checking host system type" >&5
    976982
    977983host_alias=$host
     
    9941000
    9951001echo $ac_n "checking target system type""... $ac_c" 1>&6
    996 echo "configure:997: checking target system type" >&5
     1002echo "configure:1003: checking target system type" >&5
    9971003
    9981004target_alias=$target
     
    10121018
    10131019echo $ac_n "checking build system type""... $ac_c" 1>&6
    1014 echo "configure:1015: checking build system type" >&5
     1020echo "configure:1021: checking build system type" >&5
    10151021
    10161022build_alias=$build
     
    10491055else
    10501056  RTEMS_HAS_POSIX_API=yes
     1057fi
     1058
     1059
     1060# Check whether --enable-tcpip or --disable-tcpip was given.
     1061if test "${enable_tcpip+set}" = set; then
     1062  enableval="$enable_tcpip"
     1063  \
     1064RTEMS_HAS_KA9Q=no
     1065else
     1066  RTEMS_HAS_KA9Q=yes
    10511067fi
    10521068
     
    11321148esac
    11331149
     1150# until the tcpip is made optional to build, just do this
     1151makefiles="$makefiles $tcpip_mk"
     1152
    11341153case "${host}" in
    11351154  *-pc-linux*)          host_os=Linux ;;
     
    11581177set dummy $ac_prog; ac_word=$2
    11591178echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
    1160 echo "configure:1161: checking for $ac_word" >&5
     1179echo "configure:1180: checking for $ac_word" >&5
    11611180if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then
    11621181  echo $ac_n "(cached) $ac_c" 1>&6
     
    11871206
    11881207echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6
    1189 echo "configure:1190: checking whether ln -s works" >&5
     1208echo "configure:1209: checking whether ln -s works" >&5
    11901209if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then
    11911210  echo $ac_n "(cached) $ac_c" 1>&6
     
    12291248RTEMS_BSP=$enableval
    12301249fi
     1250
    12311251
    12321252
     
    14621482s%@RTEMS_ROOT@%$RTEMS_ROOT%g
    14631483s%@RTEMS_HAS_POSIX_API@%$RTEMS_HAS_POSIX_API%g
     1484s%@RTEMS_HAS_KA9Q@%$RTEMS_HAS_KA9Q%g
    14641485s%@RTEMS_USE_MACROS@%$RTEMS_USE_MACROS%g
    14651486s%@PROJECT_ROOT@%$PROJECT_ROOT%g
  • configure.in

    rbed475e re2d79559  
    8585c/src/lib/libbsp/m68k/gen68360/startup/Makefile \
    8686c/src/lib/libbsp/m68k/gen68360/timer/Makefile \
     87c/src/lib/libbsp/m68k/gen68360/network/Makefile \
    8788c/src/lib/libbsp/m68k/gen68360/wrapup/Makefile \
    8889c/src/lib/libbsp/m68k/idp/Makefile \
     
    223224c/src/lib/libbsp/unix/posix/timer/Makefile \
    224225c/src/lib/libbsp/unix/posix/wrapup/Makefile"
     226
     227tcpip_mk="c/src/lib/libka9q/Makefile"
    225228
    226229tests_mk="c/src/tests/Makefile \
     
    378381RTEMS_HAS_POSIX_API=no,RTEMS_HAS_POSIX_API=yes)
    379382
     383AC_ARG_ENABLE(tcpip, \
     384[  --disable-tcpip                  disable KA9Q TCP/IP stack], \
     385RTEMS_HAS_KA9Q=no,RTEMS_HAS_KA9Q=yes)
     386
    380387AC_ARG_ENABLE(rtems-inlines, \
    381388[  --disable-rtems-inlines          disable RTEMS inline functions (use macros)], \
     
    451458        ;;
    452459esac
     460
     461# until the tcpip is made optional to build, just do this
     462makefiles="$makefiles $tcpip_mk"
    453463
    454464case "${host}" in
     
    496506AC_SUBST(RTEMS_ROOT)
    497507AC_SUBST(RTEMS_HAS_POSIX_API)
     508AC_SUBST(RTEMS_HAS_KA9Q)
    498509AC_SUBST(RTEMS_USE_MACROS)
    499510AC_SUBST(PROJECT_ROOT)
  • cpukit/libcsupport/include/rtems/libio.h

    rbed475e re2d79559  
    100100int __rtems_isatty(int _fd);
    101101
     102/*
     103 * External I/O handlers
     104 */
     105typedef struct {
     106    int (*open)(const char  *pathname, unsigned32 flag, unsigned32 mode);
     107    int (*close)(int  fd);
     108    int (*read)(int fd, void *buffer, unsigned32 count);
     109    int (*write)(int fd, const void *buffer, unsigned32 count);
     110    int (*ioctl)(int fd, unsigned32  command, void *buffer);
     111    int (*lseek)(int fd, rtems_libio_offset_t offset, int whence);
     112} rtems_libio_handler_t;
     113
     114void rtems_register_libio_handler(int handler_flag,
     115                                 const rtems_libio_handler_t *handler);
     116
     117#define RTEMS_FILE_DESCRIPTOR_TYPE_FILE         0x0000
     118#define RTEMS_FILE_DESCRIPTOR_TYPE_SOCKET       0x1000
     119#define rtems_make_file_descriptor(fd,flags)    ((fd)|(flags))
     120#define rtems_file_descriptor_base(fd)          ((fd) & 0x0FFF)
     121#define rtems_file_descriptor_type(fd)          ((fd) & 0xF000)
     122#define rtems_file_descriptor_type_index(fd)    ((((fd) & 0xF000) >> 12) - 1)
     123
    102124#endif /* _RTEMS_LIBIO_H */
  • cpukit/libcsupport/src/libio.c

    rbed475e re2d79559  
    8080    } while (0)
    8181
     82/*
     83 * External I/O handlers
     84 *
     85 * Space for all possible handlers is preallocated
     86 * to speed up dispatch to external handlers.
     87 */
     88
     89static rtems_libio_handler_t handlers[15];
     90
     91void
     92rtems_register_libio_handler(
     93    int                         handler_flag,
     94    const rtems_libio_handler_t *handler
     95)
     96{
     97  int handler_index = rtems_file_descriptor_type_index(handler_flag);
     98
     99  if ((handler_index < 0) || (handler_index >= 15))
     100    rtems_fatal_error_occurred( RTEMS_INVALID_NUMBER );
     101  handlers[handler_index] = *handler;
     102}
     103
    82104
    83105void
     
    85107    rtems_configuration_table *config,
    86108    unsigned32                 max_fds
    87   )
     109)
    88110{
    89111    rtems_libio_number_iops = max_fds;
     
    254276    rtems_libio_open_close_args_t args;
    255277
    256     if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL) {
    257 /*
    258       if ( rc == RTEMS_UNSATISFIED ) {
    259         puts( "open -- ENOSYS case" );
    260         assert( 0 );
    261       }
    262 */
     278    /*
     279     * Additional external I/O handlers would be supported by
     280     * adding code to pick apart the pathname appropriately.
     281     * The networking code does not require changes here since
     282     * network file descriptors are obtained using socket(), not
     283     * open().
     284     */
     285
     286    if ((rc = rtems_io_lookup_name(pathname, &np)) != RTEMS_SUCCESSFUL)
    263287        goto done;
    264     }
    265288
    266289    iop = rtems_libio_allocate();
     
    300323    rtems_status_code rc;
    301324    rtems_driver_name_t *np;
    302     rtems_libio_t *iop = rtems_libio_iop(fd);
     325    rtems_libio_t *iop;
    303326    rtems_libio_open_close_args_t args;
    304327
     328    if (rtems_file_descriptor_type(fd)) {
     329        int (*fp)(int fd);
     330
     331        fp = handlers[rtems_file_descriptor_type_index(fd)].close;
     332        if (fp == NULL) {
     333            errno = EBADF;
     334            return -1;
     335        }
     336        return (*fp)(fd);
     337    }
     338    iop = rtems_libio_iop(fd);
    305339    rtems_libio_check_fd(fd);
    306340
     
    327361    rtems_status_code rc;
    328362    rtems_driver_name_t *np;
    329     rtems_libio_t *iop = rtems_libio_iop(fd);
     363    rtems_libio_t *iop;
    330364    rtems_libio_rw_args_t args;
    331365
     366    if (rtems_file_descriptor_type(fd)) {
     367        int (*fp)(int fd, void *buffer, unsigned32 count);
     368
     369        fp = handlers[rtems_file_descriptor_type_index(fd)].read;
     370        if (fp == NULL) {
     371            errno = EBADF;
     372            return -1;
     373        }
     374        return (*fp)(fd, buffer, count);
     375    }
     376    iop = rtems_libio_iop(fd);
    332377    rtems_libio_check_fd(fd);
    333378    rtems_libio_check_buffer(buffer);
     
    363408    rtems_status_code rc;
    364409    rtems_driver_name_t *np;
    365     rtems_libio_t *iop = rtems_libio_iop(fd);
     410    rtems_libio_t *iop;
    366411    rtems_libio_rw_args_t args;
    367412
     413    if (rtems_file_descriptor_type(fd)) {
     414        int (*fp)(int fd, const void *buffer, unsigned32 count);
     415
     416        fp = handlers[rtems_file_descriptor_type_index(fd)].write;
     417        if (fp == NULL) {
     418            errno = EBADF;
     419            return -1;
     420        }
     421        return (*fp)(fd, buffer, count);
     422    }
     423    iop = rtems_libio_iop(fd);
    368424    rtems_libio_check_fd(fd);
    369425    rtems_libio_check_buffer(buffer);
     
    398454    rtems_status_code rc;
    399455    rtems_driver_name_t *np;
    400     rtems_libio_t *iop = rtems_libio_iop(fd);
     456    rtems_libio_t *iop;
    401457    rtems_libio_ioctl_args_t args;
    402458
     459    if (rtems_file_descriptor_type(fd)) {
     460        int (*fp)(int fd, unsigned32 command, void *buffer);
     461
     462        fp = handlers[rtems_file_descriptor_type_index(fd)].ioctl;
     463        if (fp == NULL) {
     464            errno = EBADF;
     465            return -1;
     466        }
     467        return (*fp)(fd, command, buffer);
     468    }
     469    iop = rtems_libio_iop(fd);
    403470    rtems_libio_check_fd(fd);
    404471
     
    429496  )   
    430497{
    431     rtems_libio_t *iop = rtems_libio_iop(fd);
    432 
     498    rtems_libio_t *iop;
     499
     500    if (rtems_file_descriptor_type(fd)) {
     501        int (*fp)(int fd, rtems_libio_offset_t offset, int whence);
     502
     503        fp = handlers[rtems_file_descriptor_type_index(fd)].lseek;
     504        if (fp == NULL) {
     505            errno = EBADF;
     506            return -1;
     507        }
     508        return (*fp)(fd, offset, whence);
     509    }
     510    iop = rtems_libio_iop(fd);
    433511    rtems_libio_check_fd(fd);
    434512
Note: See TracChangeset for help on using the changeset viewer.