| 
									
										
										
										
											2001-01-01 15:15:41 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  *  ALSA lib - local header file | 
					
						
							|  |  |  |  *  Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org> | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *   This library is free software; you can redistribute it and/or modify | 
					
						
							| 
									
										
										
										
											2001-12-30 09:22:54 +00:00
										 |  |  |  *   it under the terms of the GNU Lesser General Public License as | 
					
						
							|  |  |  |  *   published by the Free Software Foundation; either version 2.1 of | 
					
						
							| 
									
										
										
										
											2001-01-01 15:15:41 +00:00
										 |  |  |  *   the License, or (at your option) any later version. | 
					
						
							|  |  |  |  * | 
					
						
							|  |  |  |  *   This program is distributed in the hope that it will be useful, | 
					
						
							|  |  |  |  *   but WITHOUT ANY WARRANTY; without even the implied warranty of | 
					
						
							|  |  |  |  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
					
						
							| 
									
										
										
										
											2001-12-30 09:22:54 +00:00
										 |  |  |  *   GNU Lesser General Public License for more details. | 
					
						
							| 
									
										
										
										
											2001-01-01 15:15:41 +00:00
										 |  |  |  * | 
					
						
							| 
									
										
										
										
											2001-12-30 09:22:54 +00:00
										 |  |  |  *   You should have received a copy of the GNU Lesser General Public | 
					
						
							| 
									
										
										
										
											2001-01-01 15:15:41 +00:00
										 |  |  |  *   License along with this library; if not, write to the Free Software | 
					
						
							| 
									
										
										
										
											2017-11-14 14:29:26 +01:00
										 |  |  |  *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA | 
					
						
							| 
									
										
										
										
											2001-01-01 15:15:41 +00:00
										 |  |  |  * | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-06 23:48:10 +00:00
										 |  |  | #ifndef __LOCAL_H
 | 
					
						
							|  |  |  | #define __LOCAL_H
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-02-23 11:12:48 +00:00
										 |  |  | #include "config.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-09-13 11:38:32 +00:00
										 |  |  | #include <unistd.h>
 | 
					
						
							|  |  |  | #include <stdio.h>
 | 
					
						
							|  |  |  | #include <stdlib.h>
 | 
					
						
							|  |  |  | #include <string.h>
 | 
					
						
							|  |  |  | #include <fcntl.h>
 | 
					
						
							|  |  |  | #include <assert.h>
 | 
					
						
							| 
									
										
										
										
											2014-02-23 11:12:48 +00:00
										 |  |  | #ifdef HAVE_ENDIAN_H
 | 
					
						
							| 
									
										
										
										
											2001-09-13 11:38:32 +00:00
										 |  |  | #include <endian.h>
 | 
					
						
							| 
									
										
										
										
											2014-02-23 11:12:48 +00:00
										 |  |  | #elif defined(HAVE_SYS_ENDIAN_H)
 | 
					
						
							|  |  |  | #include <sys/endian.h>
 | 
					
						
							|  |  |  | #ifndef __BYTE_ORDER
 | 
					
						
							|  |  |  | #define __BYTE_ORDER BYTE_ORDER
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifndef __LITTLE_ENDIAN
 | 
					
						
							|  |  |  | #define __LITTLE_ENDIAN LITTLE_ENDIAN
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #ifndef __BIG_ENDIAN
 | 
					
						
							|  |  |  | #define __BIG_ENDIAN BIG_ENDIAN
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #error Header defining endianness not defined
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2003-06-24 19:30:08 +00:00
										 |  |  | #include <stdarg.h>
 | 
					
						
							| 
									
										
										
										
											2017-07-12 10:45:18 +02:00
										 |  |  | #include <poll.h>
 | 
					
						
							| 
									
										
										
										
											2013-10-10 18:56:22 +02:00
										 |  |  | #include <sys/types.h>
 | 
					
						
							| 
									
										
										
										
											2001-09-13 11:38:32 +00:00
										 |  |  | #include <errno.h>
 | 
					
						
							| 
									
										
										
										
											2016-03-02 23:11:54 +01:00
										 |  |  | #if defined(__linux__)
 | 
					
						
							| 
									
										
										
										
											2013-07-23 14:50:41 +02:00
										 |  |  | #include <linux/types.h>
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | #include <linux/ioctl.h>
 | 
					
						
							| 
									
										
										
										
											2016-03-02 23:11:54 +01:00
										 |  |  | #else
 | 
					
						
							|  |  |  | #include "type_compat.h"
 | 
					
						
							| 
									
										
										
										
											2016-02-24 14:15:10 +01:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-02-11 16:35:24 +00:00
										 |  |  | #ifdef SUPPORT_RESMGR
 | 
					
						
							|  |  |  | #include <resmgr.h>
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2007-03-22 00:48:18 +01:00
										 |  |  | #ifdef HAVE_LIBDL
 | 
					
						
							|  |  |  | #include <dlfcn.h>
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #define RTLD_NOW	0
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2001-06-04 18:04:18 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-12-13 09:55:44 +01:00
										 |  |  | #if __BYTE_ORDER == __LITTLE_ENDIAN
 | 
					
						
							|  |  |  | #define SND_LITTLE_ENDIAN
 | 
					
						
							|  |  |  | #define SNDRV_LITTLE_ENDIAN
 | 
					
						
							|  |  |  | #elif __BYTE_ORDER == __BIG_ENDIAN
 | 
					
						
							|  |  |  | #define SND_BIG_ENDIAN
 | 
					
						
							|  |  |  | #define SNDRV_BIG_ENDIAN
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | #error "Unsupported endian..."
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-03-30 10:12:19 +00:00
										 |  |  | #define _snd_config_iterator list_head
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | #define _snd_interval snd_interval
 | 
					
						
							|  |  |  | #define _snd_pcm_info snd_pcm_info
 | 
					
						
							|  |  |  | #define _snd_pcm_hw_params snd_pcm_hw_params
 | 
					
						
							|  |  |  | #define _snd_pcm_sw_params snd_pcm_sw_params
 | 
					
						
							|  |  |  | #define _snd_pcm_status snd_pcm_status
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define _snd_ctl_card_info snd_ctl_card_info
 | 
					
						
							|  |  |  | #define _snd_ctl_elem_id snd_ctl_elem_id
 | 
					
						
							|  |  |  | #define _snd_ctl_elem_list snd_ctl_elem_list
 | 
					
						
							|  |  |  | #define _snd_ctl_elem_info snd_ctl_elem_info
 | 
					
						
							|  |  |  | #define _snd_ctl_elem_value snd_ctl_elem_value
 | 
					
						
							|  |  |  | #define _snd_ctl_event snd_ctl_event
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define _snd_rawmidi_info snd_rawmidi_info
 | 
					
						
							|  |  |  | #define _snd_rawmidi_params snd_rawmidi_params
 | 
					
						
							|  |  |  | #define _snd_rawmidi_status snd_rawmidi_status
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define _snd_hwdep_info snd_hwdep_info
 | 
					
						
							|  |  |  | #define _snd_hwdep_dsp_status snd_hwdep_dsp_status
 | 
					
						
							|  |  |  | #define _snd_hwdep_dsp_image snd_hwdep_dsp_image
 | 
					
						
							| 
									
										
										
										
											2001-07-04 13:54:13 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | #define _snd_seq_queue_tempo snd_seq_queue_tempo
 | 
					
						
							|  |  |  | #define _snd_seq_client_info snd_seq_client_info
 | 
					
						
							|  |  |  | #define _snd_seq_port_info snd_seq_port_info
 | 
					
						
							|  |  |  | #define _snd_seq_system_info snd_seq_system_info
 | 
					
						
							|  |  |  | #define _snd_seq_queue_info snd_seq_queue_info
 | 
					
						
							|  |  |  | #define _snd_seq_queue_status snd_seq_queue_status
 | 
					
						
							|  |  |  | #define _snd_seq_queue_timer snd_seq_queue_timer
 | 
					
						
							|  |  |  | #define _snd_seq_port_subscribe snd_seq_port_subscribe
 | 
					
						
							|  |  |  | #define _snd_seq_query_subscribe snd_seq_query_subs
 | 
					
						
							|  |  |  | #define _snd_seq_client_pool snd_seq_client_pool
 | 
					
						
							|  |  |  | #define _snd_seq_remove_events snd_seq_remove_events
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define _snd_timer_id snd_timer_id
 | 
					
						
							|  |  |  | #define _snd_timer_ginfo snd_timer_ginfo
 | 
					
						
							|  |  |  | #define _snd_timer_gparams snd_timer_gparams
 | 
					
						
							|  |  |  | #define _snd_timer_gstatus snd_timer_gstatus
 | 
					
						
							|  |  |  | #define _snd_timer_select snd_timer_select
 | 
					
						
							|  |  |  | #define _snd_timer_info snd_timer_info
 | 
					
						
							|  |  |  | #define _snd_timer_params snd_timer_params
 | 
					
						
							|  |  |  | #define _snd_timer_status snd_timer_status
 | 
					
						
							| 
									
										
										
										
											2001-07-16 13:33:55 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2002-09-17 12:33:05 +00:00
										 |  |  | #define ALSA_LIBRARY_BUILD
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | /* rename some types for avoiding conflicts with alsalib's definitions */ | 
					
						
							|  |  |  | #define snd_aes_iec958		sndrv_aes_iec958
 | 
					
						
							|  |  |  | #define snd_pcm_uframes_t	sndrv_pcm_uframes_t
 | 
					
						
							|  |  |  | #define snd_pcm_sframes_t	sndrv_pcm_sframes_t
 | 
					
						
							|  |  |  | #define snd_pcm_access_t	sndrv_pcm_access_t
 | 
					
						
							|  |  |  | #define snd_pcm_format_t	sndrv_pcm_format_t
 | 
					
						
							|  |  |  | #define snd_pcm_subformat_t	sndrv_pcm_subformat_t
 | 
					
						
							|  |  |  | #define snd_pcm_state_t		sndrv_pcm_state_t
 | 
					
						
							|  |  |  | #define snd_interval		sndrv_interval
 | 
					
						
							|  |  |  | #define snd_mask		sndrv_mask
 | 
					
						
							|  |  |  | #define snd_ctl_elem_type_t	sndrv_ctl_elem_type_t
 | 
					
						
							|  |  |  | #define snd_ctl_elem_iface_t	sndrv_ctl_elem_iface_t
 | 
					
						
							|  |  |  | #define snd_ctl_tlv		sndrv_ctl_tlv
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* kill and replace kernel-specific types */ | 
					
						
							| 
									
										
										
										
											2013-07-23 14:50:41 +02:00
										 |  |  | #ifndef __user
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | #define __user
 | 
					
						
							| 
									
										
										
										
											2013-07-23 14:50:41 +02:00
										 |  |  | #endif
 | 
					
						
							|  |  |  | #ifndef __force
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | #define __force
 | 
					
						
							| 
									
										
										
										
											2013-07-23 14:50:41 +02:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-08-20 13:15:30 +00:00
										 |  |  | #include <sound/asound.h>
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* take back superfluous renames; some can be kept as is */ | 
					
						
							|  |  |  | #undef snd_aes_iec958
 | 
					
						
							|  |  |  | #undef snd_pcm_uframes_t
 | 
					
						
							|  |  |  | #undef snd_pcm_sframes_t
 | 
					
						
							|  |  |  | #undef snd_pcm_access_t
 | 
					
						
							|  |  |  | #undef snd_pcm_format_t
 | 
					
						
							|  |  |  | #undef snd_pcm_subformat_t
 | 
					
						
							|  |  |  | #undef snd_pcm_state_t
 | 
					
						
							|  |  |  | #undef snd_ctl_elem_type_t
 | 
					
						
							|  |  |  | #undef snd_ctl_elem_iface_t
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-11-25 10:36:32 +01:00
										 |  |  | #include "asoundef.h"
 | 
					
						
							| 
									
										
										
										
											2002-09-17 12:33:05 +00:00
										 |  |  | #include "alsa-symbols.h"
 | 
					
						
							| 
									
										
										
										
											2001-09-13 11:38:32 +00:00
										 |  |  | #include "version.h"
 | 
					
						
							|  |  |  | #include "global.h"
 | 
					
						
							|  |  |  | #include "input.h"
 | 
					
						
							|  |  |  | #include "output.h"
 | 
					
						
							|  |  |  | #include "error.h"
 | 
					
						
							|  |  |  | #include "conf.h"
 | 
					
						
							|  |  |  | #include "pcm.h"
 | 
					
						
							| 
									
										
										
										
											2002-01-12 10:52:42 +00:00
										 |  |  | #include "pcm_plugin.h"
 | 
					
						
							| 
									
										
										
										
											2001-09-13 11:38:32 +00:00
										 |  |  | #include "rawmidi.h"
 | 
					
						
							|  |  |  | #include "timer.h"
 | 
					
						
							|  |  |  | #include "hwdep.h"
 | 
					
						
							|  |  |  | #include "control.h"
 | 
					
						
							|  |  |  | #include "mixer.h"
 | 
					
						
							|  |  |  | #include "seq_event.h"
 | 
					
						
							|  |  |  | #include "seq.h"
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* rename some types for avoiding conflicts with alsalib's definitions */ | 
					
						
							|  |  |  | #define snd_seq_addr		sndrv_seq_addr
 | 
					
						
							|  |  |  | #define snd_seq_tick_time_t	sndrv_seq_tick_time_t
 | 
					
						
							|  |  |  | #define snd_seq_real_time	sndrv_seq_real_time
 | 
					
						
							|  |  |  | #define snd_seq_timestamp	sndrv_seq_timestamp
 | 
					
						
							| 
									
										
										
										
											2012-11-30 14:33:54 +01:00
										 |  |  | #define snd_seq_event_type_t	sndrv_seq_event_type_t
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | #define snd_seq_event		sndrv_seq_event
 | 
					
						
							|  |  |  | #define snd_seq_connect		sndrv_seq_connect
 | 
					
						
							|  |  |  | #define snd_seq_ev_note		sndrv_seq_ev_note
 | 
					
						
							|  |  |  | #define snd_seq_ev_ctrl		sndrv_seq_ev_ctrl
 | 
					
						
							|  |  |  | #define snd_seq_ev_raw8		sndrv_seq_ev_raw8
 | 
					
						
							|  |  |  | #define snd_seq_ev_raw32	sndrv_seq_ev_raw32
 | 
					
						
							|  |  |  | #define snd_seq_ev_ext		sndrv_seq_ev_ext
 | 
					
						
							|  |  |  | #define snd_seq_result		sndrv_seq_result
 | 
					
						
							|  |  |  | #define snd_seq_queue_skew	sndrv_seq_queue_skew
 | 
					
						
							|  |  |  | #define snd_seq_ev_queue_control	sndrv_seq_ev_queue_control
 | 
					
						
							|  |  |  | #define snd_seq_client_t	sndrv_seq_client_t
 | 
					
						
							|  |  |  | #define snd_seq_client_type_t	sndrv_seq_client_type_t
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-09-29 19:11:50 +00:00
										 |  |  | #include <sound/asequencer.h>
 | 
					
						
							| 
									
										
										
										
											2012-11-26 17:54:29 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | /* take back some renames */ | 
					
						
							|  |  |  | #undef snd_seq_client_t
 | 
					
						
							|  |  |  | #undef snd_seq_client_type_t
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-09-13 11:38:32 +00:00
										 |  |  | #include "seqmid.h"
 | 
					
						
							|  |  |  | #include "seq_midi_event.h"
 | 
					
						
							| 
									
										
										
										
											2001-06-20 20:52:12 +00:00
										 |  |  | #include "list.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | struct _snd_async_handler { | 
					
						
							|  |  |  | 	enum { | 
					
						
							|  |  |  | 		SND_ASYNC_HANDLER_GENERIC, | 
					
						
							|  |  |  | 		SND_ASYNC_HANDLER_CTL, | 
					
						
							| 
									
										
										
										
											2005-05-11 12:18:51 +00:00
										 |  |  | 		SND_ASYNC_HANDLER_PCM, | 
					
						
							|  |  |  | 		SND_ASYNC_HANDLER_TIMER, | 
					
						
							| 
									
										
										
										
											2001-06-20 20:52:12 +00:00
										 |  |  | 	} type; | 
					
						
							|  |  |  | 	int fd; | 
					
						
							|  |  |  | 	union { | 
					
						
							|  |  |  | 		snd_ctl_t *ctl; | 
					
						
							| 
									
										
										
										
											2005-05-11 12:18:51 +00:00
										 |  |  | 		snd_pcm_t *pcm; | 
					
						
							|  |  |  | 		snd_timer_t *timer; | 
					
						
							| 
									
										
										
										
											2001-06-20 20:52:12 +00:00
										 |  |  | 	} u; | 
					
						
							|  |  |  | 	snd_async_callback_t callback; | 
					
						
							|  |  |  | 	void *private_data; | 
					
						
							|  |  |  | 	struct list_head glist; | 
					
						
							|  |  |  | 	struct list_head hlist; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2001-01-01 15:15:41 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-03-29 10:11:38 +00:00
										 |  |  | typedef enum _snd_set_mode { | 
					
						
							| 
									
										
										
										
											2001-02-06 23:48:10 +00:00
										 |  |  | 	SND_CHANGE, | 
					
						
							|  |  |  | 	SND_TRY, | 
					
						
							|  |  |  | 	SND_TEST, | 
					
						
							| 
									
										
										
										
											2001-03-29 10:11:38 +00:00
										 |  |  | } snd_set_mode_t; | 
					
						
							| 
									
										
										
										
											2001-02-06 23:48:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-21 21:59:35 +00:00
										 |  |  | size_t page_align(size_t size); | 
					
						
							|  |  |  | size_t page_size(void); | 
					
						
							| 
									
										
										
										
											2002-04-23 15:51:29 +00:00
										 |  |  | size_t page_ptr(size_t object_offset, size_t object_size, size_t *offset, size_t *mmap_offset); | 
					
						
							| 
									
										
										
										
											2001-02-21 21:59:35 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-06-11 13:35:48 +00:00
										 |  |  | int safe_strtol(const char *str, long *val); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2003-03-18 18:00:05 +00:00
										 |  |  | int snd_send_fd(int sock, void *data, size_t len, int fd); | 
					
						
							|  |  |  | int snd_receive_fd(int sock, void *data, size_t len, int *fd); | 
					
						
							| 
									
										
										
										
											2019-03-25 16:45:43 +01:00
										 |  |  | size_t snd_strlcpy(char *dst, const char *src, size_t size); | 
					
						
							| 
									
										
										
										
											2003-03-18 18:00:05 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2004-12-21 14:11:00 +00:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * error messages | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | #ifndef NDEBUG
 | 
					
						
							|  |  |  | #define CHECK_SANITY(x) x
 | 
					
						
							|  |  |  | extern snd_lib_error_handler_t snd_err_msg; | 
					
						
							| 
									
										
										
										
											2019-06-11 23:08:09 -07:00
										 |  |  | #define SNDMSG(args...) snd_err_msg(__FILE__, __LINE__, __func__, 0, ##args)
 | 
					
						
							|  |  |  | #define SYSMSG(args...) snd_err_msg(__FILE__, __LINE__, __func__, errno, ##args)
 | 
					
						
							| 
									
										
										
										
											2004-12-21 14:11:00 +00:00
										 |  |  | #else
 | 
					
						
							|  |  |  | #define CHECK_SANITY(x) 0 /* not evaluated */
 | 
					
						
							|  |  |  | #define SNDMSG(args...) /* nop */
 | 
					
						
							|  |  |  | #define SYSMSG(args...) /* nop */
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*
 | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2001-04-19 21:18:23 +00:00
										 |  |  | #define HAVE_GNU_LD
 | 
					
						
							|  |  |  | #define HAVE_ELF
 | 
					
						
							|  |  |  | #define HAVE_ASM_PREVIOUS_DIRECTIVE
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Stolen from libc-symbols.h in GNU glibc */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* When a reference to SYMBOL is encountered, the linker will emit a
 | 
					
						
							|  |  |  |    warning message MSG.  */ | 
					
						
							| 
									
										
										
										
											2006-09-19 18:07:51 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | #define ASM_NAME(name) __SYMBOL_PREFIX name
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-04-19 21:18:23 +00:00
										 |  |  | #ifdef HAVE_GNU_LD
 | 
					
						
							|  |  |  | # ifdef HAVE_ELF
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* We want the .gnu.warning.SYMBOL section to be unallocated.  */ | 
					
						
							|  |  |  | #  ifdef HAVE_ASM_PREVIOUS_DIRECTIVE
 | 
					
						
							|  |  |  | #   define __make_section_unallocated(section_string)	\
 | 
					
						
							|  |  |  |   asm (".section " section_string "\n\t.previous"); | 
					
						
							|  |  |  | #  elif defined HAVE_ASM_POPSECTION_DIRECTIVE
 | 
					
						
							|  |  |  | #   define __make_section_unallocated(section_string)	\
 | 
					
						
							|  |  |  |   asm (".pushsection " section_string "\n\t.popsection"); | 
					
						
							|  |  |  | #  else
 | 
					
						
							|  |  |  | #   define __make_section_unallocated(section_string)
 | 
					
						
							|  |  |  | #  endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* Tacking on "\n\t#" to the section name makes gcc put it's bogus
 | 
					
						
							|  |  |  |    section attributes on what looks like a comment to the assembler.  */ | 
					
						
							|  |  |  | #  ifdef HAVE_SECTION_QUOTES
 | 
					
						
							|  |  |  | #   define link_warning(symbol, msg) \
 | 
					
						
							| 
									
										
										
										
											2006-09-19 18:07:51 +02:00
										 |  |  |   __make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \ | 
					
						
							| 
									
										
										
										
											2001-04-19 21:18:23 +00:00
										 |  |  |   static const char __evoke_link_warning_##symbol[]	\ | 
					
						
							| 
									
										
										
										
											2006-09-19 18:07:51 +02:00
										 |  |  |     __attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\"\n\t#\""))) = msg; | 
					
						
							| 
									
										
										
										
											2001-04-19 21:18:23 +00:00
										 |  |  | #  else
 | 
					
						
							|  |  |  | #   define link_warning(symbol, msg) \
 | 
					
						
							| 
									
										
										
										
											2006-09-19 18:07:51 +02:00
										 |  |  |   __make_section_unallocated (".gnu.warning." ASM_NAME(#symbol)) \ | 
					
						
							| 
									
										
										
										
											2001-04-19 21:18:23 +00:00
										 |  |  |   static const char __evoke_link_warning_##symbol[]	\ | 
					
						
							| 
									
										
										
										
											2006-09-19 18:07:51 +02:00
										 |  |  |     __attribute__ ((section (".gnu.warning." ASM_NAME(#symbol) "\n\t#"))) = msg; | 
					
						
							| 
									
										
										
										
											2001-04-19 21:18:23 +00:00
										 |  |  | #  endif
 | 
					
						
							|  |  |  | # else
 | 
					
						
							|  |  |  | #  define link_warning(symbol, msg)		\
 | 
					
						
							|  |  |  |   asm (".stabs \"" msg "\",30,0,0,0\n\t"	\ | 
					
						
							| 
									
										
										
										
											2006-09-19 18:07:51 +02:00
										 |  |  |        ".stabs \"" ASM_NAME(#symbol) "\",1,0,0,0\n"); | 
					
						
							| 
									
										
										
										
											2001-04-19 21:18:23 +00:00
										 |  |  | # endif
 | 
					
						
							|  |  |  | #else
 | 
					
						
							|  |  |  | /* We will never be heard; they will all die horribly.  */ | 
					
						
							|  |  |  | # define link_warning(symbol, msg)
 | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-02-11 16:35:24 +00:00
										 |  |  | static inline int snd_open_device(const char *filename, int fmode) | 
					
						
							|  |  |  | { | 
					
						
							| 
									
										
										
										
											2009-11-07 21:29:23 +02:00
										 |  |  | 	int fd; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #ifdef O_CLOEXEC
 | 
					
						
							|  |  |  | 	fmode |= O_CLOEXEC; | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 	fd = open(filename, fmode); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* open with resmgr */ | 
					
						
							|  |  |  | #ifdef SUPPORT_RESMGR
 | 
					
						
							|  |  |  | 	if (fd < 0) { | 
					
						
							|  |  |  | 		if (errno == EAGAIN || errno == EBUSY) | 
					
						
							|  |  |  | 			return fd; | 
					
						
							|  |  |  | 		if (! access(filename, F_OK)) | 
					
						
							|  |  |  | 			fd = rsm_open_device(filename, fmode); | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2020-02-11 11:22:18 +01:00
										 |  |  | #ifndef O_CLOEXEC
 | 
					
						
							| 
									
										
										
										
											2005-02-11 16:35:24 +00:00
										 |  |  | 	if (fd >= 0) | 
					
						
							| 
									
										
										
										
											2009-11-07 21:29:23 +02:00
										 |  |  | 		fcntl(fd, F_SETFD, FD_CLOEXEC); | 
					
						
							| 
									
										
										
										
											2020-02-11 11:22:18 +01:00
										 |  |  | #endif
 | 
					
						
							| 
									
										
										
										
											2009-11-07 21:29:23 +02:00
										 |  |  | 	return fd; | 
					
						
							| 
									
										
										
										
											2005-02-11 16:35:24 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-11-30 18:26:13 +01:00
										 |  |  | /* make local functions really local */ | 
					
						
							| 
									
										
										
										
											2010-08-23 17:05:36 +02:00
										 |  |  | #define snd_dlobj_cache_get \
 | 
					
						
							|  |  |  | 	snd1_dlobj_cache_get | 
					
						
							| 
									
										
										
										
											2019-05-24 20:31:24 +02:00
										 |  |  | #define snd_dlobj_cache_get2 \
 | 
					
						
							|  |  |  | 	snd1_dlobj_cache_get2 | 
					
						
							| 
									
										
										
										
											2010-08-23 17:05:36 +02:00
										 |  |  | #define snd_dlobj_cache_put \
 | 
					
						
							|  |  |  | 	snd1_dlobj_cache_put | 
					
						
							| 
									
										
										
										
											2007-11-30 18:26:13 +01:00
										 |  |  | #define snd_dlobj_cache_cleanup \
 | 
					
						
							|  |  |  | 	snd1_dlobj_cache_cleanup | 
					
						
							|  |  |  | #define snd_config_set_hop \
 | 
					
						
							|  |  |  | 	snd1_config_set_hop | 
					
						
							|  |  |  | #define snd_config_check_hop \
 | 
					
						
							|  |  |  | 	snd1_config_check_hop | 
					
						
							|  |  |  | #define snd_config_search_alias_hooks \
 | 
					
						
							|  |  |  | 	snd1_config_search_alias_hooks | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2005-02-14 15:09:09 +00:00
										 |  |  | /* dlobj cache */ | 
					
						
							| 
									
										
										
										
											2010-08-23 17:05:36 +02:00
										 |  |  | void *snd_dlobj_cache_get(const char *lib, const char *name, const char *version, int verbose); | 
					
						
							| 
									
										
										
										
											2019-05-24 20:31:24 +02:00
										 |  |  | void *snd_dlobj_cache_get2(const char *lib, const char *name, const char *version, int verbose); | 
					
						
							| 
									
										
										
										
											2010-08-23 17:05:36 +02:00
										 |  |  | int snd_dlobj_cache_put(void *open_func); | 
					
						
							| 
									
										
										
										
											2005-02-14 15:09:09 +00:00
										 |  |  | void snd_dlobj_cache_cleanup(void); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-01-30 14:41:51 +00:00
										 |  |  | /* for recursive checks */ | 
					
						
							|  |  |  | void snd_config_set_hop(snd_config_t *conf, int hop); | 
					
						
							|  |  |  | int snd_config_check_hop(snd_config_t *conf); | 
					
						
							|  |  |  | #define SND_CONF_MAX_HOPS	64
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2006-10-11 13:18:57 +02:00
										 |  |  | int snd_config_search_alias_hooks(snd_config_t *config, | 
					
						
							|  |  |  |                                   const char *base, const char *key, | 
					
						
							|  |  |  | 				  snd_config_t **result); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-30 14:52:35 +02:00
										 |  |  | int _snd_conf_generic_id(const char *id); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-28 16:25:41 +01:00
										 |  |  | int _snd_config_load_with_include(snd_config_t *config, snd_input_t *in, | 
					
						
							| 
									
										
										
										
											2019-11-10 13:00:59 +01:00
										 |  |  | 				  int override, const char * const *default_include_path); | 
					
						
							| 
									
										
										
										
											2018-11-28 16:25:41 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-11 18:23:15 +01:00
										 |  |  | /* convenience macros */ | 
					
						
							|  |  |  | #define ARRAY_SIZE(x) (sizeof(x) / sizeof(x[0]))
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define container_of(ptr, type, member) ({                      \
 | 
					
						
							|  |  |  | 	 const typeof( ((type *)0)->member ) *__mptr = (ptr);    \ | 
					
						
							|  |  |  | 	(type *)( (char *)__mptr - offsetof(type,member) );}) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-01-04 15:26:33 +01:00
										 |  |  | #ifdef INTERNAL
 | 
					
						
							|  |  |  | void *INTERNAL(snd_dlopen)(const char *name, int mode, char *errbuf, size_t errbuflen); | 
					
						
							|  |  |  | #endif
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-04-12 18:09:21 +02:00
										 |  |  | const char *uc_mgr_alibcfg_by_device(snd_config_t **config, const char *name); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | static inline int _snd_is_ucm_device(const char *name) | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  | 	return name && name[0] == '_' && name[1] == 'u' && name[2] == 'c' && name[3] == 'm'; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2001-02-06 23:48:10 +00:00
										 |  |  | #endif
 |