From 5ebcefe167c398e98567bb4c05d7e9fb5bcbcfe7 Mon Sep 17 00:00:00 2001 From: Jason Reiss Date: Fri, 14 Oct 2016 10:05:23 -0500 Subject: lora: move old usb packet forwarder and library utilities to new recipes add spi device path option to packet forwarder and library --- recipes-connectivity/lora/lora-gateway/library.cfg | 73 ---------------------- .../lora/lora-gateway/library_4.0.cfg | 4 +- .../lora-gateway-add-spi-path-function.patch | 57 +++++++++++++++++ .../lora/lora-gateway/lora-gateway-debug.patch | 13 ---- .../lora/lora-gateway/lora-gateway-sync-word.patch | 40 ------------ 5 files changed, 59 insertions(+), 128 deletions(-) delete mode 100644 recipes-connectivity/lora/lora-gateway/library.cfg create mode 100644 recipes-connectivity/lora/lora-gateway/lora-gateway-add-spi-path-function.patch delete mode 100644 recipes-connectivity/lora/lora-gateway/lora-gateway-debug.patch delete mode 100644 recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch (limited to 'recipes-connectivity/lora/lora-gateway') diff --git a/recipes-connectivity/lora/lora-gateway/library.cfg b/recipes-connectivity/lora/lora-gateway/library.cfg deleted file mode 100644 index 01b066d..0000000 --- a/recipes-connectivity/lora/lora-gateway/library.cfg +++ /dev/null @@ -1,73 +0,0 @@ -# That file will be included in the Makefile files that have hardware dependencies - -### SPI interface to the concentrator ### -# Accepted values: -# native Linux native SPI driver (/dev/spidev32766.0) -# ftdi FTDI SPI-over-USB bridge using libmpsse/libftdi/libusb - -CFG_SPI= ftdi -CFG_SPI_DEV = "/dev/spidev32766.2" - -### Concentrator chip ### -# Accepted values: -# sx1301 Semtech SX1301 production chip -# fpga1301 FPGA containing the SX1301 IP - -CFG_CHIP= sx1301 - -### Radio chip(s) ### -# Accepted values: -# sx1257 Dual SX1257 transceivers, covering 860-1000 MHz -# sx1255 Dual SX1255 transceivers, covering 400-510 MHz - -CFG_RADIO= sx1257 - -### RF band configuration ### -# Used to configured frequency restrictions (eg. if a SAW filter is installed) -# Accepted values: -# full Full range supported by the radio(s) -# eu868 ETSI 868 (866) MHz band -# us915 FCC 915 MHz band -# cn470 China 470 MHz band -# eu433 ETSI 433 MHz band -# cn780 China 780 MHz band - -CFG_BAND= full - -### Board misc parameters & calibration ### -# Used to configure misc board options. -# RX RSSI indication and TX power are highly dependant on radio, band, filter -# and RF front-ends, and must be calibrated for each new board design. -# Available calibration parameters: -# dev_nano_868 FPGA-based nano-concentrator, with 868 MHz SAW filter -# ref_1301_868 SX1301 reference board with SX1257 radios, 868 MHz filters -# ref_1301_433 SX1301 reference board with SX1255 radios, 433 MHz filters -# kerlink_868 Kerlink LoRa 868MHz gateway -# kerlink_433 Kerlink LoRa 433MHz gateway -# cisco_433 Cisco LoRa 433MHz gateway -# cisco_470 Cisco LoRa 470MHz gateway -# cisco_780 Cisco LoRa 780MHz gateway -# Keep empty for no calibration parameters (neutral values will be used). - -# MTAC-LORA 900MHz -CFG_BRD= mtaclora - -### Network Type ### -# Accepted values: -# private Default -# lora_mac Only compliant with devices running LoRa MAC - -CFG_NET= private - -### Debug options ### -# Set the DEBUG_* to 1 to activate debug mode in individual modules. -# Warning: that makes the module *very verbose*, do not use for production - -DEBUG_AUX= 0 -DEBUG_SPI= 0 -DEBUG_REG= 0 -# jjg - turning this on is useful to get HAL-related error messages that -# don't print out otherwise. It doesn't seem to add that much printing -# under normal operation. -DEBUG_HAL= 1 -DEBUG_GPS= 0 diff --git a/recipes-connectivity/lora/lora-gateway/library_4.0.cfg b/recipes-connectivity/lora/lora-gateway/library_4.0.cfg index d9d3055..641206f 100644 --- a/recipes-connectivity/lora/lora-gateway/library_4.0.cfg +++ b/recipes-connectivity/lora/lora-gateway/library_4.0.cfg @@ -5,8 +5,8 @@ # Warning: that makes the module *very verbose*, do not use for production DEBUG_AUX= 0 -DEBUG_SPI= 0 -DEBUG_REG= 0 +DEBUG_SPI= 0 +DEBUG_REG= 0 # jjg - turning this on is useful to get HAL-related error messages that # don't print out otherwise. It doesn't seem to add that much printing # under normal operation. diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-add-spi-path-function.patch b/recipes-connectivity/lora/lora-gateway/lora-gateway-add-spi-path-function.patch new file mode 100644 index 0000000..fa5e68c --- /dev/null +++ b/recipes-connectivity/lora/lora-gateway/lora-gateway-add-spi-path-function.patch @@ -0,0 +1,57 @@ +diff --git a/libloragw/inc/loragw_spi.h b/libloragw/inc/loragw_spi.h +index fef1f48..74ef251 100644 +--- a/libloragw/inc/loragw_spi.h ++++ b/libloragw/inc/loragw_spi.h +@@ -46,6 +46,14 @@ Maintainer: Sylvain Miermont + /* -------------------------------------------------------------------------- */ + /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */ + ++/* set SPI device */ ++/** ++@brief LoRa concentrator SPI path configuration for spidev ++@param path pointer to spidev device ++@return LGW_SPI_SUCCESS if path is valid, LGW_SPI_ERROR if not ++*/ ++int lgw_spi_set_path(const char *path); ++ + /** + @brief LoRa concentrator SPI setup (configure I/O and peripherals) + @param spi_target_ptr pointer on a generic pointer to SPI target (implementation dependant) +diff --git a/libloragw/src/loragw_spi.native.c b/libloragw/src/loragw_spi.native.c +index c01ed1c..3472133 100644 +--- a/libloragw/src/loragw_spi.native.c ++++ b/libloragw/src/loragw_spi.native.c +@@ -56,10 +56,24 @@ Maintainer: Sylvain Miermont + #define SPI_SPEED 8000000 + #define SPI_DEV_PATH "/dev/spidev0.0" + //#define SPI_DEV_PATH "/dev/spidev32766.0" ++char* spi_dev_path = SPI_DEV_PATH; + + /* -------------------------------------------------------------------------- */ + /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ + ++/* set SPI device */ ++int lgw_spi_set_path(const char *path) { ++ if (path) { ++ spi_dev_path = path; ++ return LGW_SPI_SUCCESS; ++ } ++ else { ++ return LGW_SPI_ERROR; ++ } ++} ++ ++ ++ + /* SPI initialization and configuration */ + int lgw_spi_open(void **spi_target_ptr) { + int *spi_device = NULL; +@@ -78,7 +92,7 @@ int lgw_spi_open(void **spi_target_ptr) { + } + + /* open SPI device */ +- dev = open(SPI_DEV_PATH, O_RDWR); ++ dev = open(spi_dev_path, O_RDWR); + if (dev < 0) { + DEBUG_PRINTF("ERROR: failed to open SPI device %s\n", SPI_DEV_PATH); + return LGW_SPI_ERROR; diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-debug.patch b/recipes-connectivity/lora/lora-gateway/lora-gateway-debug.patch deleted file mode 100644 index dba4392..0000000 --- a/recipes-connectivity/lora/lora-gateway/lora-gateway-debug.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: git/libloragw/src/loragw_hal.c -=================================================================== ---- git.orig/libloragw/src/loragw_hal.c 2014-12-16 16:07:20.812506157 -0600 -+++ git/libloragw/src/loragw_hal.c 2014-12-16 16:18:34.427454833 -0600 -@@ -1626,6 +1626,8 @@ - break; - } - } -+ -+ DEBUG_PRINTF("DEBUG: Tx pow_index %d, rf_power %d\n", pow_index, tx_pow_table[pow_index].rf_power); - - /* loading TX imbalance correction */ - target_mix_gain = tx_pow_table[pow_index].mix_gain; diff --git a/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch b/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch deleted file mode 100644 index e51e02a..0000000 --- a/recipes-connectivity/lora/lora-gateway/lora-gateway-sync-word.patch +++ /dev/null @@ -1,40 +0,0 @@ -diff --git a/libloragw/inc/loragw_hal.h b/libloragw/inc/loragw_hal.h -index 1516b65..24c5969 100644 ---- a/libloragw/inc/loragw_hal.h -+++ b/libloragw/inc/loragw_hal.h -@@ -302,6 +312,11 @@ struct lgw_pkt_tx_s { - - /* -------------------------------------------------------------------------- */ - /* --- PUBLIC FUNCTIONS PROTOTYPES ------------------------------------------ */ -+/** -+ * @brief Configure the lora synch word -+ * @param word for synch -+ */ -+void lgw_conf_lora_synch_word(uint8_t word); - - /** - @brief Configure an RF chain (must configure before start) -diff --git a/libloragw/src/loragw_hal.c b/libloragw/src/loragw_hal.c -index 5dbdf45..d0fe288 100644 ---- a/libloragw/src/loragw_hal.c -+++ b/libloragw/src/loragw_hal.c -@@ -827,6 +851,19 @@ void lgw_constant_adjust(void) { - /* -------------------------------------------------------------------------- */ - /* --- PUBLIC FUNCTIONS DEFINITION ------------------------------------------ */ - -+void lgw_conf_lora_synch_word(uint8_t word) { -+ uint8_t peak1 = word >> 4; -+ uint8_t peak2 = word & 0x0F; -+ -+ lgw_reg_w(LGW_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */ -+ lgw_reg_w(LGW_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */ -+ lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */ -+ lgw_reg_w(LGW_MBWSSF_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */ -+ lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK1_POS, peak1); /* default 1 */ -+ lgw_reg_w(LGW_TX_FRAME_SYNCH_PEAK2_POS, peak2); /* default 2 */ -+} -+ -+ - int lgw_rxrf_setconf(uint8_t rf_chain, struct lgw_conf_rxrf_s conf) { - - /* check if the concentrator is running */ -- cgit v1.2.3