winIDEA SDK
test_storage_emmc_is_device_empty.py
1# This script is licensed under BSD License, see file LICENSE.txt.
2#
3# (c) TASKING Germany GmbH, 2023
4
5import isystem.connect as ic
6
7
8winidea_id = ''
9
10
11def test_isDeviceEmpty():
12 connMgr = ic.ConnectionMgr()
13 connMgr.connect(ic.CConnectionConfig().instanceId(winidea_id))
14
15 devName = "eMMCtest"
16 partitionName = "Boot1"
17
18 storageCtrl = ic.CStorageDeviceFactory.makeDevice(connMgr, ic.EStorageDevice_EMMCDevice, devName, partitionName)
19
20 isEmpty = storageCtrl.isDeviceEmpty()
21 print(f"Is entire partition with name {partitionName} empty: {isEmpty}")
22
23 isEmpty = storageCtrl.isDeviceEmpty(0x0, 8)
24 print(f"Is 8 bytes at address 0x0 in partition with name {partitionName} empty: {isEmpty}")
25
26 ic.CStorageDeviceFactory.terminateDevice(connMgr, ic.EStorageDevice_EMMCDevice, devName)
27
28
29if __name__ == "__main__":
30 test_isDeviceEmpty()