[PATCH 2/2] Port BBB sd driver files to RTEMS.

Christian Mauderer list at c-mauderer.de
Wed Nov 8 20:30:31 UTC 2017


Hello Sichen,

just tested it here and it runs fine. media01 creates it normal test.txt
files without any problems.

Regards

Christian

Am 08.11.2017 um 14:43 schrieb Sichen Zhao:
> So BBB can mount and read eMMC and SD card.
> ---
>  Makefile.todo                                 |  26 ++++
>  libbsd.py                                     |  36 +++++
>  libbsd_waf.py                                 |   8 +
>  rtemsbsd/include/bsp/nexus-devices.h          |   2 +
>  rtemsbsd/include/machine/fdt.h                |   0
>  rtemsbsd/include/rtems/bsd/local/gpiobus_if.h | 152 ++++++++++++++++++
>  rtemsbsd/include/rtems/bsd/local/sdhci_if.h   | 216 ++++++++++++++++++++++++++
>  rtemsbsd/local/gpiobus_if.c                   |  62 ++++++++
>  rtemsbsd/local/sdhci_if.c                     |  90 +++++++++++
>  9 files changed, 592 insertions(+)
>  create mode 100644 rtemsbsd/include/machine/fdt.h
>  create mode 100644 rtemsbsd/include/rtems/bsd/local/gpiobus_if.h
>  create mode 100644 rtemsbsd/include/rtems/bsd/local/sdhci_if.h
>  create mode 100644 rtemsbsd/local/gpiobus_if.c
>  create mode 100644 rtemsbsd/local/sdhci_if.c
> 
> diff --git a/Makefile.todo b/Makefile.todo
> index c69908b..8890fd2 100644
> --- a/Makefile.todo
> +++ b/Makefile.todo
> @@ -35,6 +35,10 @@ GENERATED += $(LOCAL_SRC)/mmcbus_if.c
>  GENERATED += $(LOCAL_SRC)/rtwn-rtl8192cfwT.c
>  GENERATED += $(LOCAL_SRC)/rtwn-rtl8188eufw.c
>  GENERATED += $(LOCAL_SRC)/runfw.c
> +GENERATED += $(LOCAL_INC)/sdhci_if.h
> +GENERATED += $(LOCAL_SRC)/sdhci_if.c
> +GENERATED += $(LOCAL_INC)/gpiobus_if.h
> +GENERATED += $(LOCAL_SRC)/gpiobus_if.c
>  GENERATED += rtemsbsd/include/machine/rtems-bsd-regdomain.h
>  GENERATED += rtemsbsd/rtems/rtems-bsd-regdomain.c
>  GENERATED += freebsd/contrib/libpcap/grammar.h
> @@ -157,6 +161,28 @@ $(LOCAL_INC)/gpio_if.h: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
>  	awk -f $(TOOLS)/makeobjops.awk $< -h
>  	mv gpio_if.h $@
>  
> +$(LOCAL_INC)/gpiobus_if.h: $(FREEBSD_SRC)/sys/dev/gpio/gpiobus_if.m
> +	awk -f $(TOOLS)/makeobjops.awk $< -h
> +	mv gpiobus_if.h $@
> +
> +$(LOCAL_SRC)/gpiobus_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpiobus_if.m
> +	awk -f $(TOOLS)/makeobjops.awk $< -c
> +	sed -i gpiobus_if.c \
> +	    -e '1 i\#include <machine/rtems-bsd-kernel-space.h>\n' \
> +	    -e 's|#include "gpiobus_if.h"|#include <rtems/bsd/local/gpiobus_if.h>|'
> +	mv gpiobus_if.c $@
> +
> +$(LOCAL_INC)/sdhci_if.h: $(FREEBSD_SRC)/sys/dev/sdhci/sdhci_if.m
> +	awk -f $(TOOLS)/makeobjops.awk $< -h
> +	mv sdhci_if.h $@
> +
> +$(LOCAL_SRC)/sdhci_if.c: $(FREEBSD_SRC)/sys/dev/sdhci/sdhci_if.m
> +	awk -f $(TOOLS)/makeobjops.awk $< -c
> +	sed -i sdhci_if.c \
> +	    -e '1 i\#include <machine/rtems-bsd-kernel-space.h>\n' \
> +	    -e 's|#include "sdhci_if.h"|#include <rtems/bsd/local/sdhci_if.h>|'
> +	mv sdhci_if.c $@
> +
>  $(LOCAL_SRC)/gpio_if.c: $(FREEBSD_SRC)/sys/dev/gpio/gpio_if.m
>  	awk -f $(TOOLS)/makeobjops.awk $< -c
>  	mv gpio_if.c $@
> diff --git a/libbsd.py b/libbsd.py
> index 5ec2f91..5553168 100644
> --- a/libbsd.py
> +++ b/libbsd.py
> @@ -497,6 +497,41 @@ def mmc(mm):
>      return mod
>  
>  #
> +# MMC
> +#
> +def mmc_ti(mm):
> +    mod = builder.Module('mmc_ti')
> +    mod.addKernelSpaceHeaderFiles(
> +        [
> +            'sys/arm/ti/ti_cpuid.h',
> +            'sys/arm/ti/ti_prcm.h',
> +            'sys/arm/ti/ti_hwmods.h',
> +            'sys/dev/sdhci/sdhci.h',
> +            'sys/dev/sdhci/sdhci_fdt_gpio.h',
> +            'sys/dev/gpio/gpiobusvar.h',
> +        ]
> +    )
> +    mod.addKernelSpaceSourceFiles(
> +        [
> +            'sys/dev/sdhci/sdhci.c',
> +            'sys/arm/ti/ti_sdhci.c',
> +            'sys/arm/ti/ti_hwmods.c',
> +            'sys/dev/sdhci/sdhci_fdt_gpio.c',
> +            'sys/dev/gpio/ofw_gpiobus.c',
> +            'sys/dev/gpio/gpiobus.c',
> +        ],
> +        mm.generator['source']()
> +    )
> +    mod.addRTEMSSourceFiles(
> +        [
> +            'local/sdhci_if.c',
> +            'local/gpiobus_if.c',
> +        ],
> +        mm.generator['source']()
> +    )
> +    return mod
> +
> +#
>  # Input
>  #
>  def dev_input(mm):
> @@ -4465,6 +4500,7 @@ def sources(mm):
>      mm.addModule(fdt(mm))
>      mm.addModule(tty(mm))
>      mm.addModule(mmc(mm))
> +    mm.addModule(mmc_ti(mm))
>      mm.addModule(dev_input(mm))
>      mm.addModule(evdev(mm))
>  
> diff --git a/libbsd_waf.py b/libbsd_waf.py
> index 29405d3..07cef63 100644
> --- a/libbsd_waf.py
> +++ b/libbsd_waf.py
> @@ -1688,8 +1688,10 @@ def build(bld):
>                'freebsd/sys/arm/ti/am335x/am335x_musb.c',
>                'freebsd/sys/arm/ti/am335x/am335x_prcm.c',
>                'freebsd/sys/arm/ti/am335x/am335x_usbss.c',
> +              'freebsd/sys/arm/ti/ti_hwmods.c',
>                'freebsd/sys/arm/ti/ti_prcm.c',
>                'freebsd/sys/arm/ti/ti_scm.c',
> +              'freebsd/sys/arm/ti/ti_sdhci.c',
>                'freebsd/sys/arm/xilinx/zy7_slcr.c',
>                'freebsd/sys/cam/cam.c',
>                'freebsd/sys/cam/scsi/scsi_all.c',
> @@ -1748,6 +1750,8 @@ def build(bld):
>                'freebsd/sys/dev/fdt/simplebus.c',
>                'freebsd/sys/dev/ffec/if_ffec.c',
>                'freebsd/sys/dev/fxp/if_fxp.c',
> +              'freebsd/sys/dev/gpio/gpiobus.c',
> +              'freebsd/sys/dev/gpio/ofw_gpiobus.c',
>                'freebsd/sys/dev/kbd/kbd.c',
>                'freebsd/sys/dev/led/led.c',
>                'freebsd/sys/dev/mii/brgphy.c',
> @@ -1861,6 +1865,8 @@ def build(bld):
>                'freebsd/sys/dev/rtwn/usb/rtwn_usb_reg.c',
>                'freebsd/sys/dev/rtwn/usb/rtwn_usb_rx.c',
>                'freebsd/sys/dev/rtwn/usb/rtwn_usb_tx.c',
> +              'freebsd/sys/dev/sdhci/sdhci.c',
> +              'freebsd/sys/dev/sdhci/sdhci_fdt_gpio.c',
>                'freebsd/sys/dev/smc/if_smc.c',
>                'freebsd/sys/dev/tsec/if_tsec.c',
>                'freebsd/sys/dev/tsec/if_tsec_fdt.c',
> @@ -2250,6 +2256,7 @@ def build(bld):
>                'rtemsbsd/local/cryptodev_if.c',
>                'rtemsbsd/local/device_if.c',
>                'rtemsbsd/local/gpio_if.c',
> +              'rtemsbsd/local/gpiobus_if.c',
>                'rtemsbsd/local/if_dwc_if.c',
>                'rtemsbsd/local/ifdi_if.c',
>                'rtemsbsd/local/miibus_if.c',
> @@ -2262,6 +2269,7 @@ def build(bld):
>                'rtemsbsd/local/rtwn-rtl8188eufw.c',
>                'rtemsbsd/local/rtwn-rtl8192cfwT.c',
>                'rtemsbsd/local/runfw.c',
> +              'rtemsbsd/local/sdhci_if.c',
>                'rtemsbsd/local/usb_if.c',
>                'rtemsbsd/mdns/mdns-hostname-default.c',
>                'rtemsbsd/mdns/mdns.c',
> diff --git a/rtemsbsd/include/bsp/nexus-devices.h b/rtemsbsd/include/bsp/nexus-devices.h
> index f0ce1bd..b91601c 100644
> --- a/rtemsbsd/include/bsp/nexus-devices.h
> +++ b/rtemsbsd/include/bsp/nexus-devices.h
> @@ -56,6 +56,8 @@ SYSINIT_DRIVER_REFERENCE(ti_scm, simplebus);
>  SYSINIT_DRIVER_REFERENCE(am335x_prcm, simplebus);
>  SYSINIT_DRIVER_REFERENCE(usbss, simplebus);
>  SYSINIT_DRIVER_REFERENCE(musbotg, usbss);
> +SYSINIT_DRIVER_REFERENCE(sdhci_ti, simplebus);
> +SYSINIT_DRIVER_REFERENCE(mmcsd, mmc);
>  SYSINIT_DRIVER_REFERENCE(rtwn_usb, uhub);
>  SYSINIT_MODULE_REFERENCE(wlan_ratectl_none);
>  SYSINIT_MODULE_REFERENCE(wlan_sta);
> diff --git a/rtemsbsd/include/machine/fdt.h b/rtemsbsd/include/machine/fdt.h
> new file mode 100644
> index 0000000..e69de29
> diff --git a/rtemsbsd/include/rtems/bsd/local/gpiobus_if.h b/rtemsbsd/include/rtems/bsd/local/gpiobus_if.h
> new file mode 100644
> index 0000000..fb270f2
> --- /dev/null
> +++ b/rtemsbsd/include/rtems/bsd/local/gpiobus_if.h
> @@ -0,0 +1,152 @@
> +/*
> + * This file is produced automatically.
> + * Do not modify anything in here by hand.
> + *
> + * Created from source file
> + *   freebsd-org/sys/dev/gpio/gpiobus_if.m
> + * with
> + *   makeobjops.awk
> + *
> + * See the source file for legal information
> + */
> +
> +
> +#ifndef _gpiobus_if_h_
> +#define _gpiobus_if_h_
> +
> +/** @brief Unique descriptor for the GPIOBUS_ACQUIRE_BUS() method */
> +extern struct kobjop_desc gpiobus_acquire_bus_desc;
> +/** @brief A function implementing the GPIOBUS_ACQUIRE_BUS() method */
> +typedef int gpiobus_acquire_bus_t(device_t busdev, device_t dev, int how);
> +
> +static __inline int GPIOBUS_ACQUIRE_BUS(device_t busdev, device_t dev, int how)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)busdev)->ops,gpiobus_acquire_bus);
> +	return ((gpiobus_acquire_bus_t *) _m)(busdev, dev, how);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_RELEASE_BUS() method */
> +extern struct kobjop_desc gpiobus_release_bus_desc;
> +/** @brief A function implementing the GPIOBUS_RELEASE_BUS() method */
> +typedef void gpiobus_release_bus_t(device_t busdev, device_t dev);
> +
> +static __inline void GPIOBUS_RELEASE_BUS(device_t busdev, device_t dev)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)busdev)->ops,gpiobus_release_bus);
> +	((gpiobus_release_bus_t *) _m)(busdev, dev);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_SET() method */
> +extern struct kobjop_desc gpiobus_pin_set_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_SET() method */
> +typedef int gpiobus_pin_set_t(device_t dev, device_t child, uint32_t pin_num,
> +                              uint32_t pin_value);
> +
> +static __inline int GPIOBUS_PIN_SET(device_t dev, device_t child,
> +                                    uint32_t pin_num, uint32_t pin_value)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_set);
> +	return ((gpiobus_pin_set_t *) _m)(dev, child, pin_num, pin_value);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_GET() method */
> +extern struct kobjop_desc gpiobus_pin_get_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_GET() method */
> +typedef int gpiobus_pin_get_t(device_t dev, device_t child, uint32_t pin_num,
> +                              uint32_t *pin_value);
> +
> +static __inline int GPIOBUS_PIN_GET(device_t dev, device_t child,
> +                                    uint32_t pin_num, uint32_t *pin_value)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_get);
> +	return ((gpiobus_pin_get_t *) _m)(dev, child, pin_num, pin_value);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_TOGGLE() method */
> +extern struct kobjop_desc gpiobus_pin_toggle_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_TOGGLE() method */
> +typedef int gpiobus_pin_toggle_t(device_t dev, device_t child,
> +                                 uint32_t pin_num);
> +
> +static __inline int GPIOBUS_PIN_TOGGLE(device_t dev, device_t child,
> +                                       uint32_t pin_num)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_toggle);
> +	return ((gpiobus_pin_toggle_t *) _m)(dev, child, pin_num);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_GETCAPS() method */
> +extern struct kobjop_desc gpiobus_pin_getcaps_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_GETCAPS() method */
> +typedef int gpiobus_pin_getcaps_t(device_t dev, device_t child,
> +                                  uint32_t pin_num, uint32_t *caps);
> +
> +static __inline int GPIOBUS_PIN_GETCAPS(device_t dev, device_t child,
> +                                        uint32_t pin_num, uint32_t *caps)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_getcaps);
> +	return ((gpiobus_pin_getcaps_t *) _m)(dev, child, pin_num, caps);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_GETFLAGS() method */
> +extern struct kobjop_desc gpiobus_pin_getflags_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_GETFLAGS() method */
> +typedef int gpiobus_pin_getflags_t(device_t dev, device_t child,
> +                                   uint32_t pin_num, uint32_t *flags);
> +
> +static __inline int GPIOBUS_PIN_GETFLAGS(device_t dev, device_t child,
> +                                         uint32_t pin_num, uint32_t *flags)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_getflags);
> +	return ((gpiobus_pin_getflags_t *) _m)(dev, child, pin_num, flags);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_SETFLAGS() method */
> +extern struct kobjop_desc gpiobus_pin_setflags_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_SETFLAGS() method */
> +typedef int gpiobus_pin_setflags_t(device_t dev, device_t child,
> +                                   uint32_t pin_num, uint32_t flags);
> +
> +static __inline int GPIOBUS_PIN_SETFLAGS(device_t dev, device_t child,
> +                                         uint32_t pin_num, uint32_t flags)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_setflags);
> +	return ((gpiobus_pin_setflags_t *) _m)(dev, child, pin_num, flags);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_GETNAME() method */
> +extern struct kobjop_desc gpiobus_pin_getname_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_GETNAME() method */
> +typedef int gpiobus_pin_getname_t(device_t dev, uint32_t pin_num, char *name);
> +
> +static __inline int GPIOBUS_PIN_GETNAME(device_t dev, uint32_t pin_num,
> +                                        char *name)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_getname);
> +	return ((gpiobus_pin_getname_t *) _m)(dev, pin_num, name);
> +}
> +
> +/** @brief Unique descriptor for the GPIOBUS_PIN_SETNAME() method */
> +extern struct kobjop_desc gpiobus_pin_setname_desc;
> +/** @brief A function implementing the GPIOBUS_PIN_SETNAME() method */
> +typedef int gpiobus_pin_setname_t(device_t dev, uint32_t pin_num,
> +                                  const char *name);
> +
> +static __inline int GPIOBUS_PIN_SETNAME(device_t dev, uint32_t pin_num,
> +                                        const char *name)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)dev)->ops,gpiobus_pin_setname);
> +	return ((gpiobus_pin_setname_t *) _m)(dev, pin_num, name);
> +}
> +
> +#endif /* _gpiobus_if_h_ */
> diff --git a/rtemsbsd/include/rtems/bsd/local/sdhci_if.h b/rtemsbsd/include/rtems/bsd/local/sdhci_if.h
> new file mode 100644
> index 0000000..531090f
> --- /dev/null
> +++ b/rtemsbsd/include/rtems/bsd/local/sdhci_if.h
> @@ -0,0 +1,216 @@
> +/*
> + * This file is produced automatically.
> + * Do not modify anything in here by hand.
> + *
> + * Created from source file
> + *   freebsd-org/sys/dev/sdhci/sdhci_if.m
> + * with
> + *   makeobjops.awk
> + *
> + * See the source file for legal information
> + */
> +
> +
> +#ifndef _sdhci_if_h_
> +#define _sdhci_if_h_
> +
> +/** @brief Unique descriptor for the SDHCI_READ_1() method */
> +extern struct kobjop_desc sdhci_read_1_desc;
> +/** @brief A function implementing the SDHCI_READ_1() method */
> +typedef uint8_t sdhci_read_1_t(device_t brdev, struct sdhci_slot *slot,
> +                               bus_size_t off);
> +
> +static __inline uint8_t SDHCI_READ_1(device_t brdev, struct sdhci_slot *slot,
> +                                     bus_size_t off)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_read_1);
> +	return ((sdhci_read_1_t *) _m)(brdev, slot, off);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_READ_2() method */
> +extern struct kobjop_desc sdhci_read_2_desc;
> +/** @brief A function implementing the SDHCI_READ_2() method */
> +typedef uint16_t sdhci_read_2_t(device_t brdev, struct sdhci_slot *slot,
> +                                bus_size_t off);
> +
> +static __inline uint16_t SDHCI_READ_2(device_t brdev, struct sdhci_slot *slot,
> +                                      bus_size_t off)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_read_2);
> +	return ((sdhci_read_2_t *) _m)(brdev, slot, off);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_READ_4() method */
> +extern struct kobjop_desc sdhci_read_4_desc;
> +/** @brief A function implementing the SDHCI_READ_4() method */
> +typedef uint32_t sdhci_read_4_t(device_t brdev, struct sdhci_slot *slot,
> +                                bus_size_t off);
> +
> +static __inline uint32_t SDHCI_READ_4(device_t brdev, struct sdhci_slot *slot,
> +                                      bus_size_t off)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_read_4);
> +	return ((sdhci_read_4_t *) _m)(brdev, slot, off);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_READ_MULTI_4() method */
> +extern struct kobjop_desc sdhci_read_multi_4_desc;
> +/** @brief A function implementing the SDHCI_READ_MULTI_4() method */
> +typedef void sdhci_read_multi_4_t(device_t brdev, struct sdhci_slot *slot,
> +                                  bus_size_t off, uint32_t *data,
> +                                  bus_size_t count);
> +
> +static __inline void SDHCI_READ_MULTI_4(device_t brdev, struct sdhci_slot *slot,
> +                                        bus_size_t off, uint32_t *data,
> +                                        bus_size_t count)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_read_multi_4);
> +	((sdhci_read_multi_4_t *) _m)(brdev, slot, off, data, count);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_WRITE_1() method */
> +extern struct kobjop_desc sdhci_write_1_desc;
> +/** @brief A function implementing the SDHCI_WRITE_1() method */
> +typedef void sdhci_write_1_t(device_t brdev, struct sdhci_slot *slot,
> +                             bus_size_t off, uint8_t val);
> +
> +static __inline void SDHCI_WRITE_1(device_t brdev, struct sdhci_slot *slot,
> +                                   bus_size_t off, uint8_t val)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_write_1);
> +	((sdhci_write_1_t *) _m)(brdev, slot, off, val);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_WRITE_2() method */
> +extern struct kobjop_desc sdhci_write_2_desc;
> +/** @brief A function implementing the SDHCI_WRITE_2() method */
> +typedef void sdhci_write_2_t(device_t brdev, struct sdhci_slot *slot,
> +                             bus_size_t off, uint16_t val);
> +
> +static __inline void SDHCI_WRITE_2(device_t brdev, struct sdhci_slot *slot,
> +                                   bus_size_t off, uint16_t val)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_write_2);
> +	((sdhci_write_2_t *) _m)(brdev, slot, off, val);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_WRITE_4() method */
> +extern struct kobjop_desc sdhci_write_4_desc;
> +/** @brief A function implementing the SDHCI_WRITE_4() method */
> +typedef void sdhci_write_4_t(device_t brdev, struct sdhci_slot *slot,
> +                             bus_size_t off, uint32_t val);
> +
> +static __inline void SDHCI_WRITE_4(device_t brdev, struct sdhci_slot *slot,
> +                                   bus_size_t off, uint32_t val)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_write_4);
> +	((sdhci_write_4_t *) _m)(brdev, slot, off, val);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_WRITE_MULTI_4() method */
> +extern struct kobjop_desc sdhci_write_multi_4_desc;
> +/** @brief A function implementing the SDHCI_WRITE_MULTI_4() method */
> +typedef void sdhci_write_multi_4_t(device_t brdev, struct sdhci_slot *slot,
> +                                   bus_size_t off, uint32_t *data,
> +                                   bus_size_t count);
> +
> +static __inline void SDHCI_WRITE_MULTI_4(device_t brdev,
> +                                         struct sdhci_slot *slot,
> +                                         bus_size_t off, uint32_t *data,
> +                                         bus_size_t count)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_write_multi_4);
> +	((sdhci_write_multi_4_t *) _m)(brdev, slot, off, data, count);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_PLATFORM_WILL_HANDLE() method */
> +extern struct kobjop_desc sdhci_platform_will_handle_desc;
> +/** @brief A function implementing the SDHCI_PLATFORM_WILL_HANDLE() method */
> +typedef int sdhci_platform_will_handle_t(device_t brdev,
> +                                         struct sdhci_slot *slot);
> +
> +static __inline int SDHCI_PLATFORM_WILL_HANDLE(device_t brdev,
> +                                               struct sdhci_slot *slot)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_platform_will_handle);
> +	return ((sdhci_platform_will_handle_t *) _m)(brdev, slot);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_PLATFORM_START_TRANSFER() method */
> +extern struct kobjop_desc sdhci_platform_start_transfer_desc;
> +/** @brief A function implementing the SDHCI_PLATFORM_START_TRANSFER() method */
> +typedef void sdhci_platform_start_transfer_t(device_t brdev,
> +                                             struct sdhci_slot *slot,
> +                                             uint32_t *intmask);
> +
> +static __inline void SDHCI_PLATFORM_START_TRANSFER(device_t brdev,
> +                                                   struct sdhci_slot *slot,
> +                                                   uint32_t *intmask)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_platform_start_transfer);
> +	((sdhci_platform_start_transfer_t *) _m)(brdev, slot, intmask);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_PLATFORM_FINISH_TRANSFER() method */
> +extern struct kobjop_desc sdhci_platform_finish_transfer_desc;
> +/** @brief A function implementing the SDHCI_PLATFORM_FINISH_TRANSFER() method */
> +typedef void sdhci_platform_finish_transfer_t(device_t brdev,
> +                                              struct sdhci_slot *slot);
> +
> +static __inline void SDHCI_PLATFORM_FINISH_TRANSFER(device_t brdev,
> +                                                    struct sdhci_slot *slot)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_platform_finish_transfer);
> +	((sdhci_platform_finish_transfer_t *) _m)(brdev, slot);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_MIN_FREQ() method */
> +extern struct kobjop_desc sdhci_min_freq_desc;
> +/** @brief A function implementing the SDHCI_MIN_FREQ() method */
> +typedef uint32_t sdhci_min_freq_t(device_t brdev, struct sdhci_slot *slot);
> +
> +static __inline uint32_t SDHCI_MIN_FREQ(device_t brdev, struct sdhci_slot *slot)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_min_freq);
> +	return ((sdhci_min_freq_t *) _m)(brdev, slot);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_GET_CARD_PRESENT() method */
> +extern struct kobjop_desc sdhci_get_card_present_desc;
> +/** @brief A function implementing the SDHCI_GET_CARD_PRESENT() method */
> +typedef bool sdhci_get_card_present_t(device_t brdev, struct sdhci_slot *slot);
> +
> +static __inline bool SDHCI_GET_CARD_PRESENT(device_t brdev,
> +                                            struct sdhci_slot *slot)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_get_card_present);
> +	return ((sdhci_get_card_present_t *) _m)(brdev, slot);
> +}
> +
> +/** @brief Unique descriptor for the SDHCI_SET_UHS_TIMING() method */
> +extern struct kobjop_desc sdhci_set_uhs_timing_desc;
> +/** @brief A function implementing the SDHCI_SET_UHS_TIMING() method */
> +typedef void sdhci_set_uhs_timing_t(device_t brdev, struct sdhci_slot *slot);
> +
> +static __inline void SDHCI_SET_UHS_TIMING(device_t brdev,
> +                                          struct sdhci_slot *slot)
> +{
> +	kobjop_t _m;
> +	KOBJOPLOOKUP(((kobj_t)brdev)->ops,sdhci_set_uhs_timing);
> +	((sdhci_set_uhs_timing_t *) _m)(brdev, slot);
> +}
> +
> +#endif /* _sdhci_if_h_ */
> diff --git a/rtemsbsd/local/gpiobus_if.c b/rtemsbsd/local/gpiobus_if.c
> new file mode 100644
> index 0000000..a1c7dd5
> --- /dev/null
> +++ b/rtemsbsd/local/gpiobus_if.c
> @@ -0,0 +1,62 @@
> +#include <machine/rtems-bsd-kernel-space.h>
> +
> +/*
> + * This file is produced automatically.
> + * Do not modify anything in here by hand.
> + *
> + * Created from source file
> + *   freebsd-org/sys/dev/gpio/gpiobus_if.m
> + * with
> + *   makeobjops.awk
> + *
> + * See the source file for legal information
> + */
> +
> +#include <sys/param.h>
> +#include <sys/queue.h>
> +#include <sys/kernel.h>
> +#include <sys/kobj.h>
> +#include <sys/bus.h>
> +#include <sys/gpio.h>
> +#include <rtems/bsd/local/gpiobus_if.h>
> +
> +struct kobjop_desc gpiobus_acquire_bus_desc = {
> +	0, { &gpiobus_acquire_bus_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_release_bus_desc = {
> +	0, { &gpiobus_release_bus_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_set_desc = {
> +	0, { &gpiobus_pin_set_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_get_desc = {
> +	0, { &gpiobus_pin_get_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_toggle_desc = {
> +	0, { &gpiobus_pin_toggle_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_getcaps_desc = {
> +	0, { &gpiobus_pin_getcaps_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_getflags_desc = {
> +	0, { &gpiobus_pin_getflags_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_setflags_desc = {
> +	0, { &gpiobus_pin_setflags_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_getname_desc = {
> +	0, { &gpiobus_pin_getname_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc gpiobus_pin_setname_desc = {
> +	0, { &gpiobus_pin_setname_desc, (kobjop_t)kobj_error_method }
> +};
> +
> diff --git a/rtemsbsd/local/sdhci_if.c b/rtemsbsd/local/sdhci_if.c
> new file mode 100644
> index 0000000..1d6c26d
> --- /dev/null
> +++ b/rtemsbsd/local/sdhci_if.c
> @@ -0,0 +1,90 @@
> +#include <machine/rtems-bsd-kernel-space.h>
> +
> +/*
> + * This file is produced automatically.
> + * Do not modify anything in here by hand.
> + *
> + * Created from source file
> + *   freebsd-org/sys/dev/sdhci/sdhci_if.m
> + * with
> + *   makeobjops.awk
> + *
> + * See the source file for legal information
> + */
> +
> +#include <sys/param.h>
> +#include <sys/queue.h>
> +#include <sys/kernel.h>
> +#include <sys/kobj.h>
> +#include <sys/types.h>
> +#include <sys/bus.h>
> +#include <sys/sysctl.h>
> +#include <sys/taskqueue.h>
> +#include <dev/mmc/bridge.h>
> +#include <dev/sdhci/sdhci.h>
> +
> +static void
> +null_set_uhs_timing(device_t brdev __unused,
> +    struct sdhci_slot *slot __unused)
> +{
> +
> +}
> +
> +#include <rtems/bsd/local/sdhci_if.h>
> +
> +struct kobjop_desc sdhci_read_1_desc = {
> +	0, { &sdhci_read_1_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_read_2_desc = {
> +	0, { &sdhci_read_2_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_read_4_desc = {
> +	0, { &sdhci_read_4_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_read_multi_4_desc = {
> +	0, { &sdhci_read_multi_4_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_write_1_desc = {
> +	0, { &sdhci_write_1_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_write_2_desc = {
> +	0, { &sdhci_write_2_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_write_4_desc = {
> +	0, { &sdhci_write_4_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_write_multi_4_desc = {
> +	0, { &sdhci_write_multi_4_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_platform_will_handle_desc = {
> +	0, { &sdhci_platform_will_handle_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_platform_start_transfer_desc = {
> +	0, { &sdhci_platform_start_transfer_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_platform_finish_transfer_desc = {
> +	0, { &sdhci_platform_finish_transfer_desc, (kobjop_t)kobj_error_method }
> +};
> +
> +struct kobjop_desc sdhci_min_freq_desc = {
> +	0, { &sdhci_min_freq_desc, (kobjop_t)sdhci_generic_min_freq }
> +};
> +
> +struct kobjop_desc sdhci_get_card_present_desc = {
> +	0, { &sdhci_get_card_present_desc, (kobjop_t)sdhci_generic_get_card_present }
> +};
> +
> +struct kobjop_desc sdhci_set_uhs_timing_desc = {
> +	0, { &sdhci_set_uhs_timing_desc, (kobjop_t)null_set_uhs_timing }
> +};
> +
> 



More information about the devel mailing list