Hardware Abstraction Layer (HAL)

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.

  • GpsHalOpen() is called by the library before any use is made of the serial port; this function provides an opportunity for you to perform initialization of the port. Your HAL should enable the GPS device when GpsHalOpen() is called. If the device is held in reset state, the reset should be removed, by setting nRESET for BCM4750 (RST_N for BCM4751) to logic level "1". Then set nSTANDBY to logic level "1". For BCM4751, equivalent pin is REGPU. Consult the datasheet for other chips and timing requirements. It is required to induce a delay (usually 100 msec) after the nSTANDBY/REGPU is set high before starting the host-interface data traffic.
  • GpsHalWaitForEvent() is a function that your application will call to suspend while waiting for events. The basic library requires the ability to deal with two events:
    1. incoming bytes from the serial communication link;
    2. a platform timer. If using the GPS control software a third event is a character from the command stream used by the application to control the software. In most applications the implementation of this function sleeps the task incorporating GPS until one of the events becomes available.
  • GpsHalChipsetWrite() is a function the library will call when it needs to send serial data to the chip
  • GpsHalClose() is called by the library when the GLL is done with the serial port; this function provides an opportunity for you to release resources associated with the port. Your HAL should disable the GPS device when GpsHalClose() is called. For BCM4750, this means setting nSTANDBY to logic level "0". The GPS device should NOT be reset when GpsHalClose() is called.

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:

 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines