Init basesystem source codes.
[staging/basesystem.git] / video_in_hal / positioning_hal / inc / GpsCommon / MDev_Gps_TimerCtrl.h
1 /*
2  * @copyright Copyright (c) 2016-2020 TOYOTA MOTOR CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 /**
17 * @file MDev_Gps_TimerCtrl.h
18 */
19
20 #ifndef  INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
21 #define  INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
22
23 /*---------------------------------------------------------------------------*/
24 // Include files
25
26 #include "positioning_def.h"
27
28 /*---------------------------------------------------------------------------*/
29 // Value define
30
31 /* GPS-related timer value */
32 #define TIMVAL_GPS_STARTUP        500     /* 5Sec  Start confirmation monitoring timer              */
33 #define TIMVAL_GPS_RCVCYCLDAT     500     /* 5Sec  Periodic reception data monitoring timer       */
34 #define TIMVAL_GPS_RCVACK         500     /* 5Sec  ACK reception monitoring timer             */
35 #define TIMVAL_GPS_RCVDAT         500     /* 5Sec  Data reception monitoring timer(Unused)    */
36 #define TIMVAL_GPS_NAVIFST        3000    /* 30sec Initial navigation monitoring timer              */
37 #define TIMVAL_GPS_NAVICYCLE      300     /* 3sec  Navigation monitoring timer                    */
38 #define TIMVAL_GPS_NAVIDISRPT     1000    /* 10Sec  Navigation monitoring disruption log output timer */
39 #define TIMVAL_GPS_DIAGCLKGUARD   1000    /* 10sec Diagnosis provision time guard monitoring timer   */
40 #define TIMVAL_GPS_NMEADATAGUARD  1000    /* 10sec NMEA data-providing guard monitoring timer  */
41 #define TIMVAL_GPS_RECOVERY       60000   /* 600sec GPS recovery timer                  */
42 #define TIMVAL_GPS_RECEIVERERR    60000   /* 600sec GPS receiver anomaly detection timer     */
43
44 /* Sensor-related timer value */
45 #define TIMVAL_SNS_RCVFSTDAT      3000    /* 30Sec Initial sensor data reception monitoring timer */
46 #define TIMVAL_SNS_RCVCYCLDAT     300     /* 3Sec  Cyclic sensor data reception monitoring timer */
47 #define TIMVAL_SNS_RCVDISRPT      1000    /* 10Sec  Cyclic sensor data interruption log output timer */
48
49 /* Timer management table */
50 #define TIM_NON                   0x00    /* Timer counter initial value                   */
51 #define TIM_CNTMIN                0x01    /* Timer counter minimum value                   */
52 #define TIM_CNTMAX                0xff    /* Maximum value of timer counter                   */
53 #define TIMER_OFF                 0       /* Timer enable flag OFF                  */
54 #define TIMER_ON                  1       /* Timer enable flag ON                   */
55
56 /*!
57    @brief   Timer type
58  */
59 typedef enum GpsTimKind {
60   GPS_STARTUP_TIMER = 0,      /*  0 Start confirmation monitoring timer                       */
61   GPS_CYCL_TIMER,             /*  1 Cyclic GPS data reception monitoring timer                 */
62   GPS_RECV_ACK_TIMER,         /*  2 ACK reception monitoring timer                              */
63   GPS_NAVIFST_TIMER,          /*  3 Initial navigation monitoring timer                       */
64   GPS_NAVICYCLE_TIMER,        /*  4 Navigation monitoring timer                             */
65   GPS_NAVIDISRPT_TIMER,       /*  5 Navigation monitoring disruption log output timer               */
66   GPS_DIAGCLK_GUARDTIMER,     /*  6 Diagnosis provision time guard monitoring timer                */
67   GPS_NMEADATA_GUARDTIMER,    /*  7 NMEA data-providing guard monitoring timer           */
68   GPS_RECOVERY_TIMER,         /*  8 GPS recovery timer                               */
69   GPS_RECEIVERERR_TIMER,      /*  9 GPS receiver anomaly detection timer                   */
70   SNS_FST_TIMER,              /* 10 Initial sensor data reception monitoring timer             */
71   SNS_CYCLE_TIMER,            /* 11 Cyclic sensor data reception monitoring timer             */
72   SNS_DISRPT_TIMER,           /* 12 Cyclic sensor data interruption log output timer       */
73   TIM_NUM                     /* 13 Number of timer types                                  */
74 } GPS_TIM_KIND;
75
76 /*!
77    @brief   Timer status
78 */
79 typedef struct GpsTimSts {
80   u_int8  flag;               /**< Timer flag OFF:Stop,ON:Start */
81   u_int8  cnt;                /**< Start counter                     */
82   int8    rsv[2];             /**< Reserved                           */
83 } GPS_TIM_STS;
84
85 /*!
86    @brief   Timer status management table
87  */
88 typedef struct GpsTimMng {
89   GPS_TIM_STS  sts[TIM_NUM];  /**< Timer status         */
90 } GPS_TIM_MNG;
91
92 /*!
93    @brief   Timer setting information table
94 */
95 typedef struct GpsTimInfo {
96   uint32_t  timer_val;        /**< Timer value                           */
97   PNO       pno;              /**< Event notification destination process number         */
98 } GPS_TIM_INFO;
99
100 /*---------------------------------------------------------------------------*/
101 // Prototype
102
103 void    DevGpsTimInit(void);
104 BOOL    DevGpsTimeSet(GPS_TIM_KIND tim_kind);
105 BOOL    DevGpsTimeStop(GPS_TIM_KIND tim_kind);
106 u_int16 DevGpsTimeMakSeqNo(GPS_TIM_KIND tim_kind);
107 BOOL    DevGpsTimeJdgKind(u_int16 seqno);
108
109 /*---------------------------------------------------------------------------*/
110 #endif  // INC_GPSCOMMON_MDEV_GPS_TIMERCTRL_H_
111
112 /*---------------------------------------------------------------------------*/
113 /*EOF*/