当前位置: 首页>>代码示例>>C++>>正文


C++ BMM_BUFFER_POINTER函数代码示例

本文整理汇总了C++中BMM_BUFFER_POINTER函数的典型用法代码示例。如果您正苦于以下问题:C++ BMM_BUFFER_POINTER函数的具体用法?C++ BMM_BUFFER_POINTER怎么用?C++ BMM_BUFFER_POINTER使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了BMM_BUFFER_POINTER函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: mac_tx_coord_realignment_command

/**
 * @brief Sends a coordinator realignment command frame
 *
 * This function is called either in response to the reception of an orphan
 * notification command from a device (cmd_type = ORPHANREALIGNMENT),
 * or gratuitously whenever the PAN parameters are about to be changed
 * (cmd_type = COORDINATORREALIGNMENT). In the first case, the
 * paramater mor contains a pointer to the respective
 * MLME_ORPHAN.response message, while in the latter case this
 * parameter is unused, and can be passed as NULL.
 *
 * @param cmd_type Determines directed or broadcast mode
 * @param buf_ptr Pointer to the buffer, using which coord_realignment_command
 *                to be sent
 * @param new_panid Contains the new PAN-ID in case there is a network
 *                  realignment
 * @param new_channel Contains the new channel in case there is a network
 *                    realignment
 * @param new_page Contains the new channel page in case there is a network
 *                 realignment
 *
 * @return True if coord_realignment_command is sent successfully,
 *         false otherwise
 */
bool mac_tx_coord_realignment_command(frame_msgtype_t cmd_type,
                                      buffer_t *buf_ptr,
                                      uint16_t new_panid,
                                      uint8_t new_channel,
                                      uint8_t new_page)
{
    retval_t tal_tx_status;
    uint8_t frame_len;
    uint8_t *frame_ptr;
    uint8_t *temp_frame_ptr;
    uint16_t fcf;
    uint16_t bc_addr = BROADCAST;

    /*
     * Orphan request is reused to send coordinator realignment
     * command frame and finally to send comm-status-indication
     */
    mlme_orphan_resp_t orphan_resp;
    memcpy(&orphan_resp,
           (mlme_orphan_resp_t *)BMM_BUFFER_POINTER((buffer_t *)buf_ptr),
           sizeof(mlme_orphan_resp_t));

    frame_info_t *coord_realignment_frame =
            (frame_info_t *)BMM_BUFFER_POINTER((buffer_t *)buf_ptr);

    coord_realignment_frame->msg_type = cmd_type;
    coord_realignment_frame->buffer_header = buf_ptr;

    /* Get the payload pointer. */
    frame_ptr = temp_frame_ptr =
                (uint8_t *)coord_realignment_frame +
                LARGE_BUFFER_SIZE -
                COORD_REALIGN_PAYLOAD_LEN - 2;   /* Add 2 octets for FCS. */

    /* Update the payload field. */
    *frame_ptr++ = COORDINATORREALIGNMENT;

    /*
     * The payload of the frame has the parameters of the new PAN
     * configuration
     */
    *frame_ptr++ = new_panid;
    *frame_ptr++ = (new_panid >> 8);

    *frame_ptr++ = tal_pib_ShortAddress;
    *frame_ptr++ = (tal_pib_ShortAddress >> 8);

    *frame_ptr++ = new_channel;

    /*
     * Insert the device's short address, or 0xFFFF if this is a
     * gratuitous realigment.
     */
    if (ORPHANREALIGNMENT == cmd_type)
    {
        *frame_ptr++ = orphan_resp.ShortAddress;
        *frame_ptr++ = (orphan_resp.ShortAddress >> 8);
    }
开发者ID:mknapik,项目名称:avr-MAC,代码行数:82,代码来源:mac_tx_coord_realignment_command.c

示例2: mlme_get_request

/**
 * @brief Handles an MLME-GET.request
 *
 * This function handles an MLME-GET.request.
 * The MLME-GET.request primitive requests information about a
 * given PIB attribute.
 *
 * @param m Pointer to the request structure
 */
void mlme_get_request(uint8_t *m)
{
	/* Use the mlme get request buffer for mlme get confirmation */
	mlme_get_conf_t *mgc = (mlme_get_conf_t *)BMM_BUFFER_POINTER(
			(buffer_t *)m);
#if ((defined MAC_SECURITY_ZIP)  || (defined MAC_SECURITY_2006))
	uint8_t attribute_index = ((mlme_get_req_t *)mgc)->PIBAttributeIndex;
#endif /* (MAC_SECURITY_ZIP || MAC_SECURITY_2006) */

	/* Do actual PIB attribute reading */
	{
		pib_value_t *attribute_value = &mgc->PIBAttributeValue;
		uint8_t status = MAC_SUCCESS;

#if ((defined MAC_SECURITY_ZIP)  || (defined MAC_SECURITY_2006))
		status = mlme_get(((mlme_get_req_t *)mgc)->PIBAttribute,
				attribute_value, attribute_index);
		mgc->PIBAttributeIndex = attribute_index;
#else
		status = mlme_get(((mlme_get_req_t *)mgc)->PIBAttribute,
				attribute_value);
#endif /* (MAC_SECURITY_ZIP || MAC_SECURITY_2006) */
		mgc->PIBAttribute = ((mlme_get_req_t *)mgc)->PIBAttribute;
		mgc->cmdcode      = MLME_GET_CONFIRM;
		mgc->status       = status;
	}

	/* Append the mlme get confirmation to MAC-NHLE queue */
	qmm_queue_append(&mac_nhle_q, (buffer_t *)m);
}
开发者ID:thegeek82000,项目名称:asf,代码行数:39,代码来源:mac_pib.c

示例3: wpan_mlme_associate_req

bool wpan_mlme_associate_req(uint8_t LogicalChannel,
                             uint8_t ChannelPage,
                             wpan_addr_spec_t *CoordAddrSpec,
                             uint8_t CapabilityInformation)
{
    buffer_t *buffer_header;
    mlme_associate_req_t *mlme_associate_req;

    /* Allocate a buffer for mlme associate request */
    buffer_header = bmm_buffer_alloc(LARGE_BUFFER_SIZE);

    /* Check for buffer availability */
    if (NULL == buffer_header) {
        return false;
    }

    /* Get the buffer body from buffer header */
    mlme_associate_req = (mlme_associate_req_t *)BMM_BUFFER_POINTER(
                             buffer_header);

    /* Construct mlme_associate_req_t message */
    mlme_associate_req->cmdcode = MLME_ASSOCIATE_REQUEST;

    /* Operating channel */
    mlme_associate_req->LogicalChannel = LogicalChannel;

    /* Coordinator address spec */
    mlme_associate_req->CoordAddrMode = CoordAddrSpec->AddrMode;

#ifdef TEST_HARNESS_BIG_ENDIAN
    mlme_associate_req->CoordPANId
        = CPU_ENDIAN_TO_LE16(CoordAddrSpec->PANId);
#else
    mlme_associate_req->CoordPANId = CoordAddrSpec->PANId;
#endif

    ADDR_COPY_DST_SRC_64(mlme_associate_req->CoordAddress.long_address,
                         CoordAddrSpec->Addr.long_address);

    /* Other fields */
    mlme_associate_req->CapabilityInformation = CapabilityInformation;
    mlme_associate_req->ChannelPage = ChannelPage;

    /* Insert service message into NHLE MLME queue */
#ifdef ENABLE_QUEUE_CAPACITY
    if (MAC_SUCCESS != qmm_queue_append(&nhle_mac_q, buffer_header)) {
        /*
         * MLME-ASSOCIATE.request is not appended into NHLE MAC
         * queue, hence free the buffer allocated
         */
        bmm_buffer_free(buffer_header);
        return false;
    }

#else
    qmm_queue_append(&nhle_mac_q, buffer_header);
#endif  /* ENABLE_QUEUE_CAPACITY */

    return true;
}
开发者ID:thegeek82000,项目名称:asf,代码行数:60,代码来源:mac_api.c

示例4: mlme_comm_status_ind

/**
 * @brief Wrapper function for messages of type mlme_comm_status_ind_t
 *
 * This function is a callback for mlme comm status indication.
 *
 * @param m Pointer to message structure
 */
void mlme_comm_status_ind(uint8_t *m)
{
	mlme_comm_status_ind_t *pmsg;
	wpan_addr_spec_t src_addr;
	wpan_addr_spec_t dst_addr;

	/* Get the buffer body from buffer header */
	pmsg = (mlme_comm_status_ind_t *)BMM_BUFFER_POINTER(((buffer_t *)m));

	/* Source address spec */
	src_addr.PANId = pmsg->PANId;
	src_addr.AddrMode = pmsg->SrcAddrMode;
	ADDR_COPY_DST_SRC_64(src_addr.Addr.long_address, pmsg->SrcAddr);

	/* Destintion address spec */
	dst_addr.PANId = pmsg->PANId;
	dst_addr.AddrMode = pmsg->DstAddrMode;
	ADDR_COPY_DST_SRC_64(dst_addr.Addr.long_address, pmsg->DstAddr);

	/* Callback function */
	usr_mlme_comm_status_ind(&src_addr,
			&dst_addr,
			pmsg->status);

	/* Free the buffer */
	bmm_buffer_free((buffer_t *)m);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:34,代码来源:mac_callback_wrapper.c

示例5: tal_ed_end_cb

/**
 * @brief ED scan callback function.
 *
 * This function is a callback function from the TAL after ED scan
 * is performed on a specified channel.
 *
 * @param energy_level Maximum energy on the channel
 */
void tal_ed_end_cb(uint8_t energy_level)
{
	MAKE_MAC_NOT_BUSY();

	mlme_scan_conf_t *msc;

	/*
	 * Scan request buffer is used to generate a scan confirm for the ED
	 * scan
	 * which is stored in mac_conf_buf_ptr.
	 */
	msc = (mlme_scan_conf_t *)BMM_BUFFER_POINTER(
			(buffer_t *)mac_conf_buf_ptr);

	uint8_t n_eds;

	n_eds = msc->ResultListSize;
	msc->scan_result_list[0].ed_value[n_eds] = energy_level;
	msc->ResultListSize++;
	msc->scan_result_list[0].ed_value[n_eds + 1] = 0;

	msc->UnscannedChannels &= ~(1UL << scan_curr_channel);

	/* Continue with next channel */
	scan_proceed(MLME_SCAN_TYPE_ED, (buffer_t *)mac_conf_buf_ptr);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:34,代码来源:mac_scan.c

示例6: mcps_data_request

/**
 * @brief Builds the data frame for transmission
 *
 * This function builds the data frame for transmission.
 * The NWK layer has supplied the parameters.
 * The frame_info_t data type is constructed and filled in.
 * Also the FCF is constructed based on the parameters passed.
 *
 * @param msg Pointer to the MCPS-DATA.request parameter
 */
void mcps_data_request(uint8_t *msg)
{
    retval_t status = FAILURE;
    mcps_data_req_t mdr;

    memcpy(&mdr, BMM_BUFFER_POINTER((buffer_t *)msg), sizeof(mcps_data_req_t));

    if ((mdr.TxOptions & WPAN_TXOPT_INDIRECT) == 0)
    {
        /*
         * Data Requests for a coordinator using direct transmission are
         * accepted in all non-transient states (no polling and no scanning
         * is ongoing).
         */
        if ((MAC_POLL_IDLE != mac_poll_state) ||
            (MAC_SCAN_IDLE != mac_scan_state)
           )
        {
            mac_gen_mcps_data_conf((buffer_t *)msg,
                                   (uint8_t)MAC_CHANNEL_ACCESS_FAILURE,
#ifdef ENABLE_TSTAMP
                                   mdr.msduHandle,
                                   0);
#else
                                   mdr.msduHandle);
#endif  /* ENABLE_TSTAMP */
            return;
        }
    }
开发者ID:gexueyuan,项目名称:cct,代码行数:39,代码来源:mac_mcps_data.c

示例7: mac_process_gts_request

void mac_process_gts_request(buffer_t *gts_req)
{
    /* Use the frame reception buffer for association indication. */
    mlme_gts_ind_t *mgi = (mlme_gts_ind_t *)BMM_BUFFER_POINTER(
                              gts_req);

    mgi->DeviceAddr = mac_parse_data.src_addr.short_address;

    mgi->GtsChar = mac_parse_data.mac_payload_data.gts_req_data;
    mgi->cmdcode = MLME_GTS_INDICATION;

    if (GTS_ALLOCATE == (mgi->GtsChar).GtsCharType) {
        if (mac_gts_allocate(mgi->GtsChar, mgi->DeviceAddr)) {
            /* Append the MLME GTS indication to the MAC-NHLE queue.
             **/
            qmm_queue_append(&mac_nhle_q, gts_req);
        } else {
            bmm_buffer_free(gts_req);
        }
    } else {
        if (mac_gts_deallocate(mgi->GtsChar, mgi->DeviceAddr, false)) {
            /* Append the MLME GTS indication to the MAC-NHLE queue.
             **/
            qmm_queue_append(&mac_nhle_q, gts_req);
        } else {
            bmm_buffer_free(gts_req);
        }
    }
}
开发者ID:Realtime-7,项目名称:asf,代码行数:29,代码来源:mac_gts.c

示例8: rtb_process_data_ind

void rtb_process_data_ind(uint8_t *msg)
{
    buffer_t *buf_ptr = (buffer_t *)msg;
    frame_info_t *frameptr = (frame_info_t *)BMM_BUFFER_POINTER(buf_ptr);
    mac_parse_data.mpdu_length = frameptr->mpdu[0];

    /* First extract LQI. */
    mac_parse_data.ppdu_link_quality = frameptr->mpdu[mac_parse_data.mpdu_length + LQI_LEN];

#ifdef RTB_WITHOUT_MAC
    /* Handle the received frame in case the frame is an RTB frame. */
    handle_rx_rtb_frame_type(frameptr);

    /*
     * Release buffer in any case, since it is not forwarded
     * to any higher layer.
     */
    bmm_buffer_free(buf_ptr);
#else   /* #ifdef RTB_WITHOUT_MAC */
    /* Handle the received frame in case the frame is an RTB frame. */
    if (!handle_rx_rtb_frame_type(frameptr))
    {
        /* This is a not an RTB frame, so it is forwarded to the MAC. */
        frameptr->msg_type = (frame_msgtype_t)TAL_DATA_INDICATION;
        qmm_queue_append(&tal_mac_q, buf_ptr);
    }
    else
    {
        bmm_buffer_free(buf_ptr);
    }
#endif  /* #ifdef RTB_WITHOUT_MAC */
}
开发者ID:subpos,项目名称:atmel_ranging_toolbox_zigbit,代码行数:32,代码来源:rtb_rx.c

示例9: dispatch_event

/**
 * @brief Obtains the message type from the buffer and calls the respective handler
 *
 * This function decodes all events/messages and calls the appropriate handler.
 *
 * @param event Pointer to the buffer header whose body part holds the message
 * type and message elemnets
 */
void dispatch_event(uint8_t *event)
{
    /*
     * A pointer to the body of the buffer is obtained from the pointer to the
     * received header.
     */
    uint8_t *buffer_body = BMM_BUFFER_POINTER((buffer_t *)event);

    /* Check is done to see if the message type is valid */
    /* Please note:
     * The macro PGM_READ_WORD is only relevant for AVR-GCC builds and
     * reads a DWord from flash, which is the start address of the function.
     *
     * How does this work for builds that are larger than 128K?
     *
     * For IAR builds this statement is fine, since PGM_READ_WORD just
     * turns to "*". The size of the function pointer is automatically
     * 3 byte for MCUs which have more than 128K flash. The the address
     * of the callback is properly derived from this location.
     *
     * AVR-GCC currently does not support function pointers larger than
     * 16 bit. This implies that functions residing in the upper 128K
     * cannot be addressed properly. Therefore this code does not work
     * in these cases.
     * In regular cases, where code is not larger than 128K, the size
     * of a function pointer is 16 bit and properly read via PGM_READ_WORD.
     *
     * Update: In order for this to work, the option -mrelax must be given 
     * on the compiler command-line that is used to link the final ELF file. 
     * (Older compilers did not implement this option for the AVR, 
     * use -Wl,--relax instead.)     */
    /* Check for regular MAC requests. */
    if (buffer_body[CMD_ID_OCTET] <= LAST_MESSAGE)
    {
        /*
         * The following statement reads the address from the dispatch table
         * of the function to be called by utilizing function pointers.
         */
        handler_t handler = (handler_t)PGM_READ_WORD(&dispatch_table[buffer_body[CMD_ID_OCTET]]);

        if (handler != NULL)
        {
            handler(event);
        }
        else
        {
            bmm_buffer_free((buffer_t *)event);
#if (DEBUG > 0)
            ASSERT("Dispatch handler unavailable" == 0);
#endif
        }
    }
#ifdef ENABLE_RTB
    else
    {
        dispatch_rtb_event(event);
    }
#endif  /* ENABLE_RTB */
}
开发者ID:subpos,项目名称:atmel_ranging_toolbox_zigbit,代码行数:67,代码来源:mac_dispatcher.c

示例10: gen_rx_enable_conf

/*
 * @brief Internal function to initiate rx enable confirm message.
 *
 * This function creates the rx enable confirm structure,
 * and appends it into internal event queue.
 *
 * @param buf Buffer for rx enable confirmation.
 * @param status Status of attempt to switch receiver on.
 */
static void gen_rx_enable_conf(buffer_t *buf, uint8_t status)
{
    mlme_rx_enable_conf_t *rec = (mlme_rx_enable_conf_t *)BMM_BUFFER_POINTER(buf);

    rec->cmdcode = MLME_RX_ENABLE_CONFIRM;
    rec->status = status;
    qmm_queue_append(&mac_nhle_q, buf);
}
开发者ID:subpos,项目名称:atmel_ranging_toolbox_zigbit,代码行数:17,代码来源:mac_rx_enable.c

示例11: mac_process_orphan_notification

/**
 * @brief Handles an orphan notification
 *
 * This function processes an incoming orphan notification command.
 * A PAN coordinator gets to this function through a TAL data indication
 * message.
 *
 * @param msg Frame reception buffer
 */
void mac_process_orphan_notification(buffer_t *msg)
{
	mlme_orphan_ind_t *moi = (mlme_orphan_ind_t *)BMM_BUFFER_POINTER(msg);

	moi->cmdcode = MLME_ORPHAN_INDICATION;
	ADDR_COPY_DST_SRC_64(moi->OrphanAddress,
			mac_parse_data.src_addr.long_address);

	/* Append the MLME orphan indication message to MAC-NHLE queue */
	qmm_queue_append(&mac_nhle_q, msg);
}
开发者ID:AndreyMostovov,项目名称:asf,代码行数:20,代码来源:mac_orphan.c

示例12: send_reset_conf

/*
 * @brief Sends mlme reset confirm
 *
 * @param m Buffer for reset confirm
 * @param status Status of MAC reset operation
 */
static void send_reset_conf(buffer_t *buf_ptr, uint8_t status)
{
	mlme_reset_conf_t *mrc;

	mrc = (mlme_reset_conf_t *)BMM_BUFFER_POINTER(buf_ptr);

	mrc->status = status;
	mrc->cmdcode = MLME_RESET_CONFIRM;

	/* Append the mlme reset confirm to the MAC-NHLE queue */
	qmm_queue_append(&mac_nhle_q, buf_ptr);
}
开发者ID:thegeek82000,项目名称:asf,代码行数:18,代码来源:mac_misc.c

示例13: mlme_associate_conf

/**
 * @brief Wrapper function for messages of type mlme_associate_conf_t
 *
 * This function is a callback for mlme associate confirm.
 *
 * @param m Pointer to message structure
 */
void mlme_associate_conf(uint8_t *m)
{
	mlme_associate_conf_t *pmsg;

	/* Get the buffer body from buffer header */
	pmsg = (mlme_associate_conf_t *)BMM_BUFFER_POINTER(((buffer_t *)m));

	usr_mlme_associate_conf(pmsg->AssocShortAddress, pmsg->status);

	/* Free the buffer */
	bmm_buffer_free((buffer_t *)m);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:19,代码来源:mac_callback_wrapper.c

示例14: mlme_gts_ind

void mlme_gts_ind(uint8_t *m)
{
	mlme_gts_ind_t *pmsg;

	/* Get the buffer body from buffer header */
	pmsg = (mlme_gts_ind_t *)BMM_BUFFER_POINTER(((buffer_t *)m));

	usr_mlme_gts_ind(pmsg->DeviceAddr, pmsg->GtsChar);

	/* Free the buffer */
	bmm_buffer_free((buffer_t *)m);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:12,代码来源:mac_callback_wrapper.c

示例15: mlme_gts_conf

void mlme_gts_conf(uint8_t *m)
{
	mlme_gts_conf_t *pmsg;

	/* Get the buffer body from buffer header */
	pmsg = (mlme_gts_conf_t *)BMM_BUFFER_POINTER(((buffer_t *)m));

	usr_mlme_gts_conf(pmsg->GtsChar, pmsg->status);

	/* Free the buffer */
	bmm_buffer_free((buffer_t *)m);
}
开发者ID:InSoonPark,项目名称:asf,代码行数:12,代码来源:mac_callback_wrapper.c


注:本文中的BMM_BUFFER_POINTER函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。