Defines | Functions
tmr_utils.h File Reference

Mercury API - generic utilities. More...

#include <stdint.h>
#include <stddef.h>
Include dependency graph for tmr_utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define BITCLR(array, number)   ((array)[(number)/32] &= ~((uint32_t)1 << ((number)&31)))
#define BITGET(array, number)   (((array)[(number)/32] >> ((number)&31)) & 1)
#define BITSET(array, number)   ((array)[(number)/32] |= ((uint32_t)1 << ((number)&31)))
#define GETS16AT(msg, i)
#define GETU16(msg, i)   (i+=2, GETU16AT((msg), i-2))
#define GETU16AT(msg, i)
#define GETU24(msg, i)   (i+=3, GETU24AT((msg), i-3))
#define GETU24AT(msg, i)
#define GETU32(msg, i)   (i+=4, GETU32AT((msg), i-4))
#define GETU32AT(msg, i)
#define GETU8(msg, i)   ((msg)[(i)++])
#define GETU8AT(msg, i)
#define LISTAPPEND(l, value)
#define memcpy   tm_memcpy
#define numberof(x)   (sizeof((x))/sizeof((x)[0]))
#define SETS16(msg, i, s16val)
#define SETS32(msg, i, s32val)
#define SETU16(msg, i, u16val)
#define SETU32(msg, i, u32val)
#define SETU8(msg, i, u8val)
#define strcasecmp   tm_strcasecmp
#define strchr   tm_strchr
#define strcpy   tm_strcpy

Functions

void tm_gettime_consistent (uint32_t *high, uint32_t *low)
void * tm_memcpy (void *dest, const void *src, size_t n)
int tm_strcasecmp (const char *s1, const char *s2)
char * tm_strchr (const char *s, int c)
char * tm_strcpy (char *dest, const char *src)
uint32_t tm_time_subtract (uint32_t end, uint32_t start)
int tm_u8s_per_bits (int bitCount)
uint32_t TMR_byteArrayToInt (uint8_t data[], int offset)
uint64_t TMR_byteArrayToLong (uint8_t data[], int offset)
uint16_t TMR_byteArrayToShort (uint8_t data[], int offset)
uint64_t TMR_makeBitMask (int offset, int lenght)
void TMR_stringCopy (TMR_String *dest, const char *src, int len)

Detailed Description

Mercury API - generic utilities.

Author:
Nathan Williams
Date:
12/1/2009

Definition in file tmr_utils.h.


Define Documentation

#define BITCLR (   array,
  number 
)    ((array)[(number)/32] &= ~((uint32_t)1 << ((number)&31)))

Definition at line 119 of file tmr_utils.h.

#define BITGET (   array,
  number 
)    (((array)[(number)/32] >> ((number)&31)) & 1)

Definition at line 117 of file tmr_utils.h.

#define BITSET (   array,
  number 
)    ((array)[(number)/32] |= ((uint32_t)1 << ((number)&31)))

Definition at line 118 of file tmr_utils.h.

#define GETS16AT (   msg,
 
)
Value:
( \
    ((int16_t)((msg)[(i)  ]) <<  8)   | \
    ((int16_t)((msg)[(i)+1]) <<  0)   )

Definition at line 49 of file tmr_utils.h.

#define GETU16 (   msg,
 
)    (i+=2, GETU16AT((msg), i-2))

Definition at line 66 of file tmr_utils.h.

#define GETU16AT (   msg,
 
)
Value:
( \
  ((uint16_t)((msg)[(i)  ]) <<  8)   | \
  ((msg)[(i)+1] <<  0)   )

Definition at line 45 of file tmr_utils.h.

#define GETU24 (   msg,
 
)    (i+=3, GETU24AT((msg), i-3))

Definition at line 67 of file tmr_utils.h.

#define GETU24AT (   msg,
 
)
Value:
( \
  ((uint32_t)((msg)[(i)  ]) <<  16)  | \
  ((uint32_t)((msg)[(i)+1]) <<   8)  | \
  ((msg)[(i)+2] <<   0)  )

Definition at line 53 of file tmr_utils.h.

#define GETU32 (   msg,
 
)    (i+=4, GETU32AT((msg), i-4))

Definition at line 68 of file tmr_utils.h.

#define GETU32AT (   msg,
 
)
Value:
( \
  ((uint32_t)((msg)[(i)  ]) <<  24)  | \
  ((uint32_t)((msg)[(i)+1]) <<  16)  | \
  ((uint32_t)((msg)[(i)+2]) <<   8)  | \
  ((msg)[(i)+3] <<   0)  )

Definition at line 58 of file tmr_utils.h.

#define GETU8 (   msg,
 
)    ((msg)[(i)++])

Definition at line 65 of file tmr_utils.h.

#define GETU8AT (   msg,
 
)
Value:
( \
  ((msg)[(i)])          )

Definition at line 42 of file tmr_utils.h.

#define LISTAPPEND (   l,
  value 
)
Value:
do {         \
  (l)->len++;                             \
  if ((l)->len <= (l)->max)               \
    (l)->list[(l)->len - 1] = (value);    \
} while (0)

Definition at line 109 of file tmr_utils.h.

#define memcpy   tm_memcpy

Definition at line 132 of file tmr_utils.h.

#define numberof (   x)    (sizeof((x))/sizeof((x)[0]))

Definition at line 121 of file tmr_utils.h.

#define SETS16 (   msg,
  i,
  s16val 
)
Value:
do {    \
  int16_t _tmp = (s16val);            \
  (msg)[(i)++] =(int8_t) (_tmp >>  8) & 0xff;  \
  (msg)[(i)++] =(int8_t)(_tmp >>  0) & 0xff;  \
} while (0)

Definition at line 81 of file tmr_utils.h.

#define SETS32 (   msg,
  i,
  s32val 
)
Value:
do {    \
  int32_t _tmp = (s32val);            \
  (msg)[(i)++] = (int8_t)(_tmp >> 24) & 0xff;  \
  (msg)[(i)++] = (int8_t)(_tmp >> 16) & 0xff;  \
  (msg)[(i)++] = (int8_t)(_tmp >>  8) & 0xff;  \
  (msg)[(i)++] = (int8_t)(_tmp >>  0) & 0xff;  \
} while (0)

Definition at line 95 of file tmr_utils.h.

#define SETU16 (   msg,
  i,
  u16val 
)
Value:
do {    \
  uint16_t _tmp = (u16val);            \
  (msg)[(i)++] =(uint8_t) (_tmp >>  8) & 0xff;  \
  (msg)[(i)++] =(uint8_t)(_tmp >>  0) & 0xff;  \
} while (0)

Definition at line 75 of file tmr_utils.h.

#define SETU32 (   msg,
  i,
  u32val 
)
Value:
do {    \
  uint32_t _tmp = (u32val);            \
  (msg)[(i)++] = (uint8_t)(_tmp >> 24) & 0xff;  \
  (msg)[(i)++] = (uint8_t)(_tmp >> 16) & 0xff;  \
  (msg)[(i)++] = (uint8_t)(_tmp >>  8) & 0xff;  \
  (msg)[(i)++] = (uint8_t)(_tmp >>  0) & 0xff;  \
} while (0)

Definition at line 87 of file tmr_utils.h.

#define SETU8 (   msg,
  i,
  u8val 
)
Value:
do {      \
  (msg)[(i)++] = (u8val)      & 0xff;  \
} while (0)

Definition at line 71 of file tmr_utils.h.

#define strcasecmp   tm_strcasecmp

Definition at line 138 of file tmr_utils.h.

#define strchr   tm_strchr

Definition at line 134 of file tmr_utils.h.

#define strcpy   tm_strcpy

Definition at line 133 of file tmr_utils.h.


Function Documentation

void tm_gettime_consistent ( uint32_t *  high,
uint32_t *  low 
)

Definition at line 128 of file tmr_utils.c.

void* tm_memcpy ( void *  dest,
const void *  src,
size_t  n 
)

Definition at line 39 of file tmr_utils.c.

int tm_strcasecmp ( const char *  s1,
const char *  s2 
)

Definition at line 96 of file tmr_utils.c.

char* tm_strchr ( const char *  s,
int  c 
)

Definition at line 78 of file tmr_utils.c.

char* tm_strcpy ( char *  dest,
const char *  src 
)

Definition at line 59 of file tmr_utils.c.

uint32_t tm_time_subtract ( uint32_t  end,
uint32_t  start 
)

Definition at line 147 of file tmr_utils.c.

int tm_u8s_per_bits ( int  bitCount)

Minimum number of bytes required to hold a given number of bits.

Parameters:
bitCountnumber of bits to hold
Returns:
Minimum length of bytes that can contain that many bits

Definition at line 160 of file tmr_utils.c.

uint32_t TMR_byteArrayToInt ( uint8_t  data[],
int  offset 
)

Definition at line 195 of file tmr_utils.c.

uint64_t TMR_byteArrayToLong ( uint8_t  data[],
int  offset 
)

Definition at line 221 of file tmr_utils.c.

uint16_t TMR_byteArrayToShort ( uint8_t  data[],
int  offset 
)

Definition at line 209 of file tmr_utils.c.

uint64_t TMR_makeBitMask ( int  offset,
int  lenght 
)

Definition at line 180 of file tmr_utils.c.

void TMR_stringCopy ( TMR_String dest,
const char *  src,
int  len 
)

Definition at line 166 of file tmr_utils.c.



thingmagic_rfid
Author(s): Brian Bingham
autogenerated on Thu May 16 2019 03:01:26