Skip to content

Commit

Permalink
Add utility functions for ert packet
Browse files Browse the repository at this point in the history
For ease and consistency of implementation code.

Signed-off-by: Soren Soe <[email protected]>
  • Loading branch information
stsoe committed Jul 21, 2023
1 parent 207dac0 commit 1bfeb67
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/runtime_src/core/include/ert.h
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,13 @@ ert_valid_opcode(struct ert_packet *pkt)
return valid;
}

static inline uint64_t
get_ert_packet_size_bytes(struct ert_packet *pkt)
{
// header plus payload
return sizeof(pkt->header) + pkt->count * sizeof(uint32_t);
}

static inline struct ert_dpu_data*
get_ert_dpu_data(struct ert_start_kernel_cmd* pkt)
{
Expand Down Expand Up @@ -962,6 +969,12 @@ get_ert_regmap_end(struct ert_start_kernel_cmd* pkt)
return &pkt->cu_mask + pkt->count;
}

static inline uint64_t
get_ert_regmap_size_bytes(struct ert_start_kernel_cmd* pkt)
{
return (get_ert_regmap_end(pkt) - get_ert_regmap_begin(pkt)) * sizeof(uint32_t);
}

#ifdef __linux__
#define P2ROUNDUP(x, align) (-(-(x) & -(align)))
static inline struct cu_cmd_state_timestamps *
Expand Down

0 comments on commit 1bfeb67

Please sign in to comment.