Changeset 6cfc98d in rtems-libbsd


Ignore:
Timestamp:
Oct 1, 2014, 12:20:42 PM (5 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, 46b3858b27d78e14a220f8d251fd7ab28a5244f4, freebsd-9.3, 792d56bd33346adadf8b95dea2d2ed09f9e347e7
Children:
263c947
Parents:
d43544e
git-author:
Sebastian Huber <sebastian.huber@…> (10/01/14 12:20:42)
git-committer:
Sebastian Huber <sebastian.huber@…> (10/08/14 12:59:52)
Message:

nexus: Use a linker set for the devices

Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • Makefile

    rd43544e r6cfc98d  
    110110LIB_C_FILES += rtemsbsd/telnetd/pty.c
    111111LIB_C_FILES += rtemsbsd/telnetd/telnetd.c
    112 LIB_C_FILES += rtemsbsd/bsp/bsp-bsd-nexus-devices.c
    113112LIB_GEN_FILES += rtemsbsd/rtems/rtems-kvm-symbols.c
    114113LIB_C_FILES += rtemsbsd/rtems/rtems-kvm-symbols.c
  • freebsd-to-rtems.py

    rd43544e r6cfc98d  
    708708                'telnetd/pty.c',
    709709                'telnetd/telnetd.c',
    710                 'bsp/bsp-bsd-nexus-devices.c',
    711710        ]
    712711)
  • rtemsbsd/include/bsp/nexus-devices.h

    rd43544e r6cfc98d  
    11/*
    2  * Copyright (c) 2013 embedded brains GmbH.  All rights reserved.
     2 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
    33 *
    44 *  embedded brains GmbH
     
    3232#include <rtems/bsd/bsd.h>
    3333
    34 #include <machine/rtems-bsd-sysinit.h>
    35 
    3634#include <bsp.h>
    3735
     
    5250};
    5351
    54 const rtems_bsd_device rtems_bsd_nexus_devices[] = {
    55         {
    56                 .name = "smc",
    57                 .unit = 0,
    58                 .resource_count = RTEMS_ARRAY_SIZE(smc0_res),
    59                 .resources = &smc0_res[0]
    60         }
    61 };
    62 
    63 SYSINIT_DRIVER_REFERENCE(smc, nexus);
     52RTEMS_BSD_DEFINE_NEXUS_DEVICE(smc, 0, RTEMS_ARRAY_SIZE(smc0_res),
     53   &smc0_res[0]);
    6454
    6555#elif defined(__GENMCF548X_BSP_H)
    6656
    67 const rtems_bsd_device rtems_bsd_nexus_devices[] = {
    68         {
    69                 .name = "fec",
    70                 .unit = 0
    71         }, {
    72                 .name = "fec",
    73                 .unit = 1
    74         }
    75 };
     57RTEMS_BSD_DEFINE_NEXUS_DEVICE(fec, 0, 0, NULL);
    7658
    77 SYSINIT_DRIVER_REFERENCE(fec, nexus);
    78 
    79 #else
    80 
    81 const rtems_bsd_device rtems_bsd_nexus_devices[0];
     59RTEMS_BSD_DEFINE_NEXUS_DEVICE(fec, 1, 0, NULL);
    8260
    8361#endif
    84 
    85 const size_t rtems_bsd_nexus_device_count =
    86     RTEMS_ARRAY_SIZE(rtems_bsd_nexus_devices);
  • rtemsbsd/include/rtems/bsd/bsd.h

    rd43544e r6cfc98d  
    4141#define _RTEMS_BSD_BSD_H_
    4242
     43#include <sys/cdefs.h>
     44#include <sys/queue.h>
     45#include <sys/kernel.h>
     46
     47#include <rtems.h>
     48
    4349#ifdef __cplusplus
    4450extern "C" {
    4551#endif /* __cplusplus */
    46 
    47 #include <rtems.h>
    4852
    4953typedef enum {
     
    6367        size_t resource_count;
    6468        const rtems_bsd_device_resource *resources;
     69        const struct sysinit *driver_reference;
    6570} rtems_bsd_device;
    6671
    67 extern const rtems_bsd_device rtems_bsd_nexus_devices[];
    68 
    69 extern const size_t rtems_bsd_nexus_device_count;
     72#define RTEMS_BSD_DEFINE_NEXUS_DEVICE(name, unit, resource_count, resources) \
     73    extern struct sysinit SYSINIT_ENTRY_NAME(name##_nexusmodule); \
     74    RTEMS_BSD_DEFINE_SET_ITEM(nexus, name##unit, rtems_bsd_device) = \
     75        { #name, unit, (resource_count), (resources), \
     76            &SYSINIT_ENTRY_NAME(name##_nexusmodule) }
    7077
    7178rtems_status_code rtems_bsd_initialize(void);
  • rtemsbsd/rtems/rtems-bsd-nexus.c

    rd43544e r6cfc98d  
    88
    99/*
    10  * Copyright (c) 2009-2013 embedded brains GmbH.  All rights reserved.
     10 * Copyright (c) 2009-2014 embedded brains GmbH.  All rights reserved.
    1111 *
    1212 *  embedded brains GmbH
     
    5555/* #define DISABLE_INTERRUPT_EXTENSION */
    5656
     57RTEMS_BSD_DECLARE_SET(nexus, rtems_bsd_device);
     58
     59RTEMS_BSD_DEFINE_SET(nexus, rtems_bsd_device);
     60
    5761RTEMS_STATIC_ASSERT(SYS_RES_MEMORY == RTEMS_BSD_RES_MEMORY, RTEMS_BSD_RES_MEMORY);
    5862
     
    6872        rtems_status_code status;
    6973        int err;
    70         size_t i;
     74        const rtems_bsd_device *nd;
    7175
    7276        device_set_desc(dev, "RTEMS Nexus device");
     
    101105        BSD_ASSERT(err == 0);
    102106
    103         for (i = 0; i < rtems_bsd_nexus_device_count; ++i) {
    104                 const rtems_bsd_device *nd = &rtems_bsd_nexus_devices[i];
    105 
     107        SET_FOREACH(nd, nexus) {
    106108                device_add_child(dev, nd->name, nd->unit);
    107109        }
     
    134136{
    135137        struct rman *rm;
    136         size_t i;
     138        const rtems_bsd_device *nd;
    137139
    138140        switch (type) {
     
    147149        }
    148150
    149         for (i = 0; i < rtems_bsd_nexus_device_count; ++i) {
    150                 const rtems_bsd_device *nd = &rtems_bsd_nexus_devices[i];
    151 
     151        SET_FOREACH(nd, nexus) {
    152152                if (strcmp(device_get_name(child), nd->name) == 0
    153153                    && device_get_unit(child) == nd->unit) {
  • testsuite/include/rtems/bsd/test/default-network-init.h

    rd43544e r6cfc98d  
    273273SYSINIT_NEED_NET_PF_UNIX;
    274274
     275#include <bsp/nexus-devices.h>
     276
    275277#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
    276278#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
  • testsuite/swi01/init.c

    rd43544e r6cfc98d  
    4040#include "swi_test.h"
    4141
    42 const rtems_bsd_device rtems_bsd_nexus_devices[0];
    43 
    44 const size_t rtems_bsd_nexus_device_count =
    45     RTEMS_ARRAY_SIZE(rtems_bsd_nexus_devices);
    46 
    4742static void Init(rtems_task_argument arg)
    4843{
  • testsuite/timeout01/init.c

    rd43544e r6cfc98d  
    4040#include "timeout_test.h"
    4141
    42 const rtems_bsd_device rtems_bsd_nexus_devices[0];
    43 
    44 const size_t rtems_bsd_nexus_device_count =
    45     RTEMS_ARRAY_SIZE(rtems_bsd_nexus_devices);
    46 
    4742static void Init(rtems_task_argument arg)
    4843{
Note: See TracChangeset for help on using the changeset viewer.