|
@@ -1,9 +1,9 @@
|
|
|
#include "lmx2594.h"
|
|
#include "lmx2594.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
-const uint32_t lmx2594_rst[2] = {
|
|
|
|
|
- 0x00251e,
|
|
|
|
|
- 0x00251c
|
|
|
|
|
|
|
+const uint32_t lmx2594_rst[] = {
|
|
|
|
|
+ 0x002516,
|
|
|
|
|
+ 0x002514
|
|
|
};
|
|
};
|
|
|
uint32_t lmx2594regs[LMX_COUNT] = {
|
|
uint32_t lmx2594regs[LMX_COUNT] = {
|
|
|
0x700000,
|
|
0x700000,
|
|
@@ -40,10 +40,10 @@ uint32_t lmx2594regs[LMX_COUNT] = {
|
|
|
0x510000,
|
|
0x510000,
|
|
|
0x500000,
|
|
0x500000,
|
|
|
0x4F0000,
|
|
0x4F0000,
|
|
|
- 0x4E0105,
|
|
|
|
|
|
|
+ 0x4E016F,
|
|
|
0x4D0000,
|
|
0x4D0000,
|
|
|
0x4C000C,
|
|
0x4C000C,
|
|
|
- 0x4B0C40,
|
|
|
|
|
|
|
+ 0x4B0800,
|
|
|
0x4A0000,
|
|
0x4A0000,
|
|
|
0x49003F,
|
|
0x49003F,
|
|
|
0x480001,
|
|
0x480001,
|
|
@@ -72,16 +72,16 @@ uint32_t lmx2594regs[LMX_COUNT] = {
|
|
|
0x314180,
|
|
0x314180,
|
|
|
0x300300,
|
|
0x300300,
|
|
|
0x2F0300,
|
|
0x2F0300,
|
|
|
- 0x2E07FD,
|
|
|
|
|
|
|
+ 0x2E07FC,
|
|
|
0x2DC8DF,
|
|
0x2DC8DF,
|
|
|
- 0x2C1F20,
|
|
|
|
|
|
|
+ 0x2C1FA3,
|
|
|
0x2B0000,
|
|
0x2B0000,
|
|
|
0x2A0000,
|
|
0x2A0000,
|
|
|
0x290000,
|
|
0x290000,
|
|
|
0x280000,
|
|
0x280000,
|
|
|
0x2703E8,
|
|
0x2703E8,
|
|
|
0x260000,
|
|
0x260000,
|
|
|
- 0x250104,
|
|
|
|
|
|
|
+ 0x250304,
|
|
|
0x240032,
|
|
0x240032,
|
|
|
0x230004,
|
|
0x230004,
|
|
|
0x220000,
|
|
0x220000,
|
|
@@ -98,13 +98,13 @@ uint32_t lmx2594regs[LMX_COUNT] = {
|
|
|
0x17007C,
|
|
0x17007C,
|
|
|
0x160001,
|
|
0x160001,
|
|
|
0x150401,
|
|
0x150401,
|
|
|
- 0x14D848,
|
|
|
|
|
|
|
+ 0x14F848,
|
|
|
0x1327B7,
|
|
0x1327B7,
|
|
|
0x120064,
|
|
0x120064,
|
|
|
0x11012C,
|
|
0x11012C,
|
|
|
0x100080,
|
|
0x100080,
|
|
|
0x0F064F,
|
|
0x0F064F,
|
|
|
- 0x0E1E70,
|
|
|
|
|
|
|
+ 0x0E1E40,
|
|
|
0x0D4000,
|
|
0x0D4000,
|
|
|
0x0C5001,
|
|
0x0C5001,
|
|
|
0x0B0018,
|
|
0x0B0018,
|
|
@@ -117,7 +117,7 @@ uint32_t lmx2594regs[LMX_COUNT] = {
|
|
|
0x041443,
|
|
0x041443,
|
|
|
0x030642,
|
|
0x030642,
|
|
|
0x020500,
|
|
0x020500,
|
|
|
- 0x01080B,
|
|
|
|
|
|
|
+ 0x010808,
|
|
|
0x00251C
|
|
0x00251C
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -126,7 +126,7 @@ void lmx2594_init(void *bar1) {
|
|
|
uint32_t *ptr_rst = bar1 + LMX_BASE_ADDR;
|
|
uint32_t *ptr_rst = bar1 + LMX_BASE_ADDR;
|
|
|
*ptr_rst = LMX2594_RST_HEADER;
|
|
*ptr_rst = LMX2594_RST_HEADER;
|
|
|
// Reset Data
|
|
// Reset Data
|
|
|
- for (int m = 0; m < 2; m++) {
|
|
|
|
|
|
|
+ for (int m = 0; m < (sizeof(lmx2594_rst))/4; m++) {
|
|
|
uint32_t *ptr = bar1 + LMX_BASE_ADDR;
|
|
uint32_t *ptr = bar1 + LMX_BASE_ADDR;
|
|
|
*ptr = lmx2594_rst[m];
|
|
*ptr = lmx2594_rst[m];
|
|
|
}
|
|
}
|
|
@@ -159,12 +159,12 @@ int lmx_freq_set_main_band(void *bar1, double freq, double f_pd) {
|
|
|
uint32_t N = (uint32_t) N_div;
|
|
uint32_t N = (uint32_t) N_div;
|
|
|
// In frac part there is separate denominator and numerator
|
|
// In frac part there is separate denominator and numerator
|
|
|
// If frac part is 0 then the denominator is 1000 and numerator is 0
|
|
// If frac part is 0 then the denominator is 1000 and numerator is 0
|
|
|
- uint32_t frac_n = (uint32_t) ((N_div - N) * 524287);
|
|
|
|
|
- uint32_t frac_d = 524287;
|
|
|
|
|
|
|
+ uint32_t frac_n = (uint32_t) ((N_div - N) * (4294967295-1));
|
|
|
|
|
+ uint32_t frac_d = 4294967295-1;
|
|
|
// If frac part is 0 then the denominator is 1000 and numerator is 0
|
|
// If frac part is 0 then the denominator is 1000 and numerator is 0
|
|
|
if (frac_n == 0) {
|
|
if (frac_n == 0) {
|
|
|
frac_n = 0;
|
|
frac_n = 0;
|
|
|
- frac_d = 524287;
|
|
|
|
|
|
|
+ frac_d = 1000;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// Partial assist for the calibration
|
|
// Partial assist for the calibration
|
|
@@ -329,8 +329,8 @@ int lmx_freq_set_main_band(void *bar1, double freq, double f_pd) {
|
|
|
printf("f_vco = %f\n", freq);
|
|
printf("f_vco = %f\n", freq);
|
|
|
printf("SEG1_EN %08X\n",lmx2594regs[112 - CHDIV_DIV2]);
|
|
printf("SEG1_EN %08X\n",lmx2594regs[112 - CHDIV_DIV2]);
|
|
|
printf("N = %d\n", N);
|
|
printf("N = %d\n", N);
|
|
|
- printf("frac_n = %d\n", frac_n);
|
|
|
|
|
- printf("frac_d = %d\n", frac_d);
|
|
|
|
|
|
|
+ printf("frac_n = %u\n", frac_n);
|
|
|
|
|
+ printf("frac_d = %u\n", frac_d);
|
|
|
return 0;
|
|
return 0;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -485,12 +485,12 @@ int lmx_freq_set_out_of_band(void *bar1, double freq, double f_pd) {
|
|
|
|
|
|
|
|
// divide whole part and fractional part
|
|
// divide whole part and fractional part
|
|
|
uint32_t N = (uint32_t) N_div;
|
|
uint32_t N = (uint32_t) N_div;
|
|
|
- uint32_t frac_n = (uint32_t) ((N_div - N) * 524287);
|
|
|
|
|
- uint32_t frac_d = 524287;
|
|
|
|
|
|
|
+ uint32_t frac_n = (uint32_t) ((N_div - N) * (4294967295-1));
|
|
|
|
|
+ uint32_t frac_d = 4294967295-1;
|
|
|
// If frac part is 0 then the denominator is 1000 and numerator is 0
|
|
// If frac part is 0 then the denominator is 1000 and numerator is 0
|
|
|
if (frac_n == 0) {
|
|
if (frac_n == 0) {
|
|
|
frac_n = 0;
|
|
frac_n = 0;
|
|
|
- frac_d = 524287;
|
|
|
|
|
|
|
+ frac_d = 1000;
|
|
|
}
|
|
}
|
|
|
// Partial assist for the calibration
|
|
// Partial assist for the calibration
|
|
|
|
|
|
|
@@ -660,8 +660,8 @@ int lmx_freq_set_out_of_band(void *bar1, double freq, double f_pd) {
|
|
|
printf("f_vco = %f\n", f_vco);
|
|
printf("f_vco = %f\n", f_vco);
|
|
|
printf("SEG1_EN %08X\n",lmx2594regs[112 - CHDIV_DIV2]);
|
|
printf("SEG1_EN %08X\n",lmx2594regs[112 - CHDIV_DIV2]);
|
|
|
printf("N = %d\n", N);
|
|
printf("N = %d\n", N);
|
|
|
- printf("frac_n = %d\n", frac_n);
|
|
|
|
|
- printf("frac_d = %d\n", frac_d);
|
|
|
|
|
|
|
+ printf("frac_n = %u\n", frac_n);
|
|
|
|
|
+ printf("frac_d = %u\n", frac_d);
|
|
|
printf("chan_div = %d\n", chan_div);
|
|
printf("chan_div = %d\n", chan_div);
|
|
|
printf("chan_div_reg = %d\n", ch_div_reg);
|
|
printf("chan_div_reg = %d\n", ch_div_reg);
|
|
|
return 0;
|
|
return 0;
|