| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-2010, Broadcom Corporation |
|---|
| 3 | * All Rights Reserved |
|---|
| 4 | * Confidential Property of Broadcom Corporation |
|---|
| 5 | * |
|---|
| 6 | * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE |
|---|
| 7 | * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR |
|---|
| 8 | * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. |
|---|
| 9 | * |
|---|
| 10 | * $brcm_Workfile: bastmlib_clock_reference.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/3 $ |
|---|
| 12 | * $brcm_Date: 7/14/10 7:44p $ |
|---|
| 13 | * |
|---|
| 14 | * Revision History: |
|---|
| 15 | * |
|---|
| 16 | * $brcm_Log: /magnum/syslib/astmlib/noarch/bastmlib_clock_reference.h $ |
|---|
| 17 | * |
|---|
| 18 | * Hydra_Software_Devel/3 7/14/10 7:44p bandrews |
|---|
| 19 | * SW3548-1161: expose default configs as public |
|---|
| 20 | * |
|---|
| 21 | * Hydra_Software_Devel/2 6/25/09 5:49p bandrews |
|---|
| 22 | * PR53244: Add const to declaration |
|---|
| 23 | * |
|---|
| 24 | * Hydra_Software_Devel/1 3/24/08 3:08p bandrews |
|---|
| 25 | * PR40865: Fixed |
|---|
| 26 | * |
|---|
| 27 | * Hydra_Software_Devel/2 2/15/08 10:00p bandrews |
|---|
| 28 | * PR36148: Updated ASTM based on reviews |
|---|
| 29 | * |
|---|
| 30 | * Hydra_Software_Devel/1 1/25/08 9:21p bandrews |
|---|
| 31 | * PR36148: Updated based on simulation |
|---|
| 32 | ***************************************************************************/ |
|---|
| 33 | |
|---|
| 34 | #include "bstd.h" |
|---|
| 35 | #include "bastmlib.h" |
|---|
| 36 | |
|---|
| 37 | #ifndef BASTMLIB_CLOCK_REFERENCE_H__ |
|---|
| 38 | #define BASTMLIB_CLOCK_REFERENCE_H__ |
|---|
| 39 | |
|---|
| 40 | typedef struct BASTMlib_ClockReference_Impl * BASTMlib_ClockReference_Handle; |
|---|
| 41 | |
|---|
| 42 | typedef struct BASTMlib_ClockReference_Config |
|---|
| 43 | { |
|---|
| 44 | unsigned int uiMinimumTimeBetweenEvents; /* minimum time that must |
|---|
| 45 | elapse between receiving events, in ms. used with processing |
|---|
| 46 | frequency to determine size of event ring buffer. if events come |
|---|
| 47 | more often than this time, the event buffer may overflow, and newer |
|---|
| 48 | events will be lost */ |
|---|
| 49 | BASTMlib_ClockRate eClockReferenceDomain; /* the clocking domain of |
|---|
| 50 | the clock reference time stamps */ |
|---|
| 51 | unsigned int uiDeviationThreshold; /* threshold above which abs value of |
|---|
| 52 | clock reference rate difference to STC will be considered deviant, |
|---|
| 53 | in eClockReferenceDomain ticks */ |
|---|
| 54 | unsigned int uiDeviantCountThreshold; /* how many deviant clock |
|---|
| 55 | coupling measurements must be received before deeming the clock |
|---|
| 56 | reference bad and decoupling the timebases from the input */ |
|---|
| 57 | unsigned int uiIdealCountThreshold;/* how many ideal clock |
|---|
| 58 | coupling measurements must be received before deeming the clock |
|---|
| 59 | reference good and recoupling the timebases to the input */ |
|---|
| 60 | } BASTMlib_ClockReference_Config; |
|---|
| 61 | |
|---|
| 62 | void BASTMlib_ClockReference_Create( |
|---|
| 63 | BASTMlib_ClockReference_Handle * phReference |
|---|
| 64 | ); |
|---|
| 65 | |
|---|
| 66 | void BASTMlib_ClockReference_Destroy( |
|---|
| 67 | BASTMlib_ClockReference_Handle hReference |
|---|
| 68 | ); |
|---|
| 69 | |
|---|
| 70 | void BASTMlib_ClockReference_Reset_isr( |
|---|
| 71 | BASTMlib_ClockReference_Handle hReference |
|---|
| 72 | ); |
|---|
| 73 | |
|---|
| 74 | void BASTMlib_ClockReference_GetDefaultConfig( |
|---|
| 75 | BASTMlib_ClockReference_Config * psConfig |
|---|
| 76 | ); |
|---|
| 77 | |
|---|
| 78 | void BASTMlib_ClockReference_GetConfig( |
|---|
| 79 | const BASTMlib_ClockReference_Handle hReference, |
|---|
| 80 | BASTMlib_ClockReference_Config * psConfig |
|---|
| 81 | ); |
|---|
| 82 | |
|---|
| 83 | void BASTMlib_ClockReference_SetConfig( |
|---|
| 84 | BASTMlib_ClockReference_Handle hReference, |
|---|
| 85 | const BASTMlib_ClockReference_Config * psConfig |
|---|
| 86 | ); |
|---|
| 87 | |
|---|
| 88 | void BASTMlib_ClockReference_EventHandler_isr( |
|---|
| 89 | BASTMlib_ClockReference_Handle hReference, |
|---|
| 90 | const BASTMlib_ClockReference_Event * psEvent |
|---|
| 91 | |
|---|
| 92 | ); |
|---|
| 93 | |
|---|
| 94 | void BASTMlib_ClockReference_ResizeEventQueue( |
|---|
| 95 | BASTMlib_ClockReference_Handle hReference |
|---|
| 96 | ); |
|---|
| 97 | |
|---|
| 98 | #endif /* BASTMLIB_CLOCK_REFERENCE_H__ */ |
|---|
| 99 | |
|---|