Skip to content

Commit 1b671a0

Browse files
committed
Add direct write for new start bit register
1 parent 334bdb7 commit 1b671a0

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed

src/acl_kernel_if.cpp

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ acl_process_autorun_profiler_scan_chain(unsigned int physical_device_id,
4545
// address map.
4646
#define CSR_VERSION_ID_18_1 (3)
4747
#define CSR_VERSION_ID_19_1 (4)
48-
#define CSR_VERSION_ID CSR_VERSION_ID_19_1
48+
#define CSR_VERSION_ID_23_1 (5)
49+
#define CSR_VERSION_ID CSR_VERSION_ID_23_1
4950

5051
// Address map
5152
// For unit tests to work, these defines must match those in the unit test
@@ -67,19 +68,21 @@ acl_process_autorun_profiler_scan_chain(unsigned int physical_device_id,
6768

6869
// Byte offsets into the CRA:
6970
#define KERNEL_OFFSET_CSR 0
70-
#define KERNEL_OFFSET_PRINTF_BUFFER_SIZE 0x4
71-
#define KERNEL_OFFSET_CSR_PROFILE_CTRL 0xC
72-
#define KERNEL_OFFSET_CSR_PROFILE_DATA 0x10
73-
#define KERNEL_OFFSET_CSR_PROFILE_START_CYCLE 0x18
74-
#define KERNEL_OFFSET_CSR_PROFILE_STOP_CYCLE 0x20
75-
#define KERNEL_OFFSET_FINISH_COUNTER 0x28
76-
#define KERNEL_OFFSET_INVOCATION_IMAGE 0x30
71+
#define KERNEL_OFFSET_BUSY_NULL 0x4 // 4
72+
#define KERNEL_OFFSET_START_REG 0x8 // 8
73+
#define KERNEL_OFFSET_PRINTF_BUFFER_SIZE 0xC // 12
74+
#define KERNEL_OFFSET_CSR_PROFILE_CTRL 0x14 // 20
75+
#define KERNEL_OFFSET_CSR_PROFILE_DATA 0x18 // 24
76+
#define KERNEL_OFFSET_CSR_PROFILE_START_CYCLE 0x20 // 32
77+
#define KERNEL_OFFSET_CSR_PROFILE_STOP_CYCLE 0x28 // 40
78+
#define KERNEL_OFFSET_FINISH_COUNTER 0x30 // 48
79+
#define KERNEL_OFFSET_INVOCATION_IMAGE 0x38 // 56
7780

7881
// Backwards compatibility with CSR_VERSION_ID 3
7982
#define KERNEL_OFFSET_INVOCATION_IMAGE_181 0x28
8083

8184
// Bit positions
82-
#define KERNEL_CSR_GO 0
85+
#define KERNEL_CSR_START 0
8386
#define KERNEL_CSR_DONE 1
8487
#define KERNEL_CSR_STALLED 3
8588
#define KERNEL_CSR_UNSTALL 4
@@ -1279,11 +1282,15 @@ void acl_kernel_if_launch_kernel_on_custom_sof(
12791282
return;
12801283
}
12811284

1282-
unsigned int new_csr = 0;
1283-
acl_kernel_cra_read(kern, accel_id, KERNEL_OFFSET_CSR, &new_csr);
1284-
ACL_KERNEL_SET_BIT(new_csr, KERNEL_CSR_GO);
1285-
acl_kernel_cra_write(kern, accel_id, KERNEL_OFFSET_CSR, new_csr);
1286-
1285+
// backwards compatibility for version prior to 2023.1
1286+
if (kern->csr_version < CSR_VERSION_ID) {
1287+
unsigned int new_csr = 0;
1288+
acl_kernel_cra_read(kern, accel_id, KERNEL_OFFSET_CSR, &new_csr);
1289+
ACL_KERNEL_SET_BIT(new_csr, KERNEL_CSR_START);
1290+
acl_kernel_cra_write(kern, accel_id, KERNEL_OFFSET_CSR, new_csr);
1291+
} else {
1292+
acl_kernel_cra_write(kern, accel_id, KERNEL_OFFSET_START_REG, 1);
1293+
}
12871294
// IRQ handler takes care of the completion event through
12881295
// acl_kernel_if_update_status()
12891296
}

0 commit comments

Comments
 (0)