-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
Showing
3 changed files
with
185 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
# | ||
# 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 | ||
SECTION:=libs | ||
CATEGORY:=Libraries | ||
TITLE:=SX1302/SX1303 HAL | ||
endef | ||
|
||
define Package/sx1302_hal/description | ||
SX1302/SX1303 Hardware Abstraction Layer | ||
endef | ||
|
||
define Package/sx1302_hal-tests | ||
SECTION:=net | ||
CATEGORY:=Network | ||
SUBMENU:=LoRaWAN | ||
TITLE:=Tests for SX1302/SX1303 HAL | ||
DEPENDS:=+sx1302_hal +kmod-usb-acm | ||
endef | ||
|
||
define Package/sx1302_hal-utils | ||
SECTION:=net | ||
CATEGORY:=Network | ||
SUBMENU:=LoRaWAN | ||
TITLE:=Utilities for SX1302/SX1303 HAL | ||
DEPENDS:=+sx1302_hal +kmod-usb-acm | ||
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/install | ||
$(INSTALL_DIR) $(1)/usr/share/sx1302_hal | ||
$(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/reset_lgw.sh \ | ||
$(1)/usr/share/sx1302_hal | ||
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)) | ||
$(eval $(call BuildPackage,sx1302_hal-tests)) | ||
$(eval $(call BuildPackage,sx1302_hal-utils)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
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(-) | ||
|
||
diff --git a/libloragw/Makefile b/libloragw/Makefile | ||
index 881442f..ccffd29 100644 | ||
--- 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) | ||
diff --git a/libtools/Makefile b/libtools/Makefile | ||
index cf84988..86781dc 100644 | ||
--- 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) | ||
-- | ||
2.30.2 | ||
|
27 changes: 27 additions & 0 deletions
27
libs/sx1302_hal/patches/001-add_compatibility_with_basicstation.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
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(+) | ||
|
||
diff --git a/libloragw/inc/loragw_hal.h b/libloragw/inc/loragw_hal.h | ||
index 6e153a3..607b2b3 100644 | ||
--- a/libloragw/inc/loragw_hal.h | ||
+++ b/libloragw/inc/loragw_hal.h | ||
@@ -45,6 +45,7 @@ License: Revised BSD License, see LICENSE.TXT file include in the project | ||
#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 */ | ||
-- | ||
2.30.2 | ||
|