| 1 | /*************************************************************************** |
|---|
| 2 | * Copyright (c) 2003-2011, 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: bdbg_log.h $ |
|---|
| 11 | * $brcm_Revision: Hydra_Software_Devel/1 $ |
|---|
| 12 | * $brcm_Date: 4/4/11 6:10p $ |
|---|
| 13 | * |
|---|
| 14 | * Module Description: |
|---|
| 15 | * |
|---|
| 16 | * Revision History: |
|---|
| 17 | * |
|---|
| 18 | * $brcm_Log: /magnum/basemodules/dbg/bdbg_log.h $ |
|---|
| 19 | * |
|---|
| 20 | * Hydra_Software_Devel/1 4/4/11 6:10p vsilyaev |
|---|
| 21 | * SW7405-5221: API to control buffering of the debug output |
|---|
| 22 | * |
|---|
| 23 | ***************************************************************************/ |
|---|
| 24 | |
|---|
| 25 | #ifndef BDBG_LOG_H |
|---|
| 26 | #define BDBG_LOG_H |
|---|
| 27 | |
|---|
| 28 | #include "bdbg_fifo.h" |
|---|
| 29 | |
|---|
| 30 | #ifdef __cplusplus |
|---|
| 31 | extern "C" { |
|---|
| 32 | #endif |
|---|
| 33 | |
|---|
| 34 | /*************************************************************************** |
|---|
| 35 | Summary: |
|---|
| 36 | Registers Fifo that is used to log debug data |
|---|
| 37 | |
|---|
| 38 | Description: |
|---|
| 39 | When this function is called and fifo is not NULL, then debug output instead |
|---|
| 40 | of being routed to the debug console, is stored in the provided FIFO. |
|---|
| 41 | THen application could use BDBG_Dequeue_Fifo to extract and print messages |
|---|
| 42 | logged into FIFO. |
|---|
| 43 | If FIFO is NULL debug output then directed to the debug console . |
|---|
| 44 | |
|---|
| 45 | Note: |
|---|
| 46 | Element size of the provided FIFO should match number retuirned buy |
|---|
| 47 | BDBG_Log_GetElementSize |
|---|
| 48 | |
|---|
| 49 | See Also: |
|---|
| 50 | BDBG_Log_Dequeue |
|---|
| 51 | BDBG_Fifo_Create |
|---|
| 52 | BDBG_Log_GetElementSize |
|---|
| 53 | |
|---|
| 54 | Example: |
|---|
| 55 | #include "bstd.h" |
|---|
| 56 | BDBG_MODULE(some_module) |
|---|
| 57 | |
|---|
| 58 | Input: |
|---|
| 59 | <none> |
|---|
| 60 | |
|---|
| 61 | Returns: |
|---|
| 62 | <none> |
|---|
| 63 | ****************************************************************************/ |
|---|
| 64 | void BDBG_Log_SetFifo( |
|---|
| 65 | BDBG_Fifo_Handle fifo /* instance of BDBG_Fifo_Handle */ |
|---|
| 66 | ); |
|---|
| 67 | |
|---|
| 68 | /*************************************************************************** |
|---|
| 69 | Summary: |
|---|
| 70 | Extracts and prints data from the debug FIFO |
|---|
| 71 | |
|---|
| 72 | Description: |
|---|
| 73 | WHen this function is called int extracts and prints not more then single |
|---|
| 74 | line to the debug console. And on success it returns timerout that application |
|---|
| 75 | should wait prior to calling into the BDBG_Dequeue_Fifo. |
|---|
| 76 | |
|---|
| 77 | See Also: |
|---|
| 78 | BDBG_Log_SetFifo |
|---|
| 79 | BDBG_FifoReader_Create |
|---|
| 80 | |
|---|
| 81 | ****************************************************************************/ |
|---|
| 82 | BERR_Code BDBG_Log_Dequeue( |
|---|
| 83 | BDBG_FifoReader_Handle logReader, /* Instance of BDBG_FifoReader */ |
|---|
| 84 | unsigned *timeout, /* timeout, in miliseconds, that application should wait prior to calling again into BDBG_Dequeue_Fifo */ |
|---|
| 85 | char *str, /* destination buffer */ |
|---|
| 86 | size_t str_size, /* size of the buffer */ |
|---|
| 87 | size_t *str_len /* [out] length of the string */ |
|---|
| 88 | ); |
|---|
| 89 | |
|---|
| 90 | /*************************************************************************** |
|---|
| 91 | Description: |
|---|
| 92 | This function returns size of the element used for storing debug output |
|---|
| 93 | ****************************************************************************/ |
|---|
| 94 | void BDBG_Log_GetElementSize( |
|---|
| 95 | size_t *elementSize /* [out] size of the element in the debug FIFO */ |
|---|
| 96 | ); |
|---|
| 97 | |
|---|
| 98 | #ifdef __cplusplus |
|---|
| 99 | } |
|---|
| 100 | #endif |
|---|
| 101 | |
|---|
| 102 | #endif /* BDBG_LOG_H */ |
|---|