remote_csr: add sanity check of CSR CSV type column

pull/922/head
Sebastien Bourdeauducq 2018-02-13 19:54:51 +08:00
parent e67a289e2b
commit 96b948f57f
1 changed files with 6 additions and 1 deletions

View File

@ -13,7 +13,12 @@ def _get_csr_data(csv_file):
region_name, csr_name = name.split(".")
address = int(address, 0)
length = int(length, 0)
ro = ro == "ro"
if ro == "ro":
ro = True
elif ro == "rw":
ro = False
else:
raise ValueError
if region_name not in csr_data:
csr_data[region_name] = []
csr_data[region_name].append((csr_name, address, length, ro))