Functions that provide access to symbol time. One symbol period is 16 microseconds.

See Symbol Timer Control for documentation.

License#

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

The licensor of this software is Silicon Laboratories Inc. Your use of this software is governed by the terms of Silicon Labs Master Software License Agreement (MSLA) available at www.silabs.com/about-us/legal/master-software-license-agreement. This software is distributed to you in Source Code format and is governed by the sections of the MSLA applicable to Source Code.

/***************************************************************************/
#ifndef __SYMBOL_TIMER_H__
#define __SYMBOL_TIMER_H__


void halInternalStartSymbolTimer(void);

uint32_t halStackGetInt32uSymbolTick(void);

// New API:

bool halStackInt32uSymbolTickGTorEqual(uint32_t st1, uint32_t st2);

uint32_t halStackGetSymbolTicksPerSecond(void);


// New API:

typedef enum {
  EM_HAL_SYMBOL_DELAY_CHANNEL_A,  // 0
  EM_HAL_SYMBOL_DELAY_CHANNEL_B,  // 1
  EM_HAL_SYMBOL_DELAY_CHANNELS    // Must be last
} EmHalSymbolDelayChannel_t;

typedef void (*EmHalSymbolDelayCallback_t)(EmHalSymbolDelayChannel_t delayChan);

uint32_t halStackOrderSymbolDelay(EmHalSymbolDelayChannel_t delayChan,
                                  EmHalSymbolDelayCallback_t callback,
                                  uint32_t microseconds);

void halStackCancelSymbolDelay(EmHalSymbolDelayChannel_t delayChan,
                               EmHalSymbolDelayCallback_t callback);

// Old API below is deprecated; retained for backwards-compatibility only:

void halStackOrderInt16uSymbolDelayA(uint16_t symbols);

void halStackCancelSymbolDelayA(void);

void halStackSymbolDelayAIsr(void);

#endif //__SYMBOL_TIMER_H__

Symbol Timer Functions#

void

Initializes the symbol timer. When a dedicated symbol timer peripheral exists (e.g. EM2xx, EM3xx) this initialization is generally performed directly by the PHY, so this routine may be a no-op.

uint32_t

Returns the current symbol time in symbol ticks (units are platform-dependent, but typically on the order of microseconds).

bool
halStackInt32uSymbolTickGTorEqual(uint32_t st1, uint32_t st2)

Returns true if symbol tick time st1 is greater than symbol tick time st2, as determined by half the range of the symbol timer. Can only account for 1 wrap around between st1 and st2 before it is wrong.

uint32_t

Obtains the number of symtol timer ticks in one second of real time. Can be used for conversion between real time and symbol ticks.

MAC Timer Support Functions#

These functions are used for MAC layer timing and symbol-based delays.Applications should not directly call these functions. They are used internally by the operation of the stack.

enum
EM_HAL_SYMBOL_DELAY_CHANNEL_A
EM_HAL_SYMBOL_DELAY_CHANNEL_B
EM_HAL_SYMBOL_DELAY_CHANNELS
}

Specifies two independent channels for symbol delay operations.

typedef void(*
EmHalSymbolDelayCallback_t)(EmHalSymbolDelayChannel_t delayChan)

Specifies the callback API triggered when the symbol timer channel expires.

uint32_t
halStackOrderSymbolDelay(EmHalSymbolDelayChannel_t delayChan, EmHalSymbolDelayCallback_t callback, uint32_t microseconds)

Sets up a delay timer to call the indicated interrupt-context callback when it expires.

void
halStackCancelSymbolDelay(EmHalSymbolDelayChannel_t delayChan, EmHalSymbolDelayCallback_t callback)

Cancels the delay set up by an earlier halStackOrderSymbolDelay() call.

void

Sets up a timer and calls an interrupt-context callback when it expires.

void
void

This is the interrupt level callback into the stack that is called when the timers set by halStackOrderInt16uSymbolDelayA expire.

Symbol Timer Functions Documentation#

halInternalStartSymbolTimer#

void halInternalStartSymbolTimer (void )

Initializes the symbol timer. When a dedicated symbol timer peripheral exists (e.g. EM2xx, EM3xx) this initialization is generally performed directly by the PHY, so this routine may be a no-op.

Parameters
N/A

Definition at line 36 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackGetInt32uSymbolTick#

uint32_t halStackGetInt32uSymbolTick (void )

Returns the current symbol time in symbol ticks (units are platform-dependent, but typically on the order of microseconds).

Parameters
N/A

Returns

  • The least significant 32 bits of the current symbol time in symbol timer ticks.


Definition at line 43 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackInt32uSymbolTickGTorEqual#

bool halStackInt32uSymbolTickGTorEqual (uint32_t st1, uint32_t st2)

Returns true if symbol tick time st1 is greater than symbol tick time st2, as determined by half the range of the symbol timer. Can only account for 1 wrap around between st1 and st2 before it is wrong.

Parameters
N/Ast1
N/Ast2

Definition at line 51 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackGetSymbolTicksPerSecond#

uint32_t halStackGetSymbolTicksPerSecond (void )

Obtains the number of symtol timer ticks in one second of real time. Can be used for conversion between real time and symbol ticks.

Parameters
N/A

Returns

  • How many symbol ticks occur in a second.


Definition at line 58 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

MAC Timer Support Functions Documentation#

EmHalSymbolDelayChannel_t#

EmHalSymbolDelayChannel_t

Specifies two independent channels for symbol delay operations.

Enumerator
EM_HAL_SYMBOL_DELAY_CHANNEL_A
EM_HAL_SYMBOL_DELAY_CHANNEL_B
EM_HAL_SYMBOL_DELAY_CHANNELS

Definition at line 74 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

EmHalSymbolDelayCallback_t#

typedef void(* EmHalSymbolDelayCallback_t) (EmHalSymbolDelayChannel_t delayChan) )(EmHalSymbolDelayChannel_t delayChan)

Specifies the callback API triggered when the symbol timer channel expires.


Definition at line 83 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackOrderSymbolDelay#

uint32_t halStackOrderSymbolDelay (EmHalSymbolDelayChannel_t delayChan, EmHalSymbolDelayCallback_t callback, uint32_t microseconds)

Sets up a delay timer to call the indicated interrupt-context callback when it expires.

Parameters
N/AdelayChan

The symbol timer delay channel to use.

N/Acallback

The callback to call in interrupt context when the delay expires. If NULL, the timer is not actually started, but the return value is accurate; useful for polling.

N/Amicroseconds

The delay, in units of microseconds.

Used by the MAC to request an interrupt callback at a specified number of symbol timer ticks in the future.

Returns

  • The absolute symbol tick value of the delay (usually in the future).

Note

  • Internal conversion of microseconds to symbol ticks will use a rounding function.

  • No minimum delay is enforced; short delays may trigger the callback immediately, before this routine returns to its caller.


Definition at line 104 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackCancelSymbolDelay#

void halStackCancelSymbolDelay (EmHalSymbolDelayChannel_t delayChan, EmHalSymbolDelayCallback_t callback)

Cancels the delay set up by an earlier halStackOrderSymbolDelay() call.

Parameters
N/AdelayChan

The symbol timer delay channel specified in the earlier halStackOrderSymbolDelay() call.

N/Acallback

The callback specified in the earlier halStackOrderSymbolDelay() call.

Note

  • If cancelled prior to the delay expiring, the original callback will not be called.


Definition at line 119 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackOrderInt16uSymbolDelayA#

void halStackOrderInt16uSymbolDelayA (uint16_t symbols)

Sets up a timer and calls an interrupt-context callback when it expires.

Parameters
N/Asymbols

The delay, in symbols.

Used by the MAC to request an interrupt callback at a specified amount of time in the future.


Definition at line 132 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackCancelSymbolDelayA#

void halStackCancelSymbolDelayA (void )

Cancels the timer set up by halStackOrderInt16uSymbolDelayA().

Parameters
N/A

Definition at line 136 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h

halStackSymbolDelayAIsr#

void halStackSymbolDelayAIsr (void )

This is the interrupt level callback into the stack that is called when the timers set by halStackOrderInt16uSymbolDelayA expire.

Parameters
N/A

Definition at line 141 of file /Users/vihuszar/Git/EmbeddedSoftware/super/platform/base/hal/micro/symbol-timer.h