|
@@ -63,11 +63,11 @@ void handleFreqCmd(const char* recvBuff)
|
|
|
// Send the data
|
|
// Send the data
|
|
|
send_data_qspi(bar1);
|
|
send_data_qspi(bar1);
|
|
|
// Return the 1 MOSI mode
|
|
// Return the 1 MOSI mode
|
|
|
- usleep(1);
|
|
|
|
|
- cfg_reg = get_cfg_reg();
|
|
|
|
|
- SET_REGISTER_PARAM(cfg_reg,CFG_REG_SPI_MODE_BITM,CFG_REG_SPI_MODE_BITP, CFG_REG_SPI_MODE_1MOSI);
|
|
|
|
|
- *spi_mode = cfg_reg;
|
|
|
|
|
- set_cfg_reg(cfg_reg);
|
|
|
|
|
|
|
+ // usleep(1);
|
|
|
|
|
+ // cfg_reg = get_cfg_reg();
|
|
|
|
|
+ // SET_REGISTER_PARAM(cfg_reg,CFG_REG_SPI_MODE_BITM,CFG_REG_SPI_MODE_BITP, CFG_REG_SPI_MODE_1MOSI);
|
|
|
|
|
+ // *spi_mode = cfg_reg;
|
|
|
|
|
+ // set_cfg_reg(cfg_reg);
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
void send_data_qspi(void *bar1) {
|
|
void send_data_qspi(void *bar1) {
|
|
@@ -75,7 +75,7 @@ void send_data_qspi(void *bar1) {
|
|
|
uint32_t gpio_reg = get_tmsg_gpio_reg();
|
|
uint32_t gpio_reg = get_tmsg_gpio_reg();
|
|
|
uint32_t shift_reg = get_tmsg_shift_reg();
|
|
uint32_t shift_reg = get_tmsg_shift_reg();
|
|
|
// Create a header 4 Mosi mode
|
|
// Create a header 4 Mosi mode
|
|
|
- uint32_t qspi_header = ((ENUM_SPIMODE_4MOSI) |(0x1 << BITP_GPIO_4MOSI_HEADER) |(0x1 << BITP_SHIFT_REG_4MOSI_HEADER )| ((sizeof(ad9912_ftw_regs_qspi) / 4) << BITP_DDS_4MOSI_HEADER) | ((sizeof(lmx_change_freq_regs) / 4) << BITP_LMX2594_4MOSI_HEADER) | (0x1 << BITP_DAC_4MOSI_HEADER) | (0x1 << BITP_ATT_4MOSI_HEADER) |(0x2 << BITP_POT_4MOSI_HEADER)| TERM_BIT_1);
|
|
|
|
|
|
|
+ uint32_t qspi_header = ((ENUM_SPIMODE_4MOSI) |(0x1 << BITP_GPIO_4MOSI_HEADER) |(0x1 << BITP_SHIFT_REG_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);
|
|
|
uint32_t *data = bar1 + LMX_BASE_ADDR;
|
|
uint32_t *data = bar1 + LMX_BASE_ADDR;
|
|
|
*data = qspi_header;
|
|
*data = qspi_header;
|
|
|
// Initialize the registers
|
|
// Initialize the registers
|
|
@@ -91,14 +91,6 @@ void send_data_qspi(void *bar1) {
|
|
|
}
|
|
}
|
|
|
// Send the data for the shift register
|
|
// Send the data for the shift register
|
|
|
*data = shift_reg;
|
|
*data = shift_reg;
|
|
|
- // Send the data for the potentiometer
|
|
|
|
|
- for (int i = 0; i < sizeof(pot_array) / 4; i++) {
|
|
|
|
|
- *data = pot_array[i];
|
|
|
|
|
- }
|
|
|
|
|
- // Send the data for the DAC
|
|
|
|
|
- *data = armCode[0];
|
|
|
|
|
- // Send the data for the ATT
|
|
|
|
|
- *data = attCode[0];
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -150,7 +142,14 @@ void handleArmCmd(const char* recvBuff)
|
|
|
|
|
|
|
|
splitLexeme(recvBuff, armCode, sizeof(armCode[0]), convertToUInt16);
|
|
splitLexeme(recvBuff, armCode, sizeof(armCode[0]), convertToUInt16);
|
|
|
printf("\n%u\n", armCode[0]);
|
|
printf("\n%u\n", armCode[0]);
|
|
|
- // dac8811_set(bar1,armCode[0]);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ uint32_t cfg_reg = get_cfg_reg();
|
|
|
|
|
+ SET_REGISTER_PARAM(cfg_reg, CFG_REG_SPI_MODE_BITM, CFG_REG_SPI_MODE_BITP, CFG_REG_SPI_MODE_4MOSI);
|
|
|
|
|
+ uint32_t *spi_mode = bar1 +CFG_REG_ADDR;
|
|
|
|
|
+ *spi_mode = cfg_reg;
|
|
|
|
|
+ set_cfg_reg(cfg_reg);
|
|
|
|
|
+
|
|
|
|
|
+ dac8811_set_qspi(bar1,armCode[0]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void handleAttCmd(const char* recvBuff)
|
|
void handleAttCmd(const char* recvBuff)
|
|
@@ -159,7 +158,14 @@ void handleAttCmd(const char* recvBuff)
|
|
|
|
|
|
|
|
splitLexeme(recvBuff, attCode, sizeof(attCode[0]), convertToUInt16);
|
|
splitLexeme(recvBuff, attCode, sizeof(attCode[0]), convertToUInt16);
|
|
|
printf("\n%u\n", attCode[0]);
|
|
printf("\n%u\n", attCode[0]);
|
|
|
- // dac8811_att_set(bar1,attCode[0]);
|
|
|
|
|
|
|
+
|
|
|
|
|
+ uint32_t cfg_reg = get_cfg_reg();
|
|
|
|
|
+ SET_REGISTER_PARAM(cfg_reg, CFG_REG_SPI_MODE_BITM, CFG_REG_SPI_MODE_BITP, CFG_REG_SPI_MODE_4MOSI);
|
|
|
|
|
+ uint32_t *spi_mode = bar1 +CFG_REG_ADDR;
|
|
|
|
|
+ *spi_mode = cfg_reg;
|
|
|
|
|
+ set_cfg_reg(cfg_reg);
|
|
|
|
|
+
|
|
|
|
|
+ dac8811_att_set_qspi(bar1, attCode[0]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void handleIdnCmd(const char* recvBuff)
|
|
void handleIdnCmd(const char* recvBuff)
|
|
@@ -176,14 +182,25 @@ void handleOffsetCmd(const char* recvBuff)
|
|
|
|
|
|
|
|
splitLexeme(recvBuff, offsetCode, sizeof(offsetCode[0]), convertToUInt16);
|
|
splitLexeme(recvBuff, offsetCode, sizeof(offsetCode[0]), convertToUInt16);
|
|
|
printf("\n%u\n", offsetCode[0]);
|
|
printf("\n%u\n", offsetCode[0]);
|
|
|
|
|
+ uint32_t cfg_reg = get_cfg_reg();
|
|
|
|
|
+ SET_REGISTER_PARAM(cfg_reg, CFG_REG_SPI_MODE_BITM, CFG_REG_SPI_MODE_BITP, CFG_REG_SPI_MODE_4MOSI);
|
|
|
|
|
+ uint32_t *spi_mode = bar1 +CFG_REG_ADDR;
|
|
|
|
|
+ *spi_mode = cfg_reg;
|
|
|
|
|
+ set_cfg_reg(cfg_reg);
|
|
|
|
|
+ potentiometer_set_offset(bar1, offsetCode[0]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
void handleSlopeCmd(const char* recvBuff)
|
|
void handleSlopeCmd(const char* recvBuff)
|
|
|
{
|
|
{
|
|
|
printf("\nHandle command \"TMSG44:SLOPE\"\n");
|
|
printf("\nHandle command \"TMSG44:SLOPE\"\n");
|
|
|
-
|
|
|
|
|
splitLexeme(recvBuff, slopeCode, sizeof(slopeCode[0]), convertToUInt16);
|
|
splitLexeme(recvBuff, slopeCode, sizeof(slopeCode[0]), convertToUInt16);
|
|
|
printf("\n%u\n", slopeCode[0]);
|
|
printf("\n%u\n", slopeCode[0]);
|
|
|
|
|
+ uint32_t cfg_reg = get_cfg_reg();
|
|
|
|
|
+ SET_REGISTER_PARAM(cfg_reg, CFG_REG_SPI_MODE_BITM, CFG_REG_SPI_MODE_BITP, CFG_REG_SPI_MODE_4MOSI);
|
|
|
|
|
+ uint32_t *spi_mode = bar1 +CFG_REG_ADDR;
|
|
|
|
|
+ *spi_mode = cfg_reg;
|
|
|
|
|
+ set_cfg_reg(cfg_reg);
|
|
|
|
|
+ potentiometer_set_slope(bar1, slopeCode[0]);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//Проходим по массиву команд и ищем команду, которая совпадает с началом строки recvBuff.
|
|
//Проходим по массиву команд и ищем команду, которая совпадает с началом строки recvBuff.
|