userland/libtock/radio.c
// packet contains the payload of the 802.15.4 packet; this will
// be copied into a packet buffer with header space within the kernel.
packet contains the payload of the 802.15.4 packet; this will
be copied into a packet buffer with header space within the kernel.
packet contains the payload of the 802 . 15 . 4 packet ; this will be copied into a packet buffer with header space within the kernel .
int radio_send(unsigned short addr, const char* packet, unsigned char len) {
  bool cond = false;
  int err   = allow(SYS_RADIO, BUF_TX, (void*)packet, len);
  if (err < 0) {
    return err;
  }
  err = subscribe(SYS_RADIO, EVT_TX, cb_tx, &cond);
  if (err < 0) {
    return err;
  }
  unsigned int param = addr;
  param |= (len << 16);
  err    = command(SYS_RADIO, COM_TX, param);
  if (err != 0) {
    return err;
  } else {
    yield_for(&cond);
    if (tx_acked) {
      return TOCK_SUCCESS;
    } else {
      return TOCK_ENOACK;
    }
  }
}
int radio_send ( unsigned short addr , const char * packet , unsigned char len ) { bool cond = false ; int err = allow ( SYS_RADIO , BUF_TX , ( void * ) packet , len ) ; if ( err < 0 ) { return err ; } err = subscribe ( SYS_RADIO , EVT_TX , cb_tx , & cond ) ; if ( err < 0 ) { return err ; } unsigned int param = addr ; param |= ( len << 16 ) ; err = command ( SYS_RADIO , COM_TX , param ) ; if ( err != 0 ) { return err ; } else { yield_for ( & cond ) ; if ( tx_acked ) { return TOCK_SUCCESS ; } else { return TOCK_ENOACK ; } } }
packet contains the payload of the 802.15.4 packet; this will
be copied into a packet buffer with header space within the kernel.
packet contains the payload of the 802 . 15 . 4 packet ; this will be copied into a packet buffer with header space within the kernel .
// The send system call packs the length and destination address in // the 32-bit argument.