utimer.h revision e9629bad30a9f478b336ab46b8e6e02f7f87af46
15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/******************************************************************************
25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  Copyright (C) 2001-2012 Broadcom Corporation
45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
55821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  Licensed under the Apache License, Version 2.0 (the "License");
65821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  you may not use this file except in compliance with the License.
75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  You may obtain a copy of the License at:
85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  http://www.apache.org/licenses/LICENSE-2.0
105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  Unless required by applicable law or agreed to in writing, software
125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  distributed under the License is distributed on an "AS IS" BASIS,
135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  See the License for the specific language governing permissions and
155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *  limitations under the License.
165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) *
175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ******************************************************************************/
185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/******************************************************************************
202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) *
21eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch *  This file contains timer definitions from WIDCOMM's Universal Embedded
22eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch *  Drivers API.
23eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch *
245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ******************************************************************************/
255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#ifndef UTIMER_H
275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#define UTIMER_H
285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)
295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)/*******************************************************************************
30** Timer APIs
31*******************************************************************************/
32
33/**** Timer IDs ****/
34
35#define UTIMER_ID_1               0
36#define UTIMER_ID_2               1
37#define UTIMER_ID_3               2
38#define UTIMER_ID_4               3
39
40#define UTIMER_NUM_TIMERS         4     /* Number of timers supported */
41
42typedef UINT8 tUTIMER_ID;
43
44/**** Timer types ****/
45
46#define UTIMER_TYPE_PERIODIC      0
47#define UTIMER_TYPE_ONESHOT       1
48
49typedef UINT8 tUTIMER_TYPE;
50
51
52/**** Timer time ****/
53
54typedef UINT32 tUTIMER_TIME;
55
56
57/**** Timer configuration ****/
58
59typedef struct
60{
61    tUTIMER_TIME period;
62    tUTIMER_TYPE type;
63} tUTIMER_CFG;
64
65
66/**** Timer feature types ****/
67#define UTIMER_FEAT_ID_1          0
68#define UTIMER_FEAT_ID_2          1
69#define UTIMER_FEAT_ID_3          2
70#define UTIMER_FEAT_ID_4          3
71#define UTIMER_FEAT_TYPE_PERIODIC 4
72#define UTIMER_FEAT_TYPE_ONESHOT  5
73
74typedef UINT8 tUTIMER_FEATURE;
75
76
77/**** Callback for timer expiration ****/
78typedef void (tUTIMER_CBACK)(tUTIMER_ID);
79
80
81/*******************************************************************************
82** Function Prototypes
83*******************************************************************************/
84#ifdef __cplusplus
85extern "C" {
86#endif
87
88UDRV_API extern void    UTIMER_Init(void *);
89UDRV_API extern void    UTIMER_Start(tUTIMER_ID, tUTIMER_CFG *, tUTIMER_CBACK *);
90UDRV_API extern void    UTIMER_Read(tUTIMER_ID, tUTIMER_TIME *);
91UDRV_API extern void    UTIMER_Stop(tUTIMER_ID);
92UDRV_API extern BOOLEAN UTIMER_Feature(tUTIMER_FEATURE);
93
94#ifdef __cplusplus
95}
96#endif
97
98#endif /* UTIMER_H */
99