hpicmn.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* SPDX-License-Identifier: GPL-2.0-only */
  2. /*
  3. AudioScience HPI driver
  4. Copyright (C) 1997-2014 AudioScience Inc. <[email protected]>
  5. */
  6. struct hpi_adapter_obj;
  7. /* a function that takes an adapter obj and returns an int */
  8. typedef int adapter_int_func(struct hpi_adapter_obj *pao, u32 message);
  9. #define HPI_IRQ_NONE (0)
  10. #define HPI_IRQ_MESSAGE (1)
  11. #define HPI_IRQ_MIXER (2)
  12. struct hpi_adapter_obj {
  13. struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */
  14. u16 type; /* 0x6644 == ASI6644 etc */
  15. u16 index;
  16. struct hpios_spinlock dsp_lock;
  17. u16 dsp_crashed;
  18. u16 has_control_cache;
  19. void *priv;
  20. adapter_int_func *irq_query_and_clear;
  21. struct hpi_hostbuffer_status *instream_host_buffer_status;
  22. struct hpi_hostbuffer_status *outstream_host_buffer_status;
  23. };
  24. struct hpi_control_cache {
  25. /** indicates whether the structures are initialized */
  26. u16 init;
  27. u16 adap_idx;
  28. u32 control_count;
  29. u32 cache_size_in_bytes;
  30. /** pointer to allocated memory of lookup pointers. */
  31. struct hpi_control_cache_info **p_info;
  32. /** pointer to DSP's control cache. */
  33. u8 *p_cache;
  34. };
  35. struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index);
  36. u16 hpi_add_adapter(struct hpi_adapter_obj *pao);
  37. void hpi_delete_adapter(struct hpi_adapter_obj *pao);
  38. short hpi_check_control_cache(struct hpi_control_cache *pC,
  39. struct hpi_message *phm, struct hpi_response *phr);
  40. short hpi_check_control_cache_single(struct hpi_control_cache_single *pC,
  41. struct hpi_message *phm, struct hpi_response *phr);
  42. struct hpi_control_cache *hpi_alloc_control_cache(const u32
  43. number_of_controls, const u32 size_in_bytes, u8 *pDSP_control_buffer);
  44. void hpi_free_control_cache(struct hpi_control_cache *p_cache);
  45. void hpi_cmn_control_cache_sync_to_msg(struct hpi_control_cache *pC,
  46. struct hpi_message *phm, struct hpi_response *phr);
  47. void hpi_cmn_control_cache_sync_to_msg_single(struct hpi_control_cache_single
  48. *pC, struct hpi_message *phm, struct hpi_response *phr);
  49. u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr);
  50. hpi_handler_func HPI_COMMON;