Ejemplo n.º 1
0
int32_t ieee80211_aow_send_to_host(struct ieee80211com* ic, u_int8_t* data, 
                                     u_int32_t len, u_int16_t type, u_int16_t subtype, u_int8_t* addr)
{
    u_int8_t buf[AOW_MAX_HOST_PKT_SIZE];
    aow_host_pkt_t *p;
    u_int32_t plen = 0;

    if (len > (AOW_MAX_HOST_PKT_SIZE - AOW_HOST_PKT_SIZE)) {
        return -EINVAL;
    }        

    if (!is_aow_usb_calls_registered()) {
        return -EINVAL;
    }        

    p = (aow_host_pkt_t*)buf;        

    p->signature = ATH_AOW_SIGNATURE;
    p->type = type;
    p->subtype = subtype;
    p->length = len;
    p->data = buf + AOW_HOST_PKT_SIZE;
    if (addr) {
        OS_MEMCPY(p->addr, addr, IEEE80211_ADDR_LEN);
    }
    plen = len + AOW_HOST_PKT_SIZE;
    OS_MEMCPY(p->data, data, len);

    wlan_aow_dev.rx.recv_ctrl((u_int8_t*)p, plen);
    return 0;
}
Ejemplo n.º 2
0
/*
 * Setup ANI handling.  Sets all thresholds and reset the
 * channel statistics.  Note that ar5416AniReset should be
 * called by ar5416Reset before anything else happens and
 * that's where we force initial settings.
 */
void
ar5416AniAttach(struct ath_hal *ah, const struct ar5212AniParams *params24,
	const struct ar5212AniParams *params5, HAL_BOOL enable)
{
	struct ath_hal_5212 *ahp = AH5212(ah);

	if (params24 != AH_NULL) {
		OS_MEMCPY(&ahp->ah_aniParams24, params24, sizeof(*params24));
		setPhyErrBase(ah, &ahp->ah_aniParams24);
	}
	if (params5 != AH_NULL) {
		OS_MEMCPY(&ahp->ah_aniParams5, params5, sizeof(*params5));
		setPhyErrBase(ah, &ahp->ah_aniParams5);
	}

	OS_MEMZERO(ahp->ah_ani, sizeof(ahp->ah_ani));
	/* Enable MIB Counters */
	enableAniMIBCounters(ah, &ahp->ah_aniParams24 /*XXX*/);

	if (enable) {		/* Enable ani now */
		HALASSERT(params24 != AH_NULL && params5 != AH_NULL);
		ahp->ah_procPhyErr |= HAL_ANI_ENA;
	} else {
		ahp->ah_procPhyErr &= ~HAL_ANI_ENA;
	}
}
Ejemplo n.º 3
0
mi_node_t *
mi_tbl_add(EXTAP_DBG_PARM mi_node_t **root, u_int8_t *ip, u_int8_t *mac, int ipver)
{
	int		i, len = mi_ip_len(ipver);
	mi_node_t	*a;

	/*
	 * Non unicast addresses should not be added. Since the
	 * addresses being added come from ARP request/response
	 * (for IPv4), or Neighbor Discovery/Advertisement
	 * (for IPv6) packets, the input need not be validated.
	 */
	if ((a = mi_tbl_lkup2(*root, ip, ipver)) != NULL) {
		eadbg3("%s(%d): ignore dup " eamstr " for " eaistr "\n",
			f, l, eamac(mac), eaip(ip));
		return a;
	}

	for (i = 0; i < NUM_MITBL_ENTRIES; i++) {
		if (mi_node_is_free(&mi_tbl[i])) {
			OS_MEMCPY(mi_tbl[i].h_dest, mac, ETH_ALEN);
			OS_MEMCPY(mi_tbl[i].ip, ip, len);
			mi_tbl[i].ip_ver = ipver;
			mi_tbl[i].len = len;
			eadbg3("%s(%d): saving " eamstr " for " eaistr "\n",
				f, l, eamac(mac), eaip(ip));

			return &mi_tbl[i];
		}
	}

	eadbg3("%s(%d): cant save " eamstr " for " eaistr "\n",
		f, l, eamac(mac), eaip(ip));
	return NULL;
}
Ejemplo n.º 4
0
/**
 * visSwap64
 *
 * The function domSwap64 executes a byte swap on the given 64 bit value if it
 * is necessary. (The big/little endian configuration of this libraries host and
 * the attached remote RTS is different.)
 *
 * Note: This function only works if this library is connected to a remote 
 *		 ATCMControl Run Time System. (If it is not connected, this function 
 *		 returns always the input value untouched!)
 *
 * I	uVal		64 bit input value to be converted if necessary.
 *
 * return			Swapped/Original 64 bit value - see above.
 *
 */
void visSwap64(VIS_DATA *pVaL)
{
	IEC_ULINT ullSrc;
	IEC_ULINT ullDest;

	OS_MEMCPY(&ullSrc, pVaL, sizeof(IEC_ULINT));

	ullDest = domSwap64(&g_VI, ullSrc);

	OS_MEMCPY(pVaL, &ullDest, sizeof(IEC_ULINT));
}
Ejemplo n.º 5
0
void
test_pop_pbb(void) {
  static const uint8_t odhost[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab };
  static const uint8_t oshost[] = { 0xfe, 0xdc, 0xba, 0x98, 0x76, 0x54 };
  static const uint8_t idhost[] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 };
  static const uint8_t ishost[] = { 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb };
  struct port port;
  struct action_list action_list;
  struct action *action;
  struct ofp_action_pop_mpls *action_pop;
  struct lagopus_packet pkt;
  OS_MBUF *m;

  TAILQ_INIT(&action_list);
  action = calloc(1, sizeof(*action));
  action_pop = (struct ofp_action_pop_mpls *)&action->ofpat;
  action_pop->type = OFPAT_POP_PBB;
  lagopus_set_action_function(action);
  TAILQ_INSERT_TAIL(&action_list, action, entry);

  m = calloc(1, sizeof(*m));
  TEST_ASSERT_NOT_EQUAL_MESSAGE(m, NULL, "calloc error.");
  m->data = &m->dat[128];

  OS_M_PKTLEN(m) = 64 + 18;
  OS_MEMCPY(&m->data[0], odhost, ETH_ALEN);
  OS_MEMCPY(&m->data[6], oshost, ETH_ALEN);
  m->data[12] = 0x88;
  m->data[13] = 0xe7;
  m->data[14] = 0x00;
  m->data[15] = 0x11;
  m->data[16] = 0x22;
  m->data[17] = 0x33;
  /* dhost and shost */
  OS_MEMCPY(&m->data[18], idhost, ETH_ALEN);
  OS_MEMCPY(&m->data[24], ishost, ETH_ALEN);
  m->data[30] = 0x08;
  m->data[31] = 0x00;
  m->data[32] = 0x45;

  lagopus_set_in_port(&pkt, &port);
  lagopus_packet_init(&pkt, m);
  execute_action(&pkt, &action_list);
  TEST_ASSERT_EQUAL_MESSAGE(OS_M_PKTLEN(m), 64,
                            "POP_PBB length error.");
  TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(&m->data[0], idhost, ETH_ALEN,
                                        "POP_PBB ether_dhost error.");
  TEST_ASSERT_EQUAL_UINT8_ARRAY_MESSAGE(&m->data[6], ishost, ETH_ALEN,
                                        "POP_PBB ether_shost error.");
  TEST_ASSERT_EQUAL_MESSAGE(m->data[12], 0x08,
                            "POP_PBB ethertype[0] error.");
  TEST_ASSERT_EQUAL_MESSAGE(m->data[13], 0x00,
                            "POP_PBB ethertype[1] error.");
}
Ejemplo n.º 6
0
void
setUp(void) {
  size_t s;
  lagopus_ip_address_t *addr;
  struct sockaddr_in *sin;
  uint8_t *p;

  /* Make the root flowinfo. */
  TEST_ASSERT_NULL(flowinfo);
  flowinfo = new_flowinfo_vlan_vid();
  TEST_ASSERT_NOT_NULL(flowinfo);

  TEST_ASSERT_FLOWINFO_FLOW_NUM(flowinfo, 0, __func__);

  /*
   * Make the test flows.
   *
   * ARP matches have the prerequisite.
   */
  for (s = 0; s < ARRAY_LEN(test_flow); s++) {
    TEST_ASSERT_NULL(test_flow[s]);
    test_flow[s] = allocate_test_flow(10 * sizeof(struct match));
    TEST_ASSERT_NOT_NULL(test_flow[s]);
    test_flow[s]->priority = (int)s;
    FLOW_ADD_ARP_PREREQUISITE(test_flow[s]);
  }

  /* Make the test addresses. */
  for (s = 0; s < ARRAY_LEN(test_flow); s++) {
    lagopus_ip_address_create(ipv4srcstr, true, &addr);
    sin = NULL;
    lagopus_ip_address_sockaddr_get(addr, &sin);
    lagopus_ip_address_destroy(addr);
    p = (uint8_t *)&sin->sin_addr.s_addr;
    p[sizeof(sin->sin_addr.s_addr) - 1] = (uint8_t)(TEST_IPV4_ADDR_LSB(s) & 0xff);
    OS_MEMCPY(&ipv4src[s], &sin->sin_addr, sizeof(ipv4src[s]));

    lagopus_ip_address_create(ipv4tgtstr, true, &addr);
    sin = NULL;
    lagopus_ip_address_sockaddr_get(addr, &sin);
    lagopus_ip_address_destroy(addr);
    p = (uint8_t *)&sin->sin_addr.s_addr;
    p[sizeof(sin->sin_addr.s_addr) - 1] = (uint8_t)(TEST_IPV4_ADDR_LSB(s) & 0xff);
    OS_MEMCPY(&ipv4tgt[s], &sin->sin_addr, sizeof(ipv4tgt[s]));

    lagopus_ip_address_create(ipv4maskstr, true, &addr);
    sin = NULL;
    lagopus_ip_address_sockaddr_get(addr, &sin);
    lagopus_ip_address_destroy(addr);
    OS_MEMCPY(&ipv4mask[s], &sin->sin_addr, sizeof(ipv4mask[s]));
  }
}
Ejemplo n.º 7
0
/**
 * visLogin
 *
 * Login to a connected remote ATCMControl Run Time System and retrieve the actual
 * project ID from the attached RTS.
 * 
 * This function will fail, if no project is loaded on the attached RTS.
 *
 * return				OK if successful, else error number.
 */
VIS_UINT visLogin(void)
{
	SVisInfo *pVI = &g_VI;
	IEC_UINT uRes = OK;
	IEC_DATA *pData = NULL;

	if (pVI->bInitialized == FALSE)
	{
		RETURN(ERR_INIT);
	}

	if (pVI->bLogin == TRUE)
	{
		visLogout();
	}

	uRes = domGetProjVersion(pVI, &pData);
	if (uRes != OK)
	{
		RETURN(uRes);
	}
	
	OS_MEMCPY(pVI->pProjectID, pData, VMM_GUID);

	osFree(&pData);

	uRes = domLogin(pVI, pVI->pProjectID);

	if (uRes == OK)
	{
		pVI->bLogin = TRUE;
	}

	RETURN(uRes);
}
Ejemplo n.º 8
0
int
pktlog_text(struct ath_softc *sc, const char *tbuf, u_int32_t iflags)
{
    size_t len;
    struct ath_pktlog_info *pl_info;
    u_int8_t *data;
    u_int32_t    flags = iflags;

    if (!tbuf)
        return 0;

    if (g_pktlog_mode == PKTLOG_MODE_ADAPTER)
        pl_info = sc->pl_info;
    else
        pl_info = g_pktlog_info;

    if (!pl_info || ((pl_info->log_state & ATH_PKTLOG_TEXT) == 0)) {
        return 0;
    }

    flags |= (((sc->ah_mac_rev << PHFLAGS_MACREV_SFT) & PHFLAGS_MACREV_MASK) |
        ((sc->ah_mac_version << PHFLAGS_MACVERSION_SFT) & PHFLAGS_MACVERSION_MASK));
    len = strlen(tbuf);

    data = (u_int8_t *)pktlog_getbuf(sc, pl_info, PKTLOG_TYPE_TEXT, len, flags);
    OS_MEMCPY(data, tbuf, len);
    return 1;
}
Ejemplo n.º 9
0
/*
 * Create a HOSTAP node  on current channel based on ssid.
 */
int
ieee80211_create_infra_bss(struct ieee80211vap *vap,
                      const u_int8_t *essid,
                      const u_int16_t esslen)
{
    struct ieee80211com *ic = vap->iv_ic;
    struct ieee80211_node *ni;

    ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr);
    if (ni == NULL)
        return -ENOMEM;

    IEEE80211_ADDR_COPY(ni->ni_bssid, vap->iv_myaddr);
    ni->ni_esslen = esslen;
    OS_MEMCPY(ni->ni_essid, essid, ni->ni_esslen);
    ni->ni_intval = ic->ic_intval;
    if (IEEE80211_VAP_IS_PRIVACY_ENABLED(vap)) {
        ni->ni_capinfo |= IEEE80211_CAPINFO_PRIVACY;
        ni->ni_rsn = vap->iv_rsn; /* use local RSN settings as the BSS setting */
    }
    /* Set the node htcap to be same as ic htcap */
    ni->ni_htcap = ic->ic_htcap;
    IEEE80211_ADD_NODE_TARGET(ni, ni->ni_vap, 1);

    /* copy the original bssinfo into the new ni BugID: Ev# 73905 */
    ieee80211_copy_bss(ni, vap->iv_bss);

    return ieee80211_sta_join_bss(ni);
}
Ejemplo n.º 10
0
/* Get application defined IEs */
int wlan_mlme_get_appie(wlan_if_t vaphandle, ieee80211_frame_type ftype, u_int8_t *buf, u_int32_t *ielen, u_int32_t buflen)
{
    struct ieee80211vap    *vap = vaphandle;
    int                    error = 0;

    IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s\n", __func__);

    ASSERT(ftype < IEEE80211_FRAME_TYPE_MAX);

    if (ftype >= IEEE80211_FRAME_TYPE_MAX) {
        error = -EINVAL;
        goto exit;
    }

    *ielen = vap->iv_app_ie[ftype].length;

    /* verify output buffer is large enough */
    if (buflen < vap->iv_app_ie[ftype].length) {
        error = -EOVERFLOW;
        goto exit;
    }

    IEEE80211_VAP_LOCK(vap);
    /* copy app ie contents to output buffer */
    if (*ielen) {
        OS_MEMCPY(buf, vap->iv_app_ie[ftype].ie, vap->iv_app_ie[ftype].length);
    }
    IEEE80211_VAP_UNLOCK(vap);
    
exit:
    return error;
}
Ejemplo n.º 11
0
/**
 * utilIecToAnsi
 *
 * Converts an IEC string to a null terminated ANSI string. The ANSI
 * string is truncated if necessary.
 *
 * Note: szAnsi must be sized at least (MAX_IEC_STRLEN + 1)!
 */
IEC_CHAR *utilIecToAnsi(IEC_STRING OS_LPTR *strIEC, IEC_CHAR *szAnsi)
{
	OS_MEMCPY(szAnsi, strIEC->Contents, strIEC->CurLen); 
	szAnsi[strIEC->CurLen] = 0;

	return szAnsi;
}
Ejemplo n.º 12
0
int ieee80211_power_alloc_tim_bitmap(struct ieee80211vap *vap)
{
    u_int8_t *tim_bitmap = NULL;
    u_int32_t old_len = vap->iv_tim_len;

    //printk("[%s] entry\n",__func__);

    vap->iv_tim_len = howmany(vap->iv_max_aid, 8) * sizeof(u_int8_t);
    tim_bitmap = OS_MALLOC(vap->iv_ic->ic_osdev, vap->iv_tim_len, 0);
    if(!tim_bitmap) {
        vap->iv_tim_len = old_len;
        return -1;
    }    
    OS_MEMZERO(tim_bitmap, vap->iv_tim_len);
    if (vap->iv_tim_bitmap) { 
        OS_MEMCPY(tim_bitmap, vap->iv_tim_bitmap,
            vap->iv_tim_len > old_len ? old_len : vap->iv_tim_len);
        OS_FREE(vap->iv_tim_bitmap);
    }
    vap->iv_tim_bitmap = tim_bitmap;

    //printk("[%s] exits\n",__func__);

    return 0;
}
Ejemplo n.º 13
0
/* Get optional application defined IEs */
int wlan_mlme_get_optie(wlan_if_t vaphandle, u_int8_t *buf, u_int32_t *ielen, u_int32_t buflen)
{
    struct ieee80211vap    *vap = vaphandle;
    int                    error = 0;

    IEEE80211_DPRINTF(vap, IEEE80211_MSG_MLME, "%s\n", __func__);

    *ielen = vap->iv_opt_ie.length;

    /* verify output buffer is large enough */
    if (buflen < vap->iv_opt_ie.length) {
        error = -EOVERFLOW;
        goto exit;
    }

    IEEE80211_VAP_LOCK(vap);
    /* copy opt ie contents to output buffer */
    if (*ielen) {
        OS_MEMCPY(buf, vap->iv_opt_ie.ie, vap->iv_opt_ie.length);
    }
    IEEE80211_VAP_UNLOCK(vap);

exit:
    return error;
}
Ejemplo n.º 14
0
/**
 * @brief noise histogrm response 
 *
 * @param rrm
 * @param ie
 *
 * @return 
 */
u_int8_t *ieee80211_rrm_send_nhist_resp(ieee80211_rrm_t rrm,u_int8_t *ie)
{
    struct ieee80211_nhistrsp *rsp=NULL;
    struct ieee80211_measrsp_ie *measrsp=NULL;
    struct ieee80211_rrmreq_info *params=NULL;
    unsigned long tsf;
#if UMAC_SUPPORT_RRM_DEBUG 
    wlan_if_t vap = rrm->rrm_vap;
#endif        

    RRM_FUNCTION_ENTER;

    params = (struct ieee80211_rrmreq_info *)(rrm->rrmcb);
    measrsp = (struct ieee80211_measrsp_ie *)ie;
    measrsp->id = IEEE80211_ELEMID_MEASREP;
    measrsp->token=params->rep_dialogtoken;
    measrsp->rspmode = 0x00; /* Need to validate */
    measrsp->rsptype = IEEE80211_MEASRSP_NOISE_HISTOGRAM_REPORT;
    rsp = (struct ieee80211_nhistrsp *)(&measrsp->rsp[0]);
    rsp->mduration = params->duration;
    rsp->regclass = params->regclass;
    rsp->chnum = params->chnum;
    rsp->anpi = (u_int8_t)rrm->rrm_noisefloor[rsp->chnum];
    OS_GET_RANDOM_BYTES(&rsp->antid,sizeof(rsp->antid));
    OS_GET_RANDOM_BYTES(rsp->ipi,sizeof(rsp->ipi));
    tsf = OS_GET_TIMESTAMP();
    OS_MEMCPY(rsp->tsf,&tsf,4);
    ie = &rsp->rsp[0];
    measrsp->len = (ie - &measrsp->token);

    RRM_FUNCTION_EXIT;
    return ie;
}
Ejemplo n.º 15
0
/**
 * utilFormatIECString
 *
 * Formats an IEC string like sprintf. szBuffer is used as a temporary
 * buffer and must be sized at least (MAX_IEC_STRLEN + 1)!
 */
IEC_UINT utilFormatIECString(IEC_STRING OS_LPTR *strIEC, IEC_CHAR *szBuffer, IEC_CHAR *szFormat, ...)
{
	IEC_INT iCount;
	va_list va;

	if(strIEC == 0 || strIEC->MaxLen == 0)
	{
		RETURN(EXCEPT_NULL_PTR);
	}
	
	va_start(va, szFormat);
	iCount = (IEC_INT)OS_VSPRINTF(szBuffer, szFormat, va); 
	va_end(va);

	if (iCount < 0)
	{
		strIEC->CurLen = 0;
		RETURN(ERR_ERROR);
	}

	strIEC->CurLen = (IEC_STRLEN)((IEC_STRLEN)iCount > strIEC->MaxLen ? strIEC->MaxLen : (IEC_STRLEN)iCount);
	OS_MEMCPY (strIEC->Contents, szBuffer, strIEC->CurLen);

	RETURN(OK);
}
Ejemplo n.º 16
0
HAL_BOOL
ar5312GetMacAddr(struct ath_hal *ah)
{
        int wlanNum;
        struct ath_hal_5212 *ahp= AH5212(ah);
        char *macAddr;

        if ((wlanNum = GETWMACNUM(ah)) == -1) {
                return (AH_FALSE);
        }
	if (ar5312_boardConfig == AH_NULL) {
		return(AH_FALSE);
	}
	switch(wlanNum) {
	case 0:
		macAddr = ar5312_boardConfig->wlan0Mac;
		break;
	case 1:
		macAddr = ar5312_boardConfig->wlan1Mac;
		break;
	default:
		ath_hal_printf(ah, "Invalid WLAN wmac index (%d)\n",
			       wlanNum);
		return(AH_FALSE);
	}
	OS_MEMCPY(&(ahp->ah_macaddr[0]),macAddr,6);
	return(AH_TRUE);
}
Ejemplo n.º 17
0
/*
 * Setup the configuration parameters in the style the AR9300 HAL
 * wants.
 */
void
ar9300_config_defaults_freebsd(struct ath_hal *ah, HAL_OPS_CONFIG *ah_config)
{

	/* Until FreeBSD's HAL does this by default - just copy */
	OS_MEMCPY(&ah->ah_config, ah_config, sizeof(HAL_OPS_CONFIG));
	ah->ah_config.ath_hal_enable_ani = AH_TRUE;
}
Ejemplo n.º 18
0
static int
deferred_schedule_setup(
    ieee80211_p2p_go_schedule_t         go_schedule,
    u_int8_t                            num_schedules,
    ieee80211_p2p_go_schedule_req       *sch_req)
{

    u_int32_t           curr_tsf;
    struct ieee80211com *ic;
    bool                one_shot_noa;   /* Is this a one-shot NOA? */

    IEEE80211_DPRINTF_IC(go_schedule->ic, IEEE80211_VERBOSE_FUNCTION, IEEE80211_MSG_P2P_GO_SCH,
        "%s: called.\n", __func__);

    IEEE80211_P2P_GOSCHE_LOCK(go_schedule);

    /* Keep a copy of the new schedule */
    go_schedule->num_schedules = num_schedules;
    if (num_schedules) {
        /* Copy over the schedule */
        OS_MEMCPY(go_schedule->request, sch_req,
                  sizeof(ieee80211_p2p_go_schedule_req) * num_schedules);

        /* Sort the list of schedules by priority (lowest to highest) */
        sort_schedule_req(go_schedule);
    }

    if (go_schedule->paused) {
        /* Already paused. Do nothing. */
        IEEE80211_DPRINTF_IC(go_schedule->ic, IEEE80211_VERBOSE_NORMAL, IEEE80211_MSG_P2P_GO_SCH,
            "%s: Already paused; do nothing but keep copy of new schedule.\n", __func__);
        IEEE80211_P2P_GOSCHE_UNLOCK(go_schedule);
        return 0;
    }

    if (num_schedules == 0) {
        /* Empty schedule. We are done. */
        no_more_events(go_schedule);

        IEEE80211_P2P_GOSCHE_UNLOCK(go_schedule);

        return 0;
    }

    ASSERT(sch_req);

    IEEE80211_DPRINTF_IC(go_schedule->ic, IEEE80211_VERBOSE_FUNCTION, IEEE80211_MSG_P2P_GO_SCH,
        "%s: num_schedules=%d.\n", __func__, num_schedules);

    ic = go_schedule->vap->iv_ic;
    curr_tsf = ic->ic_get_TSF32(ic);

    process_schedule(go_schedule, curr_tsf, &one_shot_noa);

    IEEE80211_P2P_GOSCHE_UNLOCK(go_schedule);

    return 0;
}
/*****************************************************************************
 函 数 名  : spm_send_laser_ctl_cfg
 功能描述  : 组织子卡常用控制命令IPS消息
 输入参数  : ATG_DCI_CMD_COMMON_CTRL *pstCommonCtrl  
             NBB_BYTE ucSubCardNo                    
 输出参数  : 无
 返 回 值  : 
 调用函数  : 
 被调函数  : 
 
 修改历史      :
  1.日    期   : 2013年8月14日
    作    者   : gaos
    修改内容   : 新生成函数

*****************************************************************************/
NBB_INT spm_send_laser_ctl_cfg(ATG_DCI_CMD_COMMON_CTRL *pstCommonCtrl, NBB_BYTE ucSubCardNo NBB_CCXT_T NBB_CXT)

{
    NBB_BYTE ucMessage[80];
    NBB_INT iRv = 0;
    ATG_SBI_CMD_COMMON_CTRL *pSbiCommonCtrl;
    
    NBB_TRC_ENTRY("spm_send_laser_ctl_cfg");
    
    if (pstCommonCtrl == NULL)
    {
        NBB_TRC_DETAIL((NBB_FORMAT "  ***ERROR***:spm_send_laser_ctl_cfg(pstCommonCtrl==NULL)"));

        OS_PRINTF("***ERROR***:spm_send_laser_ctl_cfg(pstCommonCtrl==NULL)\n");

        OS_SPRINTF(ucMessage, "***ERROR***:spm_send_laser_ctl_cfg(pstCommonCtrl==NULL)\n");
        
        iRv = ERROR;
        goto EXIT_LABEL;
    }

    if (SHARED.sub_card_cb[ucSubCardNo-1] != NULL)
    {
        pSbiCommonCtrl = (ATG_SBI_CMD_COMMON_CTRL*) NBB_GET_BUFFER(NBB_NULL_HANDLE,
                                           NBB_ALIGN_OFFSET(sizeof(ATG_SBI_CMD_COMMON_CTRL)),
                                           0,
                                           NBB_RETRY_DATA | NBB_BUF_PKT); 

        if (NULL == pSbiCommonCtrl)
        {
            NBB_TRC_DETAIL((NBB_FORMAT "  ***ERROR***:spm_send_laser_ctl_cfg(pSbiCommonCtrl==NULL)"));

            OS_PRINTF("***ERROR***:spm_send_laser_ctl_cfg(pSbiCommonCtrl==NULL)\n");

            OS_SPRINTF(ucMessage, "***ERROR***:spm_send_laser_ctl_cfg(pSbiCommonCtrl==NULL)\n");
            
            iRv = ERROR;
            
            goto EXIT_LABEL;
        }
        /*************************************************************************/
        /* 初始化消息。                                                          */
        /*************************************************************************/
        NBB_ZERO_IPS(pSbiCommonCtrl);        

        pSbiCommonCtrl->ips_hdr.ips_type = IPS_ATG_SBI_CMD_COMMON_CTRL;
        pSbiCommonCtrl->key = 1;
        OS_MEMCPY(pSbiCommonCtrl->cmd_buffer, pstCommonCtrl->cmd_buffer, sizeof(NBB_BYTE)*ATG_DCI_CMD_MAX_LEN);


        spm_snd_sbi_ips(SHARED.sub_card_cb[ucSubCardNo-1], pSbiCommonCtrl, &(pSbiCommonCtrl->ips_hdr) NBB_CCXT);
    }
        
    EXIT_LABEL: NBB_TRC_EXIT();
    
    return iRv;
}
Ejemplo n.º 20
0
/**
 * utilCopyIecString
 *
 * Copies an IEC string to another.
 *
 * @return	OK				Source string fits into destination string.
 *			WRN_TRUNCATED	String doesn't fit into destionation string and has
 *							been truncated.
 */
IEC_UINT utilCopyIecString(IEC_STRING OS_LPTR *strDest, IEC_STRING OS_LPTR *strSrc)
{
	IEC_UINT uRes = (IEC_UINT)(strDest->MaxLen >= strSrc->CurLen ? OK : WRN_TRUNCATED);

	strDest->CurLen = (IEC_STRLEN)(uRes == OK ? strSrc->CurLen : strDest->MaxLen);	
	OS_MEMCPY(strDest->Contents, strSrc->Contents, strDest->CurLen);

	return uRes;
}
Ejemplo n.º 21
0
/*
 * Function     : ol_if_spectral_get_macaddr
 * Description  : Get the current Mac address
 * Input        : Pointer to Spectral and addr buffer
 * Output       : Success/Failure
 *
 */
u_int32_t ol_if_spectral_get_macaddr(void* arg, char* addr)
{
    struct ath_spectral *spectral = (struct ath_spectral *)arg;
    struct ieee80211com* ic = spectral->ic;
     
    OS_MEMCPY(addr, ic->ic_myaddr, IEEE80211_ADDR_LEN);

    return 0;
}
Ejemplo n.º 22
0
u_int32_t wlan_aow_pack_and_tx_cmd_pkts(struct ieee80211com* ic, 
                                  u_int8_t* d1, u_int32_t dlen1, 
                                  u_int8_t* d2, u_int32_t dlen2,    
                                  u_int8_t* d3, u_int32_t dlen3) 
{                                 
    u_int8_t cmd_pkt[AOW_PROTO_SUPER_PKT_LEN];                                 
    u_int32_t dlen = dlen1 + dlen2 + dlen3;
    u_int64_t tsf = ic->ic_get_aow_tsf_64(ic);

    OS_MEMCPY(cmd_pkt, d1, dlen1);
    OS_MEMCPY(cmd_pkt + dlen1, d2, dlen2);
    OS_MEMCPY(cmd_pkt + dlen1 + dlen2, d3, dlen3);

    ieee80211_aow_tx_ctrl(cmd_pkt, dlen, tsf);
    return 0;


}
Ejemplo n.º 23
0
void
setUp(void) {
  size_t s;
  struct addrunion au;
  uint8_t *p;

  /* Make the root flowinfo. */
  TEST_ASSERT_NULL(flowinfo);
  flowinfo = new_flowinfo_vlan_vid();
  TEST_ASSERT_NOT_NULL(flowinfo);

  TEST_ASSERT_FLOWINFO_FLOW_NUM(flowinfo, 0, __func__);

  /*
   * Make the test flows.
   *
   * ARP matches have the prerequisite.
   */
  for (s = 0; s < ARRAY_LEN(test_flow); s++) {
    TEST_ASSERT_NULL(test_flow[s]);
    test_flow[s] = allocate_test_flow(10 * sizeof(struct match));
    TEST_ASSERT_NOT_NULL(test_flow[s]);
    test_flow[s]->priority = (int)s;
    FLOW_ADD_ARP_PREREQUISITE(test_flow[s]);
  }

  /* Make the test addresses. */
  for (s = 0; s < ARRAY_LEN(test_flow); s++) {
    addrunion_ipv4_set(&au, ipv4srcstr);
    p = (uint8_t *)&au.addr4.s_addr;
    p[sizeof(au.addr4.s_addr) - 1] = (uint8_t)(TEST_IPV4_ADDR_LSB(s) & 0xff);
    OS_MEMCPY(&ipv4src[s], &au.addr4, sizeof(ipv4src[s]));

    addrunion_ipv4_set(&au, ipv4tgtstr);
    p = (uint8_t *)&au.addr4.s_addr;
    p[sizeof(au.addr4.s_addr) - 1] = (uint8_t)(TEST_IPV4_ADDR_LSB(s) & 0xff);
    OS_MEMCPY(&ipv4tgt[s], &au.addr4, sizeof(ipv4tgt[s]));

    addrunion_ipv4_set(&au, ipv4maskstr);
    OS_MEMCPY(&ipv4mask[s], &au.addr4, sizeof(ipv4mask[s]));
  }
}
Ejemplo n.º 24
0
/*
 * Process an RX descriptor, and return the status to the caller.
 * Copy some hardware specific items into the software portion
 * of the descriptor.
 *
 * NB: the caller is responsible for validating the memory contents
 *     of the descriptor (e.g. flushing any cached copy).
 */
HAL_STATUS
ar5416ProcRxDesc(struct ath_hal *ah, struct ath_desc *ds,
    u_int32_t pa, struct ath_desc *nds, u_int64_t tsf)
{
    HAL_STATUS retval;
    struct ath_rx_status rxs;
    /* Use the local dat structure rxs to improve dcache efficiency. */
    retval = ar5416ProcRxDescBase(ah, ds, &rxs);
    OS_MEMCPY(&ds->ds_rxstat, &rxs, sizeof(struct ath_rx_status));
    return retval;
}
Ejemplo n.º 25
0
int ieee80211_save_blacklist(char *blacklist, u_int32_t len)
{
	if(blacklist_cnt >= BLACKLIST_LIMIT){
		printk("Beyond blacklist limit count %d\n",BLACKLIST_LIMIT);
		return -1;
	}

	OS_MEMCPY(openessid_blacklist[blacklist_cnt], blacklist, len);

	blacklist_cnt++;
	return 0;
}
Ejemplo n.º 26
0
int ieee80211_save_whitelist(char *whitelist, u_int32_t len)
{
	if(whitelist_cnt >= WHITELIST_LIMIT){
		printk("Beyond whitelist limit count %d\n",WHITELIST_LIMIT);
		return -1;
	}

	OS_MEMCPY(openessid_whitelist[whitelist_cnt], whitelist, len);

	whitelist_cnt++;
	return 0;
}
Ejemplo n.º 27
0
/* Copies the color key to the cache */
void copy_color_key_tnc( igd_ovl_info_t *ovl_info, povl_tnc_cache_t ovl_cache)
{
	if (ovl_info) {
		OS_MEMCPY(&ovl_cache->ovl_info.color_key,
			  &(ovl_info->color_key),
			  sizeof(igd_ovl_color_key_info_t));
	} else {
		OS_MEMSET(&ovl_cache->ovl_info.color_key,
			  0,
			  sizeof(igd_ovl_color_key_info_t));
	}
}
Ejemplo n.º 28
0
/* Copies the video quality info to the cache */
void copy_vq_tnc(igd_ovl_info_t *ovl_info, povl_tnc_cache_t ovl_cache)
{
	if (ovl_info) {
		OS_MEMCPY(&ovl_cache->ovl_info.video_quality,
			  &(ovl_info->video_quality),
			  sizeof(igd_ovl_video_quality_info_t));
	} else {
		OS_MEMSET(&ovl_cache->ovl_info.video_quality,
			  0,
			  sizeof(igd_ovl_video_quality_info_t));
	}
}
Ejemplo n.º 29
0
static struct match *
get_match_in_port(struct match_list *match_list, uint32_t *port) {
  struct match *match;

  TAILQ_FOREACH(match, match_list, entry) {
    if (OXM_FIELD_TYPE(match->oxm_field) == OFPXMT_OFB_IN_PORT) {
      OS_MEMCPY(port, match->oxm_value, sizeof(*port));
      break;
    }
  }
  return match;
}
Ejemplo n.º 30
0
/* Copies a surface to the cache */
void copy_surf_tnc(igd_surface_t *src_surf, povl_tnc_cache_t ovl_cache)
{
	if (src_surf) {
		OS_MEMCPY(&ovl_cache->src_surf,
			  src_surf,
			  sizeof(igd_surface_t));
	} else {
		OS_MEMSET(&ovl_cache->src_surf,
			  0,
			  sizeof(igd_surface_t));
	}
}