SWRA704 June   2021 CC3120 , CC3130 , CC3135

 

  1.   Trademarks
  2. 1Introduction
  3. 2Porting the Host Driver
    1. 2.1 Porting Layer Files
    2. 2.2 Driver Enable/Disable
    3. 2.3 SPI Interface
      1. 2.3.1 Hardware Setup and Configuring Clocks
    4. 2.4 Memory Management
    5. 2.5 OS Abstraction: FreeRTOS
    6. 2.6 Timestamp Mechanism
    7. 2.7 Asynchronous Event Handler Routines
  4. 3Tips for Porting
    1. 3.1 Hardware Setup
    2. 3.2 Servicepack
    3. 3.3 Starting the Wi-Fi Driver in the Application Code
    4. 3.4 Configuring Clocks on the STM32L4
    5. 3.5 Terminal I/O Printing
    6. 3.6 Location of the Host Driver and Porting Files
    7. 3.7 Updating to the Latest Host Driver Version
  5. 4References
  6. 5License Information

Timestamp Mechanism

The timestamp mechanism is required in the SimpleLink host driver. This timestamp is used to determine a timeout when the network processor does not respond.

This example uses the FreeRTOS APIs to get the tick period and the current tick count in order to calculate a timestamp.

user.h:

#define SL_TIMESTAMP_TICKS_IN_10_MILLISECONDS (10000 / ClockP_getSystemTickPeriod())
#define slcb_GetTimestamp TimerGetCurrentTimestamp

cc_pal.c:

uint32_t ClockP_getSystemTickPeriod()
{
    uint32_t tickPeriodUs;

    /*
     *  Tick period in microseconds. configTICK_RATE_HZ is defined in the
     *  application's FreeRTOSConfig.h, which is include by FreeRTOS.h
     */
    tickPeriodUs = 1000000 / configTICK_RATE_HZ;

    return tickPeriodUs;
}

unsigned long TimerGetCurrentTimestamp()
{
    return ((uint32_t)xTaskGetTickCount());
}