当前位置:网站首页>4. Main program and cumulative interrupt processing routine implementation code
4. Main program and cumulative interrupt processing routine implementation code
2022-07-28 15:34:00 【Turing_ three hundred and twenty-one】
\qquad Here is HD-GR GNSS Implementation code of main program and cumulative interrupt processing routine of navigation software :
// agrs_gp_1_ucos.c -- Setup and mainline for HD-GR GNSS, including the main
// program and the accumulation interrupt routine
// accum_int_handler(…).
/* * 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 : gpl-gps.c * Modes : GP4020 HW I/O handling commented/replaced * version : V1.0 * date : 21st/Dec/2006 */
/* Namuru GPS receiver project * Original : interrupts.c * Modes : driving LED part has replaced for Namuru HW * version : V1.0 * date : 21st/Dec/2006 */
/* * HD-GR GNSS receiver project * Modes : Inherited the code of gpl-gps.c and interrupts.c in the Namuru * GPS receiver project V1.0, and made necessary adjustments to * adapt to the new HW, RTOS. * version : V1.0 * date : xx/xx/2015 */
#include <io.h>
#include <stdio.h>
#include <string.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 "main_accum_task.h"
#include "main_allocate.h"
#include "main_message.h"
#include "main_measure.h"
#include "main_pseudorange.h"
#include "main_position.h"
#include "main_ephemeris.h"
#include "spi_max2769.h"
#include "rtc.h"
#include "display.h"
#define TASK_STACKSIZE 1024
OS_STK accum_task_stk[TASK_STACKSIZE] __attribute__ ((section(".isrdata.rwdata")));
OS_STK meas_task_stk[TASK_STACKSIZE];
OS_STK messa_task_stk[TASK_STACKSIZE] __attribute__ ((section(".isrdata.rwdata")));
OS_STK ephem_task_stk[TASK_STACKSIZE];
OS_STK posit_task_stk[TASK_STACKSIZE];
OS_STK disp_task_stk[TASK_STACKSIZE];
OS_STK alloc_task_stk[TASK_STACKSIZE];
// OS_STK rs232_task_stk[TASK_STACKSIZE];
OS_EVENT *m_SemISR __attribute__ ((section(".isrdata.rwdata")));
static void accum_int_handler(void *context) __attribute__ ((section(".isrcode.txt")));
//
// DISP
//
/* void rs232_task(void *pdata) { int n, ch; char cmd[81]; while (1) { n = scanf("%s %d", cmd, &ch); if (n >= 2) { // if (strcmpi(cmd, "DEL") == 0 && ch >= 0 && ch < MAX_CHANNELS) { // m_CH[ch].state = CHANNEL_OFF; // } } OSTimeDlyHMSM(0, 0, 1, 0); } } */
static void accum_int_handler(void *context)
{
OSIntEnter();
// Read STATUS register to clear interrupt flag
m_status = (unsigned short)read_from_correlator(STATUS);
OSIntExit();
OSSemPost(m_SemISR);
}
//
// MAIN
//
int main(void)
{
// printf("Hello HD-GR GNSS :)\r\n");
spi_max2769_2_init();
spi_max2769_2_setup();
m_rtc_inited = (ds32x35_get_time(0) > 0) ? 1:-1;
cycgps_init_backup();
// Reset baseband processor
write_to_correlator(RESET, 0);
// Set PROG_PPS_DIV counter for 1ms: (16.368MHz*6)*1000us-1 = 98207
write_to_correlator(PROG_PPS_DIV, VALUE_PPS_DIV);
// Set ACCUM_INT for 500us: (16.368MHz*6)*500us-1 = 49103,
// (16.368MHz*6)*800us-1 = 78565,
write_to_correlator(PROG_ACCUM_INT, VALUE_ACCUM_INT);
// Set PROG_TIC counter for 0.1s: (16.368MHz*6)*0.1s-1=9820799
write_to_correlator(PROG_TIC_DIV, VALUE_TIC_DIV);
// Reset baseband processor
write_to_correlator(RESET, 0);
// These have been moved from the bottom of the file to fix an initialization issue
initialize_ephetable();
initialize_tracking();
initialize_measurements();
initialize_allocation();
// Create uC/OS-II tasks
OSTaskCreateExt(accum_task,
NULL,
(void *)&accum_task_stk[TASK_STACKSIZE-1],
ACCUM_TASK_PRIORITY,
ACCUM_TASK_PRIORITY,
accum_task_stk,
TASK_STACKSIZE,
NULL,
0);
OSTaskCreateExt(meas_task,
NULL,
(void *)&meas_task_stk[TASK_STACKSIZE-1],
MEAS_TASK_PRIORITY,
MEAS_TASK_PRIORITY,
meas_task_stk,
TASK_STACKSIZE,
NULL,
0);
OSTaskCreateExt(message_task,
NULL,
(void *)&messa_task_stk[TASK_STACKSIZE-1],
MESSA_TASK_PRIORITY,
MESSA_TASK_PRIORITY,
messa_task_stk,
TASK_STACKSIZE,
NULL,
0);
OSTaskCreateExt(ephemeris_task,
NULL,
(void *)&ephem_task_stk[TASK_STACKSIZE-1],
EPHEM_TASK_PRIORITY,
EPHEM_TASK_PRIORITY,
ephem_task_stk,
TASK_STACKSIZE,
NULL,
0);
OSTaskCreateExt(position_task,
NULL,
(void *)&posit_task_stk[TASK_STACKSIZE-1],
POSIT_TASK_PRIORITY,
POSIT_TASK_PRIORITY,
posit_task_stk,
TASK_STACKSIZE,
NULL,
0);
OSTaskCreateExt(allocate_task,
NULL,
(void *)&alloc_task_stk[TASK_STACKSIZE-1],
ALLOC_TASK_PRIORITY,
ALLOC_TASK_PRIORITY,
alloc_task_stk,
TASK_STACKSIZE,
NULL,
0);
OSTaskCreateExt(disp_task,
NULL,
(void *)&disp_task_stk[TASK_STACKSIZE-1],
DISP_TASK_PRIORITY,
DISP_TASK_PRIORITY,
disp_task_stk,
TASK_STACKSIZE,
NULL,
0);
/* OSTaskCreateExt(rs232_task, NULL, (void *)&rs232_task_stk[TASK_STACKSIZE-1], RS232_TASK_PRIORITY, RS232_TASK_PRIORITY, rs232_task_stk, TASK_STACKSIZE, NULL, 0); */
// Register ISR handler
alt_ic_isr_register(
GNSS_BDMOD_IRQ_INTERRUPT_CONTROLLER_ID,
GNSS_BDMOD_IRQ,
accum_int_handler,
//(void*)&m_status,
NULL,
0x0);
// Create semaphores
m_SemISR = OSSemCreate(0);
// Start uC/OS-II real time kernel
OSStart();
return 0;
}
边栏推荐
- Leetcode - number of operations, non repeating numbers, diagonal traversal, Joseph Ring
- 爬虫入门(1)——requests(1)
- ArcGIS Pro 中的编辑器
- Qt刷新UI界面问题
- Cross domain problems in the configuration of.Net core version 3.1
- 19、通道分配任务定义
- Solve the problem of pycharm using PowerShell
- 有奖活动分享:使用WordPress搭建一个专属自己的博客后最高可领取iPhone13
- 配置cx-oracle 解决(cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: “Th
- 7、实时数据备份和实时时钟相关定义
猜你喜欢

Crmeb v4.3 deployment process

有奖活动分享:使用WordPress搭建一个专属自己的博客后最高可领取iPhone13

I heard that many merchants of crmeb have added the function of planting grass?

Voltage relay dy-28c

SRTT-110VDC-4H-C时间继电器
![[jspwiki]jspwiki installation deployment and configuration](/img/3c/81a201bb80dcbb17d1c97b1a5bb215.png)
[jspwiki]jspwiki installation deployment and configuration

一篇文章了解RSocket协议

百度提出动态自蒸馏方法,结合交互模型与双塔模型实现稠密段落检索

MPLS LDP的原理与配置

Jds-12 time relay
随机推荐
QCustomPlot绘图工具常用方法
2022-07-28日报:Science:AI设计蛋白质再获突破,可设计特定功能性蛋白质
Compilation learning
[leetcode] 35. Search the insertion position
给你一个链表,删除链表的倒数第 n 个结点,并且返回链表的头结点。
I heard that many merchants of crmeb have added the function of planting grass?
subst命令将一个文件夹镜像成本地的一个磁盘
Write a standard character device driver with your hands
Svg verification code recognition experience
配置cx-oracle 解决(cx_Oracle.DatabaseError) DPI-1047: Cannot locate a 64-bit Oracle Client library: “Th
php parse_ URL bypass whitelist
JWY-32B电压继电器
Gfpgan blurred photo repair artifact
Solve the problem of pycharm using PowerShell
Editor in ArcGIS Pro
NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作
Share the HR experience of the first and second tier companies
Cross domain problems in the configuration of.Net core version 3.1
4、主程序和累积中断处理例程实现代码
What functions will be added to crmeb Standard Version 4.4