tests/intel_adsp: Add clock calibration test

Now that we have easy access to code on the host, it's trivial to
check the clock against host timestamps with high precision.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2022-01-23 18:48:28 -08:00 committed by Anas Nashif
commit 3da9c9213e
5 changed files with 55 additions and 1 deletions

View file

@ -324,6 +324,8 @@ async def ipc_delay_done():
await asyncio.sleep(0.1)
dsp.HIPCTDA = 1<<31
ipc_timestamp = 0
# Super-simple command language, driven by the test code on the DSP
def ipc_command(data, ext_data):
send_msg = False
@ -338,6 +340,12 @@ def ipc_command(data, ext_data):
send_msg = True
elif data == 3: # set ADSPCS
dsp.ADSPCS = ext_data
elif data == 4: # echo back microseconds since last timestamp command
global ipc_timestamp
t = round(time.time() * 1e6)
ext_data = t - ipc_timestamp
ipc_timestamp = t
send_msg = True
else:
log.warning(f"cavstool: Unrecognized IPC command 0x{data:x} ext 0x{ext_data:x}")