예제 #1
0
파일: PowerSrv.c 프로젝트: aleho/ti_wilink
/****************************************************************************************
 *                        powerSrv_create                                                           *
 ****************************************************************************************
DESCRIPTION: Power Server module creation function, called by the MAC Services create in creation phase
                performs the following:
                -   Allocate the Power Server handle
                -   Creates the Power Server State Machine

INPUT:          - hOs - Handle to OS


OUTPUT:

RETURN:     Handle to the Power Server module on success, NULL otherwise
****************************************************************************************/
TI_HANDLE powerSrv_create(TI_HANDLE hOs)
{
    powerSrv_t * pPowerSrv = NULL;
    pPowerSrv = (powerSrv_t*) os_memoryAlloc (hOs, sizeof(powerSrv_t));
    if ( pPowerSrv == NULL )
    {
        WLAN_OS_REPORT(("powerSrv_create - Memory Allocation Error!\n"));
        return NULL;
    }

    os_memoryZero (hOs, pPowerSrv, sizeof(powerSrv_t));

    pPowerSrv->hOS = hOs;

    /*creation of the State Machine*/
    pPowerSrv->hPowerSrvSM = powerSrvSM_create(hOs);
    if ( pPowerSrv->hPowerSrvSM == NULL )
    {
        WLAN_OS_REPORT(("powerSrv_create - Error in create PowerSrvSM module!\n"));
        powerSrv_destroy(pPowerSrv);
        return NULL;
    }

    return pPowerSrv;

}
예제 #2
0
/****************************************************************************************
 *                        MacServices_destroy                                                    *
 *****************************************************************************************
DESCRIPTION: destroys MacServices module
                                                                                                                               
INPUT:          hMacServices - handle to the Mac Services object.
OUTPUT:     
RETURN:     
****************************************************************************************/
void MacServices_destroy( TI_HANDLE hMacServices ) 
{
    MacServices_t *pMacServices = (MacServices_t*)hMacServices;
    
    /* destroy all SRV modules */
    if ( NULL != pMacServices->hScanSRV )
    {
        MacServices_scanSRV_destroy( pMacServices->hScanSRV );
    }
    if ( NULL != pMacServices->hMeasurementSRV )
    {
        MacServices_measurementSRV_destroy( pMacServices->hMeasurementSRV );
    }

    if(pMacServices->hPowerSrv)
    powerSrv_destroy(pMacServices->hPowerSrv);

    /* free the Mac services allocated context */
    os_memoryFree( pMacServices->hOS, (TI_HANDLE)pMacServices , sizeof(MacServices_t) );
}