commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r8629 - in usrp2/branches/features/host-ng/firmware: a


From: eb
Subject: [Commit-gnuradio] r8629 - in usrp2/branches/features/host-ng/firmware: apps lib
Date: Thu, 19 Jun 2008 14:48:14 -0600 (MDT)

Author: eb
Date: 2008-06-19 14:48:14 -0600 (Thu, 19 Jun 2008)
New Revision: 8629

Modified:
   usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c
   usrp2/branches/features/host-ng/firmware/lib/memory_map.h
Log:
check range of interp and decim

Modified: usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c
===================================================================
--- usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c       
2008-06-19 20:37:56 UTC (rev 8628)
+++ usrp2/branches/features/host-ng/firmware/apps/app_common_v2.c       
2008-06-19 20:48:14 UTC (rev 8629)
@@ -139,7 +139,10 @@
   }
 
   if (p->valid & CFGV_INTERP_DECIM){
-    dsp_tx_regs->interp_rate = p->interp;
+    if (p->interp < MIN_INTERP || p->interp > MAX_INTERP)
+      ok = false;
+    else
+      dsp_tx_regs->interp_rate = p->interp;
   }
 
   if (p->valid & CFGV_SCALE_IQ){
@@ -201,8 +204,12 @@
       decim = decim >> 1;
     }
     
-    dsp_rx_regs->decim_rate = (hb1<<9) | (hb2<<8) | decim;
-    // printf("Decim: %d, register %d\n", p->decim, (hb1<<9) | (hb2<<8) | 
decim);
+    if (decim < MIN_DECIM || decim > MAX_DECIM)
+      ok = false;
+    else {
+      dsp_rx_regs->decim_rate = (hb1<<9) | (hb2<<8) | decim;
+      // printf("Decim: %d, register %d\n", p->decim, (hb1<<9) | (hb2<<8) | 
decim);
+    }
   }
 
   if (p->valid & CFGV_SCALE_IQ){

Modified: usrp2/branches/features/host-ng/firmware/lib/memory_map.h
===================================================================
--- usrp2/branches/features/host-ng/firmware/lib/memory_map.h   2008-06-19 
20:37:56 UTC (rev 8628)
+++ usrp2/branches/features/host-ng/firmware/lib/memory_map.h   2008-06-19 
20:48:14 UTC (rev 8629)
@@ -366,6 +366,9 @@
 
 // --- dsp tx regs ---
 
+#define MIN_INTERP     1
+#define        MAX_INTERP    128
+
 typedef struct {
   volatile int32_t     freq;
   volatile uint32_t    scale_iq;       // {scale_i,scale_q}
@@ -380,6 +383,9 @@
 
 #define T_NOW (-1)
 
+#define        MIN_DECIM       1
+#define        MAX_DECIM     128
+
 typedef struct {
   volatile int32_t     freq;
   volatile uint32_t    scale_iq;       // {scale_i,scale_q}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]