/**************************************************************************** * Configuration Module for the Real-time BBC Codec/Modem * **************************************************************************** * William L. Bahn * * Academy Center for Information Security * * Department of Computer Science * * United States Air Force Academy * * USAFA, CO 80840 * **************************************************************************** * FILE:............ config.h * * DATE CREATED:.... 03 SEP 07 * * DATE MODIFIED:... 08 SEP 07 * **************************************************************************** * * REVISION HISTORY * **************************************************************************** * * DESCRIPTION * * This module imports and manages the configuration information for the * modem and the codec. * */ #ifndef CONFIGdotH #define CONFIGdotH //------------------------------------------------------------------------ // REQUIRED INCLUDES //------------------------------------------------------------------------ #include #include "dirtyd.h" //------------------------------------------------------------------------ // STRUCTURE DECLARATIONS //------------------------------------------------------------------------ typedef struct CONFIG CONFIG; //------------------------------------------------------------------------ // STRUCTURE DEFINITIONS //------------------------------------------------------------------------ // NOTE: Normally the structure definition would be in the *.c file to make // the structure members inaccessible to outside functions except through // public function calls. But for the real-time code it has been decided // to make the structure members directly visible to the functions that // manipulate them. struct CONFIG { int diagnostics; // Direction int scheduler_TX_notRX; int scheduler_realtime; // Source Parameters char *source_name; DWORD source_sample_size_bytes; DWORD source_sample_limit; WORD source_id; // Codec Parameters DWORD codec_message_bits; DWORD codec_random_bits; DWORD codec_clamp_bits; DWORD codec_fragment_bits; DWORD codec_stop_bits; DWORD codec_expansion; DWORD codec_decode_limit; DWORD codec_packet_load; // Derived Codec Parameters DWORD fragments; // Number of complete fragement in padded message DWORD padded_message_bits; // Length of message after padding with random and check bits DWORD packet_bits; DWORD last_packet_bit; DWORD bytes_per_message; DWORD bytes_per_packet; DWORD bufferbytes_per_packet; // Buffer Parameters double buffer_packets; double buffer_lambda; DWORD buffer_advance; // Modem Parameters DWORD modem_packet_rate_bps; DWORD modem_samples_per_bit; double modem_gain_dB; double modem_channel_loss_dB; double modem_threshold_pct; double modem_hysteresis_pct; double modem_jitter_bits; double modem_cushion_pct; // Derived Modem Parameters //DWORD bytes_per_sample; double nominal_tx_signal; double nominal_rx_signal; DWORD trx_bytes_per_packet_byte; DWORD cushion_bits; // Sink Parameters char *sink_name; DWORD sink_sample_size_bytes; DWORD sink_sample_limit; // Misc DWORD message_count; DWORD marks; // Lookup tables BYTE bitptr[2]; // 0 and 1 represented as BYTEs that can be passed by reference BYTE bitmask[8]; // Masks to pick off the bits within a byte // Tally Counters DWORD actual_trx_bytes; DWORD nominal_trx_bytes; double bytespertick; clock_t dem_ticks; clock_t dec_ticks; clock_t ticks; clock_t tot_ticks; }; //------------------------------------------------------------------------ // PUBLIC FUNCTION PROTOTYPES //------------------------------------------------------------------------ CONFIG *CONFIG_Del(CONFIG *p); CONFIG *CONFIG_New(char *filename, DWORD *errcode); //------------------------------------------------------------------------ #endif