On Fri, 02 Sep 2016 16:11:30 +0200, Takashi Sakamoto wrote:
On Aug 30 2016 16:24, Clemens Ladisch wrote:
In the kernel, you could use the macros from include/sound/tlv.h.
Either copy them into your test program, and use them directly:
/* 4 words: */ DECLARE_TLV_DB_MINMAX(orig, -60, +60); /* container with only one subitem; 8 words: */ DECLARE_TLV_CONTAINER(orig_container, TLV_ITEM(SNDRV_CTL_TLVT_CHMAP_FIXED, SNDRV_CHMAP_FL, SNDRV_CHMAP_FR, SNDRV_CHMAP_FC, SNDRV_CHMAP_LFE) );
or create the values by hand:
orig[0] = SNDRV_CTL_TLVT_DB_MINMAX; orig[1] = 2 * sizeof(*orig); orig[2] = -60; orig[3] = +60;
orig_container[0] = SNDRV_CTL_TLVT_CONTAINER; orig_container[1] = 6 * sizeof(*orig_container); orig_container[2] = SNDRV_CTL_TLVT_CHMAP_FIXED; orig_container[3] = 4 * sizeof(*orig_container); orig_container[4] = SNDRV_CHMAP_FL orig_container[5] = SNDRV_CHMAP_FR; orig_container[6] = SNDRV_CHMAP_FC; orig_container[7] = SNDRV_CHMAP_LFE;
Mmm. For user-defined control element sets, these macros should be in UAPI.
The macros are for static data, and for user-space, it's better to have functions filling the TLV, IMO. (Also these macros were recently already put in uapi/include/sound.)
Takashi