sx1302_hal: initial check-in
The SX1302 hardware abstraction layer is required by the basicstation to control the concentrator based on SX1302/SX1303 chip. Signed-off-by: Marcus Schref <mschref@web.de>
This commit is contained in:
parent
d3eca9a12c
commit
deb8921629
4 changed files with 173 additions and 0 deletions
109
libs/sx1302_hal/Makefile
Normal file
109
libs/sx1302_hal/Makefile
Normal file
|
@ -0,0 +1,109 @@
|
|||
#
|
||||
# Copyright (C) 2022 TDT AG <development@tdt.de>
|
||||
#
|
||||
# This is free software, licensed under the GNU General Public License v2.
|
||||
# See /LICENSE for more information.
|
||||
#
|
||||
#
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=sx1302_hal
|
||||
PKG_VERSION:=2.1.0
|
||||
PKG_RELEASE:=$(AUTORELEASE)
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/Lora-net/sx1302_hal/tar.gz/V$(PKG_VERSION)?
|
||||
PKG_HASH:=4b62aa6a83ad449c68fdd844fc35024586c9faabca3c5a90a2544735b380de5b
|
||||
|
||||
PKG_MAINTAINER:=Marcus Schref <mschref@tdt.de>
|
||||
PKG_LICENSE:=MIT BSD-3-Clause
|
||||
PKG_LICENSE_FILES:=LICENSE.TXT
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
|
||||
define Package/sx1302_hal/Default
|
||||
SECTION:=libs
|
||||
CATEGORY:=Libraries
|
||||
SUBMENU:=IoT
|
||||
TITLE:=SX1302/SX1303 HAL
|
||||
endef
|
||||
|
||||
define Package/sx1302_hal-tests
|
||||
$(call Package/sx1302_hal/Default)
|
||||
TITLE+=(Tests)
|
||||
DEPENDS:=+kmod-usb-acm
|
||||
endef
|
||||
|
||||
define Package/sx1302_hal-tests/description
|
||||
Tests for SX1302/SX1303 Hardware Abstraction Layer
|
||||
endef
|
||||
|
||||
define Package/sx1302_hal-utils
|
||||
$(call Package/sx1302_hal/Default)
|
||||
TITLE+=(Utilities)
|
||||
DEPENDS:=+kmod-usb-acm
|
||||
endef
|
||||
|
||||
define Package/sx1302_hal-utils/description
|
||||
Utilities for SX1302/SX1303 Hardware Abstraction Layer
|
||||
endef
|
||||
|
||||
CFLAGS = $(TARGET_CFLAGS)
|
||||
|
||||
define Build/Compile
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/libtools \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(ARCH)"
|
||||
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/libloragw \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(ARCH)"
|
||||
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/util_boot \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(ARCH)"
|
||||
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/util_chip_id \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(ARCH)"
|
||||
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/util_net_downlink \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(ARCH)"
|
||||
|
||||
$(MAKE) -C $(PKG_BUILD_DIR)/util_spectral_scan \
|
||||
CROSS_COMPILE="$(TARGET_CROSS)" \
|
||||
ARCH="$(ARCH)"
|
||||
endef
|
||||
|
||||
define Build/InstallDev
|
||||
$(INSTALL_DIR) $(1)/usr/include
|
||||
$(CP) $(PKG_BUILD_DIR)/libtools/inc/tinymt32.h $(1)/usr/include
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libtools/libtinymt32.a $(1)/usr/lib
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/include/lgw
|
||||
$(CP) $(PKG_BUILD_DIR)/libloragw/inc/*.h $(1)/usr/include/lgw
|
||||
|
||||
$(INSTALL_DIR) $(1)/usr/lib
|
||||
$(CP) $(PKG_BUILD_DIR)/libloragw/*.a $(1)/usr/lib
|
||||
endef
|
||||
|
||||
define Package/sx1302_hal-tests/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/libloragw/test* $(1)/usr/bin
|
||||
endef
|
||||
|
||||
define Package/sx1302_hal-utils/install
|
||||
$(INSTALL_DIR) $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/util_boot/boot $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/util_chip_id/chip_id $(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/util_net_downlink/net_downlink \
|
||||
$(1)/usr/bin
|
||||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/util_spectral_scan/spectral_scan \
|
||||
$(1)/usr/bin
|
||||
endef
|
||||
|
||||
$(eval $(call BuildPackage,sx1302_hal-tests))
|
||||
$(eval $(call BuildPackage,sx1302_hal-utils))
|
35
libs/sx1302_hal/patches/000-edit_cflags.patch
Normal file
35
libs/sx1302_hal/patches/000-edit_cflags.patch
Normal file
|
@ -0,0 +1,35 @@
|
|||
From 389e8138f543baf334442ca52edf5f7b4cfe13dc Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Schref <mschref@web.de>
|
||||
Date: Mon, 22 Aug 2022 10:02:13 +0200
|
||||
Subject: [PATCH] sx1302_hal: edit cflags
|
||||
|
||||
Enable use of TARGET_CFLAGS in addition to specified CFLAGS
|
||||
|
||||
Signed-off-by: Marcus Schref <mschref@web.de>
|
||||
---
|
||||
libloragw/Makefile | 2 +-
|
||||
libtools/Makefile | 2 +-
|
||||
2 files changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
--- a/libloragw/Makefile
|
||||
+++ b/libloragw/Makefile
|
||||
@@ -11,7 +11,7 @@ CROSS_COMPILE ?=
|
||||
CC := $(CROSS_COMPILE)gcc
|
||||
AR := $(CROSS_COMPILE)ar
|
||||
|
||||
-CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I. -I../libtools/inc
|
||||
+CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I. -I../libtools/inc
|
||||
|
||||
OBJDIR = obj
|
||||
INCLUDES = $(wildcard inc/*.h) $(wildcard ../libtools/inc/*.h)
|
||||
--- a/libtools/Makefile
|
||||
+++ b/libtools/Makefile
|
||||
@@ -7,7 +7,7 @@ CROSS_COMPILE ?=
|
||||
CC := $(CROSS_COMPILE)gcc
|
||||
AR := $(CROSS_COMPILE)ar
|
||||
|
||||
-CFLAGS := -O2 -Wall -Wextra -std=c99 -Iinc -I.
|
||||
+CFLAGS += -O2 -Wall -Wextra -std=c99 -Iinc -I.
|
||||
|
||||
OBJDIR = obj
|
||||
INCLUDES = $(wildcard inc/*.h)
|
|
@ -0,0 +1,22 @@
|
|||
From a6ae15dc6709e32f0604b6eeb0f07cc50bde18b1 Mon Sep 17 00:00:00 2001
|
||||
From: Marcus Schref <mschref@web.de>
|
||||
Date: Mon, 22 Aug 2022 10:06:03 +0200
|
||||
Subject: [PATCH] sx1302_hal: add compatibility with basicstation
|
||||
|
||||
Add LGW_LBT_ISSUE define used by Basicstation
|
||||
|
||||
Signed-off-by: Marcus Schref <mschref@web.de>
|
||||
---
|
||||
libloragw/inc/loragw_hal.h | 1 +
|
||||
1 file changed, 1 insertion(+)
|
||||
|
||||
--- a/libloragw/inc/loragw_hal.h
|
||||
+++ b/libloragw/inc/loragw_hal.h
|
||||
@@ -45,6 +45,7 @@ License: Revised BSD License, see LICENS
|
||||
#define LGW_HAL_SUCCESS 0
|
||||
#define LGW_HAL_ERROR -1
|
||||
#define LGW_LBT_NOT_ALLOWED 1
|
||||
+#define LGW_LBT_ISSUE 1
|
||||
|
||||
/* radio-specific parameters */
|
||||
#define LGW_XTAL_FREQU 32000000 /* frequency of the RF reference oscillator */
|
7
libs/sx1302_hal/test.sh
Normal file
7
libs/sx1302_hal/test.sh
Normal file
|
@ -0,0 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$1" = 'sx1302_hal-tests' ]; then
|
||||
test_loragw_com -h 2>&1 | grep "$2"
|
||||
elif [ "$1" = 'sx1302_hal-utils' ]; then
|
||||
chip_id -h 2>&1 | grep "$2"
|
||||
fi
|
Loading…
Reference in a new issue