ulink_calculate_delay() is only used within OpenOCD.
 
Symbols
loading...
Files
loading...
CodeScopeDevelopment ToolsOpenOCDulink_calculate_delay()

ulink_calculate_delay() function

OpenULINK TCK frequency helper functions ***************** Calculate delay values for a given TCK frequency. The OpenULINK firmware uses five different speed values for different commands. These speed values are calculated in these functions. The five different commands which support variable TCK frequency are implemented twice in the firmware: 1. Maximum possible frequency without any artificial delay 2. Variable frequency with artificial linear delay loop To set the ULINK to maximum frequency, it is only necessary to use the corresponding command IDs. To set the ULINK to a lower frequency, the delay loop top values have to be calculated first. Then, a CMD_CONFIGURE_TCK_FREQ command needs to be sent to the ULINK device. The delay values are described by linear equations: t = k * x + d (t = period, k = constant, x = delay value, d = constant) Thus, the delay can be calculated as in the following equation: x = (t - d) / k The constants in these equations have been determined and validated by measuring the frequency resulting from different delay values.

Syntax

static int ulink_calculate_delay(enum ulink_delay_type type,     long f,     int *delay);
Implemented in ulink.c:1282

Arguments

type

for which command to calculate the delay value.

f

TCK frequency for which to calculate the delay value in Hz.

delay

where to store resulting delay value.

Return value

on success: ERROR_OK on failure: ERROR_FAIL

References

LocationReferrerText
ulink.c:1282
static int ulink_calculate_delay(enum ulink_delay_type type, long f, int *delay)
ulink.c:212
static int ulink_calculate_delay(enum ulink_delay_type type, long f, int *delay);
ulink.c:1986ulink_khz()
ret = ulink_calculate_delay(DELAY_CLOCK_TCK, khz * 1000,
ulink.c:2002ulink_khz()
ret = ulink_calculate_delay(DELAY_CLOCK_TMS, khz * 1000,
ulink.c:2007ulink_khz()
ret = ulink_calculate_delay(DELAY_SCAN_IN, khz * 1000,
ulink.c:2012ulink_khz()
ret = ulink_calculate_delay(DELAY_SCAN_OUT, khz * 1000,
ulink.c:2017ulink_khz()
ret = ulink_calculate_delay(DELAY_SCAN_IO, khz * 1000,

Call Tree

Functions calling ulink_calculate_delay()
Functions called by ulink_calculate_delay()
all items filtered out
ulink_calculate_delay()
ceilf()
all items filtered out
Data read by ulink_calculate_delay()
Data written by ulink_calculate_delay()
ulink_calculate_delay()
ulink_calculate_delay()::t
ulink_calculate_delay()::x
ulink_calculate_delay()::x_ceil
all items filtered out