|
@@ -2,13 +2,10 @@
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
#include <stdint.h>
|
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
|
-#include <inttypes.h>
|
|
|
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
|
#include <strings.h>
|
|
#include <strings.h>
|
|
|
#include <string.h>
|
|
#include <string.h>
|
|
|
#include <sys/socket.h>
|
|
#include <sys/socket.h>
|
|
|
-#include <sys/time.h>
|
|
|
|
|
-#include <unistd.h>
|
|
|
|
|
#include <time.h>
|
|
#include <time.h>
|
|
|
|
|
|
|
|
#include "Devices/lmx2594.h"
|
|
#include "Devices/lmx2594.h"
|
|
@@ -32,6 +29,7 @@ command commands[] = {{"TMSG44:FREQ ", handle_freq_cmd},
|
|
|
{"*IDN?", handle_idn_cmd},
|
|
{"*IDN?", handle_idn_cmd},
|
|
|
{"TMSG44:OFFSET ", handle_offset_cmd},
|
|
{"TMSG44:OFFSET ", handle_offset_cmd},
|
|
|
{"TMSG44:SLOPE ", handle_slope_cmd},
|
|
{"TMSG44:SLOPE ", handle_slope_cmd},
|
|
|
|
|
+ {"TMSG44:FILE ", handle_file_cmd},
|
|
|
{NULL, NULL} // Завершающий элемент для обозначения конца массива
|
|
{NULL, NULL} // Завершающий элемент для обозначения конца массива
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -44,6 +42,7 @@ void handle_freq_cmd(const char *recv_buff) {
|
|
|
|
|
|
|
|
split_lexeme(recv_buff, freq, sizeof(freq[0]), convert_to_double);
|
|
split_lexeme(recv_buff, freq, sizeof(freq[0]), convert_to_double);
|
|
|
|
|
|
|
|
|
|
+ set_pot_values(freq[0]);
|
|
|
lmx_freq = lmx_get_freq(freq[0]);
|
|
lmx_freq = lmx_get_freq(freq[0]);
|
|
|
f_pd = ad9912_set(pci_bar_1, lmx_freq, f_pd);
|
|
f_pd = ad9912_set(pci_bar_1, lmx_freq, f_pd);
|
|
|
printf("f_pd frequency is set to %.6f MHz\n", f_pd / 1e6);
|
|
printf("f_pd frequency is set to %.6f MHz\n", f_pd / 1e6);
|
|
@@ -63,9 +62,9 @@ void send_data_qspi(reg_addr_pci *pci_bar_1) {
|
|
|
|
|
|
|
|
// Create a header 4 Mosi mode
|
|
// Create a header 4 Mosi mode
|
|
|
uint32_t qspi_header = ((ENUM_SPIMODE_4MOSI) | (0x1 << BITP_GPIO_4MOSI_HEADER) |
|
|
uint32_t qspi_header = ((ENUM_SPIMODE_4MOSI) | (0x1 << BITP_GPIO_4MOSI_HEADER) |
|
|
|
- (0x1 << BITP_SHIFT_REG_4MOSI_HEADER) |
|
|
|
|
|
|
|
+ (0x1 << BITP_SHIFT_REG_4MOSI_HEADER) |+
|
|
|
((sizeof(ad9912_ftw_regs_qspi) / 4) << BITP_DDS_4MOSI_HEADER) |
|
|
((sizeof(ad9912_ftw_regs_qspi) / 4) << BITP_DDS_4MOSI_HEADER) |
|
|
|
- ((sizeof(lmx_change_freq_regs) / 4) << BITP_LMX2594_4MOSI_HEADER) | (TERM_BIT_1));
|
|
|
|
|
|
|
+ ((sizeof(lmx_change_freq_regs) / 4) << BITP_LMX2594_4MOSI_HEADER) | (2 << BITP_POT_4MOSI_HEADER) | (TERM_BIT_1));
|
|
|
|
|
|
|
|
pci_bar_1->sbtmsg_addr = qspi_header;
|
|
pci_bar_1->sbtmsg_addr = qspi_header;
|
|
|
|
|
|
|
@@ -85,6 +84,16 @@ void send_data_qspi(reg_addr_pci *pci_bar_1) {
|
|
|
|
|
|
|
|
// Send the data for the shift register
|
|
// Send the data for the shift register
|
|
|
pci_bar_1->sbtmsg_addr = shift_reg;
|
|
pci_bar_1->sbtmsg_addr = shift_reg;
|
|
|
|
|
+ // Send the data for the potentiometer
|
|
|
|
|
+ pci_bar_1->sbtmsg_addr = pot_ch_a_file;
|
|
|
|
|
+ pci_bar_1->sbtmsg_addr = pot_ch_b_file;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void handle_file_cmd(const char *recv_buff) {
|
|
|
|
|
+ printf("\nHandle command \"TMSG44:FILE\"\n");
|
|
|
|
|
+
|
|
|
|
|
+ /* Read the adjusted potentiometer values from the file */
|
|
|
|
|
+ read_pot_file("/tmp/TMSG44-CoolPi/Potentiometer.txt");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void handle_ld_cmd(const char *recv_buff) {
|
|
void handle_ld_cmd(const char *recv_buff) {
|