From b7f16132109639f54215247fab633b947fddff56 Mon Sep 17 00:00:00 2001
From: Edward Longman <el7g15@soton.ac.uk>
Date: Thu, 16 May 2019 11:59:22 +0100
Subject: [PATCH] Fix includes and some wrong port selection

---
 source/lib/radio_drv/cc1101_drv/cc1101_drv.c  | 12 +++++------
 .../lib/radio_drv/cc1101_drv/cc1101_utils.c   | 20 +++++++++----------
 source/lib/radio_drv/cc112x_drv/cc112x_drv.c  | 12 +++++------
 .../lib/radio_drv/cc112x_drv/cc112x_utils.c   |  2 +-
 source/lib/radio_drv/cc1190_drv/cc1190_drv.c  |  4 ++--
 source/lib/radio_drv/debug_ld_op.log          |  0
 .../lib/radio_drv/hal_spi_rf_exp430fr5994.h   |  6 +++---
 source/lib/radio_drv/hal_types.h              |  5 ++---
 8 files changed, 30 insertions(+), 31 deletions(-)
 create mode 100644 source/lib/radio_drv/debug_ld_op.log

diff --git a/source/lib/radio_drv/cc1101_drv/cc1101_drv.c b/source/lib/radio_drv/cc1101_drv/cc1101_drv.c
index d1b200e..0cd943e 100644
--- a/source/lib/radio_drv/cc1101_drv/cc1101_drv.c
+++ b/source/lib/radio_drv/cc1101_drv/cc1101_drv.c
@@ -36,11 +36,11 @@
  *
  ******************************************************************************/
 #include "msp430.h"
-#include "cc1101_def.h"
-#include "radio_drv.h"
-#include "hal_spi_rf.h"
-#include "hal_timer.h"
-#include "cc1190_drv.h"
+#include "../cc1101_drv/cc1101_def.h"
+#include "../radio_drv.h"
+#include "../hal_spi_rf.h"
+#include "../../hal_mcu/hal_timer.h"
+#include "../cc1190_drv/cc1190_drv.h"
 
 #ifdef USE_CC1101
 
@@ -51,7 +51,7 @@
 /*******************************************************************************
  * Globals used inside the physical layer
  *******************************************************************************/
-unsigned char paTable[1];           
+unsigned char paTable[1];
 unsigned char rf_end_packet = 0;
 
 // Data format = Normal mode
diff --git a/source/lib/radio_drv/cc1101_drv/cc1101_utils.c b/source/lib/radio_drv/cc1101_drv/cc1101_utils.c
index b813152..1c70ef9 100644
--- a/source/lib/radio_drv/cc1101_drv/cc1101_utils.c
+++ b/source/lib/radio_drv/cc1101_drv/cc1101_utils.c
@@ -39,7 +39,7 @@
 #include "stdlib.h"
 #include "msp430.h"
 #include "cc1101_def.h"
-#include "hal_spi_rf.h"
+#include "../hal_spi_rf.h"
 
 #ifdef USE_CC1101
 
@@ -85,7 +85,7 @@ void set_tx_modulated_test_mode(void) {
 
    reg_access = 0x26;
    trx8BitRegAccess(RADIO_WRITE_ACCESS, PKTCTRL0, &reg_access, 1);
-  
+
 }
 
 /******************************************************************************
@@ -104,15 +104,15 @@ void set_tx_modulated_test_mode(void) {
 int radio_get_rssi(void) {
   int rssi;
   unsigned char cc_rssi;
-  
+
   trx8BitRegAccess(RADIO_READ_ACCESS | RADIO_BURST_ACCESS, RSSI, &cc_rssi, 1);
-  
+
   if (cc_rssi >= 128) {
     rssi = ((cc_rssi-256)>>1) - 72;
   } else {
     rssi = (cc_rssi>>1) - 72;
   }
-  return rssi; 
+  return rssi;
 }
 
 /******************************************************************************
@@ -131,7 +131,7 @@ int radio_get_rssi(void) {
 char get_device_id(void) {
   unsigned char ret_partnum;
   unsigned char ret_version;
-  
+
   trx8BitRegAccess(RADIO_READ_ACCESS+RADIO_BURST_ACCESS, VERSION, &ret_version, 1);
   trx8BitRegAccess(RADIO_READ_ACCESS+RADIO_BURST_ACCESS, PARTNUM, &ret_partnum, 1);
 
@@ -139,13 +139,13 @@ char get_device_id(void) {
   case 0:
     if(ret_version == 0x04) {
       return DEV_CC1101;
-    } 
+    }
     if(ret_version == 0x07) {
       return DEV_CC1101;
-    } 
+    }
     if(ret_version == 0x06) {
       return DEV_CC430x;
-    }    
+    }
     if(ret_version == 0x00) {
       return DEV_CC1100;
     }
@@ -158,7 +158,7 @@ char get_device_id(void) {
   default:
     break;
   }
-  
+
   return DEV_UNKNOWN;
 }
 
diff --git a/source/lib/radio_drv/cc112x_drv/cc112x_drv.c b/source/lib/radio_drv/cc112x_drv/cc112x_drv.c
index 05f0d9f..d03c7dc 100644
--- a/source/lib/radio_drv/cc112x_drv/cc112x_drv.c
+++ b/source/lib/radio_drv/cc112x_drv/cc112x_drv.c
@@ -42,10 +42,11 @@
 #include "stdlib.h"
 #include "msp430.h"
 #include "cc112x_def.h"
-#include "radio_drv.h"
-#include "hal_spi_rf.h"
-#include "hal_timer.h"
-#include "cc1190_drv.h"
+#include "../radio_drv.h"
+#include "../hal_spi_rf.h"
+#include "../../hal_mcu/hal_timer.h"
+#include "../cc1190_drv/cc1190_drv.h"
+#include "../hal_types.h"
 
 #ifdef USE_CC112X
 
@@ -927,8 +928,7 @@ int radio_freq_error(void) {
  * @return      void
  *
  */
-#pragma vector=RF_PORT_VECTOR
-__interrupt void radio_isr(void) {
+HAL_ISR_FUNC_DECLARATION(radio_isr,RF_PORT){
 
 	if(RF_GDO_PxIFG & RF_GDO_PIN) {
 
diff --git a/source/lib/radio_drv/cc112x_drv/cc112x_utils.c b/source/lib/radio_drv/cc112x_drv/cc112x_utils.c
index 9604765..2e0af3c 100644
--- a/source/lib/radio_drv/cc112x_drv/cc112x_utils.c
+++ b/source/lib/radio_drv/cc112x_drv/cc112x_utils.c
@@ -39,7 +39,7 @@
 #include "stdlib.h"
 #include "msp430.h"
 #include "cc112x_def.h"
-#include "hal_spi_rf.h"
+#include "../hal_spi_rf.h"
 
 #ifdef USE_CC112X
 
diff --git a/source/lib/radio_drv/cc1190_drv/cc1190_drv.c b/source/lib/radio_drv/cc1190_drv/cc1190_drv.c
index a1f8057..19b90aa 100644
--- a/source/lib/radio_drv/cc1190_drv/cc1190_drv.c
+++ b/source/lib/radio_drv/cc1190_drv/cc1190_drv.c
@@ -35,8 +35,8 @@
  *
  *******************************************************************************/
 #include "msp430.h"
-#include "hal_spi_rf.h"
-#include "cc112x_def.h"
+#include "../hal_spi_rf.h"
+#include "../cc112x_drv/cc112x_def.h"
 
 /******************************************************************************
  * @fn         range_extender_rxon
diff --git a/source/lib/radio_drv/debug_ld_op.log b/source/lib/radio_drv/debug_ld_op.log
new file mode 100644
index 0000000..e69de29
diff --git a/source/lib/radio_drv/hal_spi_rf_exp430fr5994.h b/source/lib/radio_drv/hal_spi_rf_exp430fr5994.h
index 44a4f77..ce25f56 100644
--- a/source/lib/radio_drv/hal_spi_rf_exp430fr5994.h
+++ b/source/lib/radio_drv/hal_spi_rf_exp430fr5994.h
@@ -67,7 +67,7 @@ extern "C" {
  */
 
 /* Transceiver SPI signal */
-#define     RF_PORT_SEL            P5SEL
+#define     RF_PORT_SEL            P5SEL0
 #define     RF_PORT_OUT            P5OUT
 #define     RF_PORT_DIR            P5DIR
 #define     RF_PORT_IN             P5IN
@@ -77,13 +77,13 @@ extern "C" {
 #define     RF_SCLK_PIN            BIT2
 
 /* Transceiver chip select signal */
-#define     RF_CS_N_PORT_SEL       P4SEL
+#define     RF_CS_N_PORT_SEL       P4SEL0
 #define     RF_CS_N_PORT_DIR       P4DIR
 #define     RF_CS_N_PORT_OUT       P4OUT
 #define     RF_CS_N_PIN            BIT4
 
 /* Transciever optional reset signal */
-#define     RF_RESET_N_PORT_SEL       P8SEL
+#define     RF_RESET_N_PORT_SEL       P8SEL0
 #define     RF_RESET_N_PORT_DIR       P8DIR
 #define     RF_RESET_N_PORT_OUT       P8OUT
 #define     RF_RESET_N_PIN            BIT3
diff --git a/source/lib/radio_drv/hal_types.h b/source/lib/radio_drv/hal_types.h
index 400f97f..6869bde 100644
--- a/source/lib/radio_drv/hal_types.h
+++ b/source/lib/radio_drv/hal_types.h
@@ -232,10 +232,9 @@ typedef unsigned short istate_t;
 #define FAR
 #define NOP()  __no_operation()
 #define HAL_ISR_FUNC_DECLARATION(f,v)   \
-    void f(void) interrupt v
-    void __attribute__((interrupt(v##_VECTOR))) f(void)
+    void __attribute__((interrupt(v ## _VECTOR))) f(void)
 #define HAL_ISR_FUNC_PROTOTYPE(f,v)     \
-    void __attribute__((interrupt(v##_VECTOR))) f(void)
+    void __attribute__((interrupt(v ## _VECTOR))) f(void)
 #define HAL_ISR_FUNCTION(f,v)           \
     HAL_ISR_FUNC_PROTOTYPE(f,v); HAL_ISR_FUNC_DECLARATION(f,v)
 
-- 
GitLab