|
| 1 | +From bc955c0d82c81e70e7855657e504a1ce743efe88 Mon Sep 17 00:00:00 2001 |
| 2 | +From: Vladimir Ermakov < [email protected]> |
| 3 | +Date: Thu, 25 Sep 2025 12:50:56 +0200 |
| 4 | +Subject: [PATCH 2/2] alsa: drop codegen file to be able to build with CGO=0 |
| 5 | + |
| 6 | +Signed-off-by: Vladimir Ermakov < [email protected]> |
| 7 | +--- |
| 8 | + pkg/alsa/device/asound_arch.c | 163 ---------------------------------- |
| 9 | + 1 file changed, 163 deletions(-) |
| 10 | + delete mode 100644 pkg/alsa/device/asound_arch.c |
| 11 | + |
| 12 | +--- a/pkg/alsa/device/asound_arch.c |
| 13 | ++++ /dev/null |
| 14 | +@@ -1,163 +0,0 @@ |
| 15 | +-#include <stdio.h> |
| 16 | +-#include <stddef.h> |
| 17 | +-#include <sys/ioctl.h> |
| 18 | +-#include <sound/asound.h> |
| 19 | +- |
| 20 | +-#define print_line(text) printf("%s\n", text) |
| 21 | +-#define print_hex_const(name) printf("\t%s = 0x%08lx\n", #name, name) |
| 22 | +-#define print_int_const(con) printf("\t%s = %d\n", #con, con) |
| 23 | +- |
| 24 | +-#define print_struct_header(str) printf("type %s struct { // size %lu\n", #str, sizeof(struct str)) |
| 25 | +-#define print_struct_member(str, mem, typ) printf("\t%s %s // offset %lu, size %lu\n", #mem == "type" ? "typ" : #mem, typ, offsetof(struct str, mem), sizeof((struct str){0}.mem)) |
| 26 | +- |
| 27 | +-// https://github.com/torvalds/linux/blob/master/include/uapi/sound/asound.h |
| 28 | +-int main() { |
| 29 | +- print_line("package device\n"); |
| 30 | +- |
| 31 | +- print_line("type unsigned_char = byte"); |
| 32 | +- print_line("type signed_int = int32"); |
| 33 | +- print_line("type unsigned_int = uint32"); |
| 34 | +- print_line("type signed_long = int64"); |
| 35 | +- print_line("type unsigned_long = uint64"); |
| 36 | +- print_line("type __u32 = uint32"); |
| 37 | +- print_line("type void__user = uintptr\n"); |
| 38 | +- |
| 39 | +- print_line("const ("); |
| 40 | +- print_int_const(SNDRV_PCM_STREAM_PLAYBACK); |
| 41 | +- print_int_const(SNDRV_PCM_STREAM_CAPTURE); |
| 42 | +- print_line(""); |
| 43 | +- print_int_const(SNDRV_PCM_ACCESS_MMAP_INTERLEAVED); |
| 44 | +- print_int_const(SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED); |
| 45 | +- print_int_const(SNDRV_PCM_ACCESS_MMAP_COMPLEX); |
| 46 | +- print_int_const(SNDRV_PCM_ACCESS_RW_INTERLEAVED); |
| 47 | +- print_int_const(SNDRV_PCM_ACCESS_RW_NONINTERLEAVED); |
| 48 | +- print_line(""); |
| 49 | +- print_int_const(SNDRV_PCM_FORMAT_S8); |
| 50 | +- print_int_const(SNDRV_PCM_FORMAT_U8); |
| 51 | +- print_int_const(SNDRV_PCM_FORMAT_S16_LE); |
| 52 | +- print_int_const(SNDRV_PCM_FORMAT_S16_BE); |
| 53 | +- print_int_const(SNDRV_PCM_FORMAT_U16_LE); |
| 54 | +- print_int_const(SNDRV_PCM_FORMAT_U16_BE); |
| 55 | +- print_int_const(SNDRV_PCM_FORMAT_S24_LE); |
| 56 | +- print_int_const(SNDRV_PCM_FORMAT_S24_BE); |
| 57 | +- print_int_const(SNDRV_PCM_FORMAT_U24_LE); |
| 58 | +- print_int_const(SNDRV_PCM_FORMAT_U24_BE); |
| 59 | +- print_int_const(SNDRV_PCM_FORMAT_S32_LE); |
| 60 | +- print_int_const(SNDRV_PCM_FORMAT_S32_BE); |
| 61 | +- print_int_const(SNDRV_PCM_FORMAT_U32_LE); |
| 62 | +- print_int_const(SNDRV_PCM_FORMAT_U32_BE); |
| 63 | +- print_int_const(SNDRV_PCM_FORMAT_FLOAT_LE); |
| 64 | +- print_int_const(SNDRV_PCM_FORMAT_FLOAT_BE); |
| 65 | +- print_int_const(SNDRV_PCM_FORMAT_FLOAT64_LE); |
| 66 | +- print_int_const(SNDRV_PCM_FORMAT_FLOAT64_BE); |
| 67 | +- print_int_const(SNDRV_PCM_FORMAT_MU_LAW); |
| 68 | +- print_int_const(SNDRV_PCM_FORMAT_A_LAW); |
| 69 | +- print_int_const(SNDRV_PCM_FORMAT_MPEG); |
| 70 | +- print_line(""); |
| 71 | +- print_hex_const(SNDRV_PCM_IOCTL_PVERSION); // A 0x00 |
| 72 | +- print_hex_const(SNDRV_PCM_IOCTL_INFO); // A 0x01 |
| 73 | +- print_hex_const(SNDRV_PCM_IOCTL_HW_REFINE); // A 0x10 |
| 74 | +- print_hex_const(SNDRV_PCM_IOCTL_HW_PARAMS); // A 0x11 |
| 75 | +- print_hex_const(SNDRV_PCM_IOCTL_SW_PARAMS); // A 0x13 |
| 76 | +- print_hex_const(SNDRV_PCM_IOCTL_PREPARE); // A 0x40 |
| 77 | +- print_hex_const(SNDRV_PCM_IOCTL_WRITEI_FRAMES); // A 0x50 |
| 78 | +- print_hex_const(SNDRV_PCM_IOCTL_READI_FRAMES); // A 0x51 |
| 79 | +- print_line(")\n"); |
| 80 | +- |
| 81 | +- print_struct_header(snd_pcm_info); |
| 82 | +- print_struct_member(snd_pcm_info, device, "unsigned_int"); |
| 83 | +- print_struct_member(snd_pcm_info, subdevice, "unsigned_int"); |
| 84 | +- print_struct_member(snd_pcm_info, stream, "signed_int"); |
| 85 | +- print_struct_member(snd_pcm_info, card, "signed_int"); |
| 86 | +- print_struct_member(snd_pcm_info, id, "[64]unsigned_char"); |
| 87 | +- print_struct_member(snd_pcm_info, name, "[80]unsigned_char"); |
| 88 | +- print_struct_member(snd_pcm_info, subname, "[32]unsigned_char"); |
| 89 | +- print_struct_member(snd_pcm_info, dev_class, "signed_int"); |
| 90 | +- print_struct_member(snd_pcm_info, dev_subclass, "signed_int"); |
| 91 | +- print_struct_member(snd_pcm_info, subdevices_count, "unsigned_int"); |
| 92 | +- print_struct_member(snd_pcm_info, subdevices_avail, "unsigned_int"); |
| 93 | +- print_line("\tpad1 [16]unsigned_char"); |
| 94 | +- print_struct_member(snd_pcm_info, reserved, "[64]unsigned_char"); |
| 95 | +- print_line("}\n"); |
| 96 | +- |
| 97 | +- print_line("type snd_pcm_uframes_t = unsigned_long"); |
| 98 | +- print_line("type snd_pcm_sframes_t = signed_long\n"); |
| 99 | +- |
| 100 | +- print_struct_header(snd_xferi); |
| 101 | +- print_struct_member(snd_xferi, result, "snd_pcm_sframes_t"); |
| 102 | +- print_struct_member(snd_xferi, buf, "void__user"); |
| 103 | +- print_struct_member(snd_xferi, frames, "snd_pcm_uframes_t"); |
| 104 | +- print_line("}\n"); |
| 105 | +- |
| 106 | +- print_line("const ("); |
| 107 | +- print_int_const(SNDRV_PCM_HW_PARAM_ACCESS); |
| 108 | +- print_int_const(SNDRV_PCM_HW_PARAM_FORMAT); |
| 109 | +- print_int_const(SNDRV_PCM_HW_PARAM_SUBFORMAT); |
| 110 | +- print_int_const(SNDRV_PCM_HW_PARAM_FIRST_MASK); |
| 111 | +- print_int_const(SNDRV_PCM_HW_PARAM_LAST_MASK); |
| 112 | +- print_line(""); |
| 113 | +- print_int_const(SNDRV_PCM_HW_PARAM_SAMPLE_BITS); |
| 114 | +- print_int_const(SNDRV_PCM_HW_PARAM_FRAME_BITS); |
| 115 | +- print_int_const(SNDRV_PCM_HW_PARAM_CHANNELS); |
| 116 | +- print_int_const(SNDRV_PCM_HW_PARAM_RATE); |
| 117 | +- print_int_const(SNDRV_PCM_HW_PARAM_PERIOD_TIME); |
| 118 | +- print_int_const(SNDRV_PCM_HW_PARAM_PERIOD_SIZE); |
| 119 | +- print_int_const(SNDRV_PCM_HW_PARAM_PERIOD_BYTES); |
| 120 | +- print_int_const(SNDRV_PCM_HW_PARAM_PERIODS); |
| 121 | +- print_int_const(SNDRV_PCM_HW_PARAM_BUFFER_TIME); |
| 122 | +- print_int_const(SNDRV_PCM_HW_PARAM_BUFFER_SIZE); |
| 123 | +- print_int_const(SNDRV_PCM_HW_PARAM_BUFFER_BYTES); |
| 124 | +- print_int_const(SNDRV_PCM_HW_PARAM_TICK_TIME); |
| 125 | +- print_int_const(SNDRV_PCM_HW_PARAM_FIRST_INTERVAL); |
| 126 | +- print_int_const(SNDRV_PCM_HW_PARAM_LAST_INTERVAL); |
| 127 | +- print_line(""); |
| 128 | +- print_int_const(SNDRV_MASK_MAX); |
| 129 | +- print_line(""); |
| 130 | +- print_int_const(SNDRV_PCM_TSTAMP_NONE); |
| 131 | +- print_int_const(SNDRV_PCM_TSTAMP_ENABLE); |
| 132 | +- print_line(")\n"); |
| 133 | +- |
| 134 | +- print_struct_header(snd_mask); |
| 135 | +- print_struct_member(snd_mask, bits, "[(SNDRV_MASK_MAX+31)/32]__u32"); |
| 136 | +- print_line("}\n"); |
| 137 | +- |
| 138 | +- print_struct_header(snd_interval); |
| 139 | +- print_struct_member(snd_interval, min, "unsigned_int"); |
| 140 | +- print_struct_member(snd_interval, max, "unsigned_int"); |
| 141 | +- print_line("\tbit unsigned_int"); |
| 142 | +- print_line("}\n"); |
| 143 | +- |
| 144 | +- print_struct_header(snd_pcm_hw_params); |
| 145 | +- print_struct_member(snd_pcm_hw_params, flags, "unsigned_int"); |
| 146 | +- print_struct_member(snd_pcm_hw_params, masks, "[SNDRV_PCM_HW_PARAM_LAST_MASK-SNDRV_PCM_HW_PARAM_FIRST_MASK+1]snd_mask"); |
| 147 | +- print_struct_member(snd_pcm_hw_params, mres, "[5]snd_mask"); |
| 148 | +- print_struct_member(snd_pcm_hw_params, intervals, "[SNDRV_PCM_HW_PARAM_LAST_INTERVAL-SNDRV_PCM_HW_PARAM_FIRST_INTERVAL+1]snd_interval"); |
| 149 | +- print_struct_member(snd_pcm_hw_params, ires, "[9]snd_interval"); |
| 150 | +- print_struct_member(snd_pcm_hw_params, rmask, "unsigned_int"); |
| 151 | +- print_struct_member(snd_pcm_hw_params, cmask, "unsigned_int"); |
| 152 | +- print_struct_member(snd_pcm_hw_params, info, "unsigned_int"); |
| 153 | +- print_struct_member(snd_pcm_hw_params, msbits, "unsigned_int"); |
| 154 | +- print_struct_member(snd_pcm_hw_params, rate_num, "unsigned_int"); |
| 155 | +- print_struct_member(snd_pcm_hw_params, rate_den, "unsigned_int"); |
| 156 | +- print_struct_member(snd_pcm_hw_params, fifo_size, "snd_pcm_uframes_t"); |
| 157 | +- print_struct_member(snd_pcm_hw_params, reserved, "[64]unsigned_char"); |
| 158 | +- print_line("}\n"); |
| 159 | +- |
| 160 | +- print_struct_header(snd_pcm_sw_params); |
| 161 | +- print_struct_member(snd_pcm_sw_params, tstamp_mode, "signed_int"); |
| 162 | +- print_struct_member(snd_pcm_sw_params, period_step, "unsigned_int"); |
| 163 | +- print_struct_member(snd_pcm_sw_params, sleep_min, "unsigned_int"); |
| 164 | +- print_struct_member(snd_pcm_sw_params, avail_min, "snd_pcm_uframes_t"); |
| 165 | +- print_struct_member(snd_pcm_sw_params, xfer_align, "snd_pcm_uframes_t"); |
| 166 | +- print_struct_member(snd_pcm_sw_params, start_threshold, "snd_pcm_uframes_t"); |
| 167 | +- print_struct_member(snd_pcm_sw_params, stop_threshold, "snd_pcm_uframes_t"); |
| 168 | +- print_struct_member(snd_pcm_sw_params, silence_threshold, "snd_pcm_uframes_t"); |
| 169 | +- print_struct_member(snd_pcm_sw_params, silence_size, "snd_pcm_uframes_t"); |
| 170 | +- print_struct_member(snd_pcm_sw_params, boundary, "snd_pcm_uframes_t"); |
| 171 | +- print_struct_member(snd_pcm_sw_params, proto, "unsigned_int"); |
| 172 | +- print_struct_member(snd_pcm_sw_params, tstamp_type, "unsigned_int"); |
| 173 | +- print_struct_member(snd_pcm_sw_params, reserved, "[56]unsigned_char"); |
| 174 | +- print_line("}\n"); |
| 175 | +- |
| 176 | +- return 0; |
| 177 | +-} |
| 178 | +\ No newline at end of file |
0 commit comments