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

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

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/pci/isp2401_input_system_private.h
Extension
.h
Size
8312 bytes
Lines
226
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

#ifndef __INPUT_SYSTEM_2401_PRIVATE_H_INCLUDED__
#define __INPUT_SYSTEM_2401_PRIVATE_H_INCLUDED__

#include "input_system_public.h"

#include "device_access.h"	/* ia_css_device_load_uint32 */

#include "assert_support.h" /* assert */
#include "print_support.h" /* print */

/* Load the register value */
static inline hrt_data ibuf_ctrl_reg_load(const ibuf_ctrl_ID_t ID,
					  const hrt_address reg)
{
	assert(ID < N_IBUF_CTRL_ID);
	assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1);
	return ia_css_device_load_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data));
}

/* Store a value to the register */
static inline void ibuf_ctrl_reg_store(const ibuf_ctrl_ID_t ID,
				       const hrt_address reg,
				       const hrt_data value)
{
	assert(ID < N_IBUF_CTRL_ID);
	assert(IBUF_CTRL_BASE[ID] != (hrt_address)-1);

	ia_css_device_store_uint32(IBUF_CTRL_BASE[ID] + reg * sizeof(hrt_data), value);
}

/* Get the state of the ibuf-controller process */
static inline void ibuf_ctrl_get_proc_state(const ibuf_ctrl_ID_t ID,
					    const u32 proc_id,
					    ibuf_ctrl_proc_state_t *state)
{
	hrt_address reg_bank_offset;

	reg_bank_offset =
	    _IBUF_CNTRL_PROC_REG_ALIGN * (1 + proc_id);

	state->num_items =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_ITEMS_PER_STORE);

	state->num_stores =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_NUM_STORES_PER_FRAME);

	state->dma_channel =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CHANNEL);

	state->dma_command =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DMA_CMD);

	state->ibuf_st_addr =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_START_ADDRESS);

	state->ibuf_stride =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_STRIDE);

	state->ibuf_end_addr =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_BUFFER_END_ADDRESS);

	state->dest_st_addr =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_START_ADDRESS);

	state->dest_stride =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_STRIDE);

	state->dest_end_addr =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_DEST_END_ADDRESS);

	state->sync_frame =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SYNC_FRAME);

	state->sync_command =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_SYNC_CMD);

	state->store_command =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_STR2MMIO_STORE_CMD);

	state->shift_returned_items =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_SHIFT_ITEMS);

	state->elems_ibuf =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_IBUF);

	state->elems_dest =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_ELEMS_P_WORD_DEST);

	state->cur_stores =
	    ibuf_ctrl_reg_load(ID, reg_bank_offset + _IBUF_CNTRL_CUR_STORES);

Annotation

Implementation Notes