1 /* 2 * TWDriverRadio.c 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 /** \file TWDriverRadio.c 36 * \brief TI WLAN BIT 37 * 38 * \see TWDriver.h 39 */ 40 41 #define __FILE_ID__ FILE_ID_119 42 #include "TWDriver.h" 43 #include "osApi.h" 44 #include "TWDriverInternal.h" 45 #include "CmdBld.h" 46 /***************************************************************************** 47 * * 48 * Static functions * 49 * * 50 ******************************************************************************/ 51 52 53 54 /***************************************************************************** 55 * * 56 * API functions * 57 * * 58 ******************************************************************************/ 59 /**************************************************************************************** 60 * TWDriverTestCB 61 ****************************************************************************************/ 62 void TWDriverTestCB(TI_HANDLE hTWD, 63 TI_STATUS eStatus, 64 TI_HANDLE pTestCmdParams) 65 { 66 TTwd *pTWD = (TTwd *)hTWD; 67 68 if (pTWD->pRadioCb != NULL) 69 { 70 os_memoryCopy(NULL, pTWD->pRadioCb, &pTWD->testCmd.testCmd_u, sizeof(pTWD->testCmd.testCmd_u)); 71 } 72 73 if (pTWD->fRadioCb != NULL) 74 { 75 pTWD->fRadioCb(pTWD->hRadioCb, eStatus, pTWD->pRadioCb); 76 } 77 } 78 79 /**************************************************************************************** 80 * TWDriverTest 81 ****************************************************************************************/ 82 TI_STATUS TWDriverTest(TI_HANDLE hTWD, 83 TestCmdID_enum eTestCmd, 84 void* pTestCmdParams, 85 TTestCmdCB fCb, 86 TI_HANDLE hCb) 87 { 88 TTwd *pTWD = (TTwd *)hTWD; 89 90 /* check parameters */ 91 if (( hTWD == NULL ) || 92 ( eTestCmd >= MAX_TEST_CMD_ID ) || 93 ( fCb == NULL ) || 94 ( hCb == NULL )) 95 { 96 return (TI_NOK); 97 } 98 99 pTWD->testCmd.testCmdId = eTestCmd; 100 101 if (pTestCmdParams != NULL) 102 { 103 os_memoryCopy(NULL, &pTWD->testCmd.testCmd_u, pTestCmdParams, sizeof(pTWD->testCmd.testCmd_u)); 104 } 105 106 pTWD->fRadioCb = fCb; 107 pTWD->pRadioCb = pTestCmdParams; 108 pTWD->hRadioCb = hCb; 109 110 return(cmdBld_CmdTest (pTWD->hCmdBld, 111 (TI_HANDLE)TWDriverTestCB, 112 hTWD, 113 &pTWD->testCmd)); 114 } 115