⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 spwtypes.h

📁 ofdm的完整系统模型,包含信道参数,多径模型,doppler频移等都可以自由修改!是您做仿真的有力帮助.c语言运行速度快!
💻 H
字号:
#ifndef SPWTYPES_H
#define SPWTYPES_H

#include "datatypes.h"

/*
 *	Base Types
 */
typedef unsigned long	ULong;

typedef char		DataV;
typedef DataV		*Data;
typedef unsigned char 	Logical;	
typedef unsigned short	FixDataV;
typedef FixDataV	*FixData;


/*
 *	Fix Point Attributes
 */

typedef struct fix_prop	{
	short	numbits;
	short	exponent;
	short	format;
} FAttrs;

/*
 *	Vector Attributes
 */

typedef struct obj_props_type {
	DATA_TYPE	type;
	int		mem_loc;
	FAttrs		fix_format;
	int		xflags;		/* fixed point customization flags */
} *Objprops;

/*
 *	Fix Point Structure
 */

typedef struct fixpoint_type {
	FAttrs 		fprops;
	FixData		values;
} Fixpoint;
#define fxpAttr(sp_fx) ((sp_fx)->fprops)
#define fxpData(sp_fx) ((sp_fx)->values)

/*
 *	Complex Structures
 */

/*
 *	double 
 */
typedef struct complex_type {
	double	real;
	double	imag;
} Complex;

/*
 *	float 
 */
typedef struct fltcmplx_type {
	float	real;
	float	imag;
} FltCmplx;

/*
 *	int
 */
typedef struct intcmplx_type {
	int	real;
	int	imag;
} IntCmplx;

/*
 *	Fix
 */

typedef struct fixcmplx_type {
	FAttrs	fprops;
	FixData	real;
	FixData	imag;

} FixCmplx;
#define fxpCxAttr(sp_fxc) ((sp_fxc)->fprops)
#define fxpCxRealdata(sp_fxc) ((sp_fxc)->real)
#define fxpCxImagdata(sp_fxc) ((sp_fxc)->imag)

/*
 *	Vectors
 */

struct vec_obj_type {
	Objprops	properties;	
	int		stepsize;	/* Distance between elements 		*/
	int		length;		/* Length of vector		     	*/
	Data		start;		/* Physical beginning of vector		*/
	Data		virtstart;	/* Actual beginning of vector		*/
	Data 		end;		/* Physical end of vector		*/
	Data		virtend;	/* Actual end of vector			*/
	Data		curr_loc;	/* Current element location		*/
};


typedef struct vec_obj_type *Ovector;

/*
 *	Union for holding any scalar/vector object
 */

#define NUMSIZE 16 	/* maximum number of unsigned ints in a fixed point number */
#define MAXBITS (NUMSIZE * 16)

typedef union typeAll {
	char 		*string;
	long 		integer;
	Fixpoint 	fixed_point;
	float 		floating_point;
	double 		double_precision;
	Logical 	logical;
	IntCmplx 	cx_integer;
 	FixCmplx 	cx_fixed_point;
	FltCmplx 	cx_floating_point;
	Complex 	cx_double_precision;
	Ovector 	vec_data;
	} TYPE_ALL;

typedef struct obj_element_type {
	DATA_TYPE type;			/* current type used */
	TYPE_ALL u;			/* union of all types */
	int xflags;			/* mode flags used to call fxp routines */
	} Otype;

#define OTYPE_TYPE(O) ((O).type)
#define OTYPE_DATA(O) ((O).u)
#define OTYPE_XFLAGS(O) ((O).xflags)
/*
 *	Attributes Structure 
 */
struct attr_type {

	/*
	 *	Vector Matrix and Tensor Dimensions
	 */

	int	m,n,q;

	/*
	 *	Fixed-Point Attributes
	 */

	FAttrs	fprops;

};
typedef struct attr_type ATTRIBUTE;


/*
 *	Memory Constants
 */

#define CRAM 	0x10
#define SRAM	0x20
#define DRAM 	0x40

#define CRAM_0	(CRAM | 1)
#define CRAM_1	(CRAM | 2)
#define CRAM_2	(CRAM | 4)

#define SRAM_0  (SRAM | 1)
#define SRAM_1  (SRAM | 2)
#define SRAM_2  (SRAM | 4)
#define SRAM_3  (SRAM | 8)

#define DRAM_0 	(DRAM | 1)
#define DRAM_1 	(DRAM | 2)

#define DEFMEM	SRAM	/* Default Memory */


/* for rayleigh fading channel */

#define		BLACKMAN 				0
#define		BARTLETT 				1
#define		HAMMING 				2
#define		HANNING 				3
#define		RECTANGLAR 				4

typedef struct {
	double		P_s_freq;
	double		P_fd;
	long		P_int_factor;
	long		P_filter_len;
	long		P_nipts;
	double		P_gain;
	double		P_norm_power;
	int			P_window;
	char		P_norm[8];
	char		P_interpolate[8];
	int			S_cnt;
	int			delay_n;
	Ovector		S_scoef;
	Ovector		S_stater;
	Ovector		S_statei;
	Ovector		S_istater;
	Ovector		S_istatei;
	Ovector		S_intrp;
} FadParams;

typedef struct {
	double		Ch_Norm_Factor;
	Ovector		Data_Buff;
	FadParams	fad_params[12];
} RayParams;

typedef struct {
	int			Ch_Delay;
	double		Norm_Var;
	Ovector		Delay_Buff;
} GauParams;

typedef struct {
	double		Phase_Reg;
	double		Base_Phase;
} FreqParams;

#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -