Example #1
0
void MissionName(int val, int xx, int yy, int len)
{
    TRACE5("->MissionName(val %d, xx %d, yy %d, len %d)", val, xx, yy, len);
    int i, j = 0;

    GetMisType(val);

    grMoveTo(xx, yy);

    for (i = 0; i < 50; i++) {
        if (j > len && Mis.Name[i] == ' ') {
            yy += 7;
            j = 0;
            grMoveTo(xx, yy);
        } else {
            draw_character(Mis.Name[i]);
        }

        j++;

        if (Mis.Name[i] == '\0') {
            break;
        }
    }

    TRACE1("<-MissionName");

    return;
}
Example #2
0
kern_return_t vm_protect(vm_task_t target_task, void* address, vm_size_t size, boolean_t set_maximum, vm_prot_t new_protection)
{
	TRACE5(target_task, address, size, set_maximum, new_protection);
	CHECK_TASK_SELF(target_task);
	
	// FIXME: Here we ignore set_maximum, not sure what to do with that
	int flags = 0;
	
	if (new_protection & VM_PROT_READ)
		flags |= PROT_READ;
	if (new_protection & VM_PROT_WRITE)
		flags |= PROT_WRITE;
	if (new_protection & VM_PROT_EXECUTE)
		flags |= PROT_EXEC;
	
	if (::mprotect(address, size, flags) == -1)
	{
		if (errno == EACCES)
			return KERN_PROTECTION_FAILURE;
		else if (errno == EINVAL || errno == ENOMEM)
			return KERN_INVALID_ADDRESS;
		else
			return KERN_FAILURE;
	}
	else
		return KERN_SUCCESS;
}
Example #3
0
/*
 * \brief	Handle the Fw Status information 
 * 
 * \param  hFwEvent  - FwEvent Driver handle
 * \return void
 * 
 * \par Description
 * This function is called from fwEvent_Handle on a sync read, or from TwIf as a CB on an async read.
 * It calls fwEvent_CallHandlers to handle the triggered interrupts.
 * 
 * \sa fwEvent_Handle
 */
static ETxnStatus fwEvent_SmHandleEvents (TfwEvent *pFwEvent)
{
    ETxnStatus eStatus;
    CL_TRACE_START_L4();

    /* Save delta between driver and FW time (needed for Tx packets lifetime) */
    pFwEvent->uFwTimeOffset = (os_timeStampMs (pFwEvent->hOs) * 1000) - 
                              ENDIAN_HANDLE_LONG (pFwEvent->tFwStatusTxn.tFwStatus.fwLocalTime);

#ifdef HOST_INTR_MODE_LEVEL
    /* Acknowledge the host interrupt for LEVEL mode (must be after HINT_STT_CLR register clear on read) */
    os_InterruptServiced (pFwEvent->hOs);
#endif

    /* Save the interrupts status retreived from the FW */
    pFwEvent->uEventVector = pFwEvent->tFwStatusTxn.tFwStatus.intrStatus;

    /* Mask unwanted interrupts */
    pFwEvent->uEventVector &= pFwEvent->uEventMask;

    /* Call the interrupts handlers */
    eStatus = fwEvent_CallHandlers (pFwEvent);

    TRACE5(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_SmHandleEvents: Status=%d, EventVector=0x%x, IntrPending=%d, NumPendHndlrs=%d, FwTimeOfst=%d\n", eStatus, pFwEvent->uEventVector, pFwEvent->bIntrPending, pFwEvent->uNumPendHndlrs, pFwEvent->uFwTimeOffset);
    CL_TRACE_END_L4("tiwlan_drv.ko", "CONTEXT", "FwEvent", "");

    /* Return the status of the handlers processing (complete, pending or error) */
    return eStatus;
} 
/**
 * \\n
 * \date 23-December-2005\n
 * \brief Prints a measurement request.\n
 *
 * Function Scope \e Public.\n
 * \param hMeasurementSRV - handle to the measurement SRV object.\n
 * \param pMsrRequest - the measurement request.\n
 */
void measurementSRVPrintRequest( TI_HANDLE hMeasurementSRV, TMeasurementRequest *pMsrRequest )
{
#ifdef TI_DBG
	measurementSRV_t* pMeasurementSRV = (measurementSRV_t*)hMeasurementSRV;
	TI_INT32 i;

	TRACE0( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "Measurement request:\n");
	TRACE5( pMeasurementSRV->hReport, REPORT_SEVERITY_INFORMATION, "band: %d, channel:%d, TX power level: %d, start time: %x-%x\n", pMsrRequest->band, pMsrRequest->channel, pMsrRequest->txPowerDbm, INT64_HIGHER(pMsrRequest->startTime), INT64_LOWER(pMsrRequest->startTime));
	for ( i = 0; i < pMsrRequest->numberOfTypes; i++ ) {
		measurementSRVPrintTypeRequest( hMeasurementSRV, &(pMsrRequest->msrTypes[ i ]));
	}
#endif /* TI_DBG */

}
/*
** Read data from a file into a buffer.  Return SQLITE_OK if all
** bytes were read successfully and SQLITE_IOERR if anything goes
** wrong.
*/
int sqlite3OsRead(OsFile *id, void *pBuf, int amt){
  int got;
  assert( id->isOpen );
  SimulateIOError(SQLITE_IOERR);
  TIMER_START;
  got = read(id->h, pBuf, amt);
  TIMER_END;
  TRACE5("READ    %-3d %5d %7d %d\n", id->h, got, last_page, TIMER_ELAPSED);
  SEEK(0);
  /* if( got<0 ) got = 0; */
  if( got==amt ){
    return SQLITE_OK;
  }else{
    return SQLITE_IOERR;
  }
}
Example #6
0
kern_return_t vm_read(vm_task_t target_task, const void* address, vm_size_t size, void** data_out, natural_t* data_count)
{
	TRACE5(target_task, address, size, data_out, data_count);
	CHECK_TASK_SELF(target_task);
	
	if (!memory_readable(address, size))
		return KERN_INVALID_ADDRESS;
	
	kern_return_t ret = vm_allocate(mach_task_self_, data_out, size, true);
	if (ret != KERN_SUCCESS)
		return ret;
	
	::memcpy(*data_out, address, size);
	*data_count = size; // Is this correct?
	
	return KERN_SUCCESS;
}
/*
** Write data from a buffer into a file.  Return SQLITE_OK on success
** or some other error code on failure.
*/
int sqlite3OsWrite(OsFile *id, const void *pBuf, int amt){
  int wrote = 0;
  assert( id->isOpen );
  assert( amt>0 );
  SimulateIOError(SQLITE_IOERR);
  SimulateDiskfullError;
  TIMER_START;
  while( amt>0 && (wrote = write(id->h, pBuf, amt))>0 ){
    amt -= wrote;
    pBuf = &((char*)pBuf)[wrote];
  }
  TIMER_END;
  TRACE5("WRITE   %-3d %5d %7d %d\n", id->h, wrote, last_page, TIMER_ELAPSED);
  SEEK(0);
  if( amt>0 ){
    return SQLITE_FULL;
  }
  return SQLITE_OK;
}
Example #8
0
/* FIXME - what happens when you seek past end of file? */
off_t csf_seek(CSF_CTX *ctx, off_t offset, int whence) {
  off_t csf_seek = 0;
  off_t true_offset;
  off_t target_offset = 0;
  int page_count = csf_page_count_for_file(ctx);
  size_t data_sz;

  switch(whence) {
    case SEEK_SET:
      target_offset = offset;
      break;
    case SEEK_CUR:
      target_offset = ctx->seek_ptr + offset;
      break;
    case SEEK_END:
      target_offset = csf_file_size(ctx) + offset;
      break;
  }  
  
  ctx->seek_ptr = target_offset;

  TRACE5("csf_seek(%d,%d,%d), ctx->seek_ptr = %d\n", *ctx->fh, offset, whence, ctx->seek_ptr);
  return ctx->seek_ptr;
}
static void
av_process_event(SDL_Event * evp)
{
	int c;

	switch (evp->type)
	{
		case SDL_QUIT:
			TRACE2("event %04x", evp->type);
			exit(0);
			break;

		case SDL_USEREVENT:
			/* TRACE2("event %04x", evp->type); */
			break;

		case SDL_KEYDOWN:
			switch (evp->key.keysym.sym)
			{
				case SDLK_UP:    c = UP_ARROW; break;
				case SDLK_DOWN:  c = DN_ARROW; break;
				case SDLK_RIGHT: c = RT_ARROW; break;
				case SDLK_LEFT:  c = LT_ARROW; break;
				case SDLK_HOME:  c = K_HOME;   break;
				case SDLK_END :  c = K_END;    break;
				case SDLK_F1:    c = 0x3B00;   break;
				case SDLK_F2:    c = 0x3C00;   break;
				case SDLK_F3:    c = 0x3D00;   break;
				default:
					c = evp->key.keysym.unicode;
					break;
			}
			TRACE4("event %04x %04x %04x", evp->type,
					evp->key.keysym.sym, evp->key.keysym.unicode);
			if (c)
			{
				keybuf[keybuf_in_idx] = c;
				keybuf_in_idx = (keybuf_in_idx + 1) % KEYBUF_SIZE;
			}
			break;

		case SDL_MOUSEBUTTONDOWN:
			av_mouse_pressed_cur = 1;
			av_mouse_pressed_latched = 1;
			av_mouse_pressed_x = evp->button.x;
			av_mouse_pressed_y = evp->button.y;
			TRACE5("event %04x %04x %04x %04x", evp->type,
					evp->button.x, evp->button.y, evp->button.button);
			break;

		case SDL_MOUSEBUTTONUP:
			TRACE5("event %04x %04x %04x %04x", evp->type,
					evp->button.x, evp->button.y, evp->button.button);
			av_mouse_pressed_cur = 0;

			/* if we get a mouse wheel event then translate it to arrow keypress */
			if (evp->button.button == SDL_BUTTON_WHEELUP
					|| evp->button.button == SDL_BUTTON_WHEELDOWN)
			{
				SDL_Event ev;
				int up = evp->button.button == SDL_BUTTON_WHEELUP;
				SDLMod mod = SDL_GetModState();
				SDLKey key;
				
				if (mod & KMOD_SHIFT)
					key = up ? SDLK_LEFT : SDLK_RIGHT;
				else
					key = up ? SDLK_UP : SDLK_DOWN;

				ev.type = SDL_KEYDOWN;
				ev.key.type = SDL_KEYDOWN;
				ev.key.state = SDL_RELEASED;
				ev.key.keysym.scancode = 0;
				ev.key.keysym.mod = mod;
				ev.key.keysym.unicode = 0;
				ev.key.keysym.sym = key;
				av_process_event(&ev);
			}
			break;

		case SDL_MOUSEMOTION:
			av_mouse_cur_x = evp->motion.x;
			av_mouse_cur_y = evp->motion.y;
			break;

			/* ignore these events */
		case SDL_KEYUP:
		case SDL_ACTIVEEVENT:
			break;
		default:
			DEBUG2("got unknown event %d", evp->type);
			break;
	}
}
Example #10
0
/*
 * \brief	FW-Event state machine
 * 
 * \param  hFwEvent  - FwEvent Driver handle
 * \return void
 * 
 * \par Description
 * 
 * Process the current FW events in a sequence that may progress in the same context,
 *     or exit if pending an Async transaction, which will call back the SM when finished.
 *
 * \sa
 */
static void fwEvent_StateMachine (TfwEvent *pFwEvent)
{
    ETxnStatus  eStatus = TXN_STATUS_ERROR; /* Set to error to detect if used uninitialized */
    CL_TRACE_START_L3();

	/* 
	 * Loop through the states sequence as long as the process is synchronous.
	 * Exit when finished or if an Asynchronous process is required. 
     * In this case the SM will be called back upon Async operation completion. 
	 */
	while (1)
	{
		switch (pFwEvent->eSmState)
		{
            /* IDLE: Update TwIf and read interrupt info from FW */
            case FWEVENT_STATE_IDLE:
            {
                CL_TRACE_START_L5();
                twIf_Awake(pFwEvent->hTwIf);
                eStatus = fwEvent_SmReadIntrInfo (pFwEvent);
                pFwEvent->eSmState = FWEVENT_STATE_WAIT_INTR_INFO;
                CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".ReadInfo");
                break;
            }
            /* WAIT_INTR_INFO: We have the interrupt info so call the handlers accordingly */
            case FWEVENT_STATE_WAIT_INTR_INFO:
            {
                CL_TRACE_START_L5();
                eStatus = fwEvent_SmHandleEvents (pFwEvent);
                /* If state was changed to IDLE by recovery or stop process, exit (process terminated) */
                if (pFwEvent->eSmState == FWEVENT_STATE_IDLE) 
                {
                    CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".HndlEvents");
                    CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", "");
                    return;
                }
                pFwEvent->eSmState = FWEVENT_STATE_WAIT_HANDLE_COMPLT;
                CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".HndlEvents");
                break;
            }
            /* WAIT_HANDLE_COMPLT: Current handling is completed. */
            case FWEVENT_STATE_WAIT_HANDLE_COMPLT:
            {
                /* If pending interrupt, read interrupt info (back to WAIT_INTR_INFO state) */
                if (pFwEvent->bIntrPending) 
                {
                    CL_TRACE_START_L5();
                    pFwEvent->bIntrPending = TI_FALSE;
                    eStatus = fwEvent_SmReadIntrInfo (pFwEvent);
                    pFwEvent->eSmState = FWEVENT_STATE_WAIT_INTR_INFO;
                    CL_TRACE_END_L5("tiwlan_drv.ko", "CONTEXT", "FwEvent", ".HndlCmplt");
                }
                /* Else - all done so release TwIf to sleep and exit */
                else 
                {
                    twIf_Sleep(pFwEvent->hTwIf);
                    pFwEvent->eSmState = FWEVENT_STATE_IDLE;

                    TRACE3(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_StateMachine: Completed, NewState=%d, Status=%d, IntrPending=%d\n", pFwEvent->eSmState, eStatus, pFwEvent->bIntrPending);
                    CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", "");

                    /**** Finished all current events handling so exit ****/
                    return;
                }
                break;
            }

        }  /* switch */

        TRACE3(pFwEvent->hReport, REPORT_SEVERITY_INFORMATION, "fwEvent_StateMachine: NewState=%d, Status=%d, IntrPending=%d\n", pFwEvent->eSmState, eStatus, pFwEvent->bIntrPending);
        
		/* If last status is Pending, exit the SM (to be called back upon Async operation completion) */
		if (eStatus == TXN_STATUS_PENDING)
		{
            CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", "");
			return;
		}

        /* If error occured, stop the process and exit (should be cleaned by recovery process) */
		else if (eStatus == TXN_STATUS_ERROR)
		{
            TRACE5(pFwEvent->hReport, REPORT_SEVERITY_ERROR, "fwEvent_StateMachine: NewState=%d, Status=%d, IntrPending=%d, EventVector=0x%x, EventMask=0x%x\n", pFwEvent->eSmState, eStatus, pFwEvent->bIntrPending, pFwEvent->uEventVector, pFwEvent->uEventMask);
            CL_TRACE_END_L3("tiwlan_drv.ko", "CONTEXT", "FwEvent", "");
            fwEvent_Stop ((TI_HANDLE)pFwEvent);
			return;
		}

        /* If we got here the status is COMPLETE so continue in the while loop to the next state */

	}  /* while */
}
Example #11
0
/************************************************************************
 *                        buildProbeReqTemplate							*
 ************************************************************************
DESCRIPTION: This function build a probe request template to set to the HAL in the scan process.
				performs the following:
				-	Build a template & set the template len, the template type is set in the site mgr
                                                                                                   
INPUT:      pSiteMgr	-	Handle to site manager	
			pTemplate	-	Pointer to the template structure		
			pSsid		-	Desired SSID

OUTPUT:		

RETURN:     TI_OK

************************************************************************/
TI_STATUS buildProbeReqTemplate(siteMgr_t * pSiteMgr, TSetTemplate * pTemplate,
				TSsid * pSsid, ERadioBand radioBand)
{
	paramInfo_t param;
	char *pBuf;
	int i;
	probeReqTemplate_t *pBuffer = (probeReqTemplate_t *) pTemplate->ptr;
	TI_UINT32 size;
	dot11_RATES_t *pDot11Rates;
	TI_UINT32 len = 0, ofdmIndex = 0;
	TI_UINT32 suppRatesLen, extSuppRatesLen;
	TI_UINT8 ratesBuf[DOT11_MAX_SUPPORTED_RATES];
	TI_UINT8 WSCOuiIe[DOT11_OUI_LEN] = { 0x00, 0x50, 0xf2, 0x04 };
	TI_UINT32 supportedRateMask, basicRateMask;
	TI_UINT16 fc = DOT11_FC_PROBE_REQ;

	os_memoryZero(pSiteMgr->hOs, pBuffer, sizeof(probeReqTemplate_t));

	/*
	 * Header First
	 */
	/* Set destination address */
	for (i = 0; i < MAC_ADDR_LEN; i++)
		pBuffer->hdr.DA[i] = 0xFF;

	/* Set BSSID address */

	for (i = 0; i < MAC_ADDR_LEN; i++)
		pBuffer->hdr.BSSID[i] = 0xFF;

	/* Build Source address */
	param.paramType = CTRL_DATA_MAC_ADDRESS;
	ctrlData_getParam(pSiteMgr->hCtrlData, &param);
	MAC_COPY(pBuffer->hdr.SA, param.content.ctrlDataDeviceMacAddress);

	COPY_WLAN_WORD(&pBuffer->hdr.fc, &fc);	/* copy with endianess handling. */

	size = sizeof(dot11_mgmtHeader_t);
	pBuf = (char *)&(pBuffer->infoElements);

	/*
	 * Informataion elements
	 */
	/* SSID */
	/* It looks like it never happens. Anyway decided to check */
	if (pSsid->len > MAX_SSID_LEN) {
		TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR,
		       "buildProbeReqTemplate. pSsid->len=%d exceeds the limit %d\n",
		       pSsid->len, MAX_SSID_LEN);
		handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION);
		return TI_NOK;
	}
	((dot11_SSID_t *) (pBuf))->hdr[0] = DOT11_SSID_ELE_ID;
	((dot11_SSID_t *) (pBuf))->hdr[1] = pSsid->len;
	os_memoryCopy(pSiteMgr->hOs, pBuf + sizeof(dot11_eleHdr_t),
		      (void *)pSsid->str, pSsid->len);
	size += sizeof(dot11_eleHdr_t) + pSsid->len;
	pBuf += sizeof(dot11_eleHdr_t) + pSsid->len;

	/* Rates */
	pDot11Rates = (dot11_RATES_t *) pBuf;

	/* 
	 * Supported rates in probe request will always use the default rates for BG or A bands,
	 * regardless of the STA desired rates.
	 */
	if (radioBand == RADIO_BAND_2_4_GHZ) {
		/* Basic rates: 1,2,5.5,11 */
		basicRateMask =
		    rate_BasicToDrvBitmap((EBasicRateSet)
					  (pSiteMgr->pDesiredParams->
					   siteMgrRegstryBasicRate
					   [DOT11_G_MODE]), TI_FALSE);
		/* Extended: 6,9,12,18,24,36,48,54 */
		supportedRateMask =
		    rate_SupportedToDrvBitmap((ESupportedRateSet)
					      (pSiteMgr->pDesiredParams->
					       siteMgrRegstrySuppRate
					       [DOT11_G_MODE]), TI_FALSE);
	} else if (radioBand == RADIO_BAND_5_0_GHZ) {	/* Basic rates: 6,12,24 */
		basicRateMask =
		    rate_BasicToDrvBitmap((EBasicRateSet)
					  (pSiteMgr->pDesiredParams->
					   siteMgrRegstryBasicRate
					   [DOT11_A_MODE]), TI_TRUE);
		/* Extended: 9,18,24,36,48,54 */
		supportedRateMask =
		    rate_SupportedToDrvBitmap((ESupportedRateSet)
					      (pSiteMgr->pDesiredParams->
					       siteMgrRegstrySuppRate
					       [DOT11_A_MODE]), TI_TRUE);
	} else {
		TRACE1(pSiteMgr->hReport, REPORT_SEVERITY_ERROR,
		       "buildProbeReqTemplate, radioBand =%d ???\n", radioBand);
		/* Use default and pray for the best */
		/* Basic rates: 1,2,5.5,11 */
		basicRateMask =
		    rate_BasicToDrvBitmap(BASIC_RATE_SET_1_2_5_5_11, TI_FALSE);
		/* Extended: 6,9,12,18,24,36,48,54 */
		supportedRateMask =
		    rate_SupportedToDrvBitmap(SUPPORTED_RATE_SET_UP_TO_54,
					      TI_FALSE);
	}

	rate_DrvBitmapToNetStr(supportedRateMask, basicRateMask, ratesBuf, &len,
			       &ofdmIndex);

	TRACE5(pSiteMgr->hReport, REPORT_SEVERITY_INFORMATION,
	       "buildProbeReqTemplate, supportedRateMask=0x%x, basicRateMask=0x%x, len=%d, ofdmIndex=%d, radioBand =%d\n",
	       supportedRateMask, basicRateMask, len, ofdmIndex, radioBand);

	/* It looks like it never happens. Anyway decided to check */
	if (len > DOT11_MAX_SUPPORTED_RATES) {
		TRACE2(pSiteMgr->hReport, REPORT_SEVERITY_ERROR,
		       "buildProbeReqTemplate. len=%d exceeds the limit %d\n",
		       len, DOT11_MAX_SUPPORTED_RATES);
		handleRunProblem(PROBLEM_BUF_SIZE_VIOLATION);
		return TI_NOK;
	}
	if (radioBand == RADIO_BAND_5_0_GHZ ||
	    pSiteMgr->pDesiredParams->siteMgrUseDraftNum == DRAFT_5_AND_EARLIER
	    || ofdmIndex == len) {
		pDot11Rates->hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID;
		pDot11Rates->hdr[1] = len;
		os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates,
			      ratesBuf, pDot11Rates->hdr[1]);
		size += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t);
		pBuf += pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t);
	} else {
		pDot11Rates->hdr[0] = DOT11_SUPPORTED_RATES_ELE_ID;
		pDot11Rates->hdr[1] = ofdmIndex;
		os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates,
			      ratesBuf, pDot11Rates->hdr[1]);
		suppRatesLen = pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t);
		pDot11Rates = (dot11_RATES_t *) (pBuf + suppRatesLen);
		pDot11Rates->hdr[0] = DOT11_EXT_SUPPORTED_RATES_ELE_ID;
		pDot11Rates->hdr[1] = len - ofdmIndex;
		os_memoryCopy(pSiteMgr->hOs, (void *)pDot11Rates->rates,
			      &ratesBuf[ofdmIndex], pDot11Rates->hdr[1]);
		extSuppRatesLen = pDot11Rates->hdr[1] + sizeof(dot11_eleHdr_t);
		size += suppRatesLen + extSuppRatesLen;
		pBuf += suppRatesLen + extSuppRatesLen;
	}

	/* add HT capabilities IE */
	StaCap_GetHtCapabilitiesIe(pSiteMgr->hStaCap, (TI_UINT8 *) pBuf, &len);
	size += len;
	pBuf += len;

	/* WiFi Simple Config */
	if (pSiteMgr->includeWSCinProbeReq
	    && (pSiteMgr->siteMgrWSCCurrMode != TIWLN_SIMPLE_CONFIG_OFF)) {
		((dot11_WSC_t *) pBuf)->hdr[0] = DOT11_WSC_PARAM_ELE_ID;
		((dot11_WSC_t *) pBuf)->hdr[1] =
		    pSiteMgr->uWscIeSize + DOT11_OUI_LEN;
		pBuf += sizeof(dot11_eleHdr_t);
		os_memoryCopy(pSiteMgr->hOs, pBuf, &WSCOuiIe, DOT11_OUI_LEN);
		os_memoryCopy(pSiteMgr->hOs,
			      pBuf + DOT11_OUI_LEN,
			      &pSiteMgr->siteMgrWSCProbeReqParams,
			      pSiteMgr->uWscIeSize);
		size +=
		    sizeof(dot11_eleHdr_t) + pSiteMgr->uWscIeSize +
		    DOT11_OUI_LEN;
		pBuf +=
		    sizeof(dot11_eleHdr_t) + pSiteMgr->uWscIeSize +
		    DOT11_OUI_LEN;
	}

	pTemplate->len = size;

	return TI_OK;
}
/** Missions() will draw the future missions among other things
 * 
 * \param plr Player
 * \param X screen coord for mission name string
 * \param Y screen coord for mission name string
 * \param val mission number
 * \param bub if set to 0 or 3 the function will not draw stuff
 */
void Missions(char plr,int X,int Y,int val,char bub)
{
  TRACE5("->Missions(plr, X %d, Y %d, val %d, bub %c)", X, Y, val, bub);
  
  if (bub==1 || bub==3) {
    PianoKey(val);
    Bub_Count=0;   // set the initial bub_count
    ClearDisplay();
    RectFill(6,31,182,46,3);
    RectFill(80,25,175,30,3);grSetColor(5);
    PrintAt(55,30,"TYPE: ");DispNum(0,0,val);
    grSetColor(5);
    if (V[val].E>0) {
      if (F5 > V[val].E && Mis.Dur==1) DurPri(F5);
	     else DurPri(V[val].E);}
	      else DurPri(F5);
  } else grSetColor(1);
  MissionName(val,X,Y,24);
  if (bub==3) GetMinus(plr);
  if (bub==0 || bub==3) {return;}
  
    
	MSteps=sOpen("missSteps.dat","r",FT_DATA);
	if (fgets(missStep, 1024, MSteps) == NULL)
		memset (missStep, 0, sizeof missStep);

	while (!feof(MSteps)&&((missStep[0]-0x30)*10+(missStep[1]-0x30))!=val) {
		if (fgets(missStep, 1024, MSteps) == NULL)
			break;
	}
	fclose(MSteps);

  int n;
	for (n=2;missStep[n]!='Z';n++)
		switch (missStep[n]) {
			case 'A': Draw_IJ	(B_Mis(++n));	break;
			case 'B': Draw_IJV	(B_Mis(++n));	break;
			case 'C': OrbOut	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3));	n+=3;	break;
			case 'D': LefEarth	(B_Mis(n+1),B_Mis(n+2));	n+=2; 	break;
			case 'E': OrbIn		(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3));	n+=3; 	break;
			case 'F': OrbMid	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3),B_Mis(n+4));	n+=4;	break;
			case 'G': LefOrb	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3),B_Mis(n+4));	n+=4;	break;
			case 'H': Draw_LowS	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3),B_Mis(n+4),B_Mis(n+5),B_Mis(n+6));	n+=6;	break;
			case 'I': Fly_By	();		break;
			case 'J': VenMarMerc	(B_Mis(++n));	break;
			case 'K': Draw_PQR	();		break;
			case 'L': Draw_PST	();		break;
			case 'M': Draw_GH	(B_Mis(n+1),B_Mis(n+2));	n+=2;	break;
			case 'N': Q_Patch	();		break;
			case 'O': RghtMoon	(B_Mis(n+1),B_Mis(n+2));	n+=2; 	break;
			case 'P': DrawLunPas	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3),B_Mis(n+4));	n+=4;	break;
			case 'Q': DrawLefMoon	(B_Mis(n+1),B_Mis(n+2)); 	n+=2;	break;
			case 'R': DrawSTUV	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3),B_Mis(n+4));	n+=4;	break;
			case 'S': Draw_HighS	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3));	n+=3;	break;
			case 'T': DrawMoon	(B_Mis(n+1),B_Mis(n+2),B_Mis(n+3),B_Mis(n+4),B_Mis(n+5),B_Mis(n+6),B_Mis(n+7));	n+=7;	break;
			case 'U': LefGap	(B_Mis(++n));	break;
			case 'V': S_Patch	(B_Mis(++n));	break;
			case 'W': DrawZ		();		break;
			default : break;
		}
  gr_sync ();
  MissionCodes(plr,MisType,Pad);
  TRACE1("<-Missions()");
}  // end function missions
Example #13
0
/** Draw mission step rectangle
 *
 * The rectangle represents the success or failure rate.
 *
 * \param plr Player data
 * \param lc ??? maybe location of the chart
 * \param safety Safety factor in percent
 * \param val value of the dice checked against safety
 * \param prob is this a problem or not?
 *
 * \return new value of lc
 */
int MCGraph(char plr, int lc, int safety, int val, char prob)
{
    int i;
    TRACE5("->MCGraph(plr, lc %d, safety %d, val %d, prob %c)", lc, safety, val, prob);
    fill_rectangle(lc - 2, 195, lc, 195 - safety * 22 / 100, 11);
    fill_rectangle(lc - 2, 195, lc, 195 - (safety - Mev[STEP].asf) * 22 / 100, 6);

    for (i = 195; i > 195 - val * 22 / 100; i--) {
        fill_rectangle(lc - 2, 195, lc, i, 21);
        delay(15);
    }


    if (plr == 1 && !AI[plr]) {
        if (val > safety && prob == 0) {
            fill_rectangle(lc - 2, 195, lc, 195 - val * 22 / 100, 9);
            lc = 191;
        } else if (val > safety) {
            fill_rectangle(lc - 2, 195, lc, 195 - val * 22 / 100, 9);
            lc += 5;
        } else {
            if (lc >= 241) {
                display::graphics.setForegroundColor(55);
                fill_rectangle(189, 173, 249, 196, 55);

                for (i = 190; i < 250; i += 2) {
                    display::graphics.legacyScreen()->setPixel(i, 178, 61);
                    display::graphics.legacyScreen()->setPixel(i, 184, 61);
                    display::graphics.legacyScreen()->setPixel(i, 190, 61);
                }

                fill_rectangle(189, 195, 191, 195 - safety * 22 / 100, 11);
                fill_rectangle(189, 195, 191, 195 - (safety - Mev[STEP].asf) * 22 / 100, 6);
                fill_rectangle(189, 195, 191, 195 - val * 22 / 100, 21);

                if (Mev[STEP].asf > 0) {
                    fill_rectangle(189, 195 - safety * 22 / 100, 191, 195 - safety * 22 / 100, 11);
                }

                lc = 196;
                /* lc > 241 */
            } else {
                lc += 5;
            }
        } /* check safety and problem */
    } else if (plr == 0 && !AI[plr]) {
        if (val > safety && prob == 0) {
            fill_rectangle(lc - 2, 195, lc, 195 - val * 22 / 100, 9);
            lc = 76;
        } else if (val > safety) {
            fill_rectangle(lc - 2, 195, lc, 195 - val * 22 / 100, 9);
            lc += 5;
        } else {
            if (lc >= 126) {
                fill_rectangle(73, 173, 133, 196, 55);

                for (i = 73; i < 133; i += 2) {
                    display::graphics.legacyScreen()->setPixel(i, 178, 61);
                    display::graphics.legacyScreen()->setPixel(i, 184, 61);
                    display::graphics.legacyScreen()->setPixel(i, 190, 61);
                }

                fill_rectangle(74, 195, 76, 195 - safety * 22 / 100, 11);
                fill_rectangle(74, 195, 76, 195 - (safety - Mev[STEP].asf) * 22 / 100, 6);
                fill_rectangle(74, 195, 76, 195 - val * 22 / 100, 21);

                if (Mev[STEP].asf > 0) {
                    fill_rectangle(74, 195 - safety * 22 / 100, 76, 195 - safety * 22 / 100, 11);
                }

                lc = 81;
            } else {
                lc += 5;
            }
        }
    }

    TRACE1("<-MCGraph()");
    return lc;
}
Example #14
0
/****************************************************************************
 *                  txHwQueue_UpdateFreeBlocks()
 ****************************************************************************
 * DESCRIPTION: 
   ===========
    This function is called per queue after reading the freed blocks counters from the FwStatus.
    It updates the queue's blocks status according to the freed blocks.
 ****************************************************************************/
static void txHwQueue_UpdateFreeBlocks (TTxHwQueue *pTxHwQueue, TI_UINT32 uQueueId, TI_UINT32 uFreeBlocks)
{
    TTxHwQueueInfo *pQueueInfo = &(pTxHwQueue->aTxHwQueueInfo[uQueueId]);
    TI_UINT32 lowThreshold;  /* Minimum blocks that are guaranteed for this Queue. */
    TI_UINT32 newUsedBlks;   /* Blocks that are used by this Queue after updating free blocks. */
    TI_UINT32 newReserved;   /* How many blocks are reserved to this Queue after freeing. */
    TI_UINT32 numBlksToFree; /* The number of blocks freed in the current queue. */

    /* If the FW free blocks counter didn't change, exit */
    uFreeBlocks = ENDIAN_HANDLE_LONG(uFreeBlocks);
    if (uFreeBlocks == pQueueInfo->uFwFreedBlksCntr) 
    {
        return;
    }

    pQueueInfo->uFwFreedBlksCntr = uFreeBlocks;

    /* The uFreeBlocks is the accumulated number of blocks freed by the FW for the uQueueId.
     * Subtracting it from the accumulated number of blocks allocated by the driver should
     *   give the current number of used blocks in this queue.
     * Since the difference is always a small positive number, a simple subtraction should work
     *   also for wrap around.
     */
    newUsedBlks = pQueueInfo->uAllocatedBlksCntr - uFreeBlocks;

    numBlksToFree = pQueueInfo->uNumBlksUsed - newUsedBlks;

#ifdef TI_DBG   /* Sanity check: make sure we don't free more than is allocated. */
    if (numBlksToFree > pQueueInfo->uNumBlksUsed)
    {
        TRACE5(pTxHwQueue->hReport, REPORT_SEVERITY_ERROR, ":  Try to free more blks than used: Queue %d, ToFree %d, Used %d, HostAlloc=0x%x, FwFree=0x%x\n", uQueueId, numBlksToFree, pQueueInfo->uNumBlksUsed, pQueueInfo->uAllocatedBlksCntr, uFreeBlocks);
    }
#endif

    /* Update total free blocks and Queue used blocks with the freed blocks number. */
    pTxHwQueue->uNumTotalBlksFree += numBlksToFree;
    pQueueInfo->uNumBlksUsed = newUsedBlks;

    lowThreshold = pQueueInfo->uNumBlksThresh;
    
    /* If after freeing the blocks we are using less than the low threshold, 
        update total reserved blocks number as follows:
       (note: if we are above the low threshold after freeing the blocks we still have no reservation.)
    */
    if (newUsedBlks < lowThreshold)
    {
        newReserved = lowThreshold - newUsedBlks;
        pQueueInfo->uNumBlksReserved = newReserved;

        
        /* If freeing the blocks reduces the used blocks from above to below the low-threshold,
            only the part from the low-threshold to the new used number is added to the 
            reserved blocks (because blocks are reserved for the Queue only up to its low-threshold):
            
              0        new used               low            old used         high
              |###########|####################|################|             |
              |###########|####################|################|             |
                           <-------------- freed -------------->
                           <-- new reserved -->
                             old reserved = 0
        */
        if (numBlksToFree > newReserved)
            pTxHwQueue->uNumTotalBlksReserved += newReserved; /* Add change to total reserved.*/


        /* Else, if we were under the low-threshold before freeing these blocks,
            all freed blocks are added to the reserved blocks: 
            
              0             new used          old used             low               high
              |################|#################|                  |                  |
              |################|#################|                  |                  |
                                <---- freed ---->
                                                  <- old reserved ->
                                <---------- new reserved ---------->
        */
        else
            pTxHwQueue->uNumTotalBlksReserved += numBlksToFree; /* Add change to total reserved.*/
    }

    TRACE5(pTxHwQueue->hReport, REPORT_SEVERITY_INFORMATION, ":  Queue %d, ToFree %d, Used %d, HostAlloc=0x%x, FwFree=0x%x\n", uQueueId, numBlksToFree, pQueueInfo->uNumBlksUsed, pQueueInfo->uAllocatedBlksCntr, uFreeBlocks);
}
Example #15
0
tEplKernel PUBLIC EplApiProcessImageAlloc(
    unsigned int uiSizeProcessImageIn_p,
    unsigned int uiSizeProcessImageOut_p,
    unsigned int uiQueueEntriesLo_p,
    unsigned int uiQueueEntriesHi_p)
{
tEplKernel      Ret = kEplSuccessful;
tShbError       ShbError;
unsigned int    fShbNewCreated;

    TRACE5("%s: Alloc(%u, %u, %u, %u)\n",
          __func__,
          uiSizeProcessImageIn_p,
          uiSizeProcessImageOut_p,
          uiQueueEntriesLo_p,
          uiQueueEntriesHi_p);

    if ((EplApiProcessImageInstance_g.m_In.m_pImage != NULL)
        || (EplApiProcessImageInstance_g.m_Out.m_pImage != NULL))
    {
        Ret = kEplApiPIAlreadyAllocated;
        goto Exit;
    }

    EplApiProcessImageInstance_g.m_In.m_pImage = EPL_MALLOC(uiSizeProcessImageIn_p);
    if (EplApiProcessImageInstance_g.m_In.m_pImage == NULL)
    {
        Ret = kEplApiPIOutOfMemory;
        goto Exit;
    }
    EplApiProcessImageInstance_g.m_In.m_uiSize = uiSizeProcessImageIn_p;

    EplApiProcessImageInstance_g.m_Out.m_pImage = EPL_MALLOC(uiSizeProcessImageOut_p);
    if (EplApiProcessImageInstance_g.m_Out.m_pImage == NULL)
    {
        Ret = kEplApiPIOutOfMemory;
        goto Exit;
    }
    EplApiProcessImageInstance_g.m_Out.m_uiSize = uiSizeProcessImageOut_p;

    TRACE5("%s: Alloc(%p, %u, %p, %u)\n",
          __func__,
          EplApiProcessImageInstance_g.m_In.m_pImage,
          EplApiProcessImageInstance_g.m_In.m_uiSize,
          EplApiProcessImageInstance_g.m_Out.m_pImage,
          EplApiProcessImageInstance_g.m_Out.m_uiSize);

    ShbError = ShbCirAllocBuffer (uiQueueEntriesLo_p * sizeof (tEplApiProcessImageCopyJobInt), EPL_API_PI_BUFFER_ID_LO,
        &EplApiProcessImageInstance_g.m_ShbInstanceJobQueueLo, &fShbNewCreated);
    // returns kShbOk, kShbOpenMismatch, kShbOutOfMem or kShbInvalidArg
    if (ShbError != kShbOk)
    {
        Ret = kEplNoResource;
        goto Exit;
    }

    ShbError = ShbCirAllocBuffer (uiQueueEntriesHi_p * sizeof (tEplApiProcessImageCopyJobInt), EPL_API_PI_BUFFER_ID_HI,
        &EplApiProcessImageInstance_g.m_ShbInstanceJobQueueHi, &fShbNewCreated);
    // returns kShbOk, kShbOpenMismatch, kShbOutOfMem or kShbInvalidArg
    if (ShbError != kShbOk)
    {
        Ret = kEplNoResource;
        goto Exit;
    }

    EplApiProcessImageInstance_g.m_pfnOrgCbSync = EplDllkRegSyncHandler(EplApiProcessImageCbSync);

Exit:
    return Ret;
}
Example #16
0
int __darwin_sysctlbyname(const char* name, void* oldp, size_t* oldlenp, void* newp, size_t newlen)
{
	TRACE5(name, oldp, oldlenp, newp, newlen);

	uint64_t val;

	if (newp)
	{
		LOG << "sysctl with newp isn't supported yet.\n";
		errno = DARWIN_EINVAL;
		return -1;
	}

	/*
	if (*oldlenp != 4 && *oldlenp != 8)
	{
		LOG << "sysctl(HW) with oldlenp=" << *oldlenp << " isn't supported yet.\n";
		errno = DARWIN_EINVAL;
		return -1;
	}
	*/

	if (!strcmp(name, "hw.physicalcpu") || !strcmp(name, "hw.logicalcpu") || !strcmp(name, "hw.ncpu"))
		val = ::sysconf(_SC_NPROCESSORS_ONLN);
	else if (!strcmp(name, "hw.physicalcpu_max") || !strcmp(name, "hw.logicalcpu_max"))
		val = ::sysconf(_SC_NPROCESSORS_CONF);
	else if (!strcmp(name, "kern.boottime"))
	{
		struct timeval tv;
		struct sysinfo si;
		
		if (*oldlenp < sizeof(struct timeval))
		{
			errno = DARWIN_ENOMEM;
			return -1;
		}
		
		sysinfo(&si);
		gettimeofday(&tv, nullptr);
		tv.tv_sec -= si.uptime;
		
		*oldlenp = sizeof(struct timeval);
		memcpy(oldp, &tv, sizeof(tv));
		return 0;
	}
	else
	{
		errno = DARWIN_EINVAL;
		return -1;
	}

	if (oldp)
	{
		if (*oldlenp == 4)
			*reinterpret_cast<uint32_t*>(oldp) = val;
		else if (*oldlenp == 8)
			*reinterpret_cast<uint64_t*>(oldp) = val;
	}
	else
		*oldlenp = sizeof(long);
	return 0;	
}
Example #17
0
/**
 * \\n
 * \date 01-Dec-2004\n
 * \brief Request the channel use by a client
 *
 * Function Scope \e Public.\n
 * \param hScr - handle to the SCR object.\n
 * \param client - the client ID requesting the channel.\n
 * \param resource - the requested resource.\n
 * \param pPendReason - the reason for a pend reply.\n
 * \return The request status.\n
 * \retval SCR_CRS_REJECT the channel cannot be allocated to this client.
 * \retval SCR_CRS_PEND the channel is currently busy, and this client had been placed on the waiting list.
 * \retval SCR_CRS_RUN the channel is allocated to this client.
 */
EScrClientRequestStatus scr_clientRequest( TI_HANDLE hScr, EScrClientId client,
                                           EScrResourceId eResource, EScePendReason* pPendReason )
{
    TScr    *pScr = (TScr*)hScr;

    TRACE2( pScr->hReport, REPORT_SEVERITY_INFORMATION, "scr_clientRequest: Client %d requesting the channel for resource %d.\n", client, eResource);

#ifdef TI_DBG
    if (client >= SCR_CID_NUM_OF_CLIENTS)
    {
        TRACE1( pScr->hReport, REPORT_SEVERITY_ERROR, "Attempting to request SCR for invalid client %d\n", client);
        return SCR_CRS_PEND;
    }
    if (SCR_RESOURCE_NUM_OF_RESOURCES <= eResource)
    {
        TRACE2( pScr->hReport, REPORT_SEVERITY_ERROR, "Attempting to request SCR by client %d for invalid resource %d\n", client, eResource);
        return SCR_CRS_PEND;
    }
#endif
    
    *pPendReason = SCR_PR_NONE;

    /* check if already inside a request - shouldn't happen!!! */
    if ( TI_TRUE == pScr->statusNotficationPending )
    {
        TRACE0( pScr->hReport, REPORT_SEVERITY_ERROR, "request call while already in request!\n");
        return SCR_CRS_PEND;
    }

    /* check if current running client is requesting */
    if ( client == pScr->runningClient[ eResource ] )
    {
        TRACE2( pScr->hReport, REPORT_SEVERITY_WARNING, "Client %d re-requesting SCR for resource %d\n", client, eResource);
        return SCR_CRS_RUN;
    }

    TRACE5( pScr->hReport, REPORT_SEVERITY_INFORMATION, "scr_clientRequest: is client enabled = %d. eResource=%d,currentMode=%d,currentGroup=%d,client=%d,\n", clientStatus[ eResource ][ pScr->currentMode ][ pScr->currentGroup ][ client ], eResource, pScr->currentMode, pScr->currentGroup, client);

    /* check if the client is enabled in the current group */
    if ( TI_TRUE != clientStatus[ eResource ][ pScr->currentMode ][ pScr->currentGroup ][ client ])
    {
        pScr->clientArray[ client ].state[ eResource ] = SCR_CS_PENDING;
        pScr->clientArray[ client ].currentPendingReason[ eResource ]
                                                = *pPendReason = SCR_PR_DIFFERENT_GROUP_RUNNING;
        return SCR_CRS_PEND;
    }
        
    /* check if a there's no running client at the moment */
    if ( SCR_CID_NO_CLIENT == pScr->runningClient[ eResource ] )
    {
        /* no running or aborted client - allow access */
        TRACE2( pScr->hReport, REPORT_SEVERITY_INFORMATION, "Resource %d allocated to client: %d\n", eResource, client);
        pScr->clientArray[ client ].state[ eResource ] = SCR_CS_RUNNING;
        pScr->runningClient[ eResource ] = client;
        return SCR_CRS_RUN;
    }
    
    /* check if any client is aborting at the moment */
    if ( SCR_CS_ABORTING == pScr->clientArray[ pScr->runningClient[ eResource ] ].state[ eResource ] )
    {
        /* a client is currently aborting, but there still might be a pending client with higher priority
           than the client currently requesting the SCR. If such client exists, the requesting client is
           notified that it is pending because of this pending client, rather than the one currently aborting.
        */
        EScrClientId highestPending;
        highestPending = scrFindHighest( hScr, SCR_CS_PENDING, eResource, 
                                         (SCR_CID_NUM_OF_CLIENTS - 1), client );
        if ( (SCR_CID_NO_CLIENT == highestPending) ||
             (highestPending < client))
        {
            /* if the requesting client has higher priority than the current highest priority pending client,
               the current highest priority pending client should be notified that its pending reason has 
               changed (it is no longer waiting for current running client to abort, but for the requesting
               client to finish, once the current has aborted */
            if ( (highestPending != SCR_CID_NO_CLIENT) &&
                 (SCR_PR_OTHER_CLIENT_ABORTING == pScr->clientArray[ highestPending ].currentPendingReason[ eResource ]))
            {

                if ( NULL != pScr->clientArray[ highestPending ].clientRequestCB )
                {
                    pScr->clientArray[ highestPending ].clientRequestCB( pScr->clientArray[ highestPending ].ClientRequestCBObj,
                                                                         SCR_CRS_PEND, eResource, SCR_PR_OTHER_CLIENT_RUNNING );
                }
                else
                {
                    TRACE1( pScr->hReport, REPORT_SEVERITY_ERROR, "Trying to call client %d callback, which is NULL\n", highestPending);
                }
            }
            pScr->clientArray[ client ].currentPendingReason[ eResource ] = *pPendReason = SCR_PR_OTHER_CLIENT_ABORTING;
        }
        else
        {
            pScr->clientArray[ client ].currentPendingReason[ eResource ] = *pPendReason = SCR_PR_OTHER_CLIENT_RUNNING;
        }
        pScr->clientArray[ client ].state[ eResource ] = SCR_CS_PENDING;
        return SCR_CRS_PEND;
    }
 
    /* check if a client with higher priority is running */
    if (pScr->runningClient[ eResource ] > client)
    {
        pScr->clientArray[ client ].state[ eResource ] = SCR_CS_PENDING;
        pScr->clientArray[ client ].currentPendingReason[ eResource ] = *pPendReason = SCR_PR_OTHER_CLIENT_RUNNING;
        return SCR_CRS_PEND;
    }

    /* if the client is not supposed to abort lower priority clients */
    if ( (SCR_CID_NO_CLIENT == abortOthers[ eResource ][ client ]) || /* client is not supposed to abort any other client */
         (pScr->runningClient[ eResource ] > abortOthers[ eResource ][ client ])) /* client is not supposed to abort running client */
    {
        /* wait for the lower priority client */
        pScr->clientArray[ client ].state[ eResource ] = SCR_CS_PENDING;
        pScr->clientArray[ client ].currentPendingReason[ eResource ] = *pPendReason = SCR_PR_OTHER_CLIENT_RUNNING;
        return SCR_CRS_PEND;
    }

    /* at this point, there is a lower priority client running, that should be aborted: */
    /* mark the requesting client as pending (until the abort process will be completed) */
    pScr->clientArray[ client ].state[ eResource ] = SCR_CS_PENDING;

    /* mark that we are in the middle of a request (if a re-entrance will occur in the complete) */
    pScr->statusNotficationPending = TI_TRUE;

    /* abort the running client */
    pScr->clientArray[ pScr->runningClient[ eResource ] ].state[ eResource ] = SCR_CS_ABORTING;
    if ( NULL != pScr->clientArray[ pScr->runningClient[ eResource ] ].clientRequestCB )
    {
        TRACE2( pScr->hReport, REPORT_SEVERITY_INFORMATION, "Sending abort request to client %d for resource %d\n", pScr->runningClient[ eResource ], eResource);
        pScr->clientArray[ pScr->runningClient[ eResource ] ].clientRequestCB( pScr->clientArray[ pScr->runningClient[ eResource ] ].ClientRequestCBObj,
                                                                               SCR_CRS_ABORT, eResource,
                                                                               SCR_PR_NONE );
    }
    else
    {
        TRACE1( pScr->hReport, REPORT_SEVERITY_ERROR, "Trying to call client %d callback, which is NULL\n", pScr->runningClient[ eResource ]);
    }

    /* mark that we have finished the request process */
    pScr->statusNotficationPending = TI_FALSE;

    /* return the current status (in case the completion changed the client status to run) */
    if ( SCR_CS_RUNNING == pScr->clientArray[ client ].state[ eResource ] )
    {
        TRACE1( pScr->hReport, REPORT_SEVERITY_INFORMATION, "channel allocated to client: %d\n", client);
        return SCR_CRS_RUN;
    }
    else
    {
        pScr->clientArray[ client ].currentPendingReason[ eResource ] = *pPendReason = SCR_PR_OTHER_CLIENT_ABORTING;
        return SCR_CRS_PEND;
    }
}
Example #18
0
int apCmd_Execute(TI_HANDLE hApCmd, TConfigCommand *pCmdObj)
{
 TApCmd *pApCmd = hApCmd;
 TI_UINT32  uModuleNumber;
 TI_STATUS  tRes = TI_NOK;
 TApCmd_Type *pParamInfo;
 ti_private_cmd_t *pMyCmd = (ti_private_cmd_t *)pCmdObj->param3;
 TApAddKeyParams  tKeyParam;
 TTwdParamInfo    tTwdParam;
 TSecurityKeys    tTwdKey;
 TI_UINT32        uHlid;

 pParamInfo = (TApCmd_Type*)os_memoryAlloc(pApCmd->hOs,sizeof(TApCmd_Type));
 if(!pParamInfo)
 {
    return TI_NOK;
 }

 uModuleNumber = GET_AP_MODULE_NUMBER(pMyCmd->cmd);
   
 switch (uModuleNumber)
 {
 case AP_ROLEAP_PARAMS:
	 {
		ERoleApState eRoleApState;

        switch (pMyCmd->cmd)
        {
         case ROLE_AP_ADD_STATION_PARAM :             
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_ADD_STATION_PARAM \n");
             break;
		case ROLE_AP_CHANGE_STATION_PARAM: 
			 TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_CHANGE_STATION_PARAM \n");
             break;
		case ROLE_AP_GET_STATION_PARAM:               
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_GET_STATION_PARAM \n");
             break;
         case ROLE_AP_SET_TX_PARAM:                   
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_TX_PARAM \n");
             break;
         case ROLE_AP_CHANGE_BSS_PARAM:             
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_CHANGE_BSS_PARAM \n");
             break;
         case ROLE_AP_SET_PORT_STATUS:                 
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_PORT_STATUS \n");
             break;
         case ROLE_AP_SET_STA_SHORT_PREAMBLE:  
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_STA_SHORT_PREAMBLE \n");
             break;
         case ROLE_AP_SET_STA_WME:
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_STA_WME \n");
             break;
         case ROLE_AP_USE_CTS_PROT:                 
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_USE_CTS_PROT \n");
             break;
         case ROLE_AP_SET_INACTIVE_INT:                
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_INACTIVE_INT \n");
             break;
         case ROLE_AP_USE_SHORT_SLOT_TIME:             
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_USE_SHORT_SLOT_TIME \n");
             break;
         case ROLE_AP_SET_PRIVACY:                     
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_PRIVACY \n");
             break;
         case ROLE_AP_SET_AP_SHORT_PREAMBLE:          
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_AP_SHORT_PREAMBLE \n");
             break;
         case ROLE_AP_SET_RATE:                       
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_RATE \n");
             break;
         case ROLE_AP_REMOVE_STATION:                 
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_REMOVE_STATION \n");
             break;
         case ROLE_AP_REMOVE_ALL_STATION:              
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_REMOVE_ALL_STATION \n");
             break;
         case ROLE_AP_SET_DTIM_PERIOD:               
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_DTIM_PERIOD \n");
             memcpy(&pParamInfo->GeneralParam,pMyCmd->in_buffer,pMyCmd->in_buffer_len);
             TRACE1(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n ROLE_AP_SET_DTIM dtim %d\n", pParamInfo->GeneralParam.lValue);
             break;
         case ROLE_AP_SET_BEACON_INT:
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_BEACON_INT \n");
             memcpy(&pParamInfo->GeneralParam,pMyCmd->in_buffer,pMyCmd->in_buffer_len);
             TRACE1(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n ROLE_AP_SET_BEACON_INT %d\n", pParamInfo->GeneralParam.lValue);
             break;
         case ROLE_AP_SET_CHANNEL:
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_CHANNEL \n");
             memcpy(&pParamInfo->ChannelParam,pMyCmd->in_buffer,pMyCmd->in_buffer_len);
             break;
         case ROLE_AP_ADD_BEACON_PARAM:
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_ADD_BEACON_PARAM \n");
             memcpy(&pParamInfo->BeaconParams,pMyCmd->in_buffer,pMyCmd->in_buffer_len);
             //report_PrintDump(pParamInfo->BeaconParams.cHead,pParamInfo->BeaconParams.iHeadLen);
             break;
         case ROLE_AP_COMMIT_CMD:                     
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_COMMIT_CMD \n");
             break;
         case ROLE_AP_SET_COUNTRY:                     
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_COUNTRY \n");
             break;
         case ROLE_AP_SET_RTS:       
             TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_RTS \n");
             break;
        case ROLE_AP_SET_SSID:
			 TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_SSID \n");
             memcpy(&pParamInfo->SsidParam,pMyCmd->in_buffer,pMyCmd->in_buffer_len);
             TRACE1(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n ROLE_AP_SET_SSID SSID %s\n", pParamInfo->SsidParam.cSsid);
            break;
        case ROLE_AP_SET_SSID_TYPE:
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_SSID_TYPE \n");
            break;
		case ROLE_AP_GET_STA_INACTIVITY:
			TRACE5(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n%s: ROLE_AP_GET_STA_INACTIVITY in_buf=%p in_len=%u out_buf=%p out_len=%u\n",
				    __FUNCTION__,pMyCmd->in_buffer, pMyCmd->in_buffer_len, pMyCmd->out_buffer, pMyCmd->out_buffer_len);
		   break;
		case ROLE_AP_DEAUTH_STATION:       
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_DEAUTH_STATION \n");
			break;

        case ROLE_AP_SET_BSS_BRIDGE:
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_SET_BSS_BRIDGE \n");
            break;

		case ROLE_AP_GET_HW:
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_GET_HW \n");
            break;

		case ROLE_AP_SET_PROBE_WPS_IE:
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_ENABLE \n");
            break;

		case ROLE_AP_STOP:
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  ROLE_AP_STOP \n");
            break;

        default:
			TRACE0(pApCmd->hReport,REPORT_SEVERITY_ERROR ,"\n apCmd_Execute:  COMMAND UNKNOWN \n");
            break;

        }

		roleAp_getApState(pApCmd->hRoleAp, &eRoleApState);

		/*If AP is stopped or in recovery now - discard the command */
		if (((eRoleApState == ROLEAP_STATE_STOPPED) || (eRoleApState == ROLEAP_STATE_RECOVERING)) && (pMyCmd->cmd != ROLE_AP_ENABLE))
		{ 
			TRACE1(pApCmd->hReport,REPORT_SEVERITY_WARNING ,"\n apCmd_Execute:  Command 0x%x from previous session - discaring! \n", pMyCmd->cmd);
            tRes = TI_OK;
			break;
		}

        if (pMyCmd->cmd & SET_BIT)
            tRes = RoleAp_setApCmd(pApCmd->hRoleAp,pMyCmd->cmd,pMyCmd->in_buffer);
        else
            tRes = RoleAp_getApCmd(pApCmd->hRoleAp,pMyCmd->cmd,pMyCmd->in_buffer,pMyCmd->out_buffer);

        break;
	 }
 case AP_TWD_PARAMS:

       switch (pMyCmd->cmd)
       {
       case TWD_ADD_KEY_PARAMS:

           memcpy(&tKeyParam,pMyCmd->in_buffer,pMyCmd->in_buffer_len);

           TRACE5(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n %s: TWD_ADD_KEY_PARAMS, alg=%u ind=%u len=%u for STA "REPORT_MACSTR"\n",
				  __FUNCTION__,tKeyParam.cAlg, tKeyParam.cKeyIndex, tKeyParam.ckeyLen,REPORT_MAC2STR(tKeyParam.cMac));

		   /* Configure Security status in TWD */
		   switch (tKeyParam.cAlg)
		   {
		   case AP_WEP_CIPHER:
			   tTwdParam.content.rsnEncryptionStatus = TWD_CIPHER_WEP;
			   tTwdKey.keyType 	= KEY_WEP;
			   break;

		   case AP_TKIP_CIPHER:
			   tTwdParam.content.rsnEncryptionStatus = TWD_CIPHER_TKIP;
			   tTwdKey.keyType 	= KEY_TKIP;
			   break;

		   case AP_CCMP_CIPHER:
			   tTwdParam.content.rsnEncryptionStatus = TWD_CIPHER_AES_CCMP;
			   tTwdKey.keyType 	= KEY_AES;
			   break;

		   case AP_IGTK_CIPHER:
			   /* TODO */
		   default:
               TRACE2(pApCmd->hReport,REPORT_SEVERITY_ERROR ,"\n %s: Invalid alg=%u\n", __FUNCTION__, tKeyParam.cAlg);
			   return TI_NOK;
		   }

           if (tKeyParam.cAlg == AP_TKIP_CIPHER)
           {
               os_memoryCopy(pApCmd->hOs,(TI_UINT8*)(((TI_UINT8*)&tTwdKey.encKey)+24),(TI_UINT8*)(((TI_UINT8*)&tKeyParam.cKey)+16),8);
               os_memoryCopy(pApCmd->hOs,(TI_UINT8*)((TI_UINT8*)&tTwdKey.micTxKey),(TI_UINT8*)(((TI_UINT8*)&tKeyParam.cKey)+16),8);
               os_memoryCopy(pApCmd->hOs,(TI_UINT8*)((TI_UINT8*)&tTwdKey.micRxKey),(TI_UINT8*)(((TI_UINT8*)&tKeyParam.cKey)+24),8);
               os_memoryCopy(pApCmd->hOs,(TI_UINT8*)(((TI_UINT8*)&tTwdKey.encKey)+16),(TI_UINT8*)(((TI_UINT8*)&tKeyParam.cKey)+24),8);
               os_memoryCopy(pApCmd->hOs,&tTwdKey.encKey,&tKeyParam.cKey,16);
           }
           else
               os_memoryCopy(pApCmd->hOs, &tTwdKey.encKey, &tKeyParam.cKey, tKeyParam.ckeyLen);

           tTwdKey.keyIndex = tKeyParam.cKeyIndex;
           tTwdKey.encLen = tKeyParam.ckeyLen;
           
           if (MAC_NULL(tKeyParam.cMac))
           {
             /* broadcast key */
             os_memorySet( pApCmd->hOs, tTwdKey.macAddress, 0xFF, AP_MAC_ADDR );
             tTwdKey.hlid = 1;
             if (tTwdKey.keyType == KEY_WEP)
               tTwdKey.lidKeyType = WEP_DEFAULT_LID_TYPE;
             else
               tTwdKey.lidKeyType = BROADCAST_LID_TYPE;
           }
           else
           {
            /* unicast key */
             if (wlanLinks_FindLinkByMac(pApCmd->hWlanLinks, tKeyParam.cMac, &uHlid) != TI_OK)
             {
        		 TRACE1(pApCmd->hReport,REPORT_SEVERITY_ERROR ,"\n apCmd_Execute:  Can't find Hlid for STA "REPORT_MACSTR"\n",
						REPORT_MAC2STR(tKeyParam.cMac));
				 return TI_NOK;
             }

  			  TRACE2(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  Hlid %d for STA "REPORT_MACSTR"\n",
					uHlid, REPORT_MAC2STR(tKeyParam.cMac));


              os_memoryCopy(pApCmd->hOs,&tTwdKey.macAddress,&tKeyParam.cMac,AP_MAC_ADDR);
              tTwdKey.hlid = uHlid;
              tTwdKey.lidKeyType = UNICAST_LID_TYPE;
           }
          
           RoleAp_setApCmd(pApCmd->hRoleAp,TWD_ADD_KEY_PARAMS,(void*)&tTwdKey);
           break;

       case TWD_DEL_KEY_PARAMS:
           
           memcpy(&tKeyParam,pMyCmd->in_buffer,pMyCmd->in_buffer_len);
           tTwdKey.keyIndex = tKeyParam.cKeyIndex;
           tTwdKey.encLen = tKeyParam.ckeyLen;
          
           TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"ApCmd Remove key : key type %d \n");

           if (tKeyParam.cMac == NULL)
           {
            /* broadcast key */
           os_memoryCopy(pApCmd->hOs,tTwdKey.macAddress,(unsigned short *)0xFFFFFFFF,AP_MAC_ADDR);
           tTwdKey.hlid = 1;
           tTwdKey.lidKeyType = WEP_DEFAULT_LID_TYPE;
           }
           else
           {
            /* unicast key */
             if (wlanLinks_FindLinkByMac(pApCmd->hWlanLinks, tKeyParam.cMac, &uHlid) != TI_OK)
             {
                TRACE1(pApCmd->hReport,REPORT_SEVERITY_ERROR ,"\n apCmd_Execute:  Can't find Hlid for STA "REPORT_MACSTR"\n",
						REPORT_MAC2STR(tKeyParam.cMac));
                return TI_NOK;
             }

              TRACE2(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"\n apCmd_Execute:  Hlid %d for STA "REPORT_MACSTR"\n",
					uHlid, REPORT_MAC2STR(tKeyParam.cMac));

              os_memoryCopy(pApCmd->hOs,&tTwdKey.macAddress,&tKeyParam.cMac,AP_MAC_ADDR);
              tTwdKey.hlid = uHlid;
              tTwdKey.lidKeyType = UNICAST_LID_TYPE;
           }

           RoleAp_setApCmd(pApCmd->hRoleAp,TWD_DEL_KEY_PARAMS,(void*)&tTwdKey);

           break;

       case TWD_SET_DEFAULT_KEY_PARAMS:
            
            TRACE0(pApCmd->hReport,REPORT_SEVERITY_INFORMATION ,"apCmd_Execute :Set Default Key \n");
            RoleAp_setApCmd(pApCmd->hRoleAp,TWD_SET_DEFAULT_KEY_PARAMS,pMyCmd->in_buffer);
              
           break;

       }

       break;

   default:
       TRACE0(pApCmd->hReport,REPORT_SEVERITY_ERROR ,"\n *** In apCmd_Execute,  illegal module number\n");

 }

  
  if (tRes == COMMAND_PENDING)
  {
      pApCmd->pAsyncCmd = pCmdObj;
  }
  else
  {
      pApCmd->pAsyncCmd = NULL;
  }

  return tRes;
}
void printInfo(PortInfo* info) {
    TRACE5(" PortInfo %p: handle=%p, mixerIndex=%d, dstLineCount=%d, dstLines=%p, ", info, (void*) info->handle, info->mixerIndex, info->dstLineCount, info->dstLines);
    TRACE5("srcLineCount=%d, srcLines=%p, targetPortCount=%d, sourcePortCount=%d, ports=%p, ", info->srcLineCount, info->srcLines, info->targetPortCount, info->sourcePortCount, info->ports);
    TRACE3("maxControlCount=%d, usedControlIDs=%d, controlIDs=%p \n", info->maxControlCount, info->usedControlIDs, info->controlIDs);
    TRACE2("usedMuxData=%d, muxData=%p, controlIDs=%p \n", info->usedMuxData, info->muxData);
}
/**
*
* roamingMngr_triggerRoamingCb
*
* \b Description:
*
* This procedure is called when Roaming should be triggered
 * due to one of apConn_roamingTrigger_e Roaming Reasons.
 * Save the trigger and process it only if there's no other Roaming trigger
 * in process.
*
* \b ARGS:
*
*  I   - hRoamingMngr - roamingMngr SM context  \n
*  I   - pData - pointer to roaming trigger
*
* \b RETURNS:
*
*  TI_OK if successful, TI_NOK otherwise.
*
*
*/
TI_STATUS roamingMngr_triggerRoamingCb(TI_HANDLE hRoamingMngr, void *pData, TI_UINT16 reasonCode)
{
	roamingMngr_t       *pRoamingMngr;
	apConn_roamingTrigger_e     roamingTrigger;
	TI_UINT32                   curTimestamp;
	TI_UINT16                   disConnReasonCode;


	pRoamingMngr = (roamingMngr_t*)hRoamingMngr;
	if ((pRoamingMngr == NULL) || (pData == NULL)) {
		return TI_NOK;
	}

	roamingTrigger = *(apConn_roamingTrigger_e *)pData;

	if ((ROAMING_OPERATIONAL_MODE_MANUAL == pRoamingMngr->RoamingOperationalMode) &&
	        (roamingTrigger == ROAMING_TRIGGER_AP_DISCONNECT)) {
		disConnReasonCode = reasonCode;
		EvHandlerSendEvent(pRoamingMngr->hEvHandler, IPC_EVENT_AP_DISCONNECT, (TI_UINT8*)&disConnReasonCode, sizeof(disConnReasonCode));
	}


	if (roamingTrigger >= ROAMING_TRIGGER_LAST) {
		TRACE1(pRoamingMngr->hReport, REPORT_SEVERITY_ERROR, "roamingMngr_triggerRoamingCb, bad roaming trigger = %d\n", roamingTrigger);
		return TI_NOK;
	}
#ifdef TI_DBG
	/* save parameters for debug*/
	pRoamingMngr->roamingTriggerEvents[pRoamingMngr->roamingTrigger]++;
#endif
	if (roamingTrigger <= ROAMING_TRIGGER_BG_SCAN_GROUP) {
		ERssiQuality    rssiQuality = ROAMING_QUALITY_NORMAL;
		if (roamingTrigger == ROAMING_TRIGGER_LOW_QUALITY_FOR_BG_SCAN) {
			rssiQuality = ROAMING_QUALITY_LOW;
		} else if (roamingTrigger == ROAMING_TRIGGER_HIGH_QUALITY_FOR_BG_SCAN) {
			rssiQuality = ROAMING_QUALITY_HIGH;
		}

		TRACE1(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_triggerRoamingCb, rssiQuality = %d \n", rssiQuality);
		scanMngr_notifyChangeTrigger(pRoamingMngr->hScanMngr, rssiQuality);
	} else {
		if (roamingTrigger > pRoamingMngr->roamingTrigger) {  /* Save the highest priority roaming trigger */
			pRoamingMngr->roamingTrigger = roamingTrigger;
			TRACE1(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_triggerRoamingCb, higher trigger = %d \n", roamingTrigger);

		}

		curTimestamp = os_timeStampMs(pRoamingMngr->hOs);

		/* If "No BSS" trigger received, disable count of low pass filter timer */
		if (roamingTrigger > ROAMING_TRIGGER_LOW_QUALITY_GROUP) {
			pRoamingMngr->lowQualityTriggerTimestamp = 0;
		}

		/* Do not invoke a new Roaming Trigger when a previous one is in process */
		if (pRoamingMngr->maskRoamingEvents == TI_FALSE) {  /* No Roaming trigger is in process */
			/* If the trigger is low quality check the low pass filter */
			TRACE1(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_triggerRoamingCb, trigger = %d \n", roamingTrigger);
			if (roamingTrigger <= ROAMING_TRIGGER_LOW_QUALITY_GROUP) {
				TI_UINT32 deltaTs = curTimestamp-pRoamingMngr->lowQualityTriggerTimestamp;

				if ((pRoamingMngr->lowQualityTriggerTimestamp != 0) &&
				        (deltaTs < pRoamingMngr->lowPassFilterRoamingAttemptInMsec)) { /* Ignore the low quality events. till the low pass time elapses */
					TRACE5(pRoamingMngr->hReport, REPORT_SEVERITY_INFORMATION, "roamingMngr_triggerRoamingCb, trigger = %d Ignored!!,deltaTs=%d, curTimestamp = %d, lowQualityTriggerTimestamp = %d, lowPassFilterRoamingAttempt=%d\n", roamingTrigger, deltaTs, curTimestamp, pRoamingMngr->lowQualityTriggerTimestamp, pRoamingMngr->lowPassFilterRoamingAttemptInMsec);
					return TI_OK;
				}
				pRoamingMngr->lowQualityTriggerTimestamp = curTimestamp;
			}

			/* Mask all future roaming events */
			pRoamingMngr->maskRoamingEvents = TI_TRUE;

#ifdef TI_DBG
			/* For debug */
			pRoamingMngr->roamingTriggerTimestamp = curTimestamp;
#endif
			return (roamingMngr_smEvent(ROAMING_EVENT_ROAM_TRIGGER, pRoamingMngr));
		} else if (roamingTrigger > ROAMING_TRIGGER_FAST_CONNECT_GROUP) {  /* If the trigger is from the Full Connect group, then stop the connection. */
			return (roamingMngr_smEvent(ROAMING_EVENT_ROAM_TRIGGER, pRoamingMngr));

		}
	}

	return TI_OK;
}