Login| Sign Up| Help| Contact|

Patent Searching and Data


Title:
HOST BASED SATELLITE POSITIONING METHODS AND SYSTEMS
Document Type and Number:
WIPO Patent Application WO/2005/086459
Kind Code:
A1
Abstract:
Methods and systems consistent with the present invention provide a host (102) based positioning system. The host based positioning system includes a tracker hardware interface (110) that connects to a dedicated hardware space vehicle tracker (104). The tracker hardware interface receives positioning information from the space vehicle tracker (104). The host based positioning system also includes a memory that includes a GPS library (124) having a user interface, a tracker interface, and an operating system interface. A processor (106) runs functions provided by the interfaces.

Inventors:
YAMAMOTO CLIFFORD (US)
NONIS SEBASTIAN (US)
PANDE ASHUTOSH (US)
BULATOVIC NIKOLA (US)
WITANIS STEFAN (US)
Application Number:
PCT/US2004/003535
Publication Date:
September 15, 2005
Filing Date:
February 06, 2004
Export Citation:
Click for automatic bibliography generation   Help
Assignee:
SIRF TECH INC (US)
YAMAMOTO CLIFFORD (US)
NONIS SEBASTIAN (US)
PANDE ASHUTOSH (US)
BULATOVIC NIKOLA (US)
WITANIS STEFAN (US)
International Classes:
G01C21/20; G01S1/00; G01S5/00; H04L29/06; (IPC1-7): H04L29/06; G01C21/20; G01S5/00
Foreign References:
US6384777B12002-05-07
US5832247A1998-11-03
US20020196181A12002-12-26
US6401037B12002-06-04
US5589835A1996-12-31
US5528248A1996-06-18
US6377891B12002-04-23
US6384777B12002-05-07
US5832247A1998-11-03
US20020196181A12002-12-26
US6401037B12002-06-04
US5589835A1996-12-31
US5528248A1996-06-18
Attorney, Agent or Firm:
Hamilton, Jennifer H. (10453 Raintree Lane Northridge, CA, US)
Download PDF:
Claims:
CLAIMS What is claimed is:
1. A system for processing positioning signals, the system comprising: a tracker hardware interface for receiving positioning information; a memory comprising a GPS library comprising a user interface, a tracker interface, and an operating system interface, the tracker interface comprising at least one tracker interface function for communicating over the tracker hardware interface; and a processor for running the tracker interface function.
2. The system of claim 1, wherein the memory further comprises a positioning engine for determining a position from the positioning information.
3. The system of claim 1, wherein the tracker hardware interface comprises a serial interface.
4. The system of claim 1, wherein the user interface comprises at least one positioning control function and at least one positioning engine communication function.
5. The system of claim 3, wherein the positioning control function comprises a positioning engine start function.
6. The system of claim 4, wherein the positioning control function comprises a positioning engine stop function.
7. The system of claim 4, wherein the positioning engine communication function is a command delivery function.
8. A method in a positioning system comprising a tracker hardware interface, the method comprising the steps of : calling a tracker interface function to receive positioning information from a tracker hardware interface; determining a position from the positioning information using a positioning engine; and calling a user interface message delivery function to communicate the position to a user application.
9. The method of claim 8, wherein the user interface message delivery function is provided by the user application.
10. The method of claim 8, wherein the positioning system further comprises a user interface, and further comprising the step of receiving a positioning engine start message from the user interface.
11. The method of claim 8, wherein the positioning system further comprises a user interface, and further comprising the step of receiving a user command for the positioning engine from the user interface.
12. The method of claim 8, wherein the positioning system further comprises a user interface, and further comprising the step of receiving a positioning engine stop message from the user interface.
13. The method of claim 8, further comprising the step of initiating execution of a Navigation thread for generating navigation data received from the tracker hardware interface.
14. The method of claim 13, further comprising the step of initiating execution of a Periodic navigation processing thread.
15. The method of claim 14, wherein the Periodic processing thread is a lower priority thread than the Navigation thread.
16. A computerreadable medium containing instructions that cause a positioning system having a tracker hardware interface to perform a method comprising the steps of : calling a tracker interface function to receive positioning information from a tracker hardware interface; determining a position from the positioning information using a positioning engine; and calling a user interface message delivery function to communicate the position to a user application.
17. The computerreadable medium of claim 16, wherein the user interface message delivery function is provided by the user application.
18. The computerreadable medium of claim 16, wherein the positioning system further comprises a user interface, and further comprising the step of receiving a positioning engine start message from the user interface.
19. The computerreadable medium of claim 16, wherein the positioning system further comprises a user interface, and further comprising the step of receiving a user command for the positioning engine from the user interface.
20. The computerreadable medium of claim 16, wherein the positioning system further comprises a user interface, and further comprising the step of receiving a positioning engine stop message from the user interface.
Description:
HOST BASED SATELLITE POSITIONING METHODS AND SYSTEMS BACKGROUND OF THE INVENTION [001] 1. Field of the Invention [002] This invention relates to satellite positioning systems. In particular, this invention relates to satellite positioning systems implemented utilizing the processing power of a host in communication with a hardware tracker.

[003] 2. Related Art [004] The worldwide utilization of wireless devices such as two-way radios, pagers, portable televisions, personal communication system ("PCS"), personal digital assistants ("PDAs") cellular telephones (also known a"mobile phones"), Bluetooth, satellite radio receivers and Satellite Positioning Systems ("SPS") such as Global Positioning Systems ("GPS"), also known as NAVSTAR, is growing at a rapid pace. Current trends are calling for the incorporation of SPS services into a broad range of electronic devices and systems, including Personal Digital Assistants (PDAs), cellular telephones, portable computers, automobiles, and the like. At the same time, manufacturers constantly strive to reduce costs and produce the most cost-attractive product possible for consumers.

[005] In the past, providing a SPS solution often involved expensive dedicated SPS signal reception and processing hardware, as well as dedicated post processing hardware for resolving location measurements, displaying location coordinates, updating map displays, and the like. However, given the rapid growth in speed, sophistication, and processing power of the host microprocessors present in the host device (e. g. , in a cellular telephone or automobile), the possibility exists for allowing the host microprocessor to bear the burden not only of running its regular applications, but also to operate as part of the SPS solution. Such an approach is presented in U. S. Pat. No. 6,430, 503, titled"Distributed GPS Navigation System, "issued to Paul W. McBurney et al. , the entirety of which is incorporated herein by reference.

[006] As noted above, however, there is a strong push toward incorporating SPS solutions in many electronic devices designed by numerous manufacturers. Of course, each device varies considerably in architecture, operating system, hardware interfaces, and the like. Prior SPS solutions did not provide the flexibility that allowed the solutions to be adapted to a wide range of electronic devices. Instead, expensive customized solutions were needed for each device, thereby undesirably increasing costs and delaying the introduction of SPS services into a wide range of devices.

[007] Therefore, a need exists for implementations of SPS solutions that overcome the problems noted above and others previously experienced.

SUMMARY [008] Methods and systems consistent with an invention of a host based SPS solution are disclosed. The SPS solution is implemented in a convenient library form that is flexible and extensible, and that may adapt to meet he needs of many different hardware platforms. As a result, a wide variety of electronic devices may incorporate SPS functionality with less expense utilizing less development time.

[009] In one example implementation, a host based SPS system may include a host processing system that connects through a tracker hardware interface to a dedicated hardware space vehicle tracker. The host processing system may also include a memory that includes a SPS library having a user interface, positioning engine, a tracker interface and an operating system interface. A processor in the host processing system runs the positioning engine and the functions provided by the interfaces.

[0010] The tracker hardware interface receives positioning information from the space vehicle tracker. Through functions in the tracker interface, the positioning information is communicated to the positioning engine. In turn, the positioning engine may determine a position and communicate the position to a user application through functions provided in the user interface.

[0011] Other apparatus, systems, methods, features and advantages of the present invention will be or will become apparent to one with skill in the art upon examination of the following figures and detailed description. It is intended that all such additional systems, methods, features and advantages be included within this description, be within the scope of the present invention, and be protected by the accompanying claims.

BRIEF DESCRIPTION OF THE FIGURES [0012] The components in the figures are not necessarily to scale, emphasis instead being placed upon illustrating the principles of the invention. In the figures, like reference numerals designate corresponding parts throughout the different views.

[0013] Figure 1 illustrates a detailed block diagram of one example of a positioning systems implemented as a host based SPS solution.

[0014] Figure 2 illustrates a hardware tracker that communicates with the positioning system shown in Figure 1.

[0015] Figure 3 depicts a hardware and software diagram of a positioning system that includes a GPS library with a user interface, a tracker interface, and an operating system interface.

[0016] Figure 4 illustrates a flow diagram of a user program running in the positioning system.

[0017] Figure 5 illustrates a block diagram of the cooperation between threads, tasks and hardware in one implementation of a host based SPS solution.

[0018] Figure 6 illustrates an execution schedule for a receive manager thread and a periodic navigation task.

[0019] Figure 7 illustrates a synchronization diagram for the timing and interaction between the threads and tasks shown in Figure 5.

DETAILED DESCRIPTION [0020] Reference will now be made in detail to an implementation in accordance with methods, systems, and products consistent with the present invention as illustrated in the accompanying drawings. The same reference numbers may be used throughout the drawings and the following description to refer to the same or like parts.

[0021] A typical satellite positioning system ("SPS") system has approximately 12 satellites that may be visible at any one time to a wireless device. SPS means any system utilizing satellites and/or land-based communications devices for providing or enabling the determination of a location of the wireless device on the earth, for example but not limited to: the global positioning system ("GPS") known as NAVSTAR, GLONASS, LORAN, Shoran, Decca, or TACAN. Although many of the interface functions below make reference to GPS, those functions are not limited to use with GPS, but, generally, are equally applicable in other SPS environments.

[0022] Figure 1 depicts a block diagram of a positioning system 100 suitable for practicing methods and implementing systems consistent with the present invention. The positioning system 100 includes a host 102 and tracker hardware 104. The host 102 includes a central processing unit ("CPU") 106, a hardware tracker interface 110, and a memory 112. The host 102 also includes a secondary storage device 114 (e. g. , generally non-volatile memory such as a magnetic disk, flash memory, optical storage, and the like), and a display 116, and an input interface 118 (e. g. , a mouse, keyboard, and the like).

[0023] An operating system 120 (e. g., Windows CE, QNX, Palm OS, UNIX, Linux, Windows 2000, NT, XP, or the like) runs in the memory 112. As will be explained in more detail below, a user program 122 communicates with a SPS library 124 and the operating system 120. The user program 122 thereby receives position information from the GPS library, and may also communicate commands to the SPS library. The user program 122 may be any program that utilizes positioning information, including, as examples, a mapping program, course charter, location aid, and the like.

[0024] The host 102 connects through the hardware tracker interface 110 and the interface connection 126 to the tracker hardware 104. The hardware tracker interface 110 may be virtually any type of data transfer interface (as examples, a serial, parallel, compact flash, PC Card, or network interface). The interface connection 126 may then be, as examples, a serial cable, parallel cable, or network cable, and may optionally be wireless. In one implementation, the hardware tracker interface 110 is an RS232 port running at 38, 400 bps, N-8-1 that communicates up to 2KB of data per second between the host 102 and the tracker hardware 104.

[0025] In other implementations, the tracker hardware (as illustrated by the reference numeral 128) is more closely incorporated into the host 102. Thus, rather than connecting to the host 102 through the interface connection 126, for example, the tracker hardware 128 may be directly coupled to the host 102 address, data, and control buses. As will be explained in more detail below, the host 102 receives and processes navigation information from the hardware tracker 104,128 in order to provide the user programs 122 with position information.

[0026] Although aspects of the present invention are depicted as being stored in memory 112, one skilled in the art will appreciate that all or part of systems and methods consistent with the present invention may be stored on or read from other machine-readable media, for example, secondary storage devices such as hard disks, floppy disks, and CD-ROMs; a signal received from a network ; or other forms of ROM or RAM either currently known or later developed. Further, although specific components of positioning system 100 are described, one skilled in the art will appreciate that a positioning system suitable for use with methods, systems, and articles of manufacture consistent with the present invention may contain additional or different components. For example, the CPU 106 may be a microprocessor, microcontroller, application specific integrated circuit ("ASIC"), discrete or a combination of other types of circuits acting as a central processing unit. The memory 112 may be RAM, DRAM, SDRAM, or any other type of read/writeable memory.

[0027] Turning next to Figure 2, that figure shows one example of an implementation of the tracker hardware 104. The tracker hardware 104 acquires and tracks SPS satellites and sends raw measurement data to the host 102 for position calculation. To that end, the tracker hardware 104 includes an antenna 202 for receiving SPS satellite signals and a radio frequency ("RF") filter 204 for passing the signals to the RF interface circuit 206. The RF interface circuit 206 processes the signals, produces 2-bit Inphase and Quadrature ("I/Q") signals and recovers SPS clocks. The RF interface circuit 206 provides the I/Q signals and SPS clocks to the location processing circuit 208 for digital processing. A reference frequency source 210 (e. g. , a crystal oscillator) provides a reference clock for the RF interface circuit 206, while the optional real time clock ("RTC") source 212 provides a reference clock for the location processing circuit 208.

[0028] The tracker hardware 104 may be implemented with components available from SiRF Technology, Inc. of San Jose California. For example, the RF interface circuit 206 may be implemented as a GRF2i/LP integrated circuit. The location processing circuit may be implemented, as examples, as a GSP2t integrated circuit or GSP2e integrated circuit. The tracker hardware 104 minimizes the overhead on the host 102 and operating system 120 by keeping low the maximum transmission rate of raw measurements to the host 102 (e. g. , one measurement per second).

[0029] With regard next to Figure 3, that figure shows a detailed block diagram of a hardware and software diagram 300 for the positioning system 100. The memory 112 in the host 102 includes a SPS library 124, user programs 122 (e. g. , map displaying, map matching, dead reckoning and route calculation programs), and the operating system 120 (which may be a multi-threaded operating system). The SPS library 124 includes a positioning engine 302, a user interface 304, a tracker interface 306, and an operating system interface 308. The user tasks 310 implement device drivers or link directly to the user programs 122, as examples.

[0030] In addition to the hardware tracker 104, persistent storage 312 and a real time clock 314 may optionally be provided. The persistent storage 312 may be, as examples, 2 KB of Flash memory, battery backed up RAM or a disk drive. The SPS library 124 may use the RTC in the host 102, the RTC 314, or may operate without an RTC.

[0031] The user interface 304 is called by the user programs 122 to start and configure the positioning system. The positioning engine 302 calls a function provide by the user program 122 (e. g., GPSOutput) to deliver positioning messages (e. g. , position updates and other synchronous and asynchronous data) to the user program 122. The tracker interface 306 provides for communication between the tracker hardware 104 and the host 102 and, to that end, may load and call the operating system 120 serial communication drivers. The operating system interface 308 calls operating system functions for task scheduling and synchronization, RTC access, and storage access.

[0032] Figure 4 shows a flow diagram of a user program 122. The user program 122 calls GPS Start to start the positioning engine 302 (step 402). The user program 122 determines whether to configure the positioning engine 302 (step 404). The program 122 configures the positioning engine 302 by sending a message to the positioning engine 302 using the GPS_Input function, for example (step 406). Next, the program 122 waits for a new position fix (or other information) from the positioning engine 302 (step 408).

[0033] When information is received, the positioning engine processes the information, for example, to display or update a map (step 410). If the program 122 continues to run (step 412), processing returns to step 404. Otherwise, the program 122 stops the positioning engine (step 414) and terminates. The positioning engine runs separately and, when new positioning information is available, creates a message for the program 122 (step 416) and sends the message to the program 122 (step 418). Tables 1-5 below show exemplary function calls.

Table 1-GPS Start () /* Starts GPS Engine tasks, initial acquisition begins : */ tGPS UINT32 result ; result = GPS Start ( GPSCTRLMODEAUTO,/* default-hot start */ 0,/* use default clock offset */ 1,/* use port 1 */ 38400/* baud rate */ Table 2-User Callback GPSOutput () /* User callback function. Receives all communication from GPS. */ #include"GP S_interface. h" void GPS- (Dutput ( tGPS UINT32 message id, void * message structure, tGPSUINT32 length) { tGPSNAVMEASUREDNAVIGATIONnavdata ; switch (messageid) { case GPS NAV MEASURED NAVIGATION : memcpy (&navdata, messagestructure, sizeof (tGPSNAVMEASUREDNAVIGATION)) ; if (navdata. navmode & GPSMODEMASK) { printf ("x=% ld, y=% ld, z=% ld \n", nav data. ecef x, nav d a. ecef else printf ("no fix \n") ; break ; case GPSNAVMEASUREDTRACKER : /*... */ break ; default : /*... */ break ; }//switch } II GPS_Output () Table 3-Configure using GPSInput () /* Configures GPS Engine to turn off SBAS correction : */ tGPSNAVSETDGPSSOURCE DGPSSrc ; tGPSUINT32 result ; DGPSSrc. bit rate = 0 ; DGPSSrc. freq = 0 ; DGPSSrc. src = GPSDGPSSRCNONE ; result = GPSInput (GPSNAVSETDGPSSOURCE, (void*) &DGPSSrc, sizeof (DGPSSrc)) ; Table 4-Configure using GPSInput () /* Forces cold start of GPS receiver : */ tGPS_NAV_INITIALIZE InitMsg ; tGPSUINT32 result ; memset (&InitMsg, 0, sizeof (InitMsg)) ; InitMsg. restart flags = GPS RESTART COLD ; result = GPSjnput (GPS-NAV-INITIALIZE, (void*) &InitMsg, sizeof (InitMsg)) ; Table 5-GPSStop () /* Stops GPS Engine and all SiRFNav tasks : */ tGPSUINT32 result ; result = GPSStop () ; [0034] Below, one exemplary implementation of the user interface 304, tracker interface 306, and an operating system interface 308 is set forth. Table 6 shows which functions and messages are associated with each interface, while Tables 7-10 set forth files and data types used or referred to in the follow description.

Table 6-Interface Functions and Messages User Interface : GPS_Start () GPS_Stop () GPS_Output () GPS Input () GPSNAVMEASUREDNAVIGATION output message GPSNAVMEASUREDTRACKER output message GPSNAVSWVERSION output message GPSNAVCLOCKSTATUS output message GPSNAVERROR output message GPSADCODOMETERDATA output message GPSNAVCOMPLETE output message GPSNAVTEXT output message, GPSNAVINITIALIZE input message GPS NAV POLL SW VERSION input message GPSNAVSETDGPSSOURCE input message GPSNAVPOLLCLOCKSTATUS input message GPSNAVSETSBASPRN input message Operating system interface : OS Thread Create () OS Thread Delete () OSThreadSleepO OSMutexCreate () OS Mutex Delete () OSMutexEnter () OSMutexExit () OS Semaphore Create () OS Semaphore Delete () OS Semaphore Wait () OSSemaphoreRelease () OS Storage Open () OS Storage Close () OS Storage Write () OSStorageWriteAll () OS Storage Read () OSRTCRead () Tracker interface : GPSCOMMTRKCreate () GPS_COMM_TRK_Delete () GPSCOMMTRKOpen () GPSCOMMTRKReopen () GPSCOMMTRKClose () GPSJOMMTRKWait () GPSCOMMTRKRead () GPSCOMMTRKWrite () Table 7 Include file Description gps types.h Type definitions used in GPS library interfaces gps_rtos. h Definitions and prototypes of the GPS operating system interface s_ctrl.h Definitions and prototypes of the GPS control interface gps interface. h Definitions and prototypes of the GPS communication interface gps_messages. h Definitions and structure defines of messages used by the communication interface gpscommtrk. h Definitions and prototypes of the tracker communication interface s_proto_sirfbinary. h Definitions and prototypes of the binary serial protocol gps debug. h Definitions for development and debugging Table 8 Source file Description gps rtos. c Contains implementation of the GPS operating system interface gps comm trk. c Contains implementation of the tracker communication interface Table 9 Library file Description SiRFNavServer.lib GPS receiver library Table 10-Data Types Type name Data range Defined as tGPS_SINT8-128 127 signed char tGPS_UINT8 0 .. 255 unsigned char tGPS SINT16 -32768 .. 32767 signed short tGPS UINT16 0 .. 65535 unsigned short tGPS SINT32-2147483648.. 2147483647 signed long tGPS UINT32 0 .. 4294967295 unsigned lon tGPS HANDLE 32 bit pointer void * [0035] The user or GPS interface includes a GPS control interface and a GPS communication interface. The GPS control Interface functions allow a user program to start and stop the GPS engine using the functions shown in Table 11. Table 11 Function Description Provided in GPS_Start() Starts GPS engine GPS library GPS_Stop() Stops GPS engine GPS library [0036] The GPS communication interface functions allow a user program to send and receive messages to and from the GPS engine using the functions shown in Table 12. Table 12 Function Description | Provided in GPS_Output() Receives a data from the GPS user code engine GPS_InputO S end commands to the GPS GPS library engine [0037] GPS_Start() initializes and starts positioning engine threads and cornmunication interface. This function should be called by user programs to start GPS activity.

Table 13 Include file gps_ctrl. h Syntax tGPS_RESULT GPS_Start(tGPS_UINT32 start_mode, tGPSUINT32 clockoffset, tGPS UINT32 port rzum, tGPS_UINT32 baud_rate) Parameter Data range Units Description start-mode Start configuration flags. See Table 14below for details. clock-offset 0, 25000.. 146000 Hz Default GPS clock offset. This value is used by the factory start or when a saved value is not available. This value should reflect a tracker's hardware peculiarity. If zero is provided here a default value of 96#50 Hz is used. port_num 1 .. 64 Specifies a communication port where tracker is connected to. 1 = serial port 1, 2 = serial port 2, baud rate 4800, 38400,57600, bps Specifies a baud rate at which 115200 tracker is connected to. Default 2t tracker baud rate is 38400 bps.

Table 14 3130 29 28 27 26 25 24 23 22 21 20 19 18 17 16 Reserved. Write 0 only. 15 14 13 12 11 10 19 18 17 6 5 4 3 2 1 0 Text ADC Reserved. Write 0 only. Start type. See enable mode. below for allowed See values. below.

Table 15-Text Enable Value Macro Description 0 Development text messages are disabled after start. Can be enabled later by GPS input message. 1 GPS CTRL MODE TEX'I ENABLE Enables development text messages right after start (via GPS Outputo function) Table 16-ADC Mode Value Macro Description 0 ADC messages from tracker are disabled. 1 GPSCTRLMODEADCE Enables ADC message from tracker at NAB LE 1 HZ 1 Hz rate 2 GPSCTRLMODEAD CE Enables ADC message from tracker at NABLE_10HZ 10Hz rate 3 Reserved Table 17-Start Type Value Macro Description 0 GPS CTRL MODE AUro GPS will automatically choose a start mode accordingly to availability of time, position and ephemeris information. This start mode should be used for normal operation. 1 GPS_CTRL_MODE_HOT For testing purposes only. GPS will make a hot start. 2 GPSCTRLMODEWARM For testing purposes only. GPS will make a warm start. 3 GPSCTRLMODECOLD For testing purposes only. GPS will make a cold start. 4 GPS_CTRL_MODE_FACTORY For testing purposes only. GPS will make a factory cold start. All saved information will be deleted. 5 GPS CTRL MODE TEST For SiRF internal testing purposes only. Other value Reserved Table 18-Return Values Return value Description GPS_SUCCESS GPS engine has started successfully GPS_CTRL_ALREADY_STARTED Error: GPS engine is already running GPS CTRL INVALID MODE Error : invalid start mode GPS_CTRL_CLOCK OFFSET OUT OF RANGE Error : clock offset is out of range GPS CTRL ERROR OPENING PORT Error : could not open serial port GPSCTRLRTOSERROR Error creating OS objects (threads, semaphores, mutexes) Table 19-Example #include"gps_types. h" #include"gps_ctrl. h" if (GPS_Start (GPS_CTRL_MODE_AUTO | GPS_CTRL_ODE_TEXT_ENABLE, 96250, 1, 38400) ! = GPSSUCCESS) { //error handler I //GPS engine has started successfully [0038] The GPS_Stop function stops the positioning engine threads and communication interface. This function should be called by the user program to stop GPS activity. Include file gps_ctrl. h Syntax tGPSRESULT GPSStop (void) Return value Description GPS SUCCESSGPS engine has stopped successfully GPS_CTRL_ALREADY_STOPPED Error: GPS engine is already stopped Table 21-Example #include"gps_types. h" #include"gps_ctrl. h" if (GPS_Stop () ! = GPSSUCCESS) { //error handler } //GPS engine has stopped successfully ...

[0039] The GPS Output function retrieves a message from positioning engine. There are no return values. The function is called by the positioning engine whenever any message is sent out. This function is implemented by the user program and statically linked with the GPS library.

Table 22 Syntax void GPS Output (tGPS UINT32 message id, void *message structure, tGPS_UINT32 length) Parameter Data range Units Description messageid GPSNAVMEASUREDNAVIGATION Message GPS NAV MEASURED TRACKER identifier. See GPSNAVRAWTRA. CKER chapter 7 for GPSNAVSWVERSION message GP S_NAV_CLOCK_STATUS details. GPS NAV SOBPS DATA GPSNAVERROR GPSNAVACK GPSNAVNAK GPS NAV VISIBLITY LIST GPSNAVNLMEASDATA GPSNAVNLDGPSDATA GPS_NAV_NL_SV SrATE DATA GPSNAVNLINITDATA GPS ADC ODOMETER DATA GPSNAVCOMPLETE GPSNAVTEXT message_structur 32 bit pointer Pointer to the e message structure with data Length Varies depending on the message-bytes Length of the message structure Table 23-Example #include"gps_types. h" #include"gps_interface. h" #include"gps_messages. h" void GPS Output (tGPS UINT32 message id, void *message_structure, tGPS_UINT32 length) { tGPSNAVMEASUREDNAVIGATIONnavdata ; switch (message id) case GPSNAVMEASUREDNAVIGATION : memcpy (&navdata, messagestructure, sizeof (tGPSNAVMEASUREDNAVIGATION)) ; if (navdata. navmode & GPSMODEMASK) printf ("x=% ld, y=% ld, z=% ld \n", navdata. ecefx, navdata. ecefy, navdata. ecefz) ; else printf ("no fix \n") ; break ; case GPSNAVMEASUREDTRACKER : //use tracker information here break ; default : break ; }//switch }//GPSOutput () [0040] The GPS_Input function sends a command to the GPS engine. The function may be called by the client program to send a command to the GPS receiver.

Table 24 Include file gpsinterface. h Syntax tGPSUINT32 GPSInput (tGPSUINT32 messageid, void *message structure, tGPSUINT32 length) Parameter Data range Units Description message id GPS NAV INITIALIZE Message identifier. GPS NAV POLL SW VERSION See chapter 7 for GPSNAVSETDGPSSOURCE message details. GPS NAV SET NAV MODE GPS NAV SET DOP MODE GPSNAVSETDGPSMODE GPSNAVSETELEVMASK GPSNAVSETPOWERMASK GPS NAV SET STAT NAV GPS NAV POLL CLOCK STATUS GPSNAVPOLLRXMGRPARAMS GPSNAVSETMSGRATE GPSNAVSETSBASPRN messagestruc 32 bit pointer Pointer to the ture message structure with data to send length Varies depending on the message bytes Length of the message structure Table 25-Return values Return value Description GPS_SUCCESS Message was sent successfully GPS_ERROR Error: Message was not acknowledged GPS_ERROR_NOT_STARTED Error: GPS engine is not running Table 26-Example #include"gps_types. h" #include"gps_interface. h" #include"gps_messages. h" /* Forces cold start of GPS receiver : */ tGPS NAV INITIALIZE InitMsg ; tGPSUINT32 result ; memset (&InitMsg, 0, sizeof (tGPSNAVINITIALIZE)) ; InitMsg. restart flags = GPSRESTARTCOLD ; result = GPS_Input (GPS NAV INITIALIZE, (void*) &InitMsg, sizeof (tGPSNAVINITIALIZE)) ; [0041] The GPS communication interface messages are exchanged between the GPS client (e. g. , a user program) and positioning or GPS engine via the user interface input and output functions.

Table 27-Primary GPS output messages Message id Message id macro Description value 2 (0x02) GPSNAVMEASUREDNAVIGATION Provides ECEF position, velocity, GPS time, position status 4 (0x04) GPSNAVMEASUREDTRACKER Provides satellite status, azimuth, elevation and C/No information 6 (0x06) GPSNAVSWVERSION Provides GPS engine software version 7 (0x07) GPSNAVCLOCKSTATUS Provides current GPS clock status 10 (OxOA GPS NAV ERROR Provides error information 45 (Ox2D) GPSADCODOMETERDATA Provides ADC, odometer and GPIO values from tracker 47 (Ox2F) GPS NAV COMPLETE This message is sent as a last one in the navigation cycle. Informs that navigation cycle i s complete. 255 (OxFF) GPSNAVTEXT Provides development text information Table 28-Primary GPS input messages Message id Message id macro Description value 128 (Ox80) GPSNAVINITIALIZE Performs re-initialization of the GPS receiver : factory, cold, warm or hot restarts. 132 (Ox84) GPSNAVPOLLSWVERSION Asks for the GPS engine software version 133 (Ox85) GPSNAVSETDGPSSOURCE Sets differential correction source 144 (0x90) GPSNAVPOLLCLOCKSTATUS Asks for the current GPS clock status 170 (OxAA) GPSNAVSETSBASPRN Sets SBAS (WAAS/EGNOS) PRN number Table 29-Additional GPS output messages for development and debug process Message id Message id macro Description value 8 (0x08) GPS NAV 50BPS DATA Provides 50 bps subframe data 11 (OxOB) GPS NAV ACK Command acknowled ient 12 (OxOC) GPS NAV NAK Command not acknowledgment 13 (OxOD) GPS NAV VISIBLITY LIST Provides current visibility list 28 (0xlC) GPS_NAV_NL_MEAS_DATA Provides navigation library measurement data 29 (OxID) GPSNAVNLDGPSDATA Provides navigation library differential data 30 (OxIE) GPSNAVNLSVSTATEDATA Provides navigation library satellite state data 31 (OxIF) GPS NAV NL INIT DATA Provides navigation library initialization data Table 30-Additional GPS input messages for development and debug process Message id Message id macro Description value 136 (Ox88 GPS NAV SET NAV MODE Sets navigation mode 137 (Ox89) GPSNAVSETDOPMODE Sets DOP mask control mode 138 (0x8A) GPS_NAV_SET_DGPS_MODE Sets differential mode of operation 139 (Ox8B) GPS NAV SET ELEV MASK Sets elevation mask 140 (Ox8C) GPS NAV SET POWER MASK Sets power mask 143 (Ox8F) GPSNAVSETSTATNAV Configures static navigation mode 152 (Ox98) GPSNAVPOLLRXMGRPARAMS Asks for current navigation parameters 166 (OxA6) GPS NAV SET MSG RATE Sets message output rate [0042] The GPSNAVMEASUREDNAVIGATION output message provides ECEF position, velocity, GPS time and position status information. The message is outputted periodically at lHz rate.

Table 31 Include file gps_messages. h Message id: Value Macro 2 (0x02) GPS NAV MEASURED NAVIGATION Table 32-Message structure Note: To get a real value of the parameter a value from the structure should be multiplied by the scale factor. tGPSNAVMEASUREDNAVIGATION StructureData type Data rangeScale Units Description member (after de-factor scaling) ecef x SINT32 1 meters ecef SINT32 1 meters Computed ECEF ecef z SINT32 1 meters position. ecefvel x SINT160. 125 m/sec ecef vel SINT16 0. 125 m/sec Computed ECEF ecef vel z SINT16 0. 125 m/sec velocity navmode UINT8 n/a n/a Navigation status flags. See below for details. hdop UINT8 0.. 50. 0 0. 2 n/a Horizontal Dilution Of Precision navmode2 UINT8 n/a n/a Navigation status flags. See below for details. gps week UINT16 > 0 1 n/a Computed full GPS week number. gps_tow UINT32 0.. 604799. 99 0. 01 sec. Computed GPS time of the week. svusedcnt UINT8 0.. 12 1 n/a Number of satellites used in solution. sv used UINT8 [12] 1.. 32 1 n/a Array of PRN numbers of satellites used in solution Table 33-navmode bit fields 7 6 5 4 3 2 1 0 DGPS DOP Altitude status reserved Position status status mask 0 status Table 34-Position status Value Macro Description 0No navigation solution 1 1 satellite degraded solution 2 2 satellites degraded solution 3 3 satellites solution (2D) 4 More than 3 satellites solution (3D) 5 3 satellites least square solution (2D) 6 More than 3 satellites least square solution (3D) 7Dead reckoning Table 35-Altitude status Value Macro Description 0 No altitude hold Altitude used from filter 2 Altitude used from user 3 Forced altitude (from user) Table 36-DOP mask status: Value Macro Description 0 DOP mask not exceeded 1 GPS MODE DOP MASK EXCEED DOP mask exceeded Table 37-DGPS status: Value Macro Description 0 Differential corrections are not used in solution 1 GPS_MODE_DGPS_USED Differential corrections are used in solution Table 38-nav mode2 bit fields : 7 6 5 4 3 2 1 0 reserved reserved reserved reserved reserved DR Solution reserved timed validation out status Table 39-Solution validation status: Value Macro Description 0 Solution is not validated 1 GPS MODE2 SOLUTION VALIDATED Solution is validated Table 40-DR timed out status: Value Macro Description 0 Dead reckoning not timed out 1 GPS MODE2 DR TIMED OUT Dead reckoning has timed out [0043] The GPSNAVMEASUREDTRACKER output message provides satellite status, azimuth, elevation and C/No information. The message is outputted periodically at lHz rate.

Table 41 Include file gpsmessages. h Message id: Value Macro 4 (0x04) GPS NAV MEASURED TRACKER Table 42-Message Structure Message structure tGPSNAVMEASUREDTRACKER Structure Data type Data range Scale Units Description member (after de-factor scaling) gpsweek UINT16 1.. 1 Computed full GPS week number. gps_tow UINT32 0 .. 604799.99 0.01 sec. Computed GPS time of the week. chnlcnt UINT8 12 1 Number of receiver's channels chnl tGPSSV Array of structures INFO [12] containing satellite information for each receiver channel. See below.

Table 43-tGPSSVINFO sub-structure: Note: To get a real value of the parameter a value from the structure should be multiplied by the scale factor. Structure Data type Data range Scal Units Description member (after de-e scaling) facto r svid UINT8 1.. 32 1 Satellite PRN number azimuth UINT8 0 359.5 1.5 Satellite azimuth angle. elevation UINT8 0 90.0 0.5 de Satellite elevation angle state UINT16 n/a Satellite tracking status. See below. cno UINT8 [10] 0.. 60 1 dB-Hz Array of satellite signal to noise ratios for the past second. Measurements are made every 100ms. Value at index zero is the oldest.

Table 44-state bit fields: 15 14 13 12 11 10 9 8 Initial reserved reserved reserved reserved reserved reserved reserved acquisiti 0 0 0 0 0 0 0 on in progress Table 45-state bit fields: 7 6 5 4 3 2 1 0 Sub Ephemeris Carrier Bit Delta Acquisition Code Frame Acquisitio data Pulling sync Phase failed locked sync n success available done done valid done [0044] The GPSNAVSWVERSION output message provides a positioning engine software version string. Message is sent as a reply to the GPSNAVPOLLSWVERSION input message.

Table 46 Include file gps_messages. h Message id: Value Macro 6 0x06 GPS NAV SW VERSION Table 47-Message structure tGPSNAVSWVERSION Structure member Data Data range Scale Units Description type (after de-factor scaling) swversion [100] UINT8 ASCII GPS engine software characters version. Version string is NULL terminated. Message length is variable but does not exceed 100 bytes. [0045] The GPSNAVCLOCKSTATUS output message provides current GPS clock status information. Message is outputted periodically at lHz rate or on demand as a reply to GPSNAVPOLLCLOCKSTATUS input message.

Table 48 Include file gps_messages. h Message id: Value Macro 17 (Ox07) GPS NAV CLOCK STATUS Table 49-Message structure Note: To get a real value of the parameter a value from the structure should be multiplied by the scale factor. tGPSNAVCLOCKSTATUS Structure Data Data range Scale Units Description member type (after de-scaling) factor gpsweekUINT16 1.. 1 Computed full GPS week number. gpstow UINT32 0.. 604799.99 0.01 sec Computed GPS time of the week. sv used cnt UINT8 0.. 12 1 Number of satellites used in solution. elk offsetUINT32 25000.. 146000 1Hz Computed clock offset clk bias UINT32 0 .. 0.1 1e-9 sec Computed clock bias est gps time UINT32 0.. 604799. 999 0. 001 sec Estimated GPS time [0046] The GPS NAV ERROR output message outputs notification, warning, and alert messages.

Table 50 Include file gps_messages. h Message id: Value Macro 10 (OxOA) GPS NAV ERROR Table 51-Message structure tGPSNAVERROR Structure Data Data range Scale Description member type (after de-scaling) factor errid UINT1 O.. OxOFFFn/a Notification code 6 0x1000 OxIFFF n/a Warnin code 0x2000 Ox2FFF n/a Alert code paras ont UINT1 0.. 5 1 Number of 32-bit 6 parameters in param [] param [5] UINT3 UINT32 range n/a Array of information 2 parameters. Meaning depends on error code [0047] The GPSADCODOMETERDATA output message provides ADC, odometer and GPIO lines state from tracker. Message is outputted periodically at 1 or 1 OHz rate depending on setting used in GPS_Start() function.

Table 52 Include file gps_messages. h Message id: Value Macro 45 (Ox2D) GPS ADC ODOMETER DATA Table 53-Message structure tGPSADCODOMETERDATA Structure Data Data range Scale Units Description member type (after de-factor scaling) current time UINT32 >= 0 1 ms Tracker Time, millisecond counts from tracker reset adc2_avg INT16 -8192 .. 8191 1 n/a Averaged measurement from ADC [2] input. See below for voltage formula. adc3_avg INT16 -8192 .. 8191 1 n/a Averaged measurement from ADC [3] input. See below for voltage formula. odo_count UINT16 0 .. 0xFFFF 1 n/a Odometer counter measurement at the most recent 100ms tracker input gpiostat UINT8 0.. OxFF n/a n/a GPIO input states at the most recent 100ms tracker input. Bit field, see below.

Table 54-gpiostat bit field: 7 6 5 4 3 2 1 0 GPI012 GPI08 GPI07 GPI05 GPI04 GPI03 GPI02 GPIOO input input input input input input input input state state state state state state state state Table 55-GPIOxx state: Value Macro Description 0 Input pin xx is in low state 1 Input pin xx is in high state [0048] In one implementation, the Voltage formula is Uin [V] = Vref * ( (adcX_avg + 8192 )/16384), where: Vref = 2. 55V, and adcX_avg is a measurement value from message above. The analog to digital converter may, for example, take measurements at 50Hz rate and the reported value adcX_avg may be an average of the last 5 samples.

[0049] The GPSNAVCOMPLETE output message is sent at the end of the navigation cycle to confirm that the GPS engine has finished a position computation cycle (with or without success). In one implementation, this message is outputted at lHz rate.

Table 56 Include file gps_messages. h Message id: Value Macro 47 (Ox2F) GPS NAV COMPLETE Table 57-Message structure tGPSNAVCOMPLETE Structure Data Data range (after Scale Units Description member type de-scaling) factor control UINT8 0 Not in use. [0050] The GPSNAVTEXT output message outputs debug and development messages in text format.

Table 58 Include file gps_messages. h Message id: Value Macro 255 (OxFF) GPS NAV TEXT Table 59-Message structure tGPSNAVTEXT Structure Data Data range Scale Units Description membertype (after de-scaling) factor msg_text[256] UINT8 ASCII Text of the message characters [0051] The GPSNAVINITIALIZE input message performs GPS engine re-initialization.

Message should be used to perform factory, cold, warm or hot restart.

Table 60 Include file gps_messages. h Message id: Value Macro 128 (0x80) GPS NAV INITIALIZE Table 61-Message structure tGPSNAVINITIALIZE Structure Data Data range (before Scale Units Description member type scaling) factor ecef x SINT32 1 meters Approximate ECEF ecef y SINT32 1 meters position. Those values ecef z SINT32 1 meters are used by warm start with initialization only. clk_offset SINT32 0, 25000 .. 146000 1 Hz Default GPS clock offset. This value is used by the factory re- start only. If zero is provided here a default value of 96250 Hz is used. gps_tow UINT32 0.. 604799 1 sec. Approximate GPS time of the week. This value is used by warm start with initialization only gps week UINT16 0.. 1 Approximate full GPS week number. This value is used by warm start with initialization only. chnl cnt UINT8 12 1 Number of channels to use. restart_flag UINT8 Restart configuration s flags. See below for details.

Table 62-restart flags bit fields : 7 6 5 4 3 2 1 0 reserved reserved Enable reserved Restart mode. See below for allowed 0 0 text 0 values. output Table 63-Restart mode Value Macro Description 0 GPS RESTART HOT Hot restart 2 GPSRESTARTWARMNOINIT Warm restart with no initialization 3 GPS RESTART WARM INIT Warm restart with initialization (fields ecef_x, ecef_y, ecef_z, s tow, s week are used) 6 GPS RESTART COLD Cold restart 8 GPS RESTART FACTORY Facto restart Other value Reserved Table 64-Enable text output: Value Macro Description 0 Development text output (messages GPS NAV TEXT) is disabled 1 GPSRESTARTTEXTOUT Development text output (messages GPS NAV TEXT is enabled [0052] In one implementation, the navigation engine will initiate restart within one second and a default clock offset value is 96250 Hz. When the actual clock offset is unknown a value of 96250 Hz should be used. However, if the real clock offset is far from a specified value a longer TTFF will be observed.

Table 65-Example #include"gps_types. h" #include"gps_interface. h" /* Forces cold start of GPS receiver : */ tGPSNAVINITIALIZE InitMsg ; tGPSUINT32 result ; memset (&InitMsg, 0, sizeof (tGPS_NAV_INITIALIZE)) ; gps init. chnl-cnt = 12 ; gpsinit. restartflags = GPSRESTARTHOT j GPSRESTARTTEXTOUT ; result = GPSInput (GPSNAVINITIALIZE, (void*) &InitMsg, sizeof (tGPS_N~V_INITIALIZE)) ; [0053] The GPSNAVPOLLSWVERSION input message asks for the software version of the position / GPS library.

Table 66 Include file gpsmessages. h Message id: Value Macro 132 (0x84) GPS NAV POLL SW VERSION Table 67-Message structure tGPSNAVPOLLSWVERSION Structure Data Data range Scale Units Description member type (before scaling) factor control UINT8 0 Not in use.

[0054] The software version string may be returned, for example, in a GPSNAVSWVERSION output message via GPS_Output() function.

[0055] The GPSNAVSETDGPSSOURCE input message selects a data source for differential (DGPS) corrections.

Table 68 Include file gps_messages. h Message id: Value Macro 133 Ox85 GPS NAV SET DGPS SOURCE Table 69-Message structure tGPSNAVSETDGPSSOURCE Structure Data type Data range Scale Units Description member (before scaling) factor src UINT8 see below n/a n/a Selects differential correction data source. Default is NONE after factory reset. freq UINT32 0 Internal beacon frequency. Not used, set to 0. bit-rate UINT8 0 Internal beacon bit rate. Not used, set to 0.

Table 70-Differential correction source: Value Macro Description 0 GPS_DGPS_SRC_NONE Differential corrections are not used for navigation GPS DGPS SRC SBAS Selects SBAS as a data source Other value Reserved [0056] These settings may be saved in nonvolatile data storage.

[0057] The GPSNAVPOLLCLOCKSTATUS input message asks for the current GPS clock status of the GPS library.

Table 71 Include file gps_messages. h Message id: Value Macro 144 0x90) GPS NAV POLL CLOCK STATUS Table 72-Message structure tGPS_NAV_POLL_CLOCK_STATUS Structure Data Data range Scale Units Description member type (before scaling) factor control UINT8 0 Not in use. [0058] The clock status data may be returned in GPSNAVCLOCKSTATUS output message via GPSOutput () function. [0059] The GPSNAVSETSBASPRN input message manually forces PRN for use in SBAS corrections.

Table 73 Include file gps_messages. h Message id: Value Macro 170 (OxAA) GPS NAV SET SBAS PRN Table 74-Message structure tGPS NAV SET DGPS MODE Structure Data Data range (before Scale Units Description member e scalin factor prn UINT8 0, 120.. 138 1 PRN number, 0 = Automatic search reserved 0 UINT32 Reserved reserved 1UINT32Reserved [0060] These settings may be saved in permanent data storage.

[0061] The Operating System Interface functions are operating system dependent and are implemented in the open source format available from SiRF Technology, Inc. The functions include Thread, mutex and semaphore functions. Permanent storage and RTC functions may be available depending on hardware availability.

Table 75-Thread control functions Function name Description Provided in OS Thread Create Function creates a thread s rtos. c OS Thread Delete () Function deletes a thread gps rtos. c Function suspends a thread for a gps_rtos. c given time Table 76-Mutex control functions Function name Description Provided in OSMutexCreate () Function creates a mutex object gpsrtos. c - a software critical section OS Mutex Delete Function deletes a mutex object gps rtos. c OS Mutex Enter () Function obtains a mutex object gps rtos. c OS Mutex Exit) Function releases a mutex object gps rtos. c Table 77-Semaphore control functions Function name Description Implemented in OSSemaphoreCreate () Function creates a semaphore gpsrtos. c object OS Semaphore_DeleteO Function deletes a semaphore gpsrtos. c object OS Semaphore Wait () Function waits for a gpsrtos. c semaphore OS Semaphore Release () Functions releases a gpsrtos. c semaphore object Table 78-Permanent storage control functions Function name Description Implemented in OS Storage Open () Functions opens a storage gpsrtos. c system OS Storage Close () Functions closes a storage gpsrtos. c system OS Storage Write () Function writes given words gps_rtos. c to the non-volatile storage area (battery backed RAM, file, registry, etc.) OS_Storage_WriteAll () Function writes all storage gps_rtos. c data to the non-volatile storage area (battery backed RAM, file, registry, etc.) OS_Storage_Read () Function retrieves a data from gps-rtos. c the non-volatile storage area Table 79-Real Time Clock control function Function name Description Implemented in OSRTCRead () Function returns a current time gps_rtos. c from on-board's real time clock.

[0062] The OS Thread Create () function uses an appropriate operating system service to create a thread. The function is called by the GPS engine at the startup to create all desired threads.

Table 80 File gps rtos. c Syntax tGPS_UINT32 OS_Thread_Create(tGPS_UINT32 thread_id, tGPSHANDLE functionptr, tGPSTHREAD *threadhandle) Parameter Data range Units Description thread id Thread macros defined in Identifier of the thread to be gps rtos. h created function ptr Thread function thread handle Handle of the created thread Table 81-Return values Return value Description GPS SUCCESS Thread was created successfully GPS RTOS ERROR An error occurred [0063] A maximum number of desired threads may be specified by a GPSRTOSTHREADMAX define.

[0064] The OS Thread Delete () function uses appropriate OS service to stop a thread and/or to wait for thread to gracefully stop. Function is called by the GPS engine from GPS_Stop() to stop all SiRFNav threads.

Table 82 File gpsrtos. c Syntax tGPS_UINT32 OS_Thread_Delete(tGPS_THREAD thread_handle, tGPS_UINT32 timeout) Parameter Data range Units Description thread handle Thread handle Timeout ms Grace period allowed before terminating the thread Table 83-Return values Return value Description GPS_SUCCESS Thread was deleted successfully GPS_RTOS_ERROR An error occurred [0065] Thread identifiers and functions may be specified, for example, in the gps_rtos. h header file. [0066] The OS_Thread_Sleep() function uses appropriate OS service to suspend a thread for a given number of milliseconds. Function is called by the GPS engine to suspend current thread temporarily.

Table 84 File gps-rtos. c Syntax tGPSUINT32 OSThreadSleep (tGPSUINT32 milliseconds) Parameter Data range Units Description Miliseconds ms Time for what thread will be suspended Table 85-Return values Return value Description GPS SUCCESS Thread sleep has finished successfully [0067] The OS_Mutex_CreateO ffinction uses an operating system service to create a Mutex (mutually exclusive) object, or OS-specific equivalent such as a software critical section.

This function is called by the GPS engine at the startup to create all desired mutexes.

Table 86 File gpsrtos. c Syntax tGPS_UINT32 OS_Mutex_Create(tGPS_MUTEX *mx_handle) Parameter Data range Units Description mxhandle Handle of the created mutex object Table 87-Return values Return value Description GPS SUCCESS Mutex was successfully created GPS RTOS ERROR An error occurred [0068] The maximum number of desired mutexes may be specified by a GPSRTOSMUTEXMAX define.

[0069] The OSMutexDelete () function uses an operating system service to delete a Mutex object. The function is called by the GPS engine at the stopping procedure to delete all used mutexes.

Table 88 File gps-rtos. c Syntax tGPSUINT32 OSMutexDelete (tGPSMUTEX mxhandle) Parameter Data range Units Description mx handleMutex object handle Table 89-Return values Return value Description GPS SUCCESS Mutex was successfully deleted GPS RTOS ERROR An error occurred [0070] The OSMutexEnter () function uses an operating system service to obtain a Mutex object. This function is called by the GPS engine just before entering into a critical section.

Table 90 File gpsrtos. c Syntax tGPS_UINT32 OS_Mutex_Enter(tGPS_MUTEX mx_handle) Parameter Data range Units Description mx handleMutex object handle Table 91-Return values Return value Description GPS SUCCESS Mutex was successfully obtained GPS RTOS ERROR An error occurred [0071] The OS Mutex Exit () function uses appropriate OS service to release a Mutex object.

Function is called by the GPS engine just after leaving from a critical section.

Table 92 File gps_rtos. c Syntax tGPS UINT32 OS Mutex Exit tGPS_MUTEXrnx_handle) Parameter Data range Units Description mx handle Mutex object handle Table 93-Return values Return value Description GPS SUCCESS Mutex was successfully released GPS_RTOS_ERROR An error occurred [0072] The OS_Semaphore_Create() function uses an operating system service to create a Semaphore object. The function is called by the GPS engine at the startup to create all desired semaphores.

Table 94 File gps_rtos. c Syntax tGPS_UINT32 OS_Semaphore_Create(tGPS_SEMAPHORE *sem_handle, tGPSUINT32 initvalue) Parameter Data range Units Description sem handle Handle of the created semaphore object init value any UINT32 Semaphore initialization value Table 95-Return values Return value Description GPS_SUCCESS Semaphore was successfully created GPS RTOS ERROR An error occurred [0073] The maximum number of desired semaphores may specified by a GPSRTOSSBMMAX define.

[0074] The OS Semaphore Delete () function uses an operating system service to delete a Semaphore object. The function is called by the GPS engine at the stopping procedure to delete all used semaphores.

Table 96 File gpsrtos. c Syntax tGPSUINT32 OSSemaphoreDelete (tGPSSEMAPHORE semhandle) Parameter Data range Units Description sem handle Semaphore object handle Table 97-Return values Return value Description GPS SUCCESS Semaphore was successfully deleted GPS RTOS ERROR An error occurred [0075] The OS Semaphore Wait () function uses an operating system service to wait for Semaphore object. Function is called by the GPS threads to wait for events.

Table 98 File gps_rtos. c Syntax tGPSUINT32 OSSemaphoreWait (tGPSSEMAPHORE semhandle, tGPSUINT32 timeout) Parameter Data range Units Description sem handle Semaphore object handle Timeout 0-4000000000 or ms Maximum time allowed to wait GPS INFINITE for semaphore Table 99-Return values Return value Description GPS SUCCESS Semaphore was successfully obtained GPS RTOS ERROR An error occurred GPSRTOSSEMWAITTIMEOUT Waiting for the semaphore has timed out, semaphore was not obtained. [0076] The OS_Semaphore_Release () function uses appropriate OS service to release a Semaphore object. The function is called by the GPS engine to schedule other thread.

Table 100 File gps_rtos. c Syntax tGPSUINT32 OSSemaphoreRelease (tGPSSEMAPHORE semhandle) Parameter Data range Units Description sem_handle Semaphore object handle Table 101 - Return values Return value Description GPS_SUCCESS Semaphore was successfully released GPS RTOS ERROR An error occurred [0077] The OS_Storage_Open() function uses an operating system or BIOS service to open a non volatile storage system. The function is called by the GPS engine at the startup to open a storage.

Table 102 File gps_rtos. c Syntax tGPS_RESULT OS_Storage_Open (void) Parameter Data range Units Description none Table 103-Return values Return value Description GPS SUCCESS Storage has been opened successfully GPS RTOS ERROR An error occurred [0078] When the nonvolatile storage is not available then function may return GPSRTOSERROR.

[0079] The OS Storage Close () function uses appropriate OS or BIOS service to close a non volatile storage system. The function is called by the GPS engine at the shut down procedure to close a storage.

Table 104 File gpsrtos. c Syntax tGPSRESULT OSStorageClose (void) Parameter Data range Units Description none Table 105-Return values Return value Description GPS SUCCESS Storage has been closed successfully GPS RTOS ERROR An error occurred [0080] When the nonvolatile storage is not available then function may return GPSRTOSERROR.

[0081] The OSStorageWrite () function uses appropriate OS or BIOS service to write given words to a non volatile storage system (battery backed RAM, file system, etc.). The function is called by the GPS engine periodically, for example every 30 seconds, to save time, position and ephemeris information. That information is used later to speed up the GPS start procedure (e. g., for hot or warm starts).

Table 106 File gpsrtos. c Syntax tGPSRESULT OSStorageWrite (tGPSUINT32 offset, tGPSUINT16'*data, tGPSLJINT16words) Parameter Data range Units Description offset bytes Offset from the beginning of the storage structure where new data should be written data Pointer to the data to write words 16 bit Number of 16 bit words to words write Table 107-Return values Return value Description GPS SUCCESS Write done successfully GPS RTOS ERROR An error occurred [0082] The OS_Storage_WriteAll0 function uses an operating system or BIOS service to write a GPS data structure to a nonvolatile storage system. The function is called by the GPS engine periodically, for example every 30 seconds, to save time, position and ephemeris information. That information is used later to speed up the GPS start procedure (hot or warm starts) Table 108 File gpsrtos. c Syntax tGPS_RESULT OS_Storage_WriteAll(tGPS_UINT8 *data, tGPSUINT16 length) Parameter Data range Units Description data Pointer to the data to write length bytes Length of the data Table 109-Return values Return value | Description GPS SUCCESS Write done successfully GPS RTOS ERROR An error occurred [00831 The OS_Storage_Read () function uses an operating system or BIOS service to read GPS data structure from a nonvolatile storage system. The function is called by the GPS engine at the startup to retrieve time, position and ephemeris information. This information is used to speed up the GPS start procedure (e. g. , for hot or warm starts).

Table 110 File gps rtos. c Syntax tGPS_RESUL T OS_Storage_Read(tGPS_UINT8 *data, tGPS_UINT16 words) Parameter Data range Units Description data Pointer to the data to read words 16 bit Length of the data words Table 111-Return values Return value Description GPS SUCCESS Read done successfully GPS RTOS ERROR An error occurred [0084) The OSRTCRead () function uses an operating system or BIOS service to read a real time clock information from the host's RTC. The function is called periodically by the GPS engine.

Table 112 File gps_rtos. c Syntax tGPSUINT32 OSRTCRead (tGPSUINT16 *weekno, tGPSUINT32 *timeOfWeek) Parameter Data range Units Description weekno 1 .. GPS full week number timeOfWeek 0 604799999 ms GPS time of the week Table 113-Return values Return value Description GPS SUCCESS Read done successfully GPS RTOS ERROR An error occurred [0085] The tracker communication interface functions allow messages to be sent and received between the tracker hardware and the user programs and position library.

Table 114-tracker communication interface functions Function Description Implemented in GPSCOMMTRKCreate () Creates tracker interface gpscommtrk. c port handle GPSCOMMTRKDelete () Deletes tracker interface gpscommtrk. c port handle GPS COMM TRK Open () Opens and configures gpscommtrk. c tracker port GPSCOMMTRKReopen () Reopens and/or gpscommtrk. c reconfigures tracker port GPS COMM TRK Close) Closes tracker ort s comm trk. c GPSCOMMTRKWait () Waits for data from the gpscommtrk. c tracker GPSCOMMTRKRead () Reads data from the gpscommtrk. c tracker GPSCOMMTRKWrite () Send commands to the gpscommtrk. c tracker [0086] The GPSCOMMTRKCreate () function uses an OS or BIOS service to create a tracker communication handle. The function is called by the GPS engine at the startup to create a communication handle.

Table 115 File gpscommtrk. c Syntax tGPSUINT32 GPSCOMMTRKCreate (tGPSCOMM *porthandle) Parameter Data range Units Description port handle Pointer to the communication port handle Table 116-Return values Return value Description GPS SUCCESS Port handle was successfully created GPS_COMM_ERROR Error creating port handle [0087] The GPS_COMM_TRK_Delete() function uses an OS or BIOS service to delete a tracker communication handle. The function is called by the GPS engine at the stopping procedure to delete a communication handler.

Table 117 File gpscommtrk. c Syntax tGPS_UINT32 GPS_COMM_TRK_Delete(tGPS_COMM port_handle) Parameter Data range Units Description port handle Pointer to the communication port handle Table 118-Return values Returnvalue Descri tion GPS SUCCESS Port handle was successfully deleted GPSCOMMERROR An error occurred while deleting port handle [0088] The GPS_COMM_TRK_Open() function uses an OS or BIOS service to open and configure a tracker communication port. The function is called by the GPS engine at the startup.

Table 11 9 File gpscommtrk. c Syntax tGPS_UINT32 GPS_COMM_TRK_Open(tGPS_COMM port_handle, tGPSUINT32 portnum, tGPSUINT32-baudrate) Parameter Data range Units Description port handle Pointer to the communication port handle portnum Specifies a communication port where tracker is connected to. 1 = serial port 1, 2 = serial port 2,... baud-rate 4800,38400, 57600, bps Specifies a baud rate at which tracker 115200 is connected to. Default 2t tracker baud rate is 38400 bps.

Table 120-Return values Return value Description GPS SUCCESS Port was successfully opened GPSCOMMERROR An error occurred while opening or configuring the port [0089] The GPS_COMM_TRK_Reopen() function uses an OS or BIOS service to re-open a tracker communication port. The function is called by the GPS engine after coming back from a power suspend mode. When power suspend mode is not required then the function may return GPSSUCCESS only.

Table 121 File gpscommtrk. c Syntax tGPS_UINT32 GPS_COMM_TRK_Reopen(tGPS_COMM port_handle Parameter Data range Units Description port_handle Pointer to the communication port handle Table 122-Return values Return value Description GPS SUCCESS Port was successfully re-opened GPS COMM ERROR An error occurred [0090] The GPSCOMMTRKClose () function uses an OS or BIOS service to close a tracker communication port. The function is called by the GPS engine at the stopping procedure to close the port.

Table 123 File gpscommtrk. c Syntax tGPS_UINT32 GPS_COMM_TRK_Close(tGPS_COMM port_handle) Parameter Data range Units Description port handle Pointer to the communication port handle Table 124-Return values Return value | Description GPS SUCCESSPort was successfully closed GPS_COMM_ERROR An error occurred [0091] The GPSCOMMTRKWait () function uses an OS or BIOS services to wait for data from a tracker communication port. The function is called by the GPS engine to wait for the tracker data.

Table 125 File gpscommtrk. c Syntax tGPSUINT32 GPSCOMMTRKWait (tGPSCOMM porthandle, tGPS_UINT32 timeout) ParameterData rangeUnits Description port handle Pointer to the communication port handle timeout 0-4000000000 or ms Timeout value GPS INFINITE Table 126-Return values Return value Description GPS SUCCESS Da-ta from tracker is available GPSCOMMDATANOTAVAILABLE Error : data from tracker was not available within given time [0092] The GPSCOMMTRKRead () function uses appropriate OS or BIOS services to read data from a tracker communication port. The function is called by the GPS engine to read tracker data.

Table 127 File gps_comm_trk. c Syntax tGPSUINT32 GPSCOMMTrkRead (tGPSCOMM porthandle, tGPSUINT8 *data, tGPSUINT32 length, tGPSUINT32 *bytesread) Parameter Data range Units Description port-handle Pointer to the communication port handle data Pointer to the read data length 1 .. 65535 bytes Number of requested bytes bytes_read 0 .. length bytes Number of bytes read Table 128-Return values Return value Description GPS SUCCESS Data read was successful GPS COMM DATA NOT AVAILABLE An error occurred [0093] The GPS_COMM_TRK_Write () function uses appropriate OS or BIOS services to write data to the tracker communication port. The function is called by the GPS engine to send commands to the tracker hardware.

Table 129 File gps_comm_trk. c Syntax tGPSUINT32 GPSCOMMTrkWrite (tGPSCOMM porthandle, tGPSUINT8 *data, tGPSUINT32 length) Parameter Data range Units Description port handle Pointer to the communication port handle data Pointer to the data to send length 1 65535 bytes Number of bytes to send Table 130-Return values Return value Description GPS_SUCCESS Data write was successful GPS COMM ERROR An error occurred [0094) Turning next to Figure 5, that figure shows a block diagram 500 of the cooperation between threads, tasks and hardware in one implementation of a host b ased GPS solution. In particular, the tracker hardware 104 communicates through a serial driver 502 (for example, the Windows CE serial driver). The serial driver 502 communicates and cooperates with a file system 504 (for example, the Windows CE file system), which includes input buffers and output buffers for the communications that will occur.

[0095] Figure 5 shows a pass through data flow path to the tracker hardware 104. The path includes the SendPassThroughDataToTracker thread 506 that forwards data directly from a client program, through a pass through control function 508 to a tracker interface send function 510. In the reception direction, the tracker interface receive function 512 forwards data from the tracker hardware 104 to the navigation/positioning engine queue 514 (if the message is destined for the positioning engine), or to the user interface queue 516 (if the message is destined directly for the user program). The DataForwarder thread 5 18 removes messages from the user interface queue 516 and sends them via the user callback function 520 to the user program. When the host 102 includes the Component Obj ect Module interface (available from Microsoft), the user callback function 520 may be the IcallBack function.

[0096] The receive manager and navigation thread 522 removes messages destined for the GPS library from the positioning engine queue 514, and also places messages destined for the user programs on the user interface queue 516. The messages for the GPS library are processed by the tasks including the NavPeriodicTask 524. A set of shared buffers, control flags, completion flags, and the like 526 are maintained by the GPS library. Finally, it is noted that the COM interface provides a set of control functions 528.

[0097] Turning next to Figure 6, that figure illustrates one execution schedule 600 for the receive manager thread 522 and the NavPeriodicTask 524. In the schedule 600, the NavPeriodicTask 524 runs as a low-priority (background) thread, while the receiver manager and navigation thread 522 run in one normal-priority thread.

[0098] With regard to Figure 7, that figure shows a synchronization diagram 700. The synchronization diagram 700 illustrates the timing and interaction between the threads and tasks shown in Figure 5.

[0099] With reference to Figure 7, receive manager (RxM) and navigation (Nav) run sequentially in one loop that waits for new data from Tracker Interface (TRK IF) Receiver before each iteration. Either RxM or Nav may signals NavPeriodicTask 524 to proceed with one iteration of its loop (unless NavPeriodicTask 524 already performing its task, in which case it will finish the task and skip one loop).

[00100] The RxM and Nav thread 522 may wait on a Critical Section when writing data to the UI Queue 516, or when sending data to Tracker 104. There will typically be a thread running while RxM&Nav are waiting. In one implementation, NavPeriodicTasks 524 runs at smaller priority than the other tasks and it will not run as long as any other thread is running.

In an alternative implementation, NavPeriodicTasks 524 runs at normal priority, but does not present a conflict as long as RxM&Nav have sufficient priority to consume data generated by NavPeriodicTasks 524.

[00101] The RxM and Nav thread 522 runs the RxM control task that maintains a state machine for the Rx and manages the state machine transitions based on current state. The RxM communicates with the tracker hardware 104 through the tracker interface. It both sends data and commands to the tracker hardware 104 to pace it through initial acquisition and tracking of SPS satellites, and receives data and status messages from the receiver with raw SPS satellite tracking data. The primary purpose of the RxM task is to manage and control the operation of the tracker hardware 104. It also preprocesses the raw tracker data and submits the processed data to the Navigation Processing Task. The RxM gets scheduled or called by the Nav Task once the tracker hardware 104 starts tracking.

[00102] The NavPeriodicTasks thread 524 is a pseudo task that peforms miscellaneous support operations for the RxM and Nav tasks. Its functions include determining and performing updates to the satellite state tables, and generating new visible SPS satellite list when new ephemeris data is collected, or whenever it is requested.

[00103] The Nav Processor Thread performs position, velocity and time computations based on the RxM generated individual SPS satellite data. This makes use of the functionality offered through the navigation library in optimally computing the navigation position data.

The computed navigation data is made available to the Data Forwarding thread. At the beginning of each iteration, the Nav Processor calls or schedules the RxM task to run, and then it performs navigation computations and generates the user position, velocity, and time data. Based on the computation results, if pre-selected error thresholds are exceeded, the Nav Processor may send commands to the receiver, either directly or through the RxM, to force the receiver to reset.

[00104] The I/O Reader thread and Tracker Interface Receiver 512 sends data to queues as shown in Figure 5. In addition, data length error checks may be performed with error counts logged in a global variable. Erroneous message bytes will be reported to the user program through debug messages.

[00105] Note that in some implementations, the I/O Writer thread 510 is not used. Instead, its role may been taken by TRK IF, whose methods are invoked from the RxM+Nav thread 522 and SendPassThruDataToTracker 504. TRKIF writes directly to the serial port. (All I/O functions will be grouped into one class). In WinCE, buffering is performed on the File System level, which allows TRKIF to return quickly upon sending data. On Nucleus, additional buffering may be provided.

[00106] The DataForwarderThread 518 reads from the UI Queue 516 and calls the user program's ICallBack interface for each binary message to be sent. If the LJI queue's Semaphore is still signaled after Callback returns, the DataForwarderThread 518 may continue piping data until the UI queue 516 is empty. In one implementation, the UI Queue 516 is not locked while Callback is being executed, which allows other threads to run while waiting for Callback to return. Client Callback typically puts data in internal storage for another thread to use. Generally, one Callback is called at a time. The UI Qusue 516 is prioritized and it will put pass-thru messages before all others in the queue.

[00107] The SendPassThruDataToTracker function 506 is an API call for sending pass- thru messages from the user program to the tracker hardware 104. Note that the pass through control function 504 may be implemented as a filter to enable or disable pass-thru nessages.

[00108] A Shutdown may be performed by purging all queues and I/O. For example, 300ms (enough for RxM&Nav to complete) may then be given for threads to complete.

Although some threads may not complete in that time, such as the DataForwarderThread 518 (that may be waiting for Callback to return), and NavPeriodicTask 524, for which there may or may not be a provision to interrupt long-term calculations. Regardless, threads which do not complete on time are terminated.

[00109] The following synchronization objects may be used: a Semaphore arsd Critical Seciton in UI Queue 516 for triggering UI output, a Semaphore and Critical Section in Trk2Nav Queue 514 for triggering Nav update, a Positioning/Navigation Library sync flag (from NavPeriodTasks to RxM and Nav), and a shutdown semaphore and flag. Note that the Critical Section (s) in the Tracker Interface are for protecting access to the serial port.

[00110] Queues may have the following API and features: Constructor/destrgctor, void *GetBuffer (int priority, long size) to obtain a pre-allocated buffer for Put (), void Put () to queues the buffer with specified priority, void *BeginGet () to waits until data ready or shutdown, void EndGet (), void Remove (), void Purge () to cancel all BeginGet calls, an internal Semaphore for notifying BeginGet () when data is ready, and an internal Critical Section.

[00111] With regard to error checking, all queue overruns, I/O errors, timeouts and COM errors may optionally be reported to client, packaged in debug messages, UI queue 516 overruns will be reported as an error to user program, Tracker message time-outs may be handled by Nav, and Trk2Nav Queue 514 overruns may be signaled to RxM and Nav.

[00112] It is further noted that the Windows registry may provide a mechanism for configuring thread priorities (that may, for example, be set once at startup and remain unchanged during execution), I/O buffer sizes, and queue sizes. Note that the SetupComm () function may be used to increase the size of existing WinCE I/O buffers. Doing so prevents input data loss under stress conditions. This may also be configurable through registry, and default values may be chosen to accommodate several seconds of I/O (e. g. , 4kb for input and lkb for output).

[00113] The foregoing description of an implementation of the invention has been presented for purposes of illustration and description. It is not exhaustive and does not limit the invention to the precise form disclosed. Modifications and variations are possible in light of the above teachings or may be acquired from practicing of the invention. For example, the described implementation includes software but the present invention may be implemented as a combination of hardware and software or in hardware alone. Note also that the implementation may vary between systems. The invention may be implemented with both object-oriented and non-object-oriented programming systems. The claims and their equivalents define the scope of the invention.