The functions declared in the file glgps_hal.h abstract the platform from the GLCT.
The easiest way to implement GLHAL for your platform is to copy the complete content of the glhal/cygwin directory to the glhal/YOURTARGET and begin modifications.
You may want to begin by implementing the functions GpsHalCreateHal() and GpsHalDestroy(). The first function is called by the library before any use is made of the hardware abstraction layer and provides an opportunity for any needed initialization. The second function is called when the library no longer requires the HAL.
Next we recommend implementing GpsHalDiagLine() API. The function provides a means for the platform to receive and log diagnostic messages from the GPS library. These are required to debug the software during the integration process. The output from the diagnostic stream can be recorded in a file or output through a diagnostic port. Most customers utilize a pre-existing debug capability and add in the GPS messages into the stream.
The next item to implement is the serial interface between the chip and the platform. Most chips support three different types of interface: UART, SPI, or I2C. All of these require an implementation of the following three functions.
The next recommended step is to implement GpsHalGetTimer() API. For this function you will need to identify a timer that has a resolution of 100ms (or finer) and is accurate to 1%.
In order to do fast GPS first starts, you will need to provide the library with the ability to store and read data to some non volatile storage (the maximum size needed to store all the information is less than 9K bytes). For this purpose you should provide functions compliant with these APIs:
If you plan to use the LTO feature you should also provide functions to manage LTO files. Note your application will not need to deal with the content or structure of the LTO file. Your application has the responsibility for keeping these files updated. Navigate to http://gllto.glpals.com/7day/v2/latest and download lto2.dat.
Many application make use of NMEA data as an interface. The library generates NMEA data and provides it through the HAL. To receive the NMEA string you will need to implement these APIs:
Bad things can happen, right? You should provide an implementation for this one, generally some type of task restart or total platform reset.
The following advanced APIs will need to be implemented if your platform can supply frequency offset information regarding the reference frequency used to drive the GPS chip: