changeset 3975:9940bed2b33e

driver/si446x: add blob ressources to tune configuration
author Jeremie Brunel <jeremie@brunel-ejm.org>
date Fri, 06 Jul 2018 14:53:36 +0200
parents 5ba55e3f043e
children 106f55578f7b
files drivers/rfpacket/si446x/si446x.c drivers/rfpacket/si446x/si446x.h drivers/rfpacket/si446x/si446x_spi.bc
diffstat 3 files changed, 20 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/drivers/rfpacket/si446x/si446x.c	Mon Jul 02 17:44:09 2018 +0200
+++ b/drivers/rfpacket/si446x/si446x.c	Fri Jul 06 14:53:36 2018 +0200
@@ -1508,6 +1508,9 @@
 
   pv->pwr = 0xFFFF;
 
+  if (device_get_param_blob(dev, "rftune", 0, (void**)&pv->rftune))
+    pv->rftune = NULL;
+
   /* Start initialisation */
   si446x_rfp_set_state(pv, SI446X_STATE_INITIALISING);
 
--- a/drivers/rfpacket/si446x/si446x.h	Mon Jul 02 17:44:09 2018 +0200
+++ b/drivers/rfpacket/si446x/si446x.h	Fri Jul 06 14:53:36 2018 +0200
@@ -173,9 +173,10 @@
   /* Request for received packets */
   struct dev_rfpacket_rx_s *rxrq;
   struct dev_rfpacket_rq_s *rq;
+  const uint8_t *rftune;
   /* Current working size and buffer */
+  uint8_t *buffer;
   uint16_t size;
-  uint8_t *buffer;
   /* Interrupt count */
   uint8_t icount;
   uint8_t flags;
@@ -183,7 +184,6 @@
   int16_t pwr;
   bool_t bcrun;
   uint8_t pending;
-
   /* Rssi, carrier level */
   uint8_t carrier, jam_rssi;
   uint32_t rssi;
--- a/drivers/rfpacket/si446x/si446x_spi.bc	Mon Jul 02 17:44:09 2018 +0200
+++ b/drivers/rfpacket/si446x/si446x_spi.bc	Fri Jul 06 14:53:36 2018 +0200
@@ -84,6 +84,21 @@
         ld8i                    %size,                 %buffer
         jmp8                    config_init
   config_done:
+        lde                     %buffer,                  %R_CTX_PV,      _offsetof(si446x_ctx_s, rftune)
+        eq0                     %buffer
+          jmp8                  tune_done
+tune_loop:
+        ld8i                    %size,                 %buffer
+        eq0                     %size
+          jmp8                  tune_done
+        tst32s                  %size,                 7
+          jmp8                  tune_done
+        call16                  %poll_gpio:link,       poll_gpio
+        spi_wrm                 %buffer,               %size,	CS_PULSE
+        add                     %buffer,               %size
+        jmp8                    tune_loop
+
+tune_done:
         mov                     %delay,                 %basetime
         shi32l                  %delay,                 12
         spi_yieldc_delay        %delay