1 /* 2 * TwIf.h 3 * 4 * Copyright(c) 1998 - 2009 Texas Instruments. All rights reserved. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * * Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * * Neither the name Texas Instruments nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 24 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 25 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 27 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 28 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 29 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 31 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 32 */ 33 34 35 36 /** \file TwIf.h 37 * \brief TwIf module API definition 38 * 39 * \see TwIf.c 40 */ 41 42 #ifndef __TWIF_API_H__ 43 #define __TWIF_API_H__ 44 45 46 #include "Device.h" 47 #include "TxnDefs.h" 48 #include "BusDrv.h" 49 50 51 /************************************************************************ 52 * Defines 53 ************************************************************************/ 54 55 56 /************************************************************************ 57 * Macros 58 ************************************************************************/ 59 /* 60 * Defines a TNETWIF read/write field with padding. 61 * A low level driver may use this padding internally 62 */ 63 #define PADDING(field) \ 64 TI_UINT8 padding [TNETWIF_READ_OFFSET_BYTES]; \ 65 field; 66 67 68 /************************************************************************ 69 * Types 70 ************************************************************************/ 71 72 typedef void (*TTwIfCallback)(TI_HANDLE hCb); 73 typedef void (*TRecoveryCb)(TI_HANDLE hCb); 74 75 76 77 /************************************************************************ 78 * Functions 79 ************************************************************************/ 80 TI_HANDLE twIf_Create (TI_HANDLE hOs); 81 TI_STATUS twIf_Destroy (TI_HANDLE hTwIf); 82 void twIf_Init (TI_HANDLE hTwIf, 83 TI_HANDLE hReport, 84 TI_HANDLE hContext, 85 TI_HANDLE hTimer, 86 TI_HANDLE hTxnQ, 87 TRecoveryCb fRecoveryCb, 88 TI_HANDLE hRecoveryCb); 89 void twIf_RegisterErrCb (TI_HANDLE hTwIf, void *fErrCb, TI_HANDLE hErrCb); 90 ETxnStatus twIf_Restart (TI_HANDLE hTwIf); 91 void twIf_SetPartition (TI_HANDLE hTwIf, 92 TPartition *pPartition); 93 void twIf_Awake (TI_HANDLE hTwIf); 94 void twIf_Sleep (TI_HANDLE hTwIf); 95 void twIf_HwAvailable (TI_HANDLE hTwIf); 96 ETxnStatus twIf_Transact (TI_HANDLE hTwIf, TTxnStruct *pTxn); 97 ETxnStatus twIf_TransactReadFWStatus (TI_HANDLE hTwIf, TTxnStruct *pTxn); 98 99 TI_BOOL twIf_isValidMemoryAddr(TI_HANDLE hTwIf, TI_UINT32 Address, TI_UINT32 Length); 100 TI_BOOL twIf_isValidRegAddr(TI_HANDLE hTwIf, TI_UINT32 Address, TI_UINT32 Length); 101 102 #ifdef TI_DBG 103 void twIf_PrintModuleInfo (TI_HANDLE hTwIf); 104 void twIf_PrintQueues (TI_HANDLE hTwIf); 105 #endif /* TI_DBG */ 106 107 108 109 110 #endif /*__TWIF_API_H__*/ 111