3、基本常数和宏定义

\qquad 下面是HD-GR GNSS导航软件的基本常数和宏定义:

// constants.h: Header file for various SHARED constants and macro definitions.

/* 
 * Copyright (C) 2005 Andrew Greenberg
 * Distributed under the GNU GENERAL PUBLIC LICENSE (GPL) Version 2 (June 1991).
 * See the "COPYING" file distributed with this software for more information.
 */

/* Namuru GPS receiver project
 * Original : constants.h
 * Modes    : GP4020 HW I/O handling commented/replaced
 * version  : V1.0
 * date     : 21st/Dec/2006
 */

/* 
 * HD-GR GNSS receiver project
 * Modes    : Inherited the code of constants.h in the Namuru GPS receiver project 
 *            V1.0 and made necessary adjustments to adapt to the new HW, RTOS and 
 *            functions.
 * version  : V1.0
 * date     : xx/xx/2015
 */

#ifndef __CONSTANTS_H__
#define __CONSTANTS_H__

// Language Constants
#define IDLE				0
#define FALSE				0
#define TRUE				1

// Physical Constants
#define SPEED_OF_LIGHT		2.99792458E8		// [m/s]
#define PI					3.141592653589793
#define PI_OVER_2			(PI / 2.0)
#define TWO_PI				(PI * 2.0)
#define RADTODEG			180.0/PI			// [deg/r]

// GNSS Week Defines
#define SECONDS_IN_WEEK		(7 * 24 * 3600)			// (604800) seconds per week
#define BITS_IN_WEEK		(50 * SECONDS_IN_WEEK)	// (30240000) gps 50Hz data rate
#define BITS_IN_WEEK_50HZ	BITS_IN_WEEK			// (30240000) gps 50Hz data rate

// Clock info
#define SAMPLE_CLOCK		16.368E6			// nominal [Hz], sets correlator timing
#define SYSTEM_CLOCK		(16.368E6*6.0)		// nominal [Hz]
// sample clock square root value
#define SAMPLE_CLOCK_SQRT	4.04574

#define TIC_PERIOD			0.1
#define TIC_2_ACCUM_DIV		128
#define TIC_2_PPS_DIV		100
#define VALUE_TIC_ADD1		(unsigned long)(SYSTEM_CLOCK*0.1)
#define VALUE_TIC_DIV		(VALUE_TIC_ADD1 - 1)
#define VALUE_ACCUM_INT		(VALUE_TIC_ADD1/TIC_2_ACCUM_DIV - 1)
#define VALUE_PPS_DIV		(VALUE_TIC_ADD1/TIC_2_PPS_DIV - 1)
//#define VALUE_ACCUM_INT	(unsigned long)(SYSTEM_CLOCK*(0.8E-3))-1
//#define VALUE_TIC			(unsigned long)(SYSTEM_CLOCK*0.1)-1
//#define VALUE_PPS			(unsigned long)(SYSTEM_CLOCK*(1.0E-3))-1

// 1MHz sample clock noise level
#define NOISE_LEVEL_1MS_1MHZ	130.384
// noise level: (SAMPLE_CLOCK_SQRT*NOISE_LEVEL_1MS_1MHZ) = 527.4995
#define NOISE_LEVEL				1500

// 3db over noise level: 745.113
#define SIGNAL_LEVEL_3DB		(1.412538*NOISE_LEVEL)
// 5db over noise level: 938.041
#define SIGNAL_LEVEL_5DB		(1.778279*NOISE_LEVEL)
// 6db over noise level: 1052.500
#define SIGNAL_LEVEL_6DB		(1.995262*NOISE_LEVEL)

// ACQ THRESHOLD: this threshold refers to the sum of early, prompt and late 
// magnitude (6dB over early, 3dB over prompt, 0db over late
#define ACQ_THRESHOLD			(SIGNAL_LEVEL_6DB+SIGNAL_LEVEL_3DB+NOISE_LEVEL)
// LOCK THRESHOLD: this treshold refers to a single correlator branch magnitude
#define LOCK_THRESHOLD			SIGNAL_LEVEL_3DB
#define TANG_THRESHOLD			SIGNAL_LEVEL_3DB


// GPS RF Timing
#define GPS_REF					10.23E6				// theoretical GPS reference frequency [Hz]
#define GPS_L1					(154*GPS_REF)		// nominal civilian GPS satellite

// GPS Code DCO timing
#define GPS_CODE_DCO_LENGTH		1024
#define GPS_CODE_PERIOD			1023				// Gold code period
#define GPS_MAX_CODE_PHASE		(2*GPS_CODE_PERIOD)	// In half-chips
#define GPS_CHIP_RATE			(GPS_REF/10)
#define GPS_CODE_TIME			(GPS_CODE_PERIOD/GPS_CHIP_RATE) // 1ms precisely
#define GPS_QUARTER_CHIP_TIME	(0.25/GPS_CHIP_RATE)	// about 74[m]

// GPS IF frequency
#define GPS_IF_FREQ				4.092E6

// GPS CARR_FREQ_RES
#define GPS_CARR_FREQ_RES		(SYSTEM_CLOCK / (1 << 30))
// Find integer setting used to tune the carrier DCO to the nominal frequency
#define GPS_CARRIER_REF   		(unsigned int)(0.5 + GPS_IF_FREQ / GPS_CARR_FREQ_RES)

// GPS CODE_FREQ_RES
#define GPS_CODE_FREQ_RES		(SYSTEM_CLOCK / (1 << 29))
/* Find integer setting used to tune the code DCO to the nominal chip rate
 * Note, this is twice the expected value since the code generator works
 * in half-chips. This also means the chip resolution is actually two times
 * better than the value given in CODE_FREQ_RES. */
#define GPS_CODE_REF			(unsigned int)(0.5 + 2 * GPS_CHIP_RATE / GPS_CODE_FREQ_RES)


// BDS B1 RF Timing
#define B1I_REF					1.023E6				// theoretical BDS reference frequency [Hz]
#define B1I_L1					(1526*B1I_REF)		// nominal B1I satellite

// BDS B1 Code DCO timing
#define B1I_CODE_DCO_LENGTH		2046
#define B1I_CODE_PERIOD			2046				// Gold code period
#define B1I_MAX_CODE_PHASE		(2*B1I_CODE_PERIOD)	// In half-chips
#define B1I_CHIP_RATE			(2*B1I_REF)			// 2.046MHz
#define B1I_CODE_TIME			(B1I_CODE_PERIOD/B1I_CHIP_RATE) // 1ms precisely
#define B1I_QUARTER_CHIP_TIME	(0.25/B1I_CHIP_RATE)// about ??[m]

// B1I_IF frequency
#define B1I_IF_FREQ 4.092E6

// B1I_CARR_FREQ_RES
#define B1I_CARR_FREQ_RES		(SYSTEM_CLOCK / (1 << 30))
// Find integer setting used to tune the carrier DCO to the nominal frequency
#define B1I_CARRIER_REF			(unsigned int)(0.5 + B1I_IF_FREQ / B1I_CARR_FREQ_RES)

// CODE_FREQ_RES
#define B1I_CODE_FREQ_RES		(SYSTEM_CLOCK / (1 << 29))
/* Find integer setting used to tune the code DCO to the nominal chip rate
 * Note, this is twice the expected value since the code generator works
 * in half-chips. This also means the chip resolution is actually two times
 * better than the value given in CODE_FREQ_RES. */
#define B1I_CODE_REF			(unsigned int)(0.5 + 2 * B1I_CHIP_RATE / B1I_CODE_FREQ_RES)

// GPS, BDS and total channels
#define BDMOD_GPS_CHANNELS	10
#define BDMOD_B1I_CHANNELS	10
#define GPS_MAX_CHANNELS		10
#define B1I_MAX_CHANNELS		10
#define TOT_MAX_CHANNELS		(GPS_MAX_CHANNELS+B1I_MAX_CHANNELS)

// GPS and BDS satellites
#define GPS_MAX_SATELLITES		32
#define B1I_MAX_SATELLITES		32

// Positioning satellite constellations
#define POS_CONSTELL_GPS		0x01	// Only use GPS satellite constellation
#define POS_CONSTELL_BDS		0x02	// Only use BDS satellite constellation
#define POS_CONSTELL_MIX		0x03	// use GPS and BDS satellite constellations

#define ENABLE_TRACKING_LOG
#define ENABLE_POSITION_LOG

// Task Priority
#define ACCUM_TASK_PRIORITY		1
#define MEAS_TASK_PRIORITY		2
#define MESSA_TASK_PRIORITY		3
#define EPHEM_TASK_PRIORITY		4
#define ALLOC_TASK_PRIORITY		5
#define POSIT_TASK_PRIORITY		6
#define DISP_TASK_PRIORITY		7
#define RS232_TASK_PRIORITY		8

// #define GNSS_ENABLE_CRITICAL
// #define GNSS_ENABLE_MUTEX
#ifdef GNSS_ENABLE_CRITICAL
#define GNSS_ENTER_CRITICAL() OS_ENTER_CRITICAL()
#define GNSS_EXIT_CRITICAL() OS_EXIT_CRITICAL()
#else
#define GNSS_ENTER_CRITICAL()
#define GNSS_EXIT_CRITICAL()
#endif

#endif // __CONSTANTS_H__

  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值