Skip to content
Merged
Show file tree
Hide file tree
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
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- name: remove any old container or image (if exists)
run: |
docker stop gh_iob_linux_container || true
docker rm gh_iob_linux_container || true
docker rmi gh_iob_linux || true
- name: build-container-image
run: docker build --pull --rm -t gh_iob_linux "."
- name: run-container
Expand Down
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 7, 2025

Choose a reason for hiding this comment

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

Changing the macro name from _SWREG_ADDR_W to _CSRS_ADDR_W could be a breaking change for existing code that depends on this generated header. Ensure all references to the old macro name are updated accordingly.

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 {mkregs_obj.core_addr_w} /* legacy name for compatibility */\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