]> rtime.felk.cvut.cz Git - arc.git/blob - include/Gpt.h
Merge with 5eed0471196ddd710647bb8cf83ad6e9aa189c61 (default branch)
[arc.git] / include / Gpt.h
1 /* -------------------------------- Arctic Core ------------------------------
2  * Arctic Core - the open source AUTOSAR platform http://arccore.com
3  *
4  * Copyright (C) 2009  ArcCore AB <contact@arccore.com>
5  *
6  * This source code is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License version 2 as published by the
8  * Free Software Foundation; See <http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt>.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
13  * for more details.
14  * -------------------------------- Arctic Core ------------------------------*/
15
16 /** @addtogroup Gpt GPT Driver
17  *  @{ */
18
19 /** @file Gpt.h
20  * API and type definitions for GPT Driver.
21  */
22
23 #ifndef GPT_H_
24 #define GPT_H_
25
26 #include "Std_Types.h"
27 //#include "EcuM.h"  mahi: What for ???
28
29 /** @name Error Codes */
30 //@{
31 #define GPT_E_UNINIT                        0x0a
32 #define GPT_E_BUSY                                                0x0b
33 #define GPT_E_NOT_STARTED                                   0x0c
34 #define GPT_E_ALREADY_INITIALIZED           0x0d
35 #define GPT_E_PARAM_CHANNEL                 0x14
36 #define GPT_E_PARAM_VALUE                                   0x15
37 #define GPT_E_PARAM_MODE                                      0x1f
38 #define GPT_E_PARAM_CONFIG                  0x0e // TODO: Not in spec. Find real value
39 //@}
40
41 /** @name Service id's */
42 //@{
43 #define GPT_INIT_SERVICE_ID                 0x01
44 #define GPT_DEINIT_SERVICE_ID               0x02
45 #define GPT_GETTIMEELAPSED_SERVICE_ID       0x03
46 #define GPT_GETTIMEREMAINING_SERVICE_ID     0x04
47 #define GPT_STARTTIMER_SERVICE_ID           0x05
48 #define GPT_STOPTIMER_SERVICE_ID            0x06
49 #define GPT_ENABLENOTIFICATION_SERVICE_ID   0x07
50 #define GPT_DISABLENOTIFICATION_SERVICE_ID  0x08
51 #define GPT_SETMODE_SERVIVCE_ID             0x09
52 #define GPT_DISABLEWAKEUP_SERVICE_ID        0x0a
53 #define GPT_ENABLEWAKEUP_SERVICE_ID         0x0b
54 #define GPT_CBK_CHECKWAKEUP_SERVICE_ID      0x0c
55 //@}
56
57 /** Channel id type */
58 typedef uint8_t Gpt_ChannelType;
59
60 /** Channel time value type */
61 typedef uint32_t Gpt_ValueType;
62
63 /** Channel behavior */
64 typedef enum
65 {
66   GPT_MODE_ONESHOT=0,
67   GPT_MODE_CONTINUOUS
68 } Gpt_ChannelMode;
69
70 typedef enum
71 {
72   GPT_MODE_NORMAL=0,
73   GPT_MODE_SLEEP
74 } Gpt_ModeType;
75
76
77 #define GPT_VENDOR_ID             1
78 #define GPT_MODULE_ID                    1
79
80 #define GPT_SW_MAJOR_VERSION    1
81 #define GPT_SW_MINOR_VERSION    0
82 #define GPT_SW_PATCH_VERSION    0
83
84 #define GPT_AR_MAJOR_VERSION     2
85 #define GPT_AR_MINOR_VERSION     2
86 #define GPT_AR_PATCH_VERSION     1
87
88 #include "Gpt_Cfg.h"
89
90 #if (GPT_VERSION_INFO_API == STD_ON)
91 #define Gpt_GetVersionInfo(_vi) STD_GET_VERSION_INFO(_vi,GPT)
92 #endif
93
94 void Gpt_Init( const Gpt_ConfigType * );
95
96 #if GPT_DEINIT_API == STD_ON
97 void Gpt_DeInit( void );
98 #endif
99
100 #if ( GPT_TIME_ELAPSED_API == STD_ON )
101 Gpt_ValueType Gpt_GetTimeElapsed(Gpt_ChannelType channel);
102 #endif
103
104 #if ( GPT_TIME_REMAINING_API == STD_ON )
105 Gpt_ValueType Gpt_GetTimeRemaining( Gpt_ChannelType channel );
106 #endif
107
108 void Gpt_StartTimer(Gpt_ChannelType channel, Gpt_ValueType value);
109
110 void Gpt_StopTimer(Gpt_ChannelType channel);
111
112 #if ( GPT_ENABLE_DISABLE_NOTIFICATION_API == STD_ON )
113 void Gpt_EnableNotification( Gpt_ChannelType channel);
114
115 void Gpt_DisableNotification( Gpt_ChannelType channel);
116 #endif
117
118 #if ( GPT_WAKEUP_FUNCTIONALITY_API == STD_ON )
119 void Gpt_SetMode( Gpt_ModeType mode );
120
121 void Gpt_DisableWakeup( Gpt_ChannelType channel );
122
123 void Gpt_EnableWakeup( Gpt_ChannelType channel );
124
125 void Gpt_Cbk_CheckWakeup( EcuM_WakeupSourceType wakeupSource );
126 #endif
127
128 #endif /*GPT_H_*/
129 /** @} */