9828c69586cb8664f8b408bda64f48adbc3e279d
[openwrt/svn-archive/archive.git] / utils / ucmb / Makefile
1 #
2 # Copyright (C) 2009 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/kernel.mk
9
10 PKG_NAME:=ucmb
11 PKG_RELEASE:=1
12
13 include $(INCLUDE_DIR)/package.mk
14
15
16 define KernelPackage/ucmb
17 SUBMENU:=Other modules
18 DEPENDS:=@LINUX_2_6 +kmod-spi-gpio +kmod-crc16
19 KCONFIG:=CONFIG_SPI=y \
20 CONFIG_SPI_MASTER=y
21 TITLE:=Microcontroller Message Bus
22 FILES:=$(PKG_BUILD_DIR)/ucmb.$(LINUX_KMOD_SUFFIX)
23 AUTOLOAD:=$(call AutoLoad,93,ucmb)
24 endef
25
26 define KernelPackage/ucmb/description
27 The Microcontroller Message Bus is a tiny SPI-GPIO based communication
28 channel used to talk to microcontrollers over GPIO pins.
29 The lowlevel protocol is CRC16 protected, so one can be pretty sure
30 that the data transmitted and received through the /dev/ucmb node is not corrupted.
31 So no further checks should be needed at upper protocol layers.
32 The device node considers every read/write to be one packet. The maximum packet
33 size is either PAGE_SIZE (at least 4kb) or the microcontroller specific packet size
34 limit, which is likely to be a lot smaller than PAGE_SIZE.
35 To register an ucmb device, simply create a struct ucmb_platform_data
36 and register it via ucmb_device_register() from another kernel module.
37 Example implementations for the microcontroller-side code can be found in
38 the utils/ucmb/microcontroller_examples subdirectory of the OpenWRT packages feed.
39 endef
40
41 define Build/Prepare
42 mkdir -p $(PKG_BUILD_DIR)
43 $(CP) ./driver/* $(PKG_BUILD_DIR)/
44 endef
45
46 define Build/Compile
47 $(MAKE) -C "$(LINUX_DIR)" \
48 CROSS_COMPILE="$(TARGET_CROSS)" \
49 ARCH="$(LINUX_KARCH)" \
50 SUBDIRS="$(PKG_BUILD_DIR)" \
51 EXTRA_CFLAGS="$(BUILDFLAGS)" \
52 modules
53 endef
54
55 $(eval $(call KernelPackage,ucmb))