| [2] | 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2004-2005, 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: tspsi_validate.h $ |
|---|
| 11 | * $brcm_Revision: 2 $ |
|---|
| 12 | * $brcm_Date: 3/11/05 6:18p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /BSEAV/lib/tspsi/tspsi_validate.h $ |
|---|
| 19 | * |
|---|
| 20 | * 2 3/11/05 6:18p erickson |
|---|
| 21 | * PR13415: add TS_Get_Message_Size |
|---|
| 22 | * |
|---|
| 23 | * 1 2/7/05 11:33p dlwin |
|---|
| 24 | * Merge down for release 2005_REFSW_MERGETOMAIN: |
|---|
| 25 | * |
|---|
| 26 | * Irvine_BSEAVSW_Devel/3 9/9/04 2:01p erickson |
|---|
| 27 | * PR12101: added hardware PR numbers |
|---|
| 28 | * |
|---|
| 29 | * Irvine_BSEAVSW_Devel/2 8/19/04 1:14p erickson |
|---|
| 30 | * PR12101: got working with magnum |
|---|
| 31 | * |
|---|
| 32 | * Irvine_BSEAVSW_Devel/1 8/19/04 10:28a erickson |
|---|
| 33 | * PR12101: added platform-independent tspsi validation code |
|---|
| 34 | * |
|---|
| 35 | ****************************************************************/ |
|---|
| 36 | #ifndef TSPSI_VALIDATE_H__ |
|---|
| 37 | #define TSPSI_VALIDATE_H__ |
|---|
| 38 | |
|---|
| 39 | /*=************************************** |
|---|
| 40 | This module is to verify that a correct message has been returned by |
|---|
| 41 | the transport message filtering hardware. Due to a hardware limitation, |
|---|
| 42 | the first message returned after starting message capture may be corrupt. |
|---|
| 43 | |
|---|
| 44 | PR's for this issue include 11331 and 8622. |
|---|
| 45 | |
|---|
| 46 | This check does not provide an absolute guarantee that the message is correct, |
|---|
| 47 | but it obtains a high degree of probability. The tests are as follows: |
|---|
| 48 | |
|---|
| 49 | 1. The application should only call these functions if it is the first |
|---|
| 50 | message captured after start. |
|---|
| 51 | 2. Run TS_Filter_Compare to verify that the filter matches the data. |
|---|
| 52 | 3. Run TS_Validate_Size to make verify that we have only whole messages. |
|---|
| 53 | *****************************************/ |
|---|
| 54 | |
|---|
| 55 | #ifndef USE_LEGACY_KERNAL_INTERFACE |
|---|
| 56 | #include <bstd.h> |
|---|
| 57 | #else |
|---|
| 58 | #include <brcm_t.h> |
|---|
| 59 | #endif |
|---|
| 60 | |
|---|
| 61 | #ifdef __cplusplus |
|---|
| 62 | extern "C" { |
|---|
| 63 | #endif |
|---|
| 64 | |
|---|
| 65 | /** |
|---|
| 66 | CPU-based filter comparison. |
|---|
| 67 | **/ |
|---|
| 68 | bool TS_Filter_Compare( const uint8_t *msg, const uint8_t *inclMask, const uint8_t *exclMask, |
|---|
| 69 | const uint8_t *coef, size_t filterSize ); |
|---|
| 70 | |
|---|
| 71 | /** |
|---|
| 72 | Return the current message size. |
|---|
| 73 | Description: |
|---|
| 74 | This assumes msg is pointing to a valid message. |
|---|
| 75 | The size includes any end padding. |
|---|
| 76 | **/ |
|---|
| 77 | int TS_Get_Message_Size(const uint8_t *msg); |
|---|
| 78 | |
|---|
| 79 | /** |
|---|
| 80 | Validate that a message size is exactly equal to the sum of its section lengths. |
|---|
| 81 | Description: |
|---|
| 82 | This test is only valid if the message starts at the beginning of the buffer. |
|---|
| 83 | The transport hardware will only write whole messages into the buffer, but if |
|---|
| 84 | you're not at the beginning, you may have wrap around and this test will fail. |
|---|
| 85 | **/ |
|---|
| 86 | bool TS_Validate_Size( const uint8_t *msg, size_t size); |
|---|
| 87 | |
|---|
| 88 | #ifdef __cplusplus |
|---|
| 89 | } |
|---|
| 90 | #endif |
|---|
| 91 | |
|---|
| 92 | #endif /* TSPSI_VALIDATE_H__ */ |
|---|