Real-Time Embedded Multithreading: Using ThreadX and ARM

Appendix I: Internal System Clock Services

Overview

The time services described in this appendix are:

tx_time_get

Retrieves the current time

tx_time_set

Sets the current time

tx_time_get

Retrieves the current time

Prototype

ULONG <b class="bold">tx_time_get</b>(VOID)

Description

This service returns the contents of the internal system clock. Each timer-tick increases the internal system clock count by one. The system clock is set to zero during initialization and can be changed to a specific value by the service tx_time_set.

Note

The physical time interval each timer-tick represents is application-specific.

Parameters

None

Return Values

system clock ticks

Value of the internal, free running, system clock.

Allowed From

Initialization, threads, timers, and ISRs

Preemption Possible

No

Example

ULONG current_time;/* Pickup the current system time, in timer-ticks. */current_time = <b class="bold">tx_time_get</b>();/* Current time now contains a copy of the internal system clock. */

tx_time_set

Sets the current time

Prototype

VOID <b class="bold">tx_time_set</b>(ULONG <b class="bold">new_time</b>)

Description

This service sets the internal system clock to the specified value. Each subsequent timer- tick increases the internal system clock count by one.

Note

The physical time interval each timer-tick represents is application-specific.

Input Parameter

new_time

New time to put in the system clock, legal values range from 0 to 0xFFFFFFFF (inclusive).

Return Values

None

Allowed From

Threads, timers, and ISRs

Preemption Possible

No

Example

/* Set the internal system time to 0x1234. */<b class="bold">tx_time_set</b>(0x1234);/* Current time now contains 0x1234 until the next timer interrupt. */

UNLIMITED FREE
ACCESS
TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Digital Parallel and Serial Converters
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.