Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
endpoint.h File Reference

Go to the source code of this file.

Macros

#define SND_USB_ENDPOINT_TYPE_DATA   0
 
#define SND_USB_ENDPOINT_TYPE_SYNC   1
 

Functions

struct snd_usb_endpointsnd_usb_add_endpoint (struct snd_usb_audio *chip, struct usb_host_interface *alts, int ep_num, int direction, int type)
 
int snd_usb_endpoint_set_params (struct snd_usb_endpoint *ep, snd_pcm_format_t pcm_format, unsigned int channels, unsigned int period_bytes, unsigned int rate, struct audioformat *fmt, struct snd_usb_endpoint *sync_ep)
 
int snd_usb_endpoint_start (struct snd_usb_endpoint *ep, int can_sleep)
 
void snd_usb_endpoint_stop (struct snd_usb_endpoint *ep, int force, int can_sleep, int wait)
 
void snd_usb_endpoint_sync_pending_stop (struct snd_usb_endpoint *ep)
 
int snd_usb_endpoint_activate (struct snd_usb_endpoint *ep)
 
int snd_usb_endpoint_deactivate (struct snd_usb_endpoint *ep)
 
void snd_usb_endpoint_free (struct list_head *head)
 
int snd_usb_endpoint_implict_feedback_sink (struct snd_usb_endpoint *ep)
 
int snd_usb_endpoint_next_packet_size (struct snd_usb_endpoint *ep)
 
void snd_usb_handle_sync_urb (struct snd_usb_endpoint *ep, struct snd_usb_endpoint *sender, const struct urb *urb)
 

Macro Definition Documentation

#define SND_USB_ENDPOINT_TYPE_DATA   0

Definition at line 4 of file endpoint.h.

#define SND_USB_ENDPOINT_TYPE_SYNC   1

Definition at line 5 of file endpoint.h.

Function Documentation

struct snd_usb_endpoint* snd_usb_add_endpoint ( struct snd_usb_audio chip,
struct usb_host_interface *  alts,
int  ep_num,
int  direction,
int  type 
)
read

snd_usb_add_endpoint: Add an endpoint to an USB audio chip

: The chip : The USB host interface : The number of the endpoint to use : SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE : SND_USB_ENDPOINT_TYPE_DATA or SND_USB_ENDPOINT_TYPE_SYNC

If the requested endpoint has not been added to the given chip before, a new instance is created. Otherwise, a pointer to the previoulsy created instance is returned. In case of any error, NULL is returned.

New endpoints will be added to chip->ep_list and must be freed by calling snd_usb_endpoint_free().

Definition at line 414 of file endpoint.c.

int snd_usb_endpoint_activate ( struct snd_usb_endpoint ep)
int snd_usb_endpoint_deactivate ( struct snd_usb_endpoint ep)

snd_usb_endpoint_deactivate: deactivate an snd_usb_endpoint

: the endpoint to deactivate

If the endpoint is not currently in use, this functions will select the alternate interface setting 0 for the interface of this endpoint.

In case of any active users, this functions does nothing.

Returns an error if usb_set_interface() failed, 0 in all other cases.

Definition at line 950 of file endpoint.c.

void snd_usb_endpoint_free ( struct list_head head)

snd_usb_endpoint_free: Free the resources of an snd_usb_endpoint

: the list header of the endpoint to free

This function does not care for the endpoint's use count but will tear down all the streaming URBs immediately and free all resources.

Definition at line 974 of file endpoint.c.

int snd_usb_endpoint_implict_feedback_sink ( struct snd_usb_endpoint ep)

snd_usb_endpoint_implicit_feedback_sink: Report endpoint usage type

: The snd_usb_endpoint

Determine whether an endpoint is driven by an implicit feedback data endpoint source.

Definition at line 131 of file endpoint.c.

int snd_usb_endpoint_next_packet_size ( struct snd_usb_endpoint ep)

Definition at line 146 of file endpoint.c.

int snd_usb_endpoint_set_params ( struct snd_usb_endpoint ep,
snd_pcm_format_t  pcm_format,
unsigned int  channels,
unsigned int  period_bytes,
unsigned int  rate,
struct audioformat fmt,
struct snd_usb_endpoint sync_ep 
)

snd_usb_endpoint_set_params: configure an snd_usb_endpoint

: the snd_usb_endpoint to configure : the audio fomat. : the number of audio channels. : the number of bytes in one alsa period. : the frame rate. : the USB audio format information : the sync endpoint to use, if any

Determine the number of URBs to be used on this endpoint. An endpoint must be configured before it can be started. An endpoint that is already running can not be reconfigured.

Definition at line 765 of file endpoint.c.

int snd_usb_endpoint_start ( struct snd_usb_endpoint ep,
int  can_sleep 
)

snd_usb_endpoint_start: start an snd_usb_endpoint

: the endpoint to start : flag indicating whether the operation is executed in non-atomic context

A call to this function will increment the use count of the endpoint. In case it is not already running, the URBs for this endpoint will be submitted. Otherwise, this function does nothing.

Must be balanced to calls of snd_usb_endpoint_stop().

Returns an error if the URB submission failed, 0 in all other cases.

Definition at line 832 of file endpoint.c.

void snd_usb_endpoint_stop ( struct snd_usb_endpoint ep,
int  force,
int  can_sleep,
int  wait 
)

snd_usb_endpoint_stop: stop an snd_usb_endpoint

: the endpoint to stop (may be NULL)

A call to this function will decrement the use count of the endpoint. In case the last user has requested the endpoint stop, the URBs will actually be deactivated.

Must be balanced to calls of snd_usb_endpoint_start().

Definition at line 914 of file endpoint.c.

void snd_usb_endpoint_sync_pending_stop ( struct snd_usb_endpoint ep)

Definition at line 514 of file endpoint.c.

void snd_usb_handle_sync_urb ( struct snd_usb_endpoint ep,
struct snd_usb_endpoint sender,
const struct urb urb 
)

snd_usb_handle_sync_urb: parse an USB sync packet

: the endpoint to handle the packet : the sending endpoint : the received packet

This function is called from the context of an endpoint that received the packet and is used to let another endpoint object handle the payload.

Definition at line 993 of file endpoint.c.