当前位置:网站首页>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;
}
边栏推荐
- 22、电文处理任务实现
- Customer service system attached to crmeb Standard Edition
- sql语句的执行流程
- Self cultivation of programmers
- Daily question (retrospective)
- vs动态库调试
- Heuristic merging simple problem on tree
- [touch] count the number of engineering documents, code lines, and line comment coverage
- Dj-131/60c voltage relay
- 正则表达式(4)
猜你喜欢

JY-7GA/1电压继电器

Hjs-de1/2 time relay

Explain the difference set, intersection set and union set of complex type set in detail.Net

Here comes the full open source free customer service system

Tencent interview -- please design a thread pool to implement sequential execution
![PMP [agile textbook + full truth simulation question]. After the exam on June 25, agile has become the top priority](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
PMP [agile textbook + full truth simulation question]. After the exam on June 25, agile has become the top priority

一篇文章了解RSocket协议

Svg verification code recognition experience

NFTScan 与 NFTPlay 在 NFT 数据领域达成战略合作

CANoe使用教程
随机推荐
Editor in ArcGIS Pro
Voltage relay dy-28c
树上启发式合并简单题
The difference between character array and string
Ry-d1/1 voltage relay
迟来的2021年终总结
Matlab导出高清图片、且Word中压缩不失真、转换PDF不失真
Pytorch - sequential and modulelist
Compilation learning
QCustomPlot绘图工具常用方法
Encapsulate the unified return object messageresult
爆肝整理 JVM 十大模块知识点总结,不信你还不懂
Crmeb Standard Edition window+phpstudy8 installation tutorial (III)
字符串(3)
Problems encountered by pyppeter
HJS-DE1/2时间继电器
.net core 3.1版本配置跨域问题
游戏测试的概念是什么?测试方法和流程有哪些?
Vs dynamic library debugging
Deepfacelab model parameters collection