sound/pci/asihpi/hpifunc.c
Source file repositories/reference/linux-study-clean/sound/pci/asihpi/hpifunc.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/asihpi/hpifunc.c- Extension
.c- Size
- 71661 bytes
- Lines
- 2869
- Domain
- Driver Families
- Bucket
- sound/pci
- 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.
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
hpi_internal.hhpimsginit.hhpidebug.h
Detected Declarations
struct hpi_handlefunction hpi_indexes_to_handlefunction hpi_handle_indexesfunction hpi_handle_to_indexesfunction hpi_handle_objectfunction hpi_format_to_msgfunction hpi_msg_to_formatfunction hpi_stream_response_to_legacyfunction hpi_send_recvV1function hpi_subsys_get_version_exfunction hpi_subsys_get_num_adaptersfunction hpi_subsys_get_adapterfunction hpi_adapter_openfunction hpi_adapter_closefunction hpi_adapter_set_modefunction hpi_adapter_set_mode_exfunction hpi_adapter_get_modefunction hpi_adapter_get_infofunction hpi_adapter_get_module_by_indexfunction hpi_adapter_set_propertyfunction hpi_adapter_get_propertyfunction hpi_adapter_enumerate_propertyfunction hpi_format_createfunction hpi_stream_estimate_buffer_sizefunction hpi_outstream_openfunction hpi_outstream_closefunction hpi_outstream_get_info_exfunction hpi_outstream_write_buffunction hpi_outstream_startfunction hpi_outstream_wait_startfunction hpi_outstream_stopfunction hpi_outstream_sinegenfunction hpi_outstream_resetfunction hpi_outstream_query_formatfunction hpi_outstream_set_formatfunction hpi_outstream_set_velocityfunction hpi_outstream_set_punch_in_outfunction hpi_outstream_ancillary_resetfunction hpi_outstream_ancillary_get_infofunction hpi_outstream_ancillary_readfunction hpi_outstream_set_time_scalefunction hpi_outstream_host_buffer_allocatefunction hpi_outstream_host_buffer_get_infofunction hpi_outstream_host_buffer_freefunction hpi_outstream_group_addfunction hpi_outstream_group_get_mapfunction hpi_outstream_group_resetfunction hpi_instream_open
Annotated Snippet
struct hpi_handle {
unsigned int obj_index:12;
unsigned int obj_type:4;
unsigned int adapter_index:14;
unsigned int spare:1;
unsigned int read_only:1;
};
union handle_word {
struct hpi_handle h;
u32 w;
};
u32 hpi_indexes_to_handle(const char c_object, const u16 adapter_index,
const u16 object_index)
{
union handle_word handle;
handle.h.adapter_index = adapter_index;
handle.h.spare = 0;
handle.h.read_only = 0;
handle.h.obj_type = c_object;
handle.h.obj_index = object_index;
return handle.w;
}
static u16 hpi_handle_indexes(const u32 h, u16 *p1, u16 *p2)
{
union handle_word uhandle;
if (!h)
return HPI_ERROR_INVALID_HANDLE;
uhandle.w = h;
*p1 = (u16)uhandle.h.adapter_index;
if (p2)
*p2 = (u16)uhandle.h.obj_index;
return 0;
}
void hpi_handle_to_indexes(const u32 handle, u16 *pw_adapter_index,
u16 *pw_object_index)
{
hpi_handle_indexes(handle, pw_adapter_index, pw_object_index);
}
char hpi_handle_object(const u32 handle)
{
union handle_word uhandle;
uhandle.w = handle;
return (char)uhandle.h.obj_type;
}
void hpi_format_to_msg(struct hpi_msg_format *pMF,
const struct hpi_format *pF)
{
pMF->sample_rate = pF->sample_rate;
pMF->bit_rate = pF->bit_rate;
pMF->attributes = pF->attributes;
pMF->channels = pF->channels;
pMF->format = pF->format;
}
static void hpi_msg_to_format(struct hpi_format *pF,
struct hpi_msg_format *pMF)
{
pF->sample_rate = pMF->sample_rate;
pF->bit_rate = pMF->bit_rate;
pF->attributes = pMF->attributes;
pF->channels = pMF->channels;
pF->format = pMF->format;
pF->mode_legacy = 0;
pF->unused = 0;
}
void hpi_stream_response_to_legacy(struct hpi_stream_res *pSR)
{
pSR->u.legacy_stream_info.auxiliary_data_available =
pSR->u.stream_info.auxiliary_data_available;
pSR->u.legacy_stream_info.state = pSR->u.stream_info.state;
}
static inline void hpi_send_recvV1(struct hpi_message_header *m,
struct hpi_response_header *r)
{
hpi_send_recv((struct hpi_message *)m, (struct hpi_response *)r);
}
u16 hpi_subsys_get_version_ex(u32 *pversion_ex)
Annotation
- Immediate include surface: `hpi_internal.h`, `hpimsginit.h`, `hpidebug.h`.
- Detected declarations: `struct hpi_handle`, `function hpi_indexes_to_handle`, `function hpi_handle_indexes`, `function hpi_handle_to_indexes`, `function hpi_handle_object`, `function hpi_format_to_msg`, `function hpi_msg_to_format`, `function hpi_stream_response_to_legacy`, `function hpi_send_recvV1`, `function hpi_subsys_get_version_ex`.
- Atlas domain: Driver Families / sound/pci.
- Implementation status: source implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.