mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
efuse: Adds support structure of efuses in efuse_table
Supported a new format of efuse description using '.' in the name. It means that RD_DIS.KEYx belongs to the range of the RD_DIS name. RD_DIS, EFUSE_BLK0, 32, 7, Read protection RD_DIS.KEY0, EFUSE_BLK0, 32, 1, Read protection for EFUSE_BLK4. RD_DIS.KEY1, EFUSE_BLK0, 33, 1, Read protection for EFUSE_BLK5.
This commit is contained in:

committed by
bot

parent
ff29aded19
commit
29f853633d
@@ -155,7 +155,7 @@ name1, EFUSE_BLK3, 1,
|
||||
name2, EFUSE_BLK3, 5, 4, Use for test name 2
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'overlap'):
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'intersected with'):
|
||||
t.verify()
|
||||
|
||||
def test_empty_field_name_fail(self):
|
||||
@@ -305,16 +305,6 @@ name2_1, EFUSE_BLK2, 5,
|
||||
self.assertEqual(t[3].bit_start, 5)
|
||||
self.assertEqual(t[3].bit_count, 4)
|
||||
|
||||
def test_custom_use_only_BLK3(self):
|
||||
csv = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
name1, EFUSE_BLK3, 0, 5, Use for test name 1
|
||||
name2, EFUSE_BLK2, 5, 4, Use for test name 2
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
with self.assertRaisesRegex(efuse_table_gen.ValidationError, 'custom_table should use only EFUSE_BLK3'):
|
||||
t.verify('custom_table')
|
||||
|
||||
def test_common_and_custom_table_use_the_same_bits(self):
|
||||
csv_common = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
@@ -334,9 +324,134 @@ name4, EFUSE_BLK3, 4,
|
||||
custom_table.verify('custom_table')
|
||||
|
||||
two_tables += custom_table
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'overlaps'):
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'intersected with'):
|
||||
two_tables.verify()
|
||||
|
||||
def test_common_and_custom_table_use_nested_fields(self):
|
||||
csv_common = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
namet1, EFUSE_BLK3, 0, 5, comment
|
||||
namet2, EFUSE_BLK1, 8, 4, comment
|
||||
"""
|
||||
common_table = efuse_table_gen.FuseTable.from_csv(csv_common)
|
||||
common_table.verify('common_table')
|
||||
two_tables = common_table
|
||||
|
||||
csv_custom = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
namet1.D1, EFUSE_BLK3, 0, 2, comment
|
||||
namet1.D1.D11, EFUSE_BLK3, 0, 1, comment
|
||||
namet1.D1.D12, EFUSE_BLK3, 1, 1, comment
|
||||
namet1.D2, EFUSE_BLK3, 2, 3, comment
|
||||
namet2.F1, EFUSE_BLK1, 9, 1, comment
|
||||
"""
|
||||
custom_table = efuse_table_gen.FuseTable.from_csv(csv_custom)
|
||||
custom_table.verify('custom_table')
|
||||
|
||||
two_tables += custom_table
|
||||
two_tables.verify()
|
||||
|
||||
def test_common_and_custom_table_use_nested_fields2(self):
|
||||
csv_common = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
namet3, EFUSE_BLK3, 0, 5, comment
|
||||
namet2, EFUSE_BLK1, 8, 4, comment
|
||||
"""
|
||||
common_table = efuse_table_gen.FuseTable.from_csv(csv_common)
|
||||
common_table.verify('common_table')
|
||||
two_tables = common_table
|
||||
|
||||
csv_custom = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
namet1.D1, EFUSE_BLK3, 0, 2, comment
|
||||
namet1.D1.D11, EFUSE_BLK3, 0, 1, comment
|
||||
namet1.D1.D12, EFUSE_BLK3, 1, 1, comment
|
||||
namet1.D2, EFUSE_BLK3, 2, 3, comment
|
||||
namet2.F1, EFUSE_BLK1, 9, 1, comment
|
||||
"""
|
||||
custom_table = efuse_table_gen.FuseTable.from_csv(csv_custom)
|
||||
custom_table.verify('custom_table')
|
||||
|
||||
two_tables += custom_table
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'namet1 is not found'):
|
||||
two_tables.verify()
|
||||
|
||||
def test_nested_fields1(self):
|
||||
csv = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
name1, EFUSE_BLK3, 0, 5, comment
|
||||
name1.D1, EFUSE_BLK3, 0, 4, comment
|
||||
name1.D1.D2, EFUSE_BLK3, 0, 3, comment
|
||||
name1.D1.D2.D3, EFUSE_BLK3, 0, 2, comment
|
||||
name1.D1.D2.D3.D4, EFUSE_BLK3, 0, 1, comment
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
t.verify()
|
||||
|
||||
for i in range(0, 5):
|
||||
self.assertEqual(t[i].bit_start, 0)
|
||||
self.assertEqual(t[i].bit_count, 5 - i)
|
||||
|
||||
def test_nested_fields2(self):
|
||||
csv = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
name1, EFUSE_BLK3, 0, 5, comment
|
||||
name1.D1, EFUSE_BLK3, 1, 4, comment
|
||||
name1.D1.D2, EFUSE_BLK3, 2, 3, comment
|
||||
name1.D1.D2.D3, EFUSE_BLK3, 3, 2, comment
|
||||
name1.D1.D2.D3.D4, EFUSE_BLK3, 4, 1, comment
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
t.verify()
|
||||
|
||||
for i in range(0, 5):
|
||||
self.assertEqual(t[i].bit_start, i)
|
||||
self.assertEqual(t[i].bit_count, 5 - i)
|
||||
|
||||
def test_nested_fields_fail1(self):
|
||||
csv = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
name1, EFUSE_BLK3, 0, 5, comment
|
||||
name1.D1, EFUSE_BLK3, 1, 4, comment
|
||||
name1.D1.D2, EFUSE_BLK3, 0, 1, comment
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'out of range'):
|
||||
t.verify()
|
||||
|
||||
def test_nested_fields_fail2(self):
|
||||
csv = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
name1, EFUSE_BLK3, 0, 5, comment
|
||||
namet2, EFUSE_BLK2, 8, 4, comment
|
||||
namet2.F1, EFUSE_BLK2, 5, 4, comment
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'intersected with'):
|
||||
t.verify()
|
||||
|
||||
def test_nested_fields_fail3(self):
|
||||
csv = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
name1, EFUSE_BLK3, 10, 5, comment
|
||||
name11, EFUSE_BLK3, 5, 1, comment
|
||||
namet2.F1, EFUSE_BLK2, 22, 1, comment
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'namet2 is not found'):
|
||||
t.verify()
|
||||
|
||||
def test_nested_fields_fail4(self):
|
||||
csv = """
|
||||
# field_name, efuse_block(EFUSE_BLK0..EFUSE_BLK3), bit_start(0..255), bit_count, comment
|
||||
name1, EFUSE_BLK3, 10, 5, comment
|
||||
name2, EFUSE_BLK3, 5, 1, comment
|
||||
name2.F1, EFUSE_BLK2, 22, 1, comment
|
||||
"""
|
||||
t = efuse_table_gen.FuseTable.from_csv(csv)
|
||||
with self.assertRaisesRegex(efuse_table_gen.InputError, 'name2 is not found'):
|
||||
t.verify()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
Reference in New Issue
Block a user