Skip to content

AnmiTaliDev/qemu-tmp117-virtio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

qemu-tmp117-virtio

QEMU fork adding emulation of the TI TMP117 high-accuracy digital temperature sensor.

Note

This repository contains only the TMP117 device files. The full QEMU source tree is not included. To build, clone the upstream QEMU repository and apply these files on top:

git clone https://gitlab.com/qemu-project/qemu.git

Then copy hw/sensor/tmp117.c, include/hw/sensor/tmp117.h and the corresponding Kconfig and meson.build entries into the cloned tree.

Usage

Add the sensor to an I2C bus in the machine definition or via the QEMU command line:

-device tmp117,bus=i2c-bus.0,address=0x48

Set the temperature at runtime via QMP (units: 1/128 degrees C):

{ "execute": "qom-set",
  "arguments": { "path": "/machine/.../tmp117",
                 "property": "temperature",
                 "value": 3200 } }

3200 / 128 = 25 °C.

Register Map

Address Name Access Reset Description
0x00 Temp_Result R 0x8000 Temperature result (read-only)
0x01 Configuration R/W 0x0220 Mode, averaging, alert config
0x02 THigh_Limit R/W 0x6000 High temperature alert limit
0x03 TLow_Limit R/W 0x8000 Low temperature alert limit
0x04 EEPROM_UL R/W 0x0000 EEPROM unlock register
0x05 EEPROM1 R/W General-purpose EEPROM
0x06 EEPROM2 R/W General-purpose EEPROM
0x07 Temp_Offset R/W 0x0000 Temperature offset
0x08 EEPROM3 R/W General-purpose EEPROM
0x0F Device_ID R 0x0117 Device identifier (read-only)

Temperature LSB = 7.8125 m°C = 1/128 °C.

License

GPL-2.0-or-later. See COPYING in the QEMU source tree.

About

QEMU TMP117 temperature sensor device emulation

Topics

Resources

License

Stars

Watchers

Forks

Contributors