![]() |
Cordio Stack and Cordio Profiles
r2p3-02rel0
|
Data Structures | |
struct | terminalCommand_t |
Terminal command. More... | |
Macros | |
#define | BDA_ADDR_LEN 6 |
BD address length. | |
#define | BDA_ADDR_STR_LEN (BDA_ADDR_LEN * 2) |
BD address string length. | |
#define | BDA_ADDR_IS_RPA(bda) (((bda)[5] & 0xC0) == 0x40) |
BDA RPA check. | |
#define | BDA_ADDR_IS_NRPA(bda) (((bda)[5] & 0xC0) == 0x00) |
BDA NRPA check. | |
#define | BDA_ADDR_IS_STATIC(bda) (((bda)[5] & 0xC0) == 0xC0) |
BDA static random check. | |
#define | BDA64_ADDR_IS_RPA(bda64) ((((bda64) >> 40) & 0xC0) == 0x40) |
BDA64 RPA check. | |
#define | BDA64_ADDR_IS_NRPA(bda64) ((((bda64) >> 40) & 0xC0) == 0x00) |
BDA64 NRPA check. | |
#define | BDA64_ADDR_IS_STATIC(bda64) ((((bda64) >> 40) & 0xC0) == 0xC0) |
BDA64 static random check. | |
#define | CALC128_LEN 16 |
128-bit integer length in bytes | |
#define | PRINT_ATTRIBUTE(a, b) |
Print function attributes. | |
#define | TERMINAL_MAX_ARGC 8u |
Maximum number of arguments to any command. | |
#define | TERMINAL_MAX_COMMAND_LEN 100u |
Maximum length of command line. | |
#define | TERMINAL_PRINTF_MAX_LEN 128u |
Maximum length of any printed output. | |
#define | TERMINAL_STRING_PROMPT "> " |
Prompt string. | |
#define | TERMINAL_STRING_ERROR "ERROR: " |
Error prefix. | |
#define | TERMINAL_STRING_USAGE "USAGE: " |
Usage prefix. | |
#define | TERMINAL_STRING_NEW_LINE "\r\n" |
New line string. | |
Typedefs | |
typedef uint8_t | bdAddr_t[BDA_ADDR_LEN] |
BD address data type. | |
typedef uint8_t(* | terminalHandler_t) (uint32_t argc, char **argv) |
Handler for a terminal command. More... | |
typedef void(* | terminalUartTx_t) (const uint8_t *pBuf, uint32_t len) |
Handler for transmit. More... | |
Enumerations | |
enum | { TERMINAL_ERROR_OK = 0, TERMINAL_ERROR_BAD_ARGUMENTS = 1, TERMINAL_ERROR_TOO_FEW_ARGUMENTS = 2, TERMINAL_ERROR_TOO_MANY_ARGUMENTS = 3, TERMINAL_ERROR_EXEC = 4 } |
Terminal command error codes. More... | |
Functions | |
void | BdaCpy (uint8_t *pDst, const uint8_t *pSrc) |
Copy a BD address from source to destination. More... | |
bool_t | BdaCmp (const uint8_t *pAddr1, const uint8_t *pAddr2) |
Compare two BD addresses. More... | |
uint8_t * | BdaClr (uint8_t *pDst) |
Set a BD address to all zeros. More... | |
bool_t | BdaIsZeros (const uint8_t *pAddr) |
Check if a BD address is all zeros. More... | |
char * | Bda2Str (const uint8_t *pAddr) |
Convert a BD address to a string. More... | |
uint64_t | BstreamToBda64 (const uint8_t *p) |
Convert bstream to BDA64. More... | |
uint64_t | BstreamToUint64 (const uint8_t *p) |
Convert bstream to uint64_t. More... | |
void | Bda64ToBstream (uint8_t *p, uint64_t bda) |
Convert BDA64 to bstream. More... | |
void | Uint64ToBstream (uint8_t *p, uint64_t n) |
Convert uint64_t to bstream. More... | |
void | Calc128Cpy (uint8_t *pDst, uint8_t *pSrc) |
Copy a 128-bit integer from source to destination. More... | |
void | Calc128Cpy64 (uint8_t *pDst, uint8_t *pSrc) |
Copy a 64-bit integer from source to destination. More... | |
void | Calc128Xor (uint8_t *pDst, uint8_t *pSrc) |
Exclusive-or two 128-bit integers and return the result in pDst. More... | |
uint32_t | CalcCrc32 (uint32_t crcInit, uint32_t len, const uint8_t *pBuf) |
Calculate the CRC-32 of the given buffer. More... | |
uint32_t | PrintVsn (char *pStr, uint32_t size, const char *pFmt, va_list ap) PRINT_ATTRIBUTE(3 |
Print a trace message. More... | |
void | TerminalInit (wsfHandlerId_t handlerId) |
Initialize terminal. More... | |
void | TerminalRegisterUartTxFunc (terminalUartTx_t uartTxFunc) |
Register the UART Tx Function for the platform. More... | |
void | TerminalRegisterCommand (terminalCommand_t *pCommand) |
Register command with terminal. More... | |
void | TerminalHandler (wsfEventMask_t event, wsfMsgHdr_t *pMsg) |
Handler for terminal messages. More... | |
void | TerminalRx (uint8_t dataByte) |
Called by application when a data byte is received. More... | |
void | TerminalTxStr (const char *pStr) |
Called by application to transmit string. More... | |
void | TerminalTxChar (char c) |
Called by application to transmit character. More... | |
void | TerminalTxPrint (const char *pStr,...) |
Called by application to print formatted data. More... | |
void | TerminalTx (const uint8_t *pData, uint16_t len) |
Application function to transmit data.. More... | |
void | WstrnCpy (char *pBuf, const char *pData, uint8_t n) |
Copies a string up to a given length. More... | |
void | WStrReverseCpy (uint8_t *pBuf1, const uint8_t *pBuf2, uint16_t len) |
Byte by byte reverse and copy a buffer. More... | |
void | WStrReverse (uint8_t *pBuf, uint8_t len) |
Byte by byte reverse a buffer. More... | |
void | WStrFormatHex (char *pBuf, uint32_t val, uint8_t len) |
Format a hex value. More... | |
Variables | |
const uint8_t | calc128Zeros [CALC128_LEN] |
128-bit zero value | |
Macros for converting a little endian byte buffer to integers. | |
#define | BYTES_TO_UINT16(n, p) {n = ((uint16_t)(p)[0] + ((uint16_t)(p)[1] << 8));} |
convert little endian byte buffer to uint16_t. | |
#define | BYTES_TO_UINT24(n, p) |
convert little endian byte buffer to uint24_t. More... | |
#define | BYTES_TO_UINT32(n, p) |
convert little endian byte buffer to uint32_t. More... | |
#define | BYTES_TO_UINT40(n, p) |
convert little endian byte buffer to uint40_t. More... | |
#define | BYTES_TO_UINT64(n, p) |
convert little endian byte buffer to uint64_t. More... | |
Macros for converting little endian integers to array of bytes | |
#define | UINT16_TO_BYTES(n) ((uint8_t) (n)), ((uint8_t)((n) >> 8)) |
convert little endian uint16_t to array of bytes. | |
#define | UINT32_TO_BYTES(n) ((uint8_t) (n)), ((uint8_t)((n) >> 8)), ((uint8_t)((n) >> 16)), ((uint8_t)((n) >> 24)) |
convert little endian uint32_t to array of bytes. | |
Macros for converting little endian integers to single bytes | |
#define | UINT16_TO_BYTE0(n) ((uint8_t) (n)) |
convert little endian uint16_t to byte 0. | |
#define | UINT16_TO_BYTE1(n) ((uint8_t) ((n) >> 8)) |
convert little endian uint16_t to byte 1. | |
#define | UINT32_TO_BYTE0(n) ((uint8_t) (n)) |
convert little endian uint32_t to byte 0. | |
#define | UINT32_TO_BYTE1(n) ((uint8_t) ((n) >> 8)) |
convert little endian uint32_t to byte 1. | |
#define | UINT32_TO_BYTE2(n) ((uint8_t) ((n) >> 16)) |
convert little endian uint32_t to byte 2. | |
#define | UINT32_TO_BYTE3(n) ((uint8_t) ((n) >> 24)) |
convert little endian uint32_t to byte 3. | |
Macros for converting a little endian byte stream to integers, with increment. | |
#define | BSTREAM_TO_INT8(n, p) {n = (int8_t)(*(p)++);} |
convert little endian byte stream to uint8_t, incrementing one byte. | |
#define | BSTREAM_TO_UINT8(n, p) {n = (uint8_t)(*(p)++);} |
convert little endian byte stream to int8_t, incrementing one byte. | |
#define | BSTREAM_TO_UINT16(n, p) {BYTES_TO_UINT16(n, p); p += 2;} |
convert little endian byte stream to uint16_t, incrementing two bytes. | |
#define | BSTREAM_TO_UINT24(n, p) {BYTES_TO_UINT24(n, p); p += 3;} |
convert little endian byte stream to uint24_t, incrementing three bytes. | |
#define | BSTREAM_TO_UINT32(n, p) {BYTES_TO_UINT32(n, p); p += 4;} |
convert little endian byte stream to uint32_t, incrementing four bytes. | |
#define | BSTREAM_TO_UINT40(n, p) {BYTES_TO_UINT40(n, p); p += 5;} |
convert little endian byte stream to uint40_t, incrementing five bytes. | |
#define | BSTREAM_TO_UINT64(n, p) {n = BstreamToUint64(p); p += 8;} |
convert little endian byte stream to uint64_t, incrementing eigth bytes. | |
#define | BSTREAM_TO_BDA(bda, p) {BdaCpy(bda, p); p += BDA_ADDR_LEN;} |
convert little endian byte stream to six byte Bluetooth device address, incrementing six bytes. | |
#define | BSTREAM_TO_BDA64(bda, p) {bda = BstreamToBda64(p); p += BDA_ADDR_LEN;} |
convert little endian byte stream to eight byte Bluetooth device address, incrementing eight bytes. | |
Macros for converting integers to a little endian byte stream, with increment. | |
#define | UINT8_TO_BSTREAM(p, n) {*(p)++ = (uint8_t)(n);} |
convert uint8_t to little endian byte stream, incrementing one byte. | |
#define | UINT16_TO_BSTREAM(p, n) {*(p)++ = (uint8_t)(n); *(p)++ = (uint8_t)((n) >> 8);} |
convert uint16_t to little endian byte stream, incrementing two bytes. | |
#define | UINT24_TO_BSTREAM(p, n) |
convert uint24_t to little endian byte stream, incrementing three bytes. More... | |
#define | UINT32_TO_BSTREAM(p, n) |
convert uint32_t to little endian byte stream, incrementing four bytes. More... | |
#define | UINT40_TO_BSTREAM(p, n) |
convert uint40_t to little endian byte stream, incrementing five bytes. More... | |
#define | UINT64_TO_BSTREAM(p, n) {Uint64ToBstream(p, n); p += sizeof(uint64_t);} |
convert uint64_t to little endian byte stream, incrementing eight bytes. | |
#define | BDA_TO_BSTREAM(p, bda) {BdaCpy(p, bda); p += BDA_ADDR_LEN;} |
convert six byte Bluetooth device address to little endian byte stream, incrementing six bytes. | |
#define | BDA64_TO_BSTREAM(p, bda) {Bda64ToBstream(p, bda); p += BDA_ADDR_LEN;} |
convert eight byte Bluetooth device address to little endian byte stream, incrementing eigth bytes. | |
Macros for converting integers to a little endian byte stream, without increment. | |
#define | UINT16_TO_BUF(p, n) {(p)[0] = (uint8_t)(n); (p)[1] = (uint8_t)((n) >> 8);} |
convert uint16_t to little endian byte stream. | |
#define | UINT24_TO_BUF(p, n) |
convert uint24_t to little endian byte stream. More... | |
#define | UINT32_TO_BUF(p, n) |
convert uint32_t to little endian byte stream. More... | |
#define | UINT40_TO_BUF(p, n) |
convert uint40_t to little endian byte stream. More... | |
Macros for comparing a little endian byte buffer to integers. | |
#define | BYTES_UINT16_CMP(p, n) ((p)[1] == UINT16_TO_BYTE1(n) && (p)[0] == UINT16_TO_BYTE0(n)) |
compare 2 byte little endian buffer with a uint16_t. | |
Macros for IEEE FLOAT type: exponent = byte 3, mantissa = bytes 2-0 | |
#define | FLT_TO_UINT32(m, e) ((m) | ((int32_t)(e) * 16777216)) |
Convert float to uint32. | |
#define | UINT32_TO_FLT(m, e, n) {m = UINT32_TO_FLT_M(n); e = UINT32_TO_FLT_E(n);} |
Convert uint32_t to float. | |
#define | UINT32_TO_FLT_M(n) |
Convert uint32_t to float mantissa component. More... | |
#define | UINT32_TO_FLT_E(n) ((int8_t)(n >> 24)) |
Convert uint32_t to float exponent component. | |
Macros for IEEE SFLOAT type: exponent = bits 15-12, mantissa = bits 11-0 | |
#define | SFLT_TO_UINT16(m, e) ((m) | (0xF000 & ((int16_t)(e) * 4096))) |
Convert sfloat to uint16_t. | |
#define | UINT16_TO_SFLT(m, e, n) {m = UINT16_TO_SFLT_M(n); e = UINT16_TO_SFLT_E(n);} |
Convert uint16_t to sfloat. | |
#define | UINT16_TO_SFLT_M(n) |
Convert uint16_T to sfloat mantissa component. More... | |
#define | UINT16_TO_SFLT_E(n) |
Convert uint16_T to sfloat exponent component. More... | |
#define BYTES_TO_UINT24 | ( | n, | |
p | |||
) |
#define BYTES_TO_UINT32 | ( | n, | |
p | |||
) |
#define BYTES_TO_UINT40 | ( | n, | |
p | |||
) |
convert little endian byte buffer to uint40_t.
#define BYTES_TO_UINT64 | ( | n, | |
p | |||
) |
convert little endian byte buffer to uint64_t.
#define UINT24_TO_BSTREAM | ( | p, | |
n | |||
) |
#define UINT32_TO_BSTREAM | ( | p, | |
n | |||
) |
convert uint32_t to little endian byte stream, incrementing four bytes.
#define UINT40_TO_BSTREAM | ( | p, | |
n | |||
) |
convert uint40_t to little endian byte stream, incrementing five bytes.
#define UINT24_TO_BUF | ( | p, | |
n | |||
) |
#define UINT32_TO_BUF | ( | p, | |
n | |||
) |
#define UINT40_TO_BUF | ( | p, | |
n | |||
) |
convert uint40_t to little endian byte stream.
#define UINT32_TO_FLT_M | ( | n | ) |
#define UINT16_TO_SFLT_M | ( | n | ) |
#define UINT16_TO_SFLT_E | ( | n | ) |
Handler for a terminal command.
argc | The number of arguments passed to the command. |
argv | The array of arguments; the 0th argument is the command. |
Definition at line 67 of file terminal.h.
Handler for transmit.
pBuf | Buffer to transmit. |
len | Number of bytes to transmit. |
Definition at line 79 of file terminal.h.
anonymous enum |
Terminal command error codes.
Definition at line 44 of file terminal.h.
Copy a BD address from source to destination.
pDst | Pointer to destination. |
pSrc | Pointer to source. |
Compare two BD addresses.
pAddr1 | First address. |
pAddr2 | Second address. |
Set a BD address to all zeros.
pDst | Pointer to destination. |
Check if a BD address is all zeros.
pAddr | Pointer to address. |
char* Bda2Str | ( | const uint8_t * | pAddr | ) |
Convert a BD address to a string.
pAddr | Pointer to BD address. |
Convert bstream to BDA64.
p | Bstream pointer. |
Convert bstream to uint64_t.
p | Bstream pointer. |
Convert BDA64 to bstream.
p | Bstream pointer. |
bda | uint64_t BDA. |
Convert uint64_t to bstream.
p | Bstream pointer. |
n | uint64_t number. |
Copy a 128-bit integer from source to destination.
pDst | Pointer to destination. |
pSrc | Pointer to source. |
Copy a 64-bit integer from source to destination.
pDst | Pointer to destination. |
pSrc | Pointer to source. |
Exclusive-or two 128-bit integers and return the result in pDst.
pDst | Pointer to destination. |
pSrc | Pointer to source. |
Calculate the CRC-32 of the given buffer.
crcInit | Initial value of the CRC. |
len | Length of the buffer. |
pBuf | Buffer to compute the CRC. |
This routine was originally generated with crcmod.py using the following parameters:
Print a trace message.
pStr | Storage for formatted string. |
size | Maximum number of characters to store. |
pFmt | Format string. |
ap | Arguments. |
void TerminalInit | ( | wsfHandlerId_t | handlerId | ) |
void TerminalRegisterUartTxFunc | ( | terminalUartTx_t | uartTxFunc | ) |
Register the UART Tx Function for the platform.
uartTxFunc | UART Tx callback function. |
void TerminalRegisterCommand | ( | terminalCommand_t * | pCommand | ) |
Register command with terminal.
pCommand | Command. |
void TerminalHandler | ( | wsfEventMask_t | event, |
wsfMsgHdr_t * | pMsg | ||
) |
Handler for terminal messages.
event | WSF event mask. |
pMsg | WSF message. |
void TerminalRx | ( | uint8_t | dataByte | ) |
Called by application when a data byte is received.
dataByte | received byte |
void TerminalTxStr | ( | const char * | pStr | ) |
Called by application to transmit string.
pStr | String. |
void TerminalTxChar | ( | char | c | ) |
Called by application to transmit character.
c | Character. |
void TerminalTxPrint | ( | const char * | pStr, |
... | |||
) |
Called by application to print formatted data.
pStr | Message format string |
... | Additional arguments, printf-style |
Application function to transmit data..
pData | Data. |
len | Length of data, in bytes. |
void WstrnCpy | ( | char * | pBuf, |
const char * | pData, | ||
uint8_t | n | ||
) |
Copies a string up to a given length.
pBuf | Pointer to buffer to copy to. |
pData | Pointer to the string to copy. |
n | Size of pBuf in bytes. |
Byte by byte reverse and copy a buffer.
pBuf1 | Buffer to hold reversed copy. |
pBuf2 | Buffer to copy. |
len | Size of pBuf1 and pBuf2 in bytes. |
Byte by byte reverse a buffer.
pBuf | Buffer to reverse. |
len | size of pBuf in bytes. |