SiRF Binary Protocol handling. More...
#include <usarts.h>Go to the source code of this file.
Data Structures | |
| struct | proto_sirf_parser_s |
Defines | |
| #define | SIRF_MAX_PAYLOAD_LENGTH ((1<<10)-1) |
| maximum length of payload in a single message | |
| #define | SIRF_MAX_MSG_LENGTH (SIRF_MAX_PAYLOAD_LENGTH+8) |
| maximum length of a single message | |
| #define | SIRF_START0 ((uint8_t)0xA0) |
| #define | SIRF_START1 ((uint8_t)0xA2) |
| #define | SIRF_END0 ((uint8_t)0xB0) |
| #define | SIRF_END1 ((uint8_t)0xB3) |
| #define | SIRFi_POWER (0x35) |
| Advanced Power Management. | |
| #define | SIRFi_INIT (0x80) |
| Initialize Data Source. | |
| #define | SIRFi_NMEA (0x81) |
| Switch to NMEA Protocol. | |
| #define | SIRFi_S_ALMANAC (0x82) |
| Set Almanac. | |
| #define | SIRFi_DUMPDATA (0x83) |
| Handle Formatted Dump Data. | |
| #define | SIRFi_VERSION (0x84) |
| Poll Software Version. | |
| #define | SIRFi_DGPS_SRC (0x85) |
| DGPS Source Control. | |
| #define | SIRFi_SETPORT (0x86) |
| Set Binary Serial Port. | |
| #define | SIRFi_SETPROTO (0x87) |
| Set Protocol. | |
| #define | SIRFi_MODE (0x88) |
| Mode Control. | |
| #define | SIRFi_DOPMASK (0x89) |
| DOP Mask Control. | |
| #define | SIRFi_DGPS_MODE (0x8A) |
| DGPS Mode. | |
| #define | SIRFi_ELE_MASK (0x8B) |
| Elevation Mask. | |
| #define | SIRFi_PWR_MASK (0x8C) |
| Power Mask. | |
| #define | SIRFi_STATIC_NAV (0x8F) |
| Static Navigation. | |
| #define | SIRFi_CLK_STAT (0x90) |
| Poll Clock Status. | |
| #define | SIRFi_DGPS_PORT (0x91) |
| Set DGPS Serial Port. | |
| #define | SIRFi_P_ALMANAC (0x92) |
| Poll Almanac. | |
| #define | SIRFi_P_EPHEMERIS (0x93) |
| Poll Ephemeris. | |
| #define | SIRFi_FLASH_UPD (0x94) |
| Flash Update. | |
| #define | SIRFi_S_EPHEMERIS (0x95) |
| Set Ephemeris. | |
| #define | SIRFi_OPMODE (0x96) |
| Switch Operating Mode. | |
| #define | SIRFi_TRICKLE (0x97) |
| Set TricklePower Parameters. | |
| #define | SIRFi_P_NAVPARM (0x98) |
| Poll Navigation Parameters. | |
| #define | SIRFi_UARTCONF (0xA5) |
| Set UART Configuration. | |
| #define | SIRFi_MSGRATE (0xA6) |
| Set Message Rate. | |
| #define | SIRFi_LOWPWRACQ (0xA7) |
| Set Low Power Acquisition Parameters. | |
| #define | SIRFi_P_CMDPARM (0xA8) |
| Poll Command Parameters. | |
| #define | SIRFi_S_SBASPARM (0xAA) |
| Set SBAS Parameters. | |
| #define | SIRFi_CLASS_DR (0xAC) |
| SiRF Dead Reckoning Class of Input Messages. | |
| #define | SIRFi_USR_INPUT (0xAF) |
| User Input Command. | |
| #define | SIRFi_USR_INP_BEG (0xB4) |
| MID_UserInputBegin. | |
| #define | SIRFi_USR_INP_END (0xC7) |
| MID_UserInputEnd. | |
| #define | SIRFi_PRESET_CONF (0xB4) |
| Preset Software Configuration. | |
| #define | SIRFi_UARTCONFOLD (0xB6) |
| Set UART Configuration (obsolete). | |
| #define | SIRFi_SOFT_CTRL (0xCD) |
| Software Control. | |
| #define | SIRFi_INTERNAL (0xE4) |
| SiRF internal message. | |
| #define | SIRFi_EXT_EPHEM (0xE8) |
| Extended Ephemeris Proprietary. | |
| #define | SIRFi_PROTO_NULL (0) |
| Set Protocol - Null. | |
| #define | SIRFi_PROTO_BIN (1) |
| Set Protocol - SiRF Binary. | |
| #define | SIRFi_PROTO_NMEA (2) |
| Set Protocol - NMEA. | |
| #define | SIRFi_PROTO_ASCII (3) |
| Set Protocol - ASCII. | |
| #define | SIRFi_PROTO_RTCM (4) |
| Set Protocol - RTCM. | |
| #define | SIRFi_PROTO_USER1 (5) |
| Set Protocol - USER1. | |
| #define | SIRFi_PROTO_SIRFLOC (6) |
| Set Protocol - SiRFLoc. | |
| #define | SIRFi_PROTO_STAT (7) |
| Set Protocol - Statistic. | |
| #define | SIRFi_SOFT_OFF (0x10) |
| Software Control - Software Commanded Off. | |
| #define | SIRFo_REF_NAV (0x01) |
| Reference Navigation Data. | |
| #define | SIRFo_NAV (0x02) |
| Measured Navigation Data. | |
| #define | SIRFo_TRUE_TRACKER (0x03) |
| True Tracker Data. | |
| #define | SIRFo_TRACKER (0x04) |
| Measured Tracking Data. | |
| #define | SIRFo_RAW_TRACK (0x05) |
| Raw Track Data. | |
| #define | SIRFo_SWVERSION (0x06) |
| SW Version. | |
| #define | SIRFo_CLOCK_STATUS (0x07) |
| Clock Status. | |
| #define | SIRFo_SUBFRAME50 (0x08) |
| 50 BPS Subframe Data | |
| #define | SIRFo_THROUGHPUT (0x09) |
| Throughput. | |
| #define | SIRFo_ERROR_ID (0x0A) |
| Error ID. | |
| #define | SIRFo_CMD_ACK (0x0B) |
| Command Acknowledgment. | |
| #define | SIRFo_CMD_NAK (0x0C) |
| Command NAcknowledgment. | |
| #define | SIRFo_VISIBLE (0x0D) |
| Visible List. | |
| #define | SIRFo_DGPS_STAT (0x1B) |
| DGPS Status Format. | |
| #define | SIRFo_GEO_NAV (0x29) |
| Geodetic Navigation Data. | |
Typedefs | |
| typedef struct proto_sirf_parser_s | proto_sirf_parser_t |
Enumerations | |
| enum | sirf_parse_state_t { SIRFPARSE_UNSYNC, SIRFPARSE_START0, SIRFPARSE_START1, SIRFPARSE_LENGTH_H, SIRFPARSE_LENGTH_L, SIRFPARSE_PAYLOAD, SIRFPARSE_CSUM_H, SIRFPARSE_CSUM_L, SIRFPARSE_END0, SIRFPARSE_END1 } |
Functions | |
| void | sirf_gps_off (usart_control_t *usart) |
| poll Software Version | |
| uint16_t | sirf_getuint16 (const uint8_t *p) |
| uint32_t | sirf_getuint32 (const uint8_t *p) |
| uint32_t | sirf_getint32 (const uint8_t *p) |
SiRF Binary Protocol handling.
reference: http://gpsd.googlecode.com/files/SiRF-SiRF-v2_4.pdf
Multi-byte values are transmitted in big-endian order.
| #define SIRF_MAX_MSG_LENGTH (SIRF_MAX_PAYLOAD_LENGTH+8) |
maximum length of a single message
a message consists of:
| typedef struct proto_sirf_parser_s proto_sirf_parser_t |
SiRF parser internal state structure
| enum sirf_parse_state_t |
SiRF parser state
{
SIRFPARSE_UNSYNC,
SIRFPARSE_START0,
SIRFPARSE_START1,
SIRFPARSE_LENGTH_H,
SIRFPARSE_LENGTH_L,
SIRFPARSE_PAYLOAD,
SIRFPARSE_CSUM_H,
SIRFPARSE_CSUM_L,
SIRFPARSE_END0,
SIRFPARSE_END1,
} sirf_parse_state_t;
| uint32_t sirf_getint32 | ( | const uint8_t * | p | ) | [inline] |
helper function to extract a int32 from message
{
int32_t ret;
#ifdef __AVR__
__asm__ ("ld %D0,%a1\n\t"
"ldd %C0,%a1+1\n\t"
"ldd %B0,%a1+2\n\t"
"ldd %A0,%a1+3\n\t"
: "=&r"(ret)
: "b"(p));
#else
#warning "using generic sirf_getintxx implementation"
ret = ((int32_t)p[0] << 24) | ((uint32_t)p[1] << 16)
| ((uint16_t)p[2] << 8) | (p[3]);
#endif
return ret;
}
| uint16_t sirf_getuint16 | ( | const uint8_t * | p | ) | [inline] |
helper function to extract a uint16 from message
{
uint16_t ret;
#ifdef __AVR__
__asm__ ("ld %B0,%a1\n\t"
"ldd %A0,%a1+1"
: "=&r"(ret)
: "b"(p));
#else
#warning "using generic sirf_getuintxx implementation"
ret = ((uint16_t)p[0] << 8) | p[1];
#endif
return ret;
}
| uint32_t sirf_getuint32 | ( | const uint8_t * | p | ) | [inline] |
helper function to extract a uint32 from message
{
uint32_t ret;
#ifdef __AVR__
__asm__ ("ld %D0,%a1\n\t"
"ldd %C0,%a1+1\n\t"
"ldd %B0,%a1+2\n\t"
"ldd %A0,%a1+3\n\t"
: "=&r"(ret)
: "b"(p));
#else
#warning "using generic sirf_getuintxx implementation"
ret = ((uint32_t)p[0] << 24) | ((uint32_t)p[1] << 16)
| ((uint16_t)p[2] << 8) | (p[3]);
#endif
return ret;
}
| void sirf_gps_off | ( | usart_control_t * | usart | ) |
poll Software Version
switch to NMEA mode
Mode Control
Static Navigation
power off GPS module
{
static const uint8_t msg [] = {SIRFi_SOFT_CTRL, SIRFi_SOFT_OFF};
sirf_send_msg (usart, msg, sizeof (msg));
usart_flush (usart);
#if 0
/* the GPS module is of no use to us until a power-cycle,
* so cut power to USART */
usart_disable (usart);
usart_poweroff (usart);
#endif
}
1.7.1