Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
rawmidi.h File Reference
#include <sound/asound.h>
#include <linux/interrupt.h>
#include <linux/spinlock.h>
#include <linux/wait.h>
#include <linux/mutex.h>
#include <linux/workqueue.h>

Go to the source code of this file.

Data Structures

struct  snd_rawmidi_ops
 
struct  snd_rawmidi_global_ops
 
struct  snd_rawmidi_runtime
 
struct  snd_rawmidi_substream
 
struct  snd_rawmidi_file
 
struct  snd_rawmidi_str
 
struct  snd_rawmidi
 

Macros

#define SNDRV_RAWMIDI_DEVICES   8
 
#define SNDRV_RAWMIDI_LFLG_OUTPUT   (1<<0)
 
#define SNDRV_RAWMIDI_LFLG_INPUT   (1<<1)
 
#define SNDRV_RAWMIDI_LFLG_OPEN   (3<<0)
 
#define SNDRV_RAWMIDI_LFLG_APPEND   (1<<2)
 

Functions

int snd_rawmidi_new (struct snd_card *card, char *id, int device, int output_count, int input_count, struct snd_rawmidi **rmidi)
 
void snd_rawmidi_set_ops (struct snd_rawmidi *rmidi, int stream, struct snd_rawmidi_ops *ops)
 
void snd_rawmidi_receive_reset (struct snd_rawmidi_substream *substream)
 
int snd_rawmidi_receive (struct snd_rawmidi_substream *substream, const unsigned char *buffer, int count)
 
void snd_rawmidi_transmit_reset (struct snd_rawmidi_substream *substream)
 
int snd_rawmidi_transmit_empty (struct snd_rawmidi_substream *substream)
 
int snd_rawmidi_transmit_peek (struct snd_rawmidi_substream *substream, unsigned char *buffer, int count)
 
int snd_rawmidi_transmit_ack (struct snd_rawmidi_substream *substream, int count)
 
int snd_rawmidi_transmit (struct snd_rawmidi_substream *substream, unsigned char *buffer, int count)
 
int snd_rawmidi_info_select (struct snd_card *card, struct snd_rawmidi_info *info)
 
int snd_rawmidi_kernel_open (struct snd_card *card, int device, int subdevice, int mode, struct snd_rawmidi_file *rfile)
 
int snd_rawmidi_kernel_release (struct snd_rawmidi_file *rfile)
 
int snd_rawmidi_output_params (struct snd_rawmidi_substream *substream, struct snd_rawmidi_params *params)
 
int snd_rawmidi_input_params (struct snd_rawmidi_substream *substream, struct snd_rawmidi_params *params)
 
int snd_rawmidi_drop_output (struct snd_rawmidi_substream *substream)
 
int snd_rawmidi_drain_output (struct snd_rawmidi_substream *substream)
 
int snd_rawmidi_drain_input (struct snd_rawmidi_substream *substream)
 
long snd_rawmidi_kernel_read (struct snd_rawmidi_substream *substream, unsigned char *buf, long count)
 
long snd_rawmidi_kernel_write (struct snd_rawmidi_substream *substream, const unsigned char *buf, long count)
 

Macro Definition Documentation

#define SNDRV_RAWMIDI_DEVICES   8

Definition at line 40 of file rawmidi.h.

#define SNDRV_RAWMIDI_LFLG_APPEND   (1<<2)

Definition at line 45 of file rawmidi.h.

#define SNDRV_RAWMIDI_LFLG_INPUT   (1<<1)

Definition at line 43 of file rawmidi.h.

#define SNDRV_RAWMIDI_LFLG_OPEN   (3<<0)

Definition at line 44 of file rawmidi.h.

#define SNDRV_RAWMIDI_LFLG_OUTPUT   (1<<0)

Definition at line 42 of file rawmidi.h.

Function Documentation

int snd_rawmidi_drain_input ( struct snd_rawmidi_substream substream)

Definition at line 198 of file rawmidi.c.

int snd_rawmidi_drain_output ( struct snd_rawmidi_substream substream)

Definition at line 169 of file rawmidi.c.

int snd_rawmidi_drop_output ( struct snd_rawmidi_substream substream)

Definition at line 155 of file rawmidi.c.

int snd_rawmidi_info_select ( struct snd_card card,
struct snd_rawmidi_info info 
)

Definition at line 578 of file rawmidi.c.

int snd_rawmidi_input_params ( struct snd_rawmidi_substream substream,
struct snd_rawmidi_params params 
)

Definition at line 650 of file rawmidi.c.

int snd_rawmidi_kernel_open ( struct snd_card card,
int  device,
int  subdevice,
int  mode,
struct snd_rawmidi_file rfile 
)

Definition at line 320 of file rawmidi.c.

long snd_rawmidi_kernel_read ( struct snd_rawmidi_substream substream,
unsigned char buf,
long  count 
)

Definition at line 965 of file rawmidi.c.

int snd_rawmidi_kernel_release ( struct snd_rawmidi_file rfile)

Definition at line 514 of file rawmidi.c.

long snd_rawmidi_kernel_write ( struct snd_rawmidi_substream substream,
const unsigned char buf,
long  count 
)

Definition at line 1211 of file rawmidi.c.

int snd_rawmidi_new ( struct snd_card card,
char id,
int  device,
int  output_count,
int  input_count,
struct snd_rawmidi **  rrawmidi 
)

snd_rawmidi_new - create a rawmidi instance : the card instance : the id string : the device index : the number of output streams : the number of input streams : the pointer to store the new rawmidi instance

Creates a new rawmidi instance. Use snd_rawmidi_set_ops() to set the operators to the new instance.

Returns zero if successful, or a negative error code on failure.

Definition at line 1443 of file rawmidi.c.

int snd_rawmidi_output_params ( struct snd_rawmidi_substream substream,
struct snd_rawmidi_params params 
)

Definition at line 621 of file rawmidi.c.

int snd_rawmidi_receive ( struct snd_rawmidi_substream substream,
const unsigned char buffer,
int  count 
)

snd_rawmidi_receive - receive the input data from the device : the rawmidi substream : the buffer pointer : the data size to read

Reads the data from the internal buffer.

Returns the size of read data, or a negative error code on failure.

Definition at line 868 of file rawmidi.c.

void snd_rawmidi_receive_reset ( struct snd_rawmidi_substream substream)
void snd_rawmidi_set_ops ( struct snd_rawmidi rmidi,
int  stream,
struct snd_rawmidi_ops ops 
)

snd_rawmidi_set_ops - set the rawmidi operators : the rawmidi instance : the stream direction, SNDRV_RAWMIDI_STREAM_XXX : the operator table

Sets the rawmidi operators for the given stream direction.

Definition at line 1665 of file rawmidi.c.

int snd_rawmidi_transmit ( struct snd_rawmidi_substream substream,
unsigned char buffer,
int  count 
)

snd_rawmidi_transmit - copy from the buffer to the device : the rawmidi substream : the buffer pointer : the data size to transfer

Copies data from the buffer to the device and advances the pointer.

Returns the copied size if successful, or a negative error code on failure.

Definition at line 1145 of file rawmidi.c.

int snd_rawmidi_transmit_ack ( struct snd_rawmidi_substream substream,
int  count 
)

snd_rawmidi_transmit_ack - acknowledge the transmission : the rawmidi substream : the tranferred count

Advances the hardware pointer for the internal output buffer with the given size and updates the condition. Call after the transmission is finished.

Returns the advanced size if successful, or a negative error code on failure.

Definition at line 1112 of file rawmidi.c.

int snd_rawmidi_transmit_empty ( struct snd_rawmidi_substream substream)

snd_rawmidi_transmit_empty - check whether the output buffer is empty : the rawmidi substream

Returns 1 if the internal output buffer is empty, 0 if not.

Definition at line 1030 of file rawmidi.c.

int snd_rawmidi_transmit_peek ( struct snd_rawmidi_substream substream,
unsigned char buffer,
int  count 
)

snd_rawmidi_transmit_peek - copy data from the internal buffer : the rawmidi substream : the buffer pointer : data size to transfer

Copies data from the internal output buffer to the given buffer.

Call this in the interrupt handler when the midi output is ready, and call snd_rawmidi_transmit_ack() after the transmission is finished.

Returns the size of copied data, or a negative error code on failure.

Definition at line 1060 of file rawmidi.c.

void snd_rawmidi_transmit_reset ( struct snd_rawmidi_substream substream)