TWD/TWDriver/TWDriverRadio.c
changeset 0 10c42ec6c05f
equal deleted inserted replaced
-1:000000000000 0:10c42ec6c05f
       
     1 /*
       
     2  * TWDriverRadio.c
       
     3  *
       
     4  * Copyright(c) 1998 - 2010 Texas Instruments. All rights reserved.      
       
     5  * All rights reserved.      
       
     6  * 
       
     7  * This program and the accompanying materials are made available under the 
       
     8  * terms of the Eclipse Public License v1.0 or BSD License which accompanies
       
     9  * this distribution. The Eclipse Public License is available at
       
    10  * http://www.eclipse.org/legal/epl-v10.html and the BSD License is as below.                                   
       
    11  *                                                                       
       
    12  * Redistribution and use in source and binary forms, with or without    
       
    13  * modification, are permitted provided that the following conditions    
       
    14  * are met:                                                              
       
    15  *                                                                       
       
    16  *  * Redistributions of source code must retain the above copyright     
       
    17  *    notice, this list of conditions and the following disclaimer.      
       
    18  *  * Redistributions in binary form must reproduce the above copyright  
       
    19  *    notice, this list of conditions and the following disclaimer in    
       
    20  *    the documentation and/or other materials provided with the         
       
    21  *    distribution.                                                      
       
    22  *  * Neither the name Texas Instruments nor the names of its            
       
    23  *    contributors may be used to endorse or promote products derived    
       
    24  *    from this software without specific prior written permission.      
       
    25  *                                                                       
       
    26  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS   
       
    27  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT     
       
    28  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
       
    29  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT  
       
    30  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
       
    31  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT      
       
    32  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
       
    33  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
       
    34  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT   
       
    35  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
       
    36  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
       
    37  */
       
    38 
       
    39 
       
    40 /** \file  TWDriverRadio.c 
       
    41  *  \brief TI WLAN BIT
       
    42  *
       
    43  *  \see   TWDriver.h 
       
    44  */
       
    45 
       
    46 #define __FILE_ID__  FILE_ID_119
       
    47 #include "TWDriver.h"
       
    48 #include "osApi.h"
       
    49 #include "TWDriverInternal.h"
       
    50 #include "CmdBld.h"
       
    51 /*****************************************************************************
       
    52 *                                                                            *
       
    53 *                       Static functions                                     *
       
    54 *                                                                            *
       
    55 ******************************************************************************/
       
    56 
       
    57 
       
    58 
       
    59 /*****************************************************************************
       
    60 *                                                                            *
       
    61 *                       API functions	                                     *
       
    62 *                                                                            *
       
    63 ******************************************************************************/
       
    64 /****************************************************************************************
       
    65  *                        TWDriverTestCB                                    
       
    66  ****************************************************************************************/
       
    67 void TWDriverTestCB(TI_HANDLE hTWD, 
       
    68 					TI_STATUS eStatus, 
       
    69 					TI_HANDLE pTestCmdParams)
       
    70 {
       
    71 	TTwd *pTWD = (TTwd *)hTWD;
       
    72 
       
    73 	if (pTWD->pRadioCb != NULL)
       
    74 	{
       
    75 	os_memoryCopy(NULL, pTWD->pRadioCb, &pTWD->testCmd.testCmd_u, sizeof(pTWD->testCmd.testCmd_u));
       
    76 	}
       
    77 
       
    78 	if (pTWD->fRadioCb != NULL)
       
    79 	{
       
    80 	pTWD->fRadioCb(pTWD->hRadioCb, eStatus, pTWD->pRadioCb);
       
    81 }
       
    82 }
       
    83 
       
    84 /****************************************************************************************
       
    85  *                        TWDriverTest                                    
       
    86  ****************************************************************************************/
       
    87 TI_STATUS TWDriverTest(TI_HANDLE hTWD, 
       
    88 					   TestCmdID_enum eTestCmd, 
       
    89 					   void* pTestCmdParams, 
       
    90 					   TTestCmdCB fCb, 
       
    91 					   TI_HANDLE hCb)
       
    92 {
       
    93 	TTwd *pTWD = (TTwd *)hTWD;
       
    94 
       
    95 	/* check parameters */
       
    96 	if (( hTWD == NULL ) ||
       
    97 		( eTestCmd >= MAX_TEST_CMD_ID ) ||
       
    98 		( fCb == NULL ) ||
       
    99 		( hCb == NULL ))
       
   100 	{
       
   101 		return (TI_NOK);
       
   102 	}
       
   103 
       
   104 	pTWD->testCmd.testCmdId = eTestCmd;
       
   105 
       
   106 	if (pTestCmdParams != NULL)
       
   107 	{
       
   108 	os_memoryCopy(NULL, &pTWD->testCmd.testCmd_u, pTestCmdParams, sizeof(pTWD->testCmd.testCmd_u));
       
   109 	}
       
   110 
       
   111 	pTWD->fRadioCb = fCb;
       
   112 	pTWD->pRadioCb = pTestCmdParams;
       
   113 	pTWD->hRadioCb = hCb;
       
   114 
       
   115 	return(cmdBld_CmdTest (pTWD->hCmdBld, 
       
   116 						   (TI_HANDLE)TWDriverTestCB, 
       
   117 						   hTWD, 
       
   118 						   &pTWD->testCmd));
       
   119 }