1 /* 2 * Copyright 2018 Oticon A/S 3 * 4 * SPDX-License-Identifier: Apache-2.0 5 */ 6 #ifndef P2G4_CHANNEL_IF 7 #define P2G4_CHANNEL_IF 8 9 #include "bs_types.h" 10 #include "p2G4_pending_tx_rx_list.h" 11 12 #ifdef __cplusplus 13 extern "C" { 14 #endif 15 16 /** 17 * Initialize the channel internal status 18 * 19 * The input parameters are: 20 * n_devices : the number of devices (transmitter/receivers) 21 * char *argv[] : a set of arguments passed to the channel library (same convention as POSIX main() command line arguments) 22 * int argc : the number of arguments passed to the channel library 23 * 24 * It is up to the channel to define which arguments it can or shall receive to configure it 25 * The only argument all channels shall understand is : 26 * [-h] [--h] [--help] [-?] 27 * for which the channel shall print a list of arguments it supports with a descriptive message for each 28 */ 29 int channel_init(int argc, char *argv[], uint n_devs); 30 31 /** 32 * Recalculate the fading and path loss of the channel in this current moment (<Now>) 33 * in between the N used paths and the receive path (<rxnbr>) 34 * 35 * inputs: 36 * tx_used : array with n_devs elements, 0: that tx is not transmitting, 37 * !=0 that tx is transmitting, 38 * e.g. {0,1,1,0}: devices 1 and 2 are transmitting, device 0 and 3 are not. 39 * tx_list : array with all transmissions status (the channel can check here the modulation type of the transmitter if necessary) 40 * txnbr : desired transmitter number (the channel will calculate the ISI only for the desired transmitter) 41 * rxnbr : device number which is receiving 42 * now : current time 43 * att : array with n_devs elements. The channel will overwrite the element i 44 * with the average attenuation from path i to rxnbr (in dBs) 45 * The caller allocates this array 46 * ISI_SNR : The channel will return here an estimate of the SNR limit due to multipath 47 * caused ISI for the desired transmitter (in dBs) 48 * If the channel does not estimate this parameter it shall set it to 100.0 49 * 50 * This function shall return < 0 on error ; 0 otherwise 51 * 52 * 53 * Note: It is ensured that for each call time (now) will be >= than in the previous calls 54 */ 55 int channel_calc(const uint *tx_used, tx_el_t *tx_list, uint txnbr, uint rxnbr, bs_time_t now, double *att, double *ISI_SNR); 56 57 /** 58 * Clean up: Free the memory the channel may have allocate 59 * close any file descriptors etc. 60 * (the simulation has ended) 61 */ 62 void channel_delete(); 63 64 #ifdef __cplusplus 65 } 66 #endif 67 68 #endif 69