2009-02-18 22:48:42 +00:00
|
|
|
#
|
2010-10-09 15:43:06 +00:00
|
|
|
# Copyright (C) 2010 OpenWrt.org
|
2009-02-18 22:48:42 +00:00
|
|
|
#
|
|
|
|
# This is free software, licensed under the GNU General Public License v2.
|
|
|
|
# See /LICENSE for more information.
|
|
|
|
|
|
|
|
include $(TOPDIR)/rules.mk
|
|
|
|
include $(INCLUDE_DIR)/kernel.mk
|
|
|
|
|
|
|
|
PKG_NAME:=ucmb
|
2010-10-09 15:43:06 +00:00
|
|
|
PKG_RELEASE:=2
|
2009-02-18 22:48:42 +00:00
|
|
|
|
|
|
|
include $(INCLUDE_DIR)/package.mk
|
|
|
|
|
|
|
|
|
|
|
|
define KernelPackage/ucmb
|
|
|
|
SUBMENU:=Other modules
|
2010-10-05 23:56:19 +00:00
|
|
|
DEPENDS:=@!LINUX_2_4 \
|
2009-06-21 12:50:15 +00:00
|
|
|
@!LINUX_2_6_21 @!LINUX_2_6_22 @!LINUX_2_6_23 @!LINUX_2_6_24 \
|
|
|
|
@!LINUX_2_6_25 @!LINUX_2_6_26 @!LINUX_2_6_27 \
|
|
|
|
+kmod-spi-gpio +kmod-crc16
|
2009-02-18 22:48:42 +00:00
|
|
|
KCONFIG:=CONFIG_SPI=y \
|
|
|
|
CONFIG_SPI_MASTER=y
|
2009-04-02 09:41:11 +00:00
|
|
|
TITLE:=Microcontroller Message Bus
|
2009-02-18 22:48:42 +00:00
|
|
|
FILES:=$(PKG_BUILD_DIR)/ucmb.$(LINUX_KMOD_SUFFIX)
|
|
|
|
AUTOLOAD:=$(call AutoLoad,93,ucmb)
|
2010-09-30 10:18:02 +00:00
|
|
|
MAINTAINER:=Michael Buesch <mb@bu3sch.de>
|
2009-02-18 22:48:42 +00:00
|
|
|
endef
|
|
|
|
|
2009-02-19 12:03:32 +00:00
|
|
|
define KernelPackage/ucmb/description
|
|
|
|
The Microcontroller Message Bus is a tiny SPI-GPIO based communication
|
|
|
|
channel used to talk to microcontrollers over GPIO pins.
|
|
|
|
The lowlevel protocol is CRC16 protected, so one can be pretty sure
|
|
|
|
that the data transmitted and received through the /dev/ucmb node is not corrupted.
|
|
|
|
So no further checks should be needed at upper protocol layers.
|
|
|
|
The device node considers every read/write to be one packet. The maximum packet
|
|
|
|
size is either PAGE_SIZE (at least 4kb) or the microcontroller specific packet size
|
|
|
|
limit, which is likely to be a lot smaller than PAGE_SIZE.
|
2009-04-02 09:41:11 +00:00
|
|
|
To register an ucmb device, simply create a struct ucmb_platform_data
|
|
|
|
and register it via ucmb_device_register() from another kernel module.
|
2009-02-19 12:03:32 +00:00
|
|
|
Example implementations for the microcontroller-side code can be found in
|
|
|
|
the utils/ucmb/microcontroller_examples subdirectory of the OpenWRT packages feed.
|
|
|
|
endef
|
|
|
|
|
2009-02-18 22:48:42 +00:00
|
|
|
define Build/Prepare
|
|
|
|
$(CP) ./driver/* $(PKG_BUILD_DIR)/
|
|
|
|
endef
|
|
|
|
|
|
|
|
define Build/Compile
|
|
|
|
$(MAKE) -C "$(LINUX_DIR)" \
|
|
|
|
CROSS_COMPILE="$(TARGET_CROSS)" \
|
|
|
|
ARCH="$(LINUX_KARCH)" \
|
|
|
|
SUBDIRS="$(PKG_BUILD_DIR)" \
|
|
|
|
EXTRA_CFLAGS="$(BUILDFLAGS)" \
|
|
|
|
modules
|
|
|
|
endef
|
|
|
|
|
2010-01-01 23:39:27 +00:00
|
|
|
define Build/InstallDev
|
|
|
|
$(INSTALL_DIR) $(1)/usr/include
|
|
|
|
$(CP) \
|
|
|
|
$(PKG_BUILD_DIR)/ucmb.h \
|
|
|
|
$(1)/usr/include
|
|
|
|
endef
|
|
|
|
|
2009-02-18 22:48:42 +00:00
|
|
|
$(eval $(call KernelPackage,ucmb))
|