static int32_t gausstrig_process_krate(CSOUND* csound, GAUSSTRIG *p) { MYFLT frq, dev; p->frq0 = *p->kfrq; frq = (*p->kfrq > FL(0.001) ? *p->kfrq : FL(0.001)); dev = *p->kdev; if (p->first > 0) { /* values less than FL(0.0) could be used in later versions as an offset in samples */ int32_t nextsamps; MYFLT nextcount, r1, r2; /* this very line of k-time fix. Changed GetSt to GetKr */ nextsamps = (int32_t)(csound->GetKr(csound) / frq); p->rand = csoundRand31(&p->rand); r1 = (MYFLT)p->rand * dv2_31; p->rand = csoundRand31(&p->rand); r2 = (MYFLT)p->rand * dv2_31; nextcount = SQRT(FL(-2.0) * LOG(r1)) * SIN(r2 * TWOPI_F); if (nextcount < FL(-1.0)) { MYFLT diff = FL(-1.0) - nextcount; nextcount = (FL(1.0) < FL(-1.0) + diff ? FL(1.0) : FL(-1.0) + diff); } else if (nextcount > FL(1.0)) { MYFLT diff = nextcount - FL(1.0); nextcount = (FL(-1.0) > FL(1.0) - diff ? FL(-1.0) : FL(1.0) - diff); } p->count = (int32_t)(nextsamps + nextcount * dev * nextsamps); p->first = 0; } if (p->count <= 0) { int32_t nextsamps; MYFLT nextcount, r1, r2; /* this very line of k-time fix. Changed GetSt to GetKr */ nextsamps = (int32_t)(csound->GetKr(csound) / frq); p->rand = csoundRand31(&p->rand); r1 = (MYFLT)p->rand * dv2_31; p->rand = csoundRand31(&p->rand); r2 = (MYFLT)p->rand * dv2_31; nextcount = SQRT(FL(-2.0) * LOG(r1)) * SIN(r2 * TWOPI_F); if (nextcount < FL(-1.0)) { MYFLT diff = FL(-1.0) - nextcount; nextcount = (FL(1.0) < FL(-1.0) + diff ? FL(1.0) : FL(-1.0) + diff); } else if (nextcount > FL(1.0)) { MYFLT diff = nextcount - FL(1.0); nextcount = (FL(-1.0) > FL(1.0) - diff ? FL(-1.0) : FL(1.0) - diff); } p->count = (int32_t)(nextsamps + nextcount * dev * nextsamps); *p->out = *p->kamp; } else { if (p->mmode && *p->kfrq != p->frq0) p->count = 0; *p->out = FL(0.0); } p->count--; return OK; }
static int psynth_process(CSOUND *csound, _PSYN *p) { double ampnext, amp, freq, freqnext, phase, ratio; double a, f, frac, incra, incrph, factor; MYFLT scale = *p->scal, pitch = *p->pitch; int ndx, size = p->func->flen; int i, j, k, m, id; int notcontin = 0; int contin = 0; int tracks = p->tracks, maxtracks = (int) *p->maxtracks; MYFLT *tab = p->func->ftable, *out = p->out; float *fin = (float *) p->fin->frame.auxp; uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; int pos = p->pos; double *amps = (double *) p->amps.auxp, *freqs = (double *) p->freqs.auxp; double *phases = (double *) p->phases.auxp; MYFLT *outsum = (MYFLT *) p->sum.auxp; int *trackID = (int *) p->trackID.auxp; int hopsize = p->hopsize; double min = p->min; ratio = size * csound->onedsr; factor = p->factor; maxtracks = p->numbins > maxtracks ? maxtracks : p->numbins; if (UNLIKELY(offset)) memset(out, '\0', offset*sizeof(MYFLT)); if (UNLIKELY(early)) { nsmps -= early; memset(&out[nsmps], '\0', early*sizeof(MYFLT)); } for (n = offset; n < nsmps; n++) { out[n] = outsum[pos]; pos++; if (pos == hopsize) { memset(outsum, 0, sizeof(MYFLT) * hopsize); /* for each track */ i = j = k = 0; while (i < maxtracks * 4) { ampnext = (double) fin[i] * scale; freqnext = (double) fin[i + 1] * pitch; if ((id = (int) fin[i + 3]) != -1) { j = k + notcontin; if (k < tracks - notcontin) { if (trackID[j] == id) { /* if this is a continuing track */ contin = 1; freq = freqs[j]; phase = phases[j]; amp = amps[j]; } else { /* if this is a dead track */ contin = 0; freqnext = freq = freqs[j]; phase = phases[j]; amp = amps[j]; ampnext = FL(0.0); } } else { /* new track */ contin = 1; freq = freqnext; phase = -freq * factor; amp = FL(0.0); } if(amp > min){ /* interpolation & track synthesis loop */ a = amp; f = freq; incra = (ampnext - amp) / hopsize; incrph = (freqnext - freq) / hopsize; for (m = 0; m < hopsize; m++) { /* table lookup oscillator */ phase += f * ratio; while (phase < 0) phase += size; while (phase >= size) phase -= size; ndx = (int) phase; frac = phase - ndx; outsum[m] += a * (tab[ndx] + (tab[ndx + 1] - tab[ndx]) * frac); a += incra; f += incrph; } } /* keep amp, freq, and phase values for next time */ if (contin) { amps[k] = ampnext; freqs[k] = freqnext; phases[k] = phase; trackID[k] = id; i += 4; k++; } else notcontin++; } else break; } pos = 0; p->tracks = k; } } p->pos = pos; return OK; }
/*---------------------------------------------------------------------------- * * The function limSendRemainOnChannelDebugMarkerFrame, prepares Marker frame * for Start and End of remain on channel with RemainOnChannelMsg as Vendor * Specific information element of the frame. * *----------------------------------------------------------------------------*/ tSirRetStatus limSendRemainOnChannelDebugMarkerFrame(tpAniSirGlobal pMac, tANI_U8 *remainOnChannelMsg) { tSirMacAddr magicMacAddr= {0x11, 0x22, 0x33, 0x44, 0x55, 0x66}; tANI_U32 nBytes, nPayload; tSirRetStatus nSirStatus; tANI_U8 *pFrame; void *pPacket; eHalStatus halstatus; tANI_U8 txFlag = 0; publicVendorSpecific *pPublicVendorSpecific; pPublicVendorSpecific = vos_mem_malloc(sizeof(publicVendorSpecific)); if( pPublicVendorSpecific == NULL ) { limLog( pMac, LOGE, FL( "Unable to allocate memory for Vendor specific information" " element" ) ); return eSIR_MEM_ALLOC_FAILED; } // Assigning Action category code as unknown as this is debug marker frame pPublicVendorSpecific->category = REMAIN_ON_CHANNEL_UNKNOWN_ACTION_CATEGORY; pPublicVendorSpecific->elementid = VENDOR_SPECIFIC_ELEMENT_ID; pPublicVendorSpecific->length = strlen(remainOnChannelMsg); nPayload = sizeof(publicVendorSpecific) + pPublicVendorSpecific->length; nBytes = nPayload + sizeof( tSirMacMgmtHdr ); halstatus = palPktAlloc( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( tANI_U16 )nBytes, ( void** ) &pFrame, ( void** ) &pPacket ); if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) { limLog( pMac, LOGE, FL("Failed to allocate %d bytes for a Remain" " on channel action frame."), nBytes ); nSirStatus = eSIR_MEM_ALLOC_FAILED; goto end; } vos_mem_zero( pFrame, nBytes ); // Populate frame with MAC header nSirStatus = limPopulateMacHeader( pMac, pFrame, SIR_MAC_MGMT_FRAME, SIR_MAC_MGMT_ACTION, magicMacAddr, pMac->lim.gSelfMacAddr); if ( eSIR_SUCCESS != nSirStatus ) { limLog( pMac, LOGE, FL("Failed to populate the buffer descriptor for a" " Action frame for remain on channel.") ); palPktFree( pMac->hHdd, HAL_TXRX_FRM_802_11_MGMT, ( void* ) pFrame, ( void* ) pPacket ); goto end; } // Copy Public Vendor specific fields to frame's information element vos_mem_copy( (pFrame + (sizeof( tSirMacMgmtHdr ))), pPublicVendorSpecific, sizeof(publicVendorSpecific) ); // Copy Remain On channel message to Vendor Specific information field vos_mem_copy( (pFrame + (nBytes - pPublicVendorSpecific->length)), remainOnChannelMsg, pPublicVendorSpecific->length ); halstatus = halTxFrame( pMac, pPacket, ( tANI_U16 ) sizeof(tSirMacMgmtHdr) + nPayload, HAL_TXRX_FRM_802_11_MGMT, ANI_TXDIR_TODS, 7,//SMAC_SWBD_TX_TID_MGMT_HIGH, limTxComplete, pFrame, txFlag ); if ( ! HAL_STATUS_SUCCESS ( halstatus ) ) { limLog( pMac, LOGE, FL("could not send marker frame for" " remain on channel!" )); //Pkt will be freed up by the callback nSirStatus = eSIR_FAILURE; goto end; } nSirStatus = eSIR_SUCCESS; end: vos_mem_free( pPublicVendorSpecific ); return nSirStatus; }
void BiQuad_clear(BiQuad *b) { b->inputs[0] = FL(0.0); b->inputs[1] = FL(0.0); b->lastOutput = FL(0.0); }
/* dotablefilter() * * * * */ static int32_t dotablefilter (CSOUND *csound, TABFILT *p) { int32 loopcount; /* Loop counter. Set by the length of the dest table.*/ int32 indx = 0; /* Index to be added to offsets */ int32 indx2 = 0; /*index into source table*/ MYFLT *based, *bases; /* Base addresses of the two tables.*/ int32 masks; /* Binary masks for the source table */ MYFLT *pdest, *ps; MYFLT threshold; int32 ftype; MYFLT previous = FL(0.0); //int32 sourcelength; ftype = (int32) *p->ftype; threshold = Digest (*p->threshold); loopcount = p->funcd->flen; //sourcelength = loopcount; /* Now get the base addresses and length masks of the tables. */ based = p->funcd->ftable; bases = p->funcs->ftable; masks = p->funcs->lenmask; do { /* Create source pointers by ANDing index with mask, and adding to base * address. This causes source addresses to wrap around if the * destination table is longer. * Destination address is simply the index plus the base address since * we know we will be writing within the table. */ pdest = based + indx; ps = bases + (masks & indx2); switch (ftype) { default: case 0: *pdest = *ps; indx++; indx2++; break; case 1: { /* filter all above threshold */ int32_t p, q = 0; float2frac (csound, *ps, &p, &q); if (Digest (q) > threshold) { indx2++; } else { *pdest = *ps; indx++; indx2++; } break; } case 2: { /* filter all below threshold */ int32_t p, q = 0; float2frac (csound, *ps, &p, &q); if (Digest (q) < threshold) { indx2++; } else { *pdest = *ps; indx++; indx2++; } break; } case 3: { /* generate IOIs from source and write into destination */ if (*ps == FL(0.0)) { /* skip zeros in source table */ indx2++; break; } *pdest = *ps - previous; previous = *ps; indx++; indx2++; break; } } } while (--loopcount); *p->result = indx; return OK; }
void make_DCBlock(DCBlock* p) { p->outputs = FL(0.0); p->inputs = FL(0.0); }
void ADSR_keyOn(ADSR *a) { a->target = FL(1.0); a->rate = a->attackRate; a->state = ATTACK; }
eHalStatus csrTdlsProcessSendMgmt( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsSendMgmtCmdInfo *tdlsSendMgmtCmdInfo = &cmd->u.tdlsCmd.u.tdlsSendMgmtCmdInfo ; tSirTdlsSendMgmtReq *tdlsSendMgmtReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; if (NULL == pSession->pConnectBssDesc) { smsLog( pMac, LOGE, FL("BSS Description is not present") ); return eHAL_STATUS_FAILURE; } tdlsSendMgmtReq = vos_mem_malloc( sizeof(tSirTdlsSendMgmtReq) + tdlsSendMgmtCmdInfo->len); if ( NULL == tdlsSendMgmtReq ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("alloc failed") ); VOS_ASSERT(0) ; return status ; } tdlsSendMgmtReq->sessionId = cmd->sessionId; //Using dialog as transactionId. This can be used to match response with request tdlsSendMgmtReq->transactionId = tdlsSendMgmtCmdInfo->dialog; tdlsSendMgmtReq->reqType = tdlsSendMgmtCmdInfo->frameType ; tdlsSendMgmtReq->dialog = tdlsSendMgmtCmdInfo->dialog ; tdlsSendMgmtReq->statusCode = tdlsSendMgmtCmdInfo->statusCode ; tdlsSendMgmtReq->responder = tdlsSendMgmtCmdInfo->responder; vos_mem_copy(tdlsSendMgmtReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); vos_mem_copy(tdlsSendMgmtReq->peerMac, tdlsSendMgmtCmdInfo->peerMac, sizeof(tSirMacAddr)) ; if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) { vos_mem_copy(tdlsSendMgmtReq->addIe, tdlsSendMgmtCmdInfo->buf, tdlsSendMgmtCmdInfo->len); } // Send the request to PE. smsLog( pMac, LOG1, "sending TDLS Mgmt Frame req to PE " ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_SEND_MGMT_REQ, (void *)tdlsSendMgmtReq , sizeof(tSirTdlsSendMgmtReq)+tdlsSendMgmtCmdInfo->len) ; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC")); } if(tdlsSendMgmtCmdInfo->len && tdlsSendMgmtCmdInfo->buf) { //Done with the buf. Free it. vos_mem_free( tdlsSendMgmtCmdInfo->buf ); tdlsSendMgmtCmdInfo->buf = NULL; tdlsSendMgmtCmdInfo->len = 0; } return status; }
eHalStatus csrTdlsProcessAddSta( tpAniSirGlobal pMac, tSmeCmd *cmd ) { tTdlsAddStaCmdInfo *tdlsAddStaCmdInfo = &cmd->u.tdlsCmd.u.tdlsAddStaCmdInfo ; tSirTdlsAddStaReq *tdlsAddStaReq = NULL ; tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, cmd->sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; if (NULL == pSession->pConnectBssDesc) { smsLog( pMac, LOGE, FL("BSS description is not present") ); return eHAL_STATUS_FAILURE; } tdlsAddStaReq = vos_mem_malloc(sizeof(tSirTdlsAddStaReq)); if ( NULL == tdlsAddStaReq ) status = eHAL_STATUS_FAILURE; else status = eHAL_STATUS_SUCCESS; if (!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("alloc failed") ); VOS_ASSERT(0) ; return status ; } tdlsAddStaReq->sessionId = cmd->sessionId; tdlsAddStaReq->tdlsAddOper = tdlsAddStaCmdInfo->tdlsAddOper; //Using dialog as transactionId. This can be used to match response with request tdlsAddStaReq->transactionId = 0; vos_mem_copy( tdlsAddStaReq->bssid, pSession->pConnectBssDesc->bssId, sizeof (tSirMacAddr)); vos_mem_copy( tdlsAddStaReq->peerMac, tdlsAddStaCmdInfo->peerMac, sizeof(tSirMacAddr)) ; tdlsAddStaReq->capability = tdlsAddStaCmdInfo->capability; tdlsAddStaReq->uapsd_queues = tdlsAddStaCmdInfo->uapsdQueues; tdlsAddStaReq->max_sp = tdlsAddStaCmdInfo->maxSp; vos_mem_copy( tdlsAddStaReq->extn_capability, tdlsAddStaCmdInfo->extnCapability, SIR_MAC_MAX_EXTN_CAP); tdlsAddStaReq->htcap_present = tdlsAddStaCmdInfo->htcap_present; vos_mem_copy( &tdlsAddStaReq->htCap, &tdlsAddStaCmdInfo->HTCap, sizeof(tdlsAddStaCmdInfo->HTCap)); tdlsAddStaReq->vhtcap_present = tdlsAddStaCmdInfo->vhtcap_present; vos_mem_copy( &tdlsAddStaReq->vhtCap, &tdlsAddStaCmdInfo->VHTCap, sizeof(tdlsAddStaCmdInfo->VHTCap)); tdlsAddStaReq->supported_rates_length = tdlsAddStaCmdInfo->supportedRatesLen; vos_mem_copy( &tdlsAddStaReq->supported_rates, tdlsAddStaCmdInfo->supportedRates, tdlsAddStaCmdInfo->supportedRatesLen); // Send the request to PE. smsLog( pMac, LOGE, "sending TDLS Add Sta req to PE " ); status = tdlsSendMessage(pMac, eWNI_SME_TDLS_ADD_STA_REQ, (void *)tdlsAddStaReq , sizeof(tSirTdlsAddStaReq)) ; if(!HAL_STATUS_SUCCESS( status ) ) { smsLog( pMac, LOGE, FL("Failed to send request to MAC")); } return status; }
int32_t call_system_set(CSOUND *csound, SYSTEM *p) { IGN(csound); p->prv_ktrig = FL(0.0); return OK; }
/** * limIsAuthAlgoSupported() * *FUNCTION: * This function is called in various places within LIM code * to determine whether passed authentication algorithm is enabled * or not * *LOGIC: * *ASSUMPTIONS: * NA * *NOTE: * NA * * @param authType Indicates MAC based authentication type * (eSIR_OPEN_SYSTEM or eSIR_SHARED_KEY) * If Shared Key authentication to be used, * 'Privacy Option Implemented' flag is also * checked. * * @return true if passed authType is enabled else false */ tANI_U8 limIsAuthAlgoSupported(tpAniSirGlobal pMac, tAniAuthType authType, tpPESession psessionEntry) { tANI_U32 algoEnable, privacyOptImp; if (authType == eSIR_OPEN_SYSTEM) { if(psessionEntry->limSystemRole == eLIM_AP_ROLE) { if((psessionEntry->authType == eSIR_OPEN_SYSTEM) || (psessionEntry->authType == eSIR_AUTO_SWITCH)) return true; else return false; } if (wlan_cfgGetInt(pMac, WNI_CFG_OPEN_SYSTEM_AUTH_ENABLE, &algoEnable) != eSIR_SUCCESS) { /** * Could not get AuthAlgo1 Enable value * from CFG. Log error. */ limLog(pMac, LOGE, FL("could not retrieve AuthAlgo1 Enable value")); return false; } else return ( (algoEnable > 0 ? true : false) ); } else { if(psessionEntry->limSystemRole == eLIM_AP_ROLE) { if((psessionEntry->authType == eSIR_SHARED_KEY) || (psessionEntry->authType == eSIR_AUTO_SWITCH)) algoEnable = true; else algoEnable = false; } else if (wlan_cfgGetInt(pMac, WNI_CFG_SHARED_KEY_AUTH_ENABLE, &algoEnable) != eSIR_SUCCESS) { /** * Could not get AuthAlgo2 Enable value * from CFG. Log error. */ limLog(pMac, LOGE, FL("could not retrieve AuthAlgo2 Enable value")); return false; } if(psessionEntry->limSystemRole == eLIM_AP_ROLE) { privacyOptImp = psessionEntry->privacy; } else if (wlan_cfgGetInt(pMac, WNI_CFG_PRIVACY_ENABLED, &privacyOptImp) != eSIR_SUCCESS) { /** * Could not get PrivacyOptionImplemented value * from CFG. Log error. */ limLog(pMac, LOGE, FL("could not retrieve PrivacyOptImplemented value")); return false; } return (algoEnable && privacyOptImp); } } /****** end limIsAuthAlgoSupported() ******/
eHalStatus sme_FTUpdateKey(tHalHandle hHal, tANI_U32 sessionId, tCsrRoamSetKey * pFTKeyInfo ) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); tCsrRoamSession *pSession = CSR_GET_SESSION( pMac, sessionId ); eHalStatus status = eHAL_STATUS_FAILURE; if (!pSession) { smsLog( pMac, LOGE, FL("pSession is NULL")); return eHAL_STATUS_FAILURE; } if (pFTKeyInfo == NULL) { smsLog( pMac, LOGE, "%s: pFTKeyInfo is NULL", __func__); return eHAL_STATUS_FAILURE; } status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) { return eHAL_STATUS_FAILURE; } #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "sme_FTUpdateKey is received in state %d", pSession->ftSmeContext.FTState); #endif // Global Station FT State switch(pSession->ftSmeContext.FTState) { case eFT_SET_KEY_WAIT: if (sme_GetFTPreAuthState(hHal, sessionId) == TRUE) { status = sme_FTSendUpdateKeyInd(pMac, sessionId, pFTKeyInfo); if (status != 0 ) { smsLog( pMac, LOGE, "%s: Key set failure %d", __func__, status); pSession->ftSmeContext.setFTPTKState = FALSE; status = eHAL_STATUS_FT_PREAUTH_KEY_FAILED; } else { pSession->ftSmeContext.setFTPTKState = TRUE; status = eHAL_STATUS_FT_PREAUTH_KEY_SUCCESS; smsLog( pMac, LOG1, "%s: Key set success", __func__); } sme_SetFTPreAuthState(hHal, sessionId, FALSE); } pSession->ftSmeContext.FTState = eFT_START_READY; #ifdef WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "%s: state changed to %d status %d", __func__, pSession->ftSmeContext.FTState, status); #endif break; default: smsLog( pMac, LOGW, "%s: Unhandled state=%d", __func__, pSession->ftSmeContext.FTState); status = eHAL_STATUS_FAILURE; break; } sme_ReleaseGlobalLock( &pMac->sme ); return status; }
tSirRetStatus schAppendAddnIE(tpAniSirGlobal pMac, tpPESession psessionEntry, tANI_U8 *pFrame, tANI_U32 maxBeaconSize, tANI_U32 *nBytes) { tSirRetStatus status = eSIR_FAILURE; tANI_U32 present, len; tANI_U8 addIE[WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN]; if((status = wlan_cfgGetInt(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG, &present)) != eSIR_SUCCESS) { schLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_FLAG")); return status; } if(present) { if((status = wlan_cfgGetStrLen(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &len)) != eSIR_SUCCESS) { schLog(pMac, LOGP, FL("Unable to get WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA length")); return status; } if(len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN && len && ((len + *nBytes) <= maxBeaconSize)) { if((status = wlan_cfgGetStr(pMac, WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA, &addIE[0], &len)) == eSIR_SUCCESS) { tANI_U8* pP2pIe = limGetP2pIEPtr(pMac, &addIE[0], len); if(pP2pIe != NULL) { tANI_U8 noaLen = 0; tANI_U8 noaStream[SIR_MAX_NOA_ATTR_LEN + SIR_P2P_IE_HEADER_LEN]; noaLen = limGetNoaAttrStream(pMac, noaStream, psessionEntry); if(noaLen) { if(noaLen + len <= WNI_CFG_PROBE_RSP_BCN_ADDNIE_DATA_LEN) { vos_mem_copy(&addIE[len], noaStream, noaLen); len += noaLen; pP2pIe[1] += noaLen; } else { schLog(pMac, LOGE, FL("Not able to insert NoA because of length constraint")); } } } vos_mem_copy(pFrame, &addIE[0], len); *nBytes = *nBytes + len; } } } return status; }
static int32_t gausstrig_process_arate(CSOUND* csound, GAUSSTRIG *p) { uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; MYFLT *out = p->out; MYFLT frq, dev; p->frq0 = *p->kfrq; frq = (p->frq0 > FL(0.001) ? p->frq0 : FL(0.001)); dev = *p->kdev; if (UNLIKELY(offset)) memset(p->out, '\0', offset*sizeof(MYFLT)); if (UNLIKELY(early)) { nsmps -= early; memset(&p->out[nsmps], '\0', early*sizeof(MYFLT)); } //memset(out, '\0', offset*sizeof(MYFLT)); if (p->first > FL(0.0)) { /* values less than FL(0.0) could be used in later versions as an offset in samples */ int32_t nextsamps; MYFLT nextcount, dev, r1, r2; //p->frq0 = *p->kfrq; //frq = (p->frq0 > FL(0.001) ? p->frq0 : FL(0.001)); dev = *p->kdev; nextsamps = (int32_t)(csound->GetSr(csound) / frq); p->rand = csoundRand31(&p->rand); r1 = (MYFLT)p->rand * dv2_31; p->rand = csoundRand31(&p->rand); r2 = (MYFLT)p->rand * dv2_31; nextcount = SQRT(FL(-2.0) * LOG(r1)) * SIN(r2 * TWOPI_F); if (nextcount < FL(-1.0)) { MYFLT diff = FL(-1.0) - nextcount; nextcount = (FL(1.0) < FL(-1.0) + diff ? FL(1.0) : FL(-1.0) + diff); } else if (nextcount > FL(1.0)) { MYFLT diff = nextcount - FL(1.0); nextcount = (FL(-1.0) > FL(1.0) - diff ? FL(-1.0) : FL(1.0) - diff); } p->count = (int32_t)(nextsamps + nextcount * dev * nextsamps); p->first = 0; /* Only once called */ } for (n=offset; n<nsmps; n++) { if (p->count <= 0) { int32_t nextsamps; MYFLT nextcount, r1, r2; nextsamps = (int32_t)(csound->GetSr(csound) / frq); p->rand = csoundRand31(&p->rand); r1 = (MYFLT)p->rand * dv2_31; p->rand = csoundRand31(&p->rand); r2 = (MYFLT)p->rand * dv2_31; nextcount = SQRT(FL(-2.0) * LOG(r1)) * SIN(r2 * TWOPI_F); if (nextcount < FL(-1.0)) { MYFLT diff = FL(-1.0) - nextcount; nextcount = (FL(1.0) < FL(-1.0) + diff ? FL(1.0) : FL(-1.0) + diff); } else if (nextcount > FL(1.0)) { MYFLT diff = nextcount - FL(1.0); nextcount = (FL(-1.0) > FL(1.0) - diff ? FL(-1.0) : FL(1.0) - diff); } p->count = (int32_t)(nextsamps + nextcount * dev * nextsamps); out[n] = *p->kamp; } else { if (p->mmode && *p->kfrq != p->frq0) p->count = 0; out[n] = FL(0.0); } p->count--; } return OK; }
tSirRetStatus uMacPostCtrlMsg(void* pSirGlobal, tSirMbMsg* pMb) { tSirMsgQ msg; tpAniSirGlobal pMac = (tpAniSirGlobal)pSirGlobal; tSirMbMsg* pMbLocal; msg.type = pMb->type; msg.bodyval = 0; WDALOG3(wdaLog(pMac, LOG3, FL("msgType %d, msgLen %d\n" ), pMb->type, pMb->msgLen)); // copy the message from host buffer to firmware buffer // this will make sure that firmware allocates, uses and frees // it's own buffers for mailbox message instead of working on // host buffer // second parameter, 'wait option', to palAllocateMemory is ignored on Windows if( eHAL_STATUS_SUCCESS != palAllocateMemory( pMac->hHdd, (void **)&pMbLocal, pMb->msgLen)) { WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n"))); return eSIR_FAILURE; } palCopyMemory(pMac, (void *)pMbLocal, (void *)pMb, pMb->msgLen); msg.bodyptr = pMbLocal; switch (msg.type & HAL_MMH_MB_MSG_TYPE_MASK) { case WDA_MSG_TYPES_BEGIN: // Posts a message to the HAL MsgQ wdaPostCtrlMsg(pMac, &msg); break; case SIR_LIM_MSG_TYPES_BEGIN: // Posts a message to the LIM MsgQ limPostMsgApi(pMac, &msg); break; case SIR_CFG_MSG_TYPES_BEGIN: // Posts a message to the CFG MsgQ wdaPostCfgMsg(pMac, &msg); break; case SIR_PMM_MSG_TYPES_BEGIN: // Posts a message to the PMM MsgQ pmmPostMessage(pMac, &msg); break; case SIR_PTT_MSG_TYPES_BEGIN: WDALOGW( wdaLog(pMac, LOGW, FL("%s:%d: message type = 0x%X"), __func__, __LINE__, msg.type)); vos_mem_free(msg.bodyptr); break; default: WDALOGW( wdaLog(pMac, LOGW, FL("Unknown message type = " "0x%X\n"), msg.type)); // Release the memory. if (palFreeMemory( pMac->hHdd, (void*)(msg.bodyptr)) != eHAL_STATUS_SUCCESS) { WDALOGE( wdaLog(pMac, LOGE, FL("Buffer Allocation failed!\n"))); return eSIR_FAILURE; } break; } return eSIR_SUCCESS; } // uMacPostCtrlMsg()
static void sndfilein_noscale(CSOUND *csound) { sndfilein_(csound, FL(1.0)); }
void Envelope_keyOff(Envelope *e) { e->target = FL(0.0); if (e->value != e->target) e->state = 1; }
void hdd_sendMgmtFrameOverMonitorIface( hdd_adapter_t *pMonAdapter, tANI_U32 nFrameLength, tANI_U8* pbFrames, tANI_U8 frameType ) { //Indicate a Frame over Monitor Intf. int rxstat; struct sk_buff *skb = NULL; int needed_headroom = 0; int flag = HDD_RX_FLAG_IV_STRIPPED | HDD_RX_FLAG_DECRYPTED | HDD_RX_FLAG_MMIC_STRIPPED; #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK hdd_context_t* pHddCtx = (hdd_context_t*)(pMonAdapter->pHddCtx); #endif hddLog( LOG1, FL("Indicate Frame over Monitor Intf")); VOS_ASSERT( (pbFrames != NULL) ); /* room for the radiotap header based on driver features * 1 Byte for RADIO TAP Flag, 1 Byte padding and 2 Byte for * RX flags. * */ needed_headroom = sizeof(struct ieee80211_radiotap_header) + 4; //alloc skb here skb = alloc_skb(VPKT_SIZE_BUFFER, GFP_ATOMIC); if (unlikely(NULL == skb)) { hddLog( LOGW, FL("Unable to allocate skb")); return; } skb_reserve(skb, VPKT_SIZE_BUFFER); if (unlikely(skb_headroom(skb) < nFrameLength)) { VOS_TRACE(VOS_MODULE_ID_HDD, VOS_TRACE_LEVEL_FATAL, "HDD [%d]: Insufficient headroom, " "head[%p], data[%p], req[%d]", __LINE__, skb->head, skb->data, nFrameLength); kfree_skb(skb); return ; } // actually push the data memcpy(skb_push(skb, nFrameLength), pbFrames, nFrameLength); /* prepend radiotap information */ if( 0 != hdd_wlan_add_rx_radiotap_hdr( skb, needed_headroom, flag ) ) { hddLog( LOGE, FL("Not Able Add Radio Tap")); //free skb kfree_skb(skb); return ; } skb_reset_mac_header( skb ); skb->dev = pMonAdapter->dev; skb->protocol = eth_type_trans( skb, skb->dev ); skb->ip_summed = CHECKSUM_NONE; #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION); #endif rxstat = netif_rx_ni(skb); if( NET_RX_SUCCESS == rxstat ) { hddLog( LOG1, FL("Success")); } else hddLog( LOGE, FL("Failed %d"), rxstat); return ; }
MYFLT DCBlock_tick(DCBlock* p, MYFLT sample) { p->outputs = sample - p->inputs + FL(0.99) * p->outputs; p->inputs = sample; return p->outputs; }
void hdd_indicateMgmtFrame( hdd_adapter_t *pAdapter, tANI_U32 nFrameLength, tANI_U8* pbFrames, tANI_U8 frameType, tANI_U32 rxChan ) { tANI_U16 freq; tANI_U8 type = 0; tANI_U8 subType = 0; tActionFrmType actionFrmType; hdd_cfg80211_state_t *cfgState = NULL; hddLog(VOS_TRACE_LEVEL_INFO, "%s: Frame Type = %d Frame Length = %d\n", __func__, frameType, nFrameLength); if (NULL == pAdapter) { hddLog( LOGE, FL("pAdapter is NULL")); return; } if (NULL == pAdapter->dev) { hddLog( LOGE, FL("pAdapter->dev is NULL")); return; } if (WLAN_HDD_ADAPTER_MAGIC != pAdapter->magic) { hddLog( LOGE, FL("pAdapter has invalid magic")); return; } if( !nFrameLength ) { hddLog( LOGE, FL("Frame Length is Invalid ZERO")); return; } if (NULL == pbFrames) { hddLog( LOGE, FL("pbFrames is NULL")); return; } if( ( WLAN_HDD_SOFTAP == pAdapter->device_mode ) || ( WLAN_HDD_P2P_GO == pAdapter->device_mode ) ) { hdd_adapter_t *pMonAdapter = hdd_get_mon_adapter( WLAN_HDD_GET_CTX(pAdapter) ); if( NULL != pMonAdapter ) { hddLog( LOG1, FL("Indicate Frame over Monitor Interface")); hdd_sendMgmtFrameOverMonitorIface( pMonAdapter, nFrameLength, pbFrames, frameType); return; } } //Channel indicated may be wrong. TODO //Indicate an action frame. if( rxChan <= MAX_NO_OF_2_4_CHANNELS ) { freq = ieee80211_channel_to_frequency( rxChan, IEEE80211_BAND_2GHZ); } else { freq = ieee80211_channel_to_frequency( rxChan, IEEE80211_BAND_5GHZ); } type = WLAN_HDD_GET_TYPE_FRM_FC(pbFrames[0]); subType = WLAN_HDD_GET_SUBTYPE_FRM_FC(pbFrames[0]); cfgState = WLAN_HDD_GET_CFG_STATE_PTR( pAdapter ); if ((type == SIR_MAC_MGMT_FRAME) && (subType == SIR_MAC_MGMT_ACTION) && (pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_OFFSET] == WLAN_HDD_PUBLIC_ACTION_FRAME)) { actionFrmType = pbFrames[WLAN_HDD_PUBLIC_ACTION_FRAME_TYPE_OFFSET]; hddLog(LOG1, "Rx Action Frame %u \n", actionFrmType); #ifdef WLAN_FEATURE_P2P_DEBUG if(actionFrmType > MAX_P2P_ACTION_FRAME_TYPE) { hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P] unknown[%d] <--- OTA", actionFrmType); } else { hddLog(VOS_TRACE_LEVEL_ERROR,"[P2P] %s <--- OTA", p2p_action_frame_type[actionFrmType]); if( (actionFrmType == WLAN_HDD_PROV_DIS_REQ) && (globalP2PConnectionStatus == P2P_NOT_ACTIVE) ) { globalP2PConnectionStatus = P2P_GO_NEG_PROCESS; hddLog(LOGE,"[P2P State]Inactive state to " "GO negotation progress state"); } else if( (actionFrmType == WLAN_HDD_GO_NEG_CNF) && (globalP2PConnectionStatus == P2P_GO_NEG_PROCESS) ) { globalP2PConnectionStatus = P2P_GO_NEG_COMPLETED; hddLog(LOGE,"[P2P State]GO nego progress to GO nego" " completed state"); } else if( (actionFrmType == WLAN_HDD_INVITATION_REQ) && (globalP2PConnectionStatus == P2P_NOT_ACTIVE) ) { globalP2PConnectionStatus = P2P_GO_NEG_COMPLETED; hddLog(LOGE,"[P2P State]Inactive state to GO nego" " completed state Autonomus GO fromation"); } } #endif if (((actionFrmType == WLAN_HDD_PROV_DIS_RESP) && (cfgState->actionFrmState == HDD_PD_REQ_ACK_PENDING)) || ((actionFrmType == WLAN_HDD_GO_NEG_RESP) && (cfgState->actionFrmState == HDD_GO_NEG_REQ_ACK_PENDING))) { hddLog(LOG1, "%s: ACK_PENDING and But received RESP for Action frame ", __func__); hdd_sendActionCnf(pAdapter, TRUE); } } //Indicate Frame Over Normal Interface hddLog( LOG1, FL("Indicate Frame over NL80211 Interface")); #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,4,0)) cfg80211_rx_mgmt( pAdapter->dev, freq, 0, pbFrames, nFrameLength, GFP_ATOMIC ); #else cfg80211_rx_mgmt( pAdapter->dev, freq, pbFrames, nFrameLength, GFP_ATOMIC ); #endif //LINUX_VERSION_CODE }
void ADSR_keyOff(ADSR *a) { a->target = FL(0.0); a->rate = a->releaseRate; a->state = RELEASE; }
static void hdd_wlan_tx_complete( hdd_adapter_t* pAdapter, hdd_cfg80211_state_t* cfgState, tANI_BOOLEAN actionSendSuccess ) { struct ieee80211_radiotap_header *rthdr; unsigned char *pos; struct sk_buff *skb = cfgState->skb; #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK hdd_context_t *pHddCtx = (hdd_context_t*)(pAdapter->pHddCtx); #endif /* 2 Byte for TX flags and 1 Byte for Retry count */ u32 rtHdrLen = sizeof(*rthdr) + 3; u8 *data; /* We have to return skb with Data starting with MAC header. We have * copied SKB data starting with MAC header to cfgState->buf. We will pull * entire skb->len from skb and then we will push cfgState->buf to skb * */ if( NULL == skb_pull(skb, skb->len) ) { hddLog( LOGE, FL("Not Able to Pull %d byte from skb"), skb->len); kfree_skb(cfgState->skb); return; } data = skb_push( skb, cfgState->len ); if (data == NULL) { hddLog( LOGE, FL("Not Able to Push %d byte to skb"), cfgState->len); kfree_skb( cfgState->skb ); return; } memcpy( data, cfgState->buf, cfgState->len ); /* send frame to monitor interfaces now */ if( skb_headroom(skb) < rtHdrLen ) { hddLog( LOGE, FL("No headroom for rtap header")); kfree_skb(cfgState->skb); return; } rthdr = (struct ieee80211_radiotap_header*) skb_push( skb, rtHdrLen ); memset( rthdr, 0, rtHdrLen ); rthdr->it_len = cpu_to_le16( rtHdrLen ); rthdr->it_present = cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | (1 << IEEE80211_RADIOTAP_DATA_RETRIES) ); pos = (unsigned char *)( rthdr+1 ); // Fill TX flags *pos = actionSendSuccess; pos += 2; // Fill retry count *pos = 0; pos++; skb_set_mac_header( skb, 0 ); skb->ip_summed = CHECKSUM_NONE; skb->pkt_type = PACKET_OTHERHOST; skb->protocol = htons(ETH_P_802_2); memset( skb->cb, 0, sizeof( skb->cb ) ); #ifdef WLAN_FEATURE_HOLD_RX_WAKELOCK wake_lock_timeout(&pHddCtx->rx_wake_lock, HDD_WAKE_LOCK_DURATION); #endif if (in_interrupt()) netif_rx( skb ); else netif_rx_ni( skb ); /* Enable Queues which we have disabled earlier */ netif_tx_start_all_queues( pAdapter->dev ); }
/** * @function : limUpdateAssocStaDatas * * @brief : This function is called to Update the Station Descriptor (dph) Details from * Association / ReAssociation Response Frame * *LOGIC: * *ASSUMPTIONS: * *NOTE: * * @param pMac - Pointer to Global MAC structure * @param pStaDs - Station Descriptor in DPH * @param pAssocRsp - Pointer to Association Response Structure * * @return None */ void limUpdateAssocStaDatas(tpAniSirGlobal pMac, tpDphHashNode pStaDs, tpSirAssocRsp pAssocRsp,tpPESession psessionEntry) { tANI_U32 prop; tANI_U32 phyMode; tANI_U32 val; //tpSirBoardCapabilities pBoardCaps; tANI_BOOLEAN qosMode; tANI_U16 rxHighestRate = 0; limGetPhyMode(pMac, &phyMode, psessionEntry); pStaDs->staType= STA_ENTRY_SELF; limGetQosMode(psessionEntry, &qosMode); // set the ani peer bit, if self mode is one of the proprietary modes if(IS_DOT11_MODE_PROPRIETARY(psessionEntry->dot11mode)) { wlan_cfgGetInt(pMac, WNI_CFG_PROPRIETARY_ANI_FEATURES_ENABLED, &prop); if (prop) { pStaDs->aniPeer = eHAL_SET; pStaDs->propCapability = pAssocRsp->propIEinfo.capability; } } //pMac->lim.gLimMlmState = eLIM_MLM_LINK_ESTABLISHED_STATE; pStaDs->mlmStaContext.authType = psessionEntry->limCurrentAuthType; // Add capabilities information, rates and AID pStaDs->mlmStaContext.capabilityInfo = pAssocRsp->capabilityInfo; pStaDs->shortPreambleEnabled= (tANI_U8)pAssocRsp->capabilityInfo.shortPreamble; //Update HT Capabilites only when the self mode supports HT if(IS_DOT11_MODE_HT(psessionEntry->dot11mode)) { pStaDs->mlmStaContext.htCapability = pAssocRsp->HTCaps.present; if ( pAssocRsp->HTCaps.present ) { pStaDs->htGreenfield = ( tANI_U8 ) pAssocRsp->HTCaps.greenField; if (psessionEntry->htSupportedChannelWidthSet) { pStaDs->htSupportedChannelWidthSet = ( tANI_U8 ) (pAssocRsp->HTCaps.supportedChannelWidthSet ? pAssocRsp->HTInfo.recommendedTxWidthSet : pAssocRsp->HTCaps.supportedChannelWidthSet ); } else { pStaDs->htSupportedChannelWidthSet = eHT_CHANNEL_WIDTH_20MHZ; } pStaDs->htLsigTXOPProtection = ( tANI_U8 ) pAssocRsp->HTCaps.lsigTXOPProtection; pStaDs->htMIMOPSState = (tSirMacHTMIMOPowerSaveState)pAssocRsp->HTCaps.mimoPowerSave; pStaDs->htMaxAmsduLength = ( tANI_U8 ) pAssocRsp->HTCaps.maximalAMSDUsize; pStaDs->htAMpduDensity = pAssocRsp->HTCaps.mpduDensity; pStaDs->htDsssCckRate40MHzSupport = (tANI_U8)pAssocRsp->HTCaps.dsssCckMode40MHz; pStaDs->htShortGI20Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI20MHz; pStaDs->htShortGI40Mhz = (tANI_U8)pAssocRsp->HTCaps.shortGI40MHz; pStaDs->htMaxRxAMpduFactor = pAssocRsp->HTCaps.maxRxAMPDUFactor; limFillRxHighestSupportedRate(pMac, &rxHighestRate, pAssocRsp->HTCaps.supportedMCSSet); pStaDs->supportedRates.rxHighestDataRate = rxHighestRate; /* This is for AP as peer STA and we are INFRA STA. We will put APs offset in dph node which is peer STA */ pStaDs->htSecondaryChannelOffset = (tANI_U8)pAssocRsp->HTInfo.secondaryChannelOffset; //FIXME_AMPDU // In the future, may need to check for "assoc.HTCaps.delayedBA" // For now, it is IMMEDIATE BA only on ALL TID's pStaDs->baPolicyFlag = 0xFF; } } #ifdef WLAN_FEATURE_11AC if(IS_DOT11_MODE_VHT(psessionEntry->dot11mode)) { pStaDs->mlmStaContext.vhtCapability = pAssocRsp->VHTCaps.present; if (pAssocRsp->VHTCaps.present && psessionEntry->htSupportedChannelWidthSet) pStaDs->vhtSupportedChannelWidthSet = pAssocRsp->VHTOperation.chanWidth; } if (limPopulatePeerRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry , &pAssocRsp->VHTCaps) != eSIR_SUCCESS) #else if (limPopulatePeerRateSet(pMac, &pStaDs->supportedRates, pAssocRsp->HTCaps.supportedMCSSet, false,psessionEntry) != eSIR_SUCCESS) #endif { limLog(pMac, LOGP, FL("could not get rateset and extended rate set")); return; } //If one of the rates is 11g rates, set the ERP mode. if ((phyMode == WNI_CFG_PHY_MODE_11G) && sirIsArate(pStaDs->supportedRates.llaRates[0] & 0x7f)) pStaDs->erpEnabled = eHAL_SET; val = WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET_LEN; if (wlan_cfgGetStr(pMac, WNI_CFG_PROPRIETARY_OPERATIONAL_RATE_SET, (tANI_U8 *) &pStaDs->mlmStaContext.propRateSet.propRate, &val) != eSIR_SUCCESS) { /// Could not get prop rateset from CFG. Log error. limLog(pMac, LOGP, FL("could not retrieve prop rateset")); return; } pStaDs->mlmStaContext.propRateSet.numPropRates = (tANI_U8) val; pStaDs->qosMode = 0; pStaDs->lleEnabled = 0; // update TSID to UP mapping //if (pMac->lim.gLimQosEnabled) if (qosMode) { if (pAssocRsp->edcaPresent) { tSirRetStatus status; status = schBeaconEdcaProcess(pMac,&pAssocRsp->edca, psessionEntry); PELOG2(limLog(pMac, LOG2, "Edca set update based on AssocRsp: status %d", status);) if (status != eSIR_SUCCESS) { PELOGE(limLog(pMac, LOGE, FL("Edca error in AssocResp "));) } else { // update default tidmap based on ACM
static int pvsband(CSOUND *csound, PVSBAND *p) { int i, N = p->fin->N; MYFLT lowcut = *p->klowcut; MYFLT lowbnd = *p->klowbnd; MYFLT higbnd = *p->khigbnd; MYFLT higcut = *p->khigcut; float *fin = (float *) p->fin->frame.auxp; float *fout = (float *) p->fout->frame.auxp; MYFLT fade = *p->fade; MYFLT opef = FL(1.0) - EXP(fade); if (UNLIKELY(fout == NULL)) goto err1; if (lowcut<FL(0.0)) lowcut = FL(0.0); if (lowbnd<lowcut) lowbnd = lowcut; if (higbnd<lowbnd) higbnd = lowbnd; if (higcut<higbnd) higcut = higbnd; if (p->fin->sliding) { uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; int NB = p->fout->NB; if (UNLIKELY(early)) nsmps -= early; for (n=offset; n<nsmps; n++) { int change = 0; CMPLX *fin = (CMPLX *) p->fin->frame.auxp + n*NB; CMPLX *fout = (CMPLX *) p->fout->frame.auxp + n*NB; if (XINARG2) lowcut = p->klowcut[n], change = 1; if (XINARG3) lowbnd = p->klowbnd[n], change = 1; if (XINARG4) higbnd = p->khigbnd[n], change = 1; if (XINARG5) higcut = p->khigcut[n], change = 1; if (change) { if (lowcut<FL(0.0)) lowcut = FL(0.0); if (lowbnd<lowcut) lowbnd = lowcut; if (higbnd<lowbnd) higbnd = lowbnd; if (higcut<higbnd) higcut = higbnd; } for (i = 0; i < NB-1; i++) { MYFLT frq = fin[i].im; MYFLT afrq = (frq<FL(0.0)? -frq : frq); if (afrq < lowcut || afrq>higcut) { /* outside band */ fout[i].re = FL(0.0); fout[i].im = -FL(1.0); } else if (afrq > lowbnd && afrq<higbnd) { /* inside nand */ fout[i] = fin[i]; } else if (afrq > lowcut && afrq < lowbnd) { /* ramp up */ if (fade != FL(0.0)) { fout[i].re = fin[i].re * (FL(1.0) - EXP(fade*(afrq-lowcut)/(lowbnd-lowcut)))/opef; } else fout[i].re = fin[i].re * (afrq - lowcut)/(lowbnd - lowcut); fout[i].im = frq; } else { /* ramp down */ if (fade != FL(0.0)) { fout[i].re = fin[i].re * (FL(1.0) - EXP(fade*(higcut-afrq)/(higcut-higbnd)))/opef; } else fout[i].re = fin[i].re * (higcut - afrq)/(higcut - higbnd); fout[i].im = frq; } } } return OK; } if (p->lastframe < p->fin->framecount) { for (i = 0; i < N; i += 2) { MYFLT frq = fin[i+1]; MYFLT afrq = (frq<FL(0.0)? -frq : frq); if (afrq < lowcut || afrq>higcut) { fout[i] = FL(0.0); fout[i+1] = -FL(1.0); } else if (afrq > lowbnd && afrq<higbnd) { fout[i] = fin[i]; fout[i+1] = fin[i+1]; } else if (afrq > lowcut && afrq < lowbnd) { if (fade != FL(0.0)) fout[i] = fin[i] * (1.0f - expf(fade*(afrq-lowcut)/(lowbnd-lowcut)))/opef; else fout[i] = fin[i] * (frq - lowcut)/(lowbnd - lowcut); fout[i+1] = frq; } else { if (fade != FL(0.0)) fout[i] = fin[i] * (1.0f - expf(fade*(higcut-afrq)/(higcut-higbnd)))/opef; else fout[i] = fin[i] * (higcut - frq)/(higcut - higbnd); fout[i+1] = frq; } } p->fout->framecount = p->lastframe = p->fin->framecount; } return OK; err1: return csound->PerfError(csound, p->h.insdshead, Str("pvsband: not initialised")); }
static int trcross_process(CSOUND *csound, _PSCROSS *p) { MYFLT interval = *p->kpar1, bal = *p->kpar2; int mode = p->kpar3 != NULL ? (int) *p->kpar3 : 0; float *framein2 = (float *) p->fsig3->frame.auxp; float *frameout = (float *) p->fsig1->frame.auxp; float *framein1 = (float *) p->fsig2->frame.auxp; int i = 0, j = 0, nomatch = 1, id, end = p->numbins * 4; float max = 0; MYFLT boundup, boundown; int maxj = -1; id = (int) framein1[3]; if (p->lastframe < p->fsig2->framecount) { if (bal > 1) bal = FL(1.0); if (bal < 0) bal = FL(0.0); if (mode < 1) for (i = 0; framein2[i + 3] != -1 && i < end; i += 4) max = framein2[i] > max ? framein2[i] : max; for (i = 0; id != -1 && i < end; i += 4, id = (int) framein1[i + 3]) { boundup = framein1[i + 1] * interval; boundown = framein1[i + 1] * (FL(1.0) / interval); for (j = 0; j < end && framein2[j + 3] != -1; j += 4) { if ((framein2[j + 1] > boundown) && (framein2[j + 1] <= boundup)) { if (maxj != -1) maxj = framein2[j] > framein2[maxj] ? j : maxj; else maxj = j; nomatch = 0; } } if (!nomatch) { if (mode < 1) frameout[i] = (float) ((framein1[i] * (max ? framein2[maxj] / max : 1.0f)) * bal + framein1[i] * (FL(1.0) - bal)); else frameout[i] = (float) (framein2[maxj] * bal + framein1[i] * (FL(1.0) - bal)); frameout[i + 1] = framein1[i + 1]; frameout[i + 2] = framein1[i + 2]; frameout[i + 3] = (float) id; } else { frameout[i] = (float) (framein1[i] * (FL(1.0) - bal)); frameout[i + 1] = framein1[i + 1]; frameout[i + 2] = framein1[i + 2]; frameout[i + 3] = (float) id; } nomatch = 1; maxj = -1; } if (i + 3 < p->numbins * 4) frameout[i + 3] = -1.0f; p->fsig1->framecount = p->lastframe = p->fsig2->framecount; /*csound->Message(csound, "mix %d : %d\n", k/4, j/4);*/ } return OK; }
/*-------------------------------------------------------------------------- Each time the supplicant sends down the FT IEs to the driver. This function is called in SME. This fucntion packages and sends the FT IEs to PE. ------------------------------------------------------------------------*/ void sme_SetFTIEs( tHalHandle hHal, tANI_U8 sessionId, const tANI_U8 *ft_ies, tANI_U16 ft_ies_length ) { tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); eHalStatus status = eHAL_STATUS_FAILURE; status = sme_AcquireGlobalLock( &pMac->sme ); if (!( HAL_STATUS_SUCCESS( status ))) return; if (ft_ies == NULL) { smsLog( pMac, LOGE, FL(" ft ies is NULL")); sme_ReleaseGlobalLock( &pMac->sme ); return; } #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "FT IEs Req is received in state %d", pMac->ft.ftSmeContext.FTState); #endif // Global Station FT State switch(pMac->ft.ftSmeContext.FTState) { case eFT_START_READY: case eFT_AUTH_REQ_READY: if ((pMac->ft.ftSmeContext.auth_ft_ies) && (pMac->ft.ftSmeContext.auth_ft_ies_length)) { // Free the one we received last from the supplicant vos_mem_free(pMac->ft.ftSmeContext.auth_ft_ies); pMac->ft.ftSmeContext.auth_ft_ies_length = 0; } // Save the FT IEs pMac->ft.ftSmeContext.auth_ft_ies = vos_mem_malloc(ft_ies_length); if ( NULL == pMac->ft.ftSmeContext.auth_ft_ies ) { smsLog( pMac, LOGE, FL("Memory allocation failed for " "auth_ft_ies")); sme_ReleaseGlobalLock( &pMac->sme ); return; } pMac->ft.ftSmeContext.auth_ft_ies_length = ft_ies_length; vos_mem_copy((tANI_U8 *)pMac->ft.ftSmeContext.auth_ft_ies, ft_ies,ft_ies_length); pMac->ft.ftSmeContext.FTState = eFT_AUTH_REQ_READY; #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "ft_ies_length=%d", ft_ies_length); #endif break; case eFT_AUTH_COMPLETE: // We will need to re-start preauth. If we received FT IEs in // eFT_PRE_AUTH_DONE state, it implies there was a rekey in // our pre-auth state. Hence this implies we need Pre-auth again. // OK now inform SME we have no pre-auth list. // Delete the pre-auth node locally. Set your self back to restart pre-auth // TBD #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "Pre-auth done and now receiving---> AUTH REQ <---- in state %d", pMac->ft.ftSmeContext.FTState); smsLog( pMac, LOGE, "Unhandled reception of FT IES in state %d", pMac->ft.ftSmeContext.FTState); #endif break; case eFT_REASSOC_REQ_WAIT: // We are done with pre-auth, hence now waiting for // reassoc req. This is the new FT Roaming in place // At this juncture we are ready to start sending Re-Assoc Req. #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOGE, "New Reassoc Req=%p in state %d", ft_ies, pMac->ft.ftSmeContext.FTState); #endif if ((pMac->ft.ftSmeContext.reassoc_ft_ies) && (pMac->ft.ftSmeContext.reassoc_ft_ies_length)) { // Free the one we received last from the supplicant vos_mem_free(pMac->ft.ftSmeContext.reassoc_ft_ies); pMac->ft.ftSmeContext.reassoc_ft_ies_length = 0; } // Save the FT IEs pMac->ft.ftSmeContext.reassoc_ft_ies = vos_mem_malloc(ft_ies_length); if ( NULL == pMac->ft.ftSmeContext.reassoc_ft_ies ) { smsLog( pMac, LOGE, FL("Memory allocation failed for " "reassoc_ft_ies")); sme_ReleaseGlobalLock( &pMac->sme ); return; } pMac->ft.ftSmeContext.reassoc_ft_ies_length = ft_ies_length; vos_mem_copy((tANI_U8 *)pMac->ft.ftSmeContext.reassoc_ft_ies, ft_ies, ft_ies_length); pMac->ft.ftSmeContext.FTState = eFT_SET_KEY_WAIT; #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG smsLog( pMac, LOG1, "ft_ies_length=%d state=%d", ft_ies_length, pMac->ft.ftSmeContext.FTState); #endif break; default: smsLog( pMac, LOGE, FL(" Unhandled state=%d"), pMac->ft.ftSmeContext.FTState); break; } sme_ReleaseGlobalLock( &pMac->sme ); }
static int psynth3_process(CSOUND *csound, _PSYN *p) { double ampnext, amp, freq, freqnext, phase, phasenext; double a2, a3, cph; double phasediff, facsqr, ph; double a, frac, incra, incrph, factor, lotwopi, cnt; MYFLT scale = *p->scal, pitch = *p->pitch; int ndx, size = p->func->flen; int i, j, k, m, id; int notcontin = 0; int contin = 0; int tracks = p->tracks, maxtracks = (int) *p->maxtracks; MYFLT *tab = p->func->ftable, *out = p->out; float *fin = (float *) p->fin->frame.auxp; uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; int pos = p->pos; double *amps = (double *) p->amps.auxp, *freqs = (double *) p->freqs.auxp; double *phases = (double *) p->phases.auxp; MYFLT *outsum = (MYFLT *) p->sum.auxp; int *trackID = (int *) p->trackID.auxp; int hopsize = p->hopsize; double min = p->min; incrph = csound->onedsr; lotwopi = (double) (size) / TWOPI_F; factor = p->factor; facsqr = p->facsqr; maxtracks = p->numbins > maxtracks ? maxtracks : p->numbins; if (UNLIKELY(offset)) memset(out, '\0', offset*sizeof(MYFLT)); if (UNLIKELY(early)) { nsmps -= early; memset(&out[nsmps], '\0', early*sizeof(MYFLT)); } for (n = offset; n < nsmps; n++) { out[n] = outsum[pos]; pos++; if (pos == hopsize) { memset(outsum, 0, sizeof(MYFLT) * hopsize); /* for each track */ i = j = k = 0; while (i < maxtracks * 4) { ampnext = (double) fin[i] * scale; freqnext = (double) fin[i + 1] * TWOPI_F * pitch; phasenext = (double) fin[i + 2]; if ((id = (int) fin[i + 3]) != -1) { j = k + notcontin; if (k < tracks - notcontin) { if (trackID[j] == id) { /* if this is a continuing track */ contin = 1; freq = freqs[j]; phase = phases[j]; amp = amps[j]; } else { /* if this is a dead track */ contin = 0; freqnext = freq = freqs[j]; phase = phases[j]; phasenext = phase + freq * factor; amp = amps[j]; ampnext = FL(0.0); } } else { /* new track */ contin = 1; freq = freqnext; phase = phasenext - freq * factor; amp = FL(0.0); } if(amp > min){ /* phasediff */ phasediff = phasenext - phase; while (phasediff >= PI_F) phasediff -= TWOPI_F; while (phasediff < -PI_F) phasediff += TWOPI_F; /* update phasediff to match the freq */ cph = ((freq + freqnext) * factor *0.5 - phasediff) / TWOPI; phasediff += TWOPI_F * cph; /* interpolation coefs */ a2 = 3.0 / facsqr * (phasediff - factor / 3.0 * (2.0 * freq + freqnext)); a3 = 1.0 / (3.0 * facsqr) * (freqnext - freq - 2.0 * a2 * factor); /* interpolation & track synthesis loop */ a = amp; ph = phase; cnt = 0; incra = (ampnext - amp) / hopsize; for (m = 0; m < hopsize; m++) { /* table lookup oscillator */ ph *= lotwopi; while (ph < 0) ph += size; while (ph >= size) ph -= size; ndx = (int) ph; frac = ph - ndx; outsum[m] += a * (tab[ndx] + (tab[ndx + 1] - tab[ndx]) * frac); a += incra; cnt += incrph; ph = phase + cnt * (freq + cnt * (a2 + a3 * cnt)); } } /* keep amp, freq, and phase values for next time */ if (contin) { amps[k] = ampnext; freqs[k] = freqnext; phasenext += (cph - (int) cph) * TWOPI; while (phasenext < 0) phasenext += TWOPI_F; while (phasenext >= TWOPI_F) phasenext -= TWOPI_F; phases[k] = phasenext; trackID[k] = id; i += 4; k++; } else notcontin++; } else break; } pos = 0; p->tracks = k; } } p->pos = pos; return OK; }
eHalStatus sme_FTSendUpdateKeyInd(tHalHandle hHal, tCsrRoamSetKey * pFTKeyInfo) { tSirFTUpdateKeyInfo *pMsg; tANI_U16 msgLen; eHalStatus status = eHAL_STATUS_FAILURE; tAniEdType tmpEdType; tSirKeyMaterial *keymaterial = NULL; tAniEdType edType; tpAniSirGlobal pMac = PMAC_STRUCT( hHal ); #if defined WLAN_FEATURE_VOWIFI_11R_DEBUG int i = 0; smsLog(pMac, LOG1, FL("keyLength %d"), pFTKeyInfo->keyLength); for (i=0; i<pFTKeyInfo->keyLength; i++) smsLog(pMac, LOG1, FL("%02x"), pFTKeyInfo->Key[i]); #endif msgLen = sizeof( tANI_U16) + sizeof( tANI_U16 ) + sizeof( pMsg->keyMaterial.length ) + sizeof( pMsg->keyMaterial.edType ) + sizeof( pMsg->keyMaterial.numKeys ) + sizeof( pMsg->keyMaterial.key ); pMsg = vos_mem_malloc(msgLen); if ( NULL == pMsg ) { return eHAL_STATUS_FAILURE; } vos_mem_set(pMsg, msgLen, 0); pMsg->messageType = pal_cpu_to_be16((tANI_U16)eWNI_SME_FT_UPDATE_KEY); pMsg->length = pal_cpu_to_be16(msgLen); keymaterial = &pMsg->keyMaterial; keymaterial->length = pFTKeyInfo->keyLength; edType = csrTranslateEncryptTypeToEdType( pFTKeyInfo->encType ); tmpEdType = pal_cpu_to_be32(edType); keymaterial->edType = tmpEdType; // Set the pMsg->keyMaterial.length field (this length is defined as all // data that follows the edType field // in the tSirKeyMaterial keyMaterial; field). // // !!NOTE: This keyMaterial.length contains the length of a MAX size key, // though the keyLength can be // shorter than this max size. Is LIM interpreting this ok ? keymaterial->numKeys = 1; keymaterial->key[ 0 ].keyId = pFTKeyInfo->keyId; keymaterial->key[ 0 ].unicast = (tANI_U8)eANI_BOOLEAN_TRUE; keymaterial->key[ 0 ].keyDirection = pFTKeyInfo->keyDirection; vos_mem_copy(&keymaterial->key[ 0 ].keyRsc, pFTKeyInfo->keyRsc, CSR_MAX_RSC_LEN); keymaterial->key[ 0 ].paeRole = pFTKeyInfo->paeRole; keymaterial->key[ 0 ].keyLength = pFTKeyInfo->keyLength; if ( pFTKeyInfo->keyLength && pFTKeyInfo->Key ) { vos_mem_copy(&keymaterial->key[ 0 ].key, pFTKeyInfo->Key, pFTKeyInfo->keyLength); if(pFTKeyInfo->keyLength == 16) { smsLog(pMac, LOG1, "SME Set Update Ind keyIdx (%d) encType(%d) key = " "%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X-%02X", pMsg->keyMaterial.key[0].keyId, (tAniEdType)pMsg->keyMaterial.edType, pMsg->keyMaterial.key[0].key[0], pMsg->keyMaterial.key[0].key[1], pMsg->keyMaterial.key[0].key[2], pMsg->keyMaterial.key[0].key[3], pMsg->keyMaterial.key[0].key[4], pMsg->keyMaterial.key[0].key[5], pMsg->keyMaterial.key[0].key[6], pMsg->keyMaterial.key[0].key[7], pMsg->keyMaterial.key[0].key[8], pMsg->keyMaterial.key[0].key[9], pMsg->keyMaterial.key[0].key[10], pMsg->keyMaterial.key[0].key[11], pMsg->keyMaterial.key[0].key[12], pMsg->keyMaterial.key[0].key[13], pMsg->keyMaterial.key[0].key[14], pMsg->keyMaterial.key[0].key[15]); } } vos_mem_copy( &pMsg->bssId[ 0 ], &pFTKeyInfo->peerMac[ 0 ], sizeof(tCsrBssid) ); smsLog(pMac, LOG1, "BSSID = "MAC_ADDRESS_STR, MAC_ADDR_ARRAY(pMsg->bssId)); status = palSendMBMessage(pMac->hHdd, pMsg); return( status ); }
void dumpSchedule(tANI_U8 index) { tpSchSchedule s = &schedule[index]; PELOG2(schLog(pMac, LOG2, FL("============== SCHEDULE %d ===============\n"), index);)
/* a separate k-time init for proper work of gausstrig */ static int32_t gausstrig_initk(CSOUND* csound, GAUSSTRIG *p) { p->rand = csoundRand31(&csound->randSeed1); p->first = *p->ifrst1; #if 0 if (*p->ifrst1 > FL(0.0)) { /* values less than FL(0.0) could be used in later versions as an offset in samples */ int32_t nextsamps; MYFLT nextcount, frq, dev, r1, r2; p->frq0 = *p->kfrq; frq = (*p->kfrq > FL(0.001) ? *p->kfrq : FL(0.001)); dev = *p->kdev; /* this very line of k-time fix. Changed GetSt to GetKr */ nextsamps = (int32_t)(csound->GetKr(csound) / frq); p->rand = csoundRand31(&p->rand); r1 = (MYFLT)p->rand * dv2_31; p->rand = csoundRand31(&p->rand); r2 = (MYFLT)p->rand * dv2_31; nextcount = SQRT(FL(-2.0) * LOG(r1)) * SIN(r2 * TWOPI_F); if (nextcount < FL(-1.0)) { MYFLT diff = FL(-1.0) - nextcount; nextcount = (FL(1.0) < FL(-1.0) + diff ? FL(1.0) : FL(-1.0) + diff); } else if (nextcount > FL(1.0)) { MYFLT diff = nextcount - FL(1.0); nextcount = (FL(-1.0) > FL(1.0) - diff ? FL(-1.0) : FL(1.0) - diff); } p->count = (int32_t)(nextsamps + nextcount * dev * nextsamps); } #endif //else { /* GaussTrig UGen behavior */ p->count = 0; //} p->mmode = (*p->imode <= FL(0.0) ? 0 : 1); return OK; }