====== Interface ====== The following files have been rewritten:
Include/antenna.h Base/Antenna/ICS/* Base/Antenna/Common/antenna.c \begin{comment} And all files that ask for a ICS-card! \end{comment} In table tab:commands you can see the newly defined commands. ====New commands defined==== ^ Name ^ Short description ^ | ''swr_ant_ics_init'' | Initialises the ics-cards, should be called first | | ''swr_ant_ics_get_fs_rx'' | Returns the real sampling-frequency | | ''swr_ant_ics_get_fs_tx'' | Returns the real sampling-frequency | | ''swr_ant_ics_rx'' | Sets the bandwith and the if-frequency | | ''swr_ant_ics_rx_freq'' | Sets the if-frequency of the reception, also while the radio is running | | ''swr_ant_ics_tx'' | Sets the if-frequency of the transmission, also while the radio is running | | ''swr_ant_ics_clk'' | Sets the speed of the clock-reference, as well as the multiplication-factor of the DACs | | ''swr_ant_ics_start'' | Starts the transmission | | ''swr_ant_ics_stop'' | Stops the transmission | | ''swr_ant_ics_io'' | Returns the time left to reach a certain position in the reception | | ''swr_ant_ics_set_synth'' | Sets the synthesizer on the RF-card | | ''swr_ant_ics_write_ddcs'' | Writes the calculated values to the DDCs, can't be called while the radio is running! | \newpage ===== int swr_ant_ics_init( fs_rx, fs_tx, ch_rx, ch_tx, sig_type ); ===== This is the first function to call to initialise the cards. This function can only be called when the cards are not running, as some very basic parameters are defined in here. ==== fs_rx ==== **Type**: double **Description:** sampling frequency for the reception, in Hz. Must be between 10kHz and 3MHz. The sampling-frequency on the reception has some constraints, described in the function //swr_ant_ics_clk//. This sampling-frequency is given in complex samples, so that a sampling frequency of 10MHz gives a theoretical bandwith of 10MHz! See also //swr_ant_ics_rx// ==== fs_tx ==== **Type**: double **Description:** sampling frequency for the transmission, in Hz. Must be between 10kHz and 3MHz. The sampling-frequency of the transmission has some constraints that are described in the function //swr_ant_ics_clk//. This frequency is in complex samples! Please be aware that the DACs have an in-built filter that cuts the useful signal to about 75% of the bandwith of fs_tx. So if fs_tx is 1MHz, the useful bandwith is about 750kHz. ==== ch_tx ==== **Type**: uint **Description:** how many rx-channels, between 0 and 4 ==== ch_tx ==== **Type**: uint **Description:** how many tx-channels, between 0 and 4 ==== sig_type ==== **Type**: swr_signal_type_t **Description:** the desired type of the rx-channels, it depends on the program in the FPGA. A version exists for a one-channel, 32-bit complex reception mode (16bits real and 16bits imaginary), using the DDCs but allowing for a longer aquisition time. In this mode, //ch_tx// must be 0 and //ch_rx// 1. The different signal types correspond to the following: SIG_COMPLEX_ICSis the signal used by most of the radio-systems, as it allows to use the DDC and works with complex signals on the reception path SIG_S16is used for the 802.11. Here the DDCs are completely bypassed and raw ADC-material is received.SIG_S32not implemented yet: DDCs work in wideband real-mode only SIG_COMPLEX_S16uses the modified FPGA to implement a 1-channel 32 to 16 bit conversion, including the DDCs. Used for GPS-reception. After this function has been called, everything is set up so that //swr_ant_init// can be called. All other funtions defined in here are only for more special needs. //swr_ant_ics_init// calls //swr_ant_ics_clk( 100e6, 4, 50e6 )// which initialises the multipliers on the ICS-cards. fs_rx and fs_tx have to meet certain criterias, so the final values may differ from the chosen ones! To get the real values, use the functions //swr_ant_ics_get_fs_rx// as well as the function //swr_ant_ics_get_fs_tx//, which return the re-calculated values. \newpage ===== double swr_ant_ics_get_fs_rx( void ); ===== ===== double swr_ant_ics_get_fs_tx( void ); ===== These function get the actual sampling frequency as calculated by //swr_ant_ics_clk//. They return the actual frequency in Hz, which may differ from the settings, because of the limitations of the cards. ===== void swr_ant_ics_rx( ch, fc, W ); ===== ==== ch ==== **Type**: int **Description:** The affected channel, 0-3 ==== fc ==== **Type**: double **Description:** The new center-frequency ==== W ==== **Type**: double **Description:** The bandwith of the final samples that contain data, relative to fs_rx set by swr_ant_ics_init. W \in {0.085, 0.17, 0.34, 0.5, 0.75}. If a non-existant bandwith is selected, the next-higher (or highest available) will be chosen. fc is re-calculated to fit into [0..\frac{fs_ rx}{2}], using the availability of different Nyquist windows. First it is converted relative to the sampling-frequency: $f=\frac{fc}{fs_rx}$ Then it is converted using: $f_p=\frac{1-\left|\left(f-\lfloor f \rfloor \right ) * 2 - 1 \right |}{2}$ f_p is calculated with 31 bits precision. For a fs_rx of 100MHz this gives a precision of \frac{1}{20}Hz. ===== void swr_ant_ics_rx_freq( ch, fc ); ===== Function to set only the intermediate-frequency of the reception-part. ==== ch ==== **Type**: int **Description:** The affected channel, 0-3 ==== fc ==== **Type**: double **Description:** The new intermediate-frequency, see also the function swr_ant_ics_rx Because it is very difficult to re-program the DDC-chip while the software-radio is running, this function has been written to only re-program the intermediate-frequency and nothing else. This function only calculates the new value to be programmed in the DDC-chip. The final programmation of the chip is done in the DMA-interrupt so that the transmission is not interrupted. ===== void swr_ant_ics_tx( ch, fi_tx ); ===== This sets the intermediate frequency 'fi_tx' for the tx-channel. For the re-calculation of the intermediate frequency, see //swr_ant_ics_rx//. This function can be used without problems during runtime. ==== ch ==== **Type**: int **Description:** The affected channel, 0-3 ==== fi_tx ==== **Type**: double **Description:** center-frequency, in Hz ===== void swr_ant_ics_clk( f_adc dac_mult, f_dac ); ===== The ICS-cards usually are clocked by an external 50MHz-clock. If you set a new clock-frequency, fs_rx and fs_tx are re-calculated and might differ. A frequency set with //swr_ant_ics_init// might be possible with f_dac=50MHz, but not fit correctly into f_dac=25MHz! ==== f_adc ==== **Type**: double **Description:** the external frequency in Hz ==== dac_mult ==== **Type**: int **Description:** the multiplier. One of { 1, 4..16 } ==== f_dac ==== **Type**: double **Description:** the external frequency in Hz ===== void swr_ant_ch_start( void ); ===== Here the channel begins to send/receive data. All initialised antennas begin at once to send/receive. ===== void swr_ant_ch_stop( void ); ===== Here the channel interrupts sending/receiving data. It may be that later on another transmission starts. ===== int swr_ant_ch_io( slot ); ===== This function returns the time to wait so that the next slot will be sent/received. ==== slot ==== **Type**: int **Description:** read/write up to this block ==== return ==== **Type**: int **Description:** The time in micro-seconds (10^{-6}) to wait ===== void swr_ant_ch_set_synth( ch, RF, side); ===== Sets the synthesizer on a given RF-board. Due to some constraints, the RF-boards take quite some time to behave stable in a new frequency. This is in the order of a couple of ms. ==== ch ==== **Type**: int **Description:** The affected channel, 0-3 ==== RF ==== **Type**: double **Description:** The frequency in Hz: [2.3..2.5] * 10^{9} ==== side ==== **Type**: int **Description:** low- or high-injection: 0Auto 1low-injection 2high-injection \newpage ===== void swr_ant_ch_set_freq_diff( ch, freq_diff); ===== As described in the function //swr_ant_ics_tx//, the value for the intermediate tx-frequency has a resolution of 32bits. With this function, you can set an offset to the 'official' value. ==== ch ==== **Type**: int **Description:** The affected channel, 0-3 ==== frec_diff ==== **Type**: long int **Description:** An offset to the set value. The step is \frac{fs_tx}{2^{32}}, where fs_tx includes an eventual multiplicator (usually 4). ===== write_ddcs( void ); ===== A function called //ics554_ddc_set_cic// is used to set the decimation to the desired value. The main problem is the calculation of the attenuation of the signal. This function has been tested for a wide range of decimations and should work without problems.