1 /****************************************************************************** 2 * 3 * Copyright (C) 2001-2012 Broadcom Corporation 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at: 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ******************************************************************************/ 18 19 /****************************************************************************** 20 * 21 * This file contains timer definitions from WIDCOMM's Universal Embedded 22 * Drivers API. 23 * 24 ******************************************************************************/ 25 26 #ifndef UTIMER_H 27 #define UTIMER_H 28 29 /******************************************************************************* 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 42 typedef UINT8 tUTIMER_ID; 43 44 /**** Timer types ****/ 45 46 #define UTIMER_TYPE_PERIODIC 0 47 #define UTIMER_TYPE_ONESHOT 1 48 49 typedef UINT8 tUTIMER_TYPE; 50 51 52 /**** Timer time ****/ 53 54 typedef UINT32 tUTIMER_TIME; 55 56 57 /**** Timer configuration ****/ 58 59 typedef 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 74 typedef UINT8 tUTIMER_FEATURE; 75 76 77 /**** Callback for timer expiration ****/ 78 typedef void (tUTIMER_CBACK)(tUTIMER_ID); 79 80 81 /******************************************************************************* 82 ** Function Prototypes 83 *******************************************************************************/ 84 #ifdef __cplusplus 85 extern "C" { 86 #endif 87 88 UDRV_API extern void UTIMER_Init(void *); 89 UDRV_API extern void UTIMER_Start(tUTIMER_ID, tUTIMER_CFG *, tUTIMER_CBACK *); 90 UDRV_API extern void UTIMER_Read(tUTIMER_ID, tUTIMER_TIME *); 91 UDRV_API extern void UTIMER_Stop(tUTIMER_ID); 92 UDRV_API extern BOOLEAN UTIMER_Feature(tUTIMER_FEATURE); 93 94 #ifdef __cplusplus 95 } 96 #endif 97 98 #endif /* UTIMER_H */ 99