当前位置:网站首页>22、电文处理任务实现
22、电文处理任务实现
2022-07-28 14:26:00 【Turing_321】
\qquad 下面是HD-GR GNSS导航软件的电文处理任务实现代码:
// main_message.c -- Navigation message processing task.
/* * 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 : message.c * Mods : driving LED part has commented/replaced for Namuru HW * version : V1.1 * date : 8/7/2008 */
/* * HD-GR GNSS receiver project * Modes : Inherited the code of message.c in the Namuru GPS receiver project * V1.0 and made necessary adjustments to adapt to the new RTOS and * functions. * version : V1.0 * date : xx/xx/2015 */
#include <io.h>
#include <stdio.h>
#include <math.h>
#include "includes.h"
#include "system.h"
#include "altera_avalon_pio_regs.h"
#include "alt_types.h"
#include "sys/alt_irq.h"
#include "gps_message.h"
#include "b1i_message.h"
#include "main_ephemeris.h"
#include "main_position.h"
/****************************************************************************** * Defines ******************************************************************************/
/****************************************************************************** * Globals ******************************************************************************/
OS_FLAG_GRP *m_MessageFlag __attribute__ ((section(".isrdata.rwdata")));
OS_FLAGS channels_with_subframes __attribute__ ((section(".isrdata.rwdata")));
/****************************************************************************** * Statics ******************************************************************************/
/****************************************************************************** * Stuff incoming bits from the accum_task into words and subframes in * the messages structure. ******************************************************************************/
void message_task(void* pdata) // input 'pdata' not used
{
INT8U err;
OS_FLAGS channels_with_bits, channel_bits;
// There's no way that we're going to get a bit before this thread
// is first executed, so it's ok to run the flag init here.
m_MessageFlag = OSFlagCreate((OS_FLAGS)0, &err);
while (1) {
// Block if there are no channels with bits ready. Wake up if any bits
// from the 20 channels (0xFFFFF) are set. Clear the flag on wakeup,
// with the bits saved in channels_with_bits.
channels_with_bits = OSFlagPend(m_MessageFlag,
(1 << TOT_MAX_CHANNELS) - 1,
OS_FLAG_WAIT_SET_ANY + OS_FLAG_CONSUME,
0, &err);
// OK we're awake, process the messages
GNSS_ENTER_CRITICAL();
channel_bits = g_channel_bits;
GNSS_EXIT_CRITICAL();
// led_turnon(LED3);
// Clear the flag IPC shadow (see below)
channels_with_subframes = 0;
if (m_sys_posconst & POS_CONSTELL_BDS) {
b1i_process_message(channels_with_bits >> GPS_MAX_CHANNELS,
channel_bits >> GPS_MAX_CHANNELS);
channels_with_subframes <<= GPS_MAX_CHANNELS;
}
if (m_sys_posconst & POS_CONSTELL_GPS) {
gps_process_message(channels_with_bits, channel_bits);
}
// Wake up the ephemeris thread if there are subframes ready
if (channels_with_subframes) {
OSFlagPost(m_EphemerisChannelFlag, channels_with_subframes, OS_FLAG_SET, &err);
}
// led_turnoff(LED3);
}
}
边栏推荐
- 每日一题(回溯)
- What functions will be added to crmeb Standard Version 4.4
- 机器学习的3大“疑难杂症”,因果学习是突破口 | 重庆大学刘礼
- JWY-32B电压继电器
- Establish binary tree + C language code from preorder and middle order
- Deepfacelab model parameters collection
- CANoe使用教程
- 4518. Minimum ticket price
- In 2022, the average salary of global programmers was released, and China ranked unexpectedly
- redis常用命令总结(自备)
猜你喜欢
随机推荐
Gfpgan blurred photo repair artifact
Repvgg paper explanation and model reproduction using pytoch
【通道注意力机制】SENet
2022年全球程序员平均薪资发布,中国排名很意外
svg 验证码识别体验
Jds-12 time relay
3540. Binary search tree
No files or folders found to process
Knowledge payment open source system
About the reptile thing
3511. 倒水问题
分享一下一二线大厂HR面经分享
.net core 2.2 版本跨域配置
Volatile principle
3588. 排列与二进制
新版数据同步问题
chrome插件调试
PMP【敏捷教材+全真模拟题】,续6月25日考试之后,敏捷就成为了重中
Crmeb v4.3 deployment process
pyppeteer 遇到的问题









