osd_cl_cdm class

API to access the functionality of the Core Debug Module (CDM).

Usage

#include <osd/osd.h>
#include <osd/cl_cdm.h>

Public Interface

Typedefs

typedef void(* osd_cl_cdm_handler_fn)(void *, const struct osd_cdm_desc *, const struct osd_cdm_event *)

Functions

osd_result osd_cl_cdm_get_desc(struct osd_hostmod_ctx * hostmod_ctx, unsigned int cdm_di_addr, struct osd_cdm_desc * cdm_desc)

Populate the CDM descriptor with data from the debug module

Return
OSD_OK on success OSD_ERROR_WRONG_MODULE if the module at cdm_di_addr is not a CDM any other value indicates an error
Parameters
  • hostmod_ctx: the host module handling the communication
  • cdm_di_addr: DI address of the CDM module to get describe
  • [out] cdm_desc: pre-allocated memory descriptor for the result

osd_result osd_cl_cdm_handle_event(void * arg, struct osd_packet * pkg)

Event handler to process CDM event, to be passed to a hostmod instance

osd_result cl_cdm_cpureg_read(struct osd_hostmod_ctx * hostmod_ctx, struct osd_cdm_desc * cdm_desc, void * reg_val, uint16_t reg_addr, int flags)

Read data from an SPR of the CPU attached to a Core Debug Module (CDM)

Return
OSD_OK if the read was successful any other value indicates an error
See
osd_cl_cdm_cpureg_write()
Parameters
  • hostmod_ctx: the host module handling the communication
  • [out] cdm_desc: pre-allocated memory descriptor for the result
  • reg_val: the returned read data
  • reg_addr: address to read from
  • flags: flags. Set OSD_HOSTMOD_BLOCKING to block indefinitely until the access succeeds.

osd_result cl_cdm_cpureg_write(struct osd_hostmod_ctx * hostmod_ctx, struct osd_cdm_desc * cdm_desc, const void * reg_val, uint16_t reg_addr, int flags)

Write data to an SPR of the CPU attached to a Core Debug Module (CDM)

Return
OSD_OK if the write was successful any other value indicates an error
See
osd_cl_cdm_cpureg_read()
Parameters
  • hostmod_ctx: the host module handling the communication
  • [out] cdm_desc: pre-allocated memory descriptor for the result
  • reg_val: the data to be written
  • reg_addr: address to write data to
  • flags: flags. Set OSD_HOSTMOD_BLOCKING to block indefinitely until the access succeeds.

struct osd_cdm_desc
#include <cl_cdm.h>

Information about a Core Debug Module

Public Members

unsigned int di_addr

DI address of CDM module.

uint16_t core_ctrl

Control signal for CPU core.

uint16_t core_reg_upper

Most significant bits of the SPR address.

uint16_t core_data_width

CPU data width in bits.

struct osd_cdm_event
#include <cl_cdm.h>

A single event generated by the CDM module

Public Members

bool stall

indicates the debugger that the CPU core is stalled.

struct osd_cdm_event_handler

Public Members

const struct osd_cdm_desc* cdm_desc
osd_cl_cdm_handler_fn cb_fn
void* cb_arg