Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions scripts/drivers.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def bfs_search_files(search_path):

# Remove registers with address ranges from list
def filter_table(table):
filtered_table = [i for i in table if i['log2n_items'] == 0]
filtered_table = [i for i in table if i["log2n_items"] == 0]
return filtered_table


Expand Down Expand Up @@ -68,7 +68,7 @@ def write_linux_swheader(mkregs_obj, table, out_dir, top):
fswhdr.write("\n")

fswhdr.write("//used address space width\n")
fswhdr.write(f"#define {core_prefix}_SWREG_ADDR_W {mkregs_obj.core_addr_w}\n\n")
fswhdr.write(f"#define {core_prefix}_CSRS_ADDR_W {mkregs_obj.core_addr_w}\n\n")

Comment on lines +71 to 72
Copy link

Copilot AI Aug 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The macro name change from _SWREG_ADDR_W to _CSRS_ADDR_W could be a breaking change for existing code that depends on this header file. Ensure that all consumers of this generated header are updated to use the new macro name.

Suggested change
fswhdr.write(f"#define {core_prefix}_CSRS_ADDR_W {mkregs_obj.core_addr_w}\n\n")
fswhdr.write(f"#define {core_prefix}_CSRS_ADDR_W {mkregs_obj.core_addr_w}\n")
fswhdr.write(f"#define {core_prefix}_SWREG_ADDR_W {core_prefix}_CSRS_ADDR_W\n\n")

Copilot uses AI. Check for mistakes.
fswhdr.write("//Addresses\n")
for row in table:
Expand Down Expand Up @@ -133,7 +133,9 @@ def write_linux_sysfs_header(table, out_dir, top, multi=False):
)
fswhdr.write("\tu32 value = 0;\n")
if multi:
fswhdr.write(f"\tstruct iob_data *{top}_data = (struct iob_data*) dev->platform_data;\n")
fswhdr.write(
f"\tstruct iob_data *{top}_data = (struct iob_data*) dev->platform_data;\n"
)
fswhdr.write(f"\tif (!mutex_trylock(&{top}_mutex)) {{\n")
fswhdr.write('\t\tpr_info("Another process is accessing the device\\n");\n')
fswhdr.write("\t\treturn -EBUSY;\n")
Expand All @@ -157,7 +159,9 @@ def write_linux_sysfs_header(table, out_dir, top, multi=False):
f"static ssize_t sysfs_{reg_name}_show(struct device *dev, struct device_attribute *attr, char *buf) {{\n"
)
if multi:
fswhdr.write(f"\tstruct iob_data *{top}_data = (struct iob_data*) dev->platform_data;\n")
fswhdr.write(
f"\tstruct iob_data *{top}_data = (struct iob_data*) dev->platform_data;\n"
)
fswhdr.write(
f"\tu32 value = iob_data_read_reg({top}_data->regbase, {top.upper()}_{reg_name.upper()}_ADDR, {top.upper()}_{reg_name.upper()}_W);\n"
)
Expand Down
Loading