drivers/staging/media/atomisp/pci/css_trace.h

Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/pci/css_trace.h

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/pci/css_trace.h
Extension
.h
Size
10252 bytes
Lines
270
Domain
Driver Families
Bucket
drivers/staging
Inferred role
Driver Families: implementation source
Status
source implementation candidate

Why This File Exists

Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.

Dependency Surface

Detected Declarations

Annotated Snippet

struct trace_item_t {
	u8   major;
	u8   minor;
	u16  counter;
};

#define MAX_SCRATCH_DATA	4
#define MAX_CMD_DATA		2

/* trace header: holds the version and the topology of the tracer. */
struct trace_header_t {
	/* 1st dword: descriptor */
	u8   version;
	u8   max_threads;
	u16  max_tracer_points;
	/* 2nd field: command + data */
	/* 2nd dword */
	u32  command;
	/* 3rd & 4th dword */
	u32  data[MAX_CMD_DATA];
	/* 3rd field: debug pointer */
	/* 5th & 6th dword: debug pointer mechanism */
	u32  debug_ptr_signature;
	u32  debug_ptr_value;
	/* Rest of the header: status & scratch data */
	u8   thr_status_byte[SH_CSS_MAX_SP_THREADS];
	u16  thr_status_word[SH_CSS_MAX_SP_THREADS];
	u32  thr_status_dword[SH_CSS_MAX_SP_THREADS];
	u32  scratch_debug[MAX_SCRATCH_DATA];
};

/* offsets for master_port read/write */
#define HDR_HDR_OFFSET              0	/* offset of the header */
#define HDR_COMMAND_OFFSET          offsetof(struct trace_header_t, command)
#define HDR_DATA_OFFSET             offsetof(struct trace_header_t, data)
#define HDR_DEBUG_SIGNATURE_OFFSET  offsetof(struct trace_header_t, debug_ptr_signature)
#define HDR_DEBUG_POINTER_OFFSET    offsetof(struct trace_header_t, debug_ptr_value)
#define HDR_STATUS_OFFSET           offsetof(struct trace_header_t, thr_status_byte)
#define HDR_STATUS_OFFSET_BYTE      offsetof(struct trace_header_t, thr_status_byte)
#define HDR_STATUS_OFFSET_WORD      offsetof(struct trace_header_t, thr_status_word)
#define HDR_STATUS_OFFSET_DWORD     offsetof(struct trace_header_t, thr_status_dword)
#define HDR_STATUS_OFFSET_SCRATCH   offsetof(struct trace_header_t, scratch_debug)

/*
Trace version history:
 1: initial version, hdr = descr, command & ptr.
 2: added ISP + 24-bit fields.
 3: added thread ID.
 4: added status in header.
*/
#define TRACER_VER			4

#define TRACE_BUFF_ADDR       0xA000
#define TRACE_BUFF_SIZE       0x1000	/* 4K allocated */

#define TRACE_ENABLE_SP0 0
#define TRACE_ENABLE_SP1 0
#define TRACE_ENABLE_ISP 0

enum TRACE_CORE_ID {
	TRACE_SP0_ID,
	TRACE_SP1_ID,
	TRACE_ISP_ID
};

/* TODO: add timing format? */
enum TRACE_DUMP_FORMAT {
	TRACE_DUMP_FORMAT_POINT_NO_TID,
	TRACE_DUMP_FORMAT_VALUE24,
	TRACE_DUMP_FORMAT_VALUE24_TIMING,
	TRACE_DUMP_FORMAT_VALUE24_TIMING_DELTA,
	TRACE_DUMP_FORMAT_POINT
};

/* currently divided as follows:*/
#if (TRACE_ENABLE_SP0 + TRACE_ENABLE_SP1 + TRACE_ENABLE_ISP == 3)
/* can be divided as needed */
#define TRACE_SP0_SIZE (TRACE_BUFF_SIZE / 4)
#define TRACE_SP1_SIZE (TRACE_BUFF_SIZE / 4)
#define TRACE_ISP_SIZE (TRACE_BUFF_SIZE / 2)
#elif (TRACE_ENABLE_SP0 + TRACE_ENABLE_SP1 + TRACE_ENABLE_ISP == 2)
#if TRACE_ENABLE_SP0
#define TRACE_SP0_SIZE (TRACE_BUFF_SIZE / 2)
#else
#define TRACE_SP0_SIZE (0)
#endif
#if TRACE_ENABLE_SP1
#define TRACE_SP1_SIZE (TRACE_BUFF_SIZE / 2)
#else
#define TRACE_SP1_SIZE (0)

Annotation

Implementation Notes