/*************************************************************************** * Copyright (c) 2007-2009, Broadcom Corporation * All Rights Reserved * Confidential Property of Broadcom Corporation * * THIS SOFTWARE MAY ONLY BE USED SUBJECT TO AN EXECUTED SOFTWARE LICENSE * AGREEMENT BETWEEN THE USER AND BROADCOM. YOU HAVE NO RIGHT TO USE OR * EXPLOIT THIS MATERIAL EXCEPT SUBJECT TO THE TERMS OF SUCH AN AGREEMENT. * * $brcm_Workfile: bmsglib.h $ * $brcm_Revision: Hydra_Software_Devel/11 $ * $brcm_Date: 7/8/09 2:57p $ * * Module Description: * * Revision History: * * $brcm_Log: /magnum/syslib/msglib/7401/bmsglib.h $ * * Hydra_Software_Devel/11 7/8/09 2:57p erickson * PR53768: removed BMSGlib_BufferMode. it was never implemented and has * no use. * * Hydra_Software_Devel/10 3/24/09 10:01a erickson * PR53516: added BMSGlib_GetStatus * * Hydra_Software_Devel/9 6/18/08 1:08p erickson * PR43730: fix warnings by moving param to size_t * * Hydra_Software_Devel/8 5/9/08 1:29p erickson * PR42456: added BMSGlib_Format_ePES_SAVE_ALL. clarified that * maxContiguousMessageSize only applies to PSI messages. * * Hydra_Software_Devel/7 4/14/08 1:16p erickson * PR41730: move user buffer override from Open time to Start time to give * maximum flexibility * * Hydra_Software_Devel/6 3/21/08 11:04a erickson * PR40813: added BMSGlib_SessionParams.bank. Removed unimplemented * BMSGlib_Format's. Clarified mem alloc design. * * Hydra_Software_Devel/5 3/10/08 1:27p erickson * PR39836: enforce memory allocation rules for group masters. If the * group master Closes, all other sessions in the group must be Stopped. * Don't allow the group master to restart if there are other sessions * still active in the group. * * Hydra_Software_Devel/4 2/26/08 10:29p erickson * PR39781: allow maxContiguousMessageSize == 0 for no data copy on wrap * around * * Hydra_Software_Devel/3 9/13/07 1:42p gmullen * PR32868: Changed bmsglib to accept PID channel number, rather than PID * and band combo. * * Hydra_Software_Devel/2 7/26/07 11:11p erickson * PR32868: added more debug and verification * * Hydra_Software_Devel/1 7/26/07 12:35p erickson * PR32868: initial checkin of BMSGlib * ************************************************************************/ #ifndef BMSGLIB_H__ #define BMSGLIB_H__ /*=****************************** Provide library for message filtering, especially for an efficient, reliable implementation of filter groups. 740x platforms have a HW restriction which limits a pid/band to be routed to the message filter block only once. This creates the requirement to use filter groups if you want to apply more than one filter on a pid. This HW restriction does not exist in all chips. For those chips which supports duplicate pid channels, BMSGlib_SessionParams.filterGroup defaults to false. Filter groups allow multiple filters to be applied on a single pid channel, but places all filtered messages into a single ring buffer. This requires the application to demux the messages per filter. BMSGlib supports high-bandwidth message capture. Therfore it minimizes any data copy. Sample Usage: void dataReadyCallback_isr(void *context) { BKNI_SetEvent((BKNI_EventHandle)context); } main() { uint16_t pids[]; // given BKNI_EventHandle event; BMSGlib_Settings settings; BMSGlib_Handle msglib; BMSGlib_Session_Handle msglib_session; BMSGlib_GetDefaultSettings(&settings); settings.xpt = xpt; settings.mem = mem; BMSGlib_Open(&msglib, settings); BKNI_CreateEvent(&event); BMSGlib_GetDefaultSessionSetting(&session_settings); session_settings.bufferSize = 4*1024; // let MSGlib alloc session_settings.dataReadyCallback_isr = dataReadyCallback_isr; session_settings.callbackContext = event; BMSGlib_OpenSession(&msglib_session, &session_settings); for (i=0;i 0, or may come from a group buffer (another session in the same filter group). Returns NULL if no data is available. This is rightly marked as const because the user should not modify the data. If the user does, another BMSGlib_SessionHandle might get invalid results. */ size_t *length /* [out] number of bytes pointed to by buffer. returns 0 if no data is available. */ ); /* Summary: Notify MSGlib of how much data was consumed from the last BMSGlib_GetBuffer call. Description: It must be <= the length returned by BMSGlib_GetBuffer. If < length, you must call BMSGlib_GetBuffer again to reobtain the pointer to the buffer. That is, you cannot call BMSGlib_ReadComplete more than once after each BMSGlib_GetBuffer. You cannot call BMSGlib_ReadComplete after calling BMSGlib_StopSession. */ BERR_Code BMSGlib_ReadComplete( BMSGlib_Session_Handle handle, unsigned amount_consumed /* number of bytes the caller has processed. Must be <= the length returned by last call to BMSGlib_GetBuffer. */ ); /* Summary: Status information returned by BMSGlib_GetStatus */ typedef struct BMSGlib_Status { unsigned groupMembers; /* total number of filters in the filter group, including this session */ bool isGroupMaster; /* true if this session is the group master */ } BMSGlib_Status; /* Summary: Get status information about the session */ BERR_Code BMSGlib_GetStatus( BMSGlib_Session_Handle handle, BMSGlib_Status *pStatus /* [out] */ ); #ifdef __cplusplus } #endif #endif /* BMSGLIB_H__ */