arch/dev/radio/dw1000/glossy/glossy.c
/* GLOSSY_USE_802154_FRAME */
/*---------------------------------------------------------------------------*/
/** \brief Generate a Glossy frame stored to the given buffer.
 *
 * \param glossy_header The header for the Glossy packet.
 * \param payload       The Glossy payload.
 * \param payload_len   The length of the Glossy payload.
 * \param buffer        An external buffer where the prepared packet has
 *                      to be stored.
 *
 * \return PSDU length of the created frame
 */
GLOSSY_USE_802154_FRAME
\brief Generate a Glossy frame stored to the given buffer.

\param glossy_header The header for the Glossy packet.
\param payload       The Glossy payload.
\param payload_len   The length of the Glossy payload.
\param buffer        An external buffer where the prepared packet has
to be stored.

\return PSDU length of the created frame
GLOSSY_USE_802154_FRAME \ brief Generate a Glossy frame stored to the given buffer . \ param glossy_header The header for the Glossy packet . \ param payload The Glossy payload . \ param payload_len The length of the Glossy payload . \ param buffer An external buffer where the prepared packet has to be stored . \ return PSDU length of the created frame
static int
glossy_frame_new(const glossy_header_t *header,
        const glossy_payload_t *payload,
        const uint8_t payload_len,
        uint8_t *buffer)
{
    size_t offset = 0;
    #if GLOSSY_USE_802154_FRAME
    buffer[0] =
        (glossy_fcf.frame_type & 7) |
        ((glossy_fcf.security_enabled & 1)  << 3) |
        ((glossy_fcf.frame_pending & 1)     << 4) |
        ((glossy_fcf.ack_required & 1)      << 5) |
        ((glossy_fcf.panid_compression & 1) << 6);
    buffer[1] =
        (glossy_fcf.seqno_suppression & 1) |
        ((glossy_fcf.dest_addr_mode & 3)    << 2) |
        ((glossy_fcf.frame_version & 3)     << 4) |
        ((glossy_fcf.src_addr_mode & 3)     << 6);
    buffer[2] = 0x0;                                
    offset = IEEE_HDR_LEN;
    #endif 
    memcpy(buffer + offset, header, sizeof(glossy_header_t));
    offset += sizeof(glossy_header_t);
    memcpy(buffer + offset, payload, sizeof(uint8_t) * payload_len);
    offset += sizeof(uint8_t) * payload_len;
    return offset + DW1000_CRC_LEN;
}
static int glossy_frame_new ( const glossy_header_t * header , const glossy_payload_t * payload , const uint8_t payload_len , uint8_t * buffer ) { size_t offset = 0 ; #if GLOSSY_USE_802154_FRAME buffer [ 0 ] = ( glossy_fcf . frame_type & 7 ) | ( ( glossy_fcf . security_enabled & 1 ) << 3 ) | ( ( glossy_fcf . frame_pending & 1 ) << 4 ) | ( ( glossy_fcf . ack_required & 1 ) << 5 ) | ( ( glossy_fcf . panid_compression & 1 ) << 6 ) ; buffer [ 1 ] = ( glossy_fcf . seqno_suppression & 1 ) | ( ( glossy_fcf . dest_addr_mode & 3 ) << 2 ) | ( ( glossy_fcf . frame_version & 3 ) << 4 ) | ( ( glossy_fcf . src_addr_mode & 3 ) << 6 ) ; buffer [ 2 ] = 0x0 ; offset = IEEE_HDR_LEN ; #endif memcpy ( buffer + offset , header , sizeof ( glossy_header_t ) ) ; offset += sizeof ( glossy_header_t ) ; memcpy ( buffer + offset , payload , sizeof ( uint8_t ) * payload_len ) ; offset += sizeof ( uint8_t ) * payload_len ; return offset + DW1000_CRC_LEN ; }
GLOSSY_USE_802154_FRAME
\brief Generate a Glossy frame stored to the given buffer.
GLOSSY_USE_802154_FRAME \ brief Generate a Glossy frame stored to the given buffer .
// 0 as seq number /* GLOSSY_USE_802154_FRAME */ // attach MAC payload: // copy the glossy_header and payload to the buffer