Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros | Functions
amdtp.c File Reference
#include <linux/device.h>
#include <linux/err.h>
#include <linux/firewire.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include "amdtp.h"

Go to the source code of this file.

Macros

#define TICKS_PER_CYCLE   3072
 
#define CYCLES_PER_SECOND   8000
 
#define TICKS_PER_SECOND   (TICKS_PER_CYCLE * CYCLES_PER_SECOND)
 
#define TRANSFER_DELAY_TICKS   0x2e00 /* 479.17 µs */
 
#define TAG_CIP   1
 
#define CIP_EOH   (1u << 31)
 
#define CIP_FMT_AM   (0x10 << 24)
 
#define AMDTP_FDF_AM824   (0 << 19)
 
#define AMDTP_FDF_SFC_SHIFT   16
 
#define INTERRUPT_INTERVAL   16
 
#define QUEUE_LENGTH   48
 

Functions

int amdtp_out_stream_init (struct amdtp_out_stream *s, struct fw_unit *unit, enum cip_out_flags flags)
 
 EXPORT_SYMBOL (amdtp_out_stream_init)
 
void amdtp_out_stream_destroy (struct amdtp_out_stream *s)
 
 EXPORT_SYMBOL (amdtp_out_stream_destroy)
 
void amdtp_out_stream_set_rate (struct amdtp_out_stream *s, unsigned int rate)
 
 EXPORT_SYMBOL (amdtp_out_stream_set_rate)
 
unsigned int amdtp_out_stream_get_max_payload (struct amdtp_out_stream *s)
 
 EXPORT_SYMBOL (amdtp_out_stream_get_max_payload)
 
void amdtp_out_stream_set_pcm_format (struct amdtp_out_stream *s, snd_pcm_format_t format)
 
 EXPORT_SYMBOL (amdtp_out_stream_set_pcm_format)
 
void amdtp_out_stream_pcm_prepare (struct amdtp_out_stream *s)
 
 EXPORT_SYMBOL (amdtp_out_stream_pcm_prepare)
 
int amdtp_out_stream_start (struct amdtp_out_stream *s, int channel, int speed)
 
 EXPORT_SYMBOL (amdtp_out_stream_start)
 
unsigned long amdtp_out_stream_pcm_pointer (struct amdtp_out_stream *s)
 
 EXPORT_SYMBOL (amdtp_out_stream_pcm_pointer)
 
void amdtp_out_stream_update (struct amdtp_out_stream *s)
 
 EXPORT_SYMBOL (amdtp_out_stream_update)
 
void amdtp_out_stream_stop (struct amdtp_out_stream *s)
 
 EXPORT_SYMBOL (amdtp_out_stream_stop)
 
void amdtp_out_stream_pcm_abort (struct amdtp_out_stream *s)
 
 EXPORT_SYMBOL (amdtp_out_stream_pcm_abort)
 

Macro Definition Documentation

#define AMDTP_FDF_AM824   (0 << 19)

Definition at line 27 of file amdtp.c.

#define AMDTP_FDF_SFC_SHIFT   16

Definition at line 28 of file amdtp.c.

#define CIP_EOH   (1u << 31)

Definition at line 25 of file amdtp.c.

#define CIP_FMT_AM   (0x10 << 24)

Definition at line 26 of file amdtp.c.

#define CYCLES_PER_SECOND   8000

Definition at line 18 of file amdtp.c.

#define INTERRUPT_INTERVAL   16

Definition at line 31 of file amdtp.c.

#define QUEUE_LENGTH   48

Definition at line 32 of file amdtp.c.

#define TAG_CIP   1

Definition at line 23 of file amdtp.c.

#define TICKS_PER_CYCLE   3072

Definition at line 17 of file amdtp.c.

#define TICKS_PER_SECOND   (TICKS_PER_CYCLE * CYCLES_PER_SECOND)

Definition at line 19 of file amdtp.c.

#define TRANSFER_DELAY_TICKS   0x2e00 /* 479.17 µs */

Definition at line 21 of file amdtp.c.

Function Documentation

void amdtp_out_stream_destroy ( struct amdtp_out_stream s)

amdtp_out_stream_destroy - free stream resources : the AMDTP output stream to destroy

Definition at line 63 of file amdtp.c.

unsigned int amdtp_out_stream_get_max_payload ( struct amdtp_out_stream s)

amdtp_out_stream_get_max_payload - get the stream's packet size : the AMDTP output stream

This function must not be called before the stream has been configured with amdtp_out_stream_set_hw_params(), amdtp_out_stream_set_pcm(), and amdtp_out_stream_set_midi().

Definition at line 116 of file amdtp.c.

int amdtp_out_stream_init ( struct amdtp_out_stream s,
struct fw_unit unit,
enum cip_out_flags  flags 
)

amdtp_out_stream_init - initialize an AMDTP output stream structure : the AMDTP output stream to initialize : the target of the stream : the packet transmission method to use

Definition at line 42 of file amdtp.c.

void amdtp_out_stream_pcm_abort ( struct amdtp_out_stream s)

amdtp_out_stream_pcm_abort - abort the running PCM device : the AMDTP stream about to be stopped

If the isochronous stream needs to be stopped asynchronously, call this function first to stop the PCM device.

Definition at line 598 of file amdtp.c.

unsigned long amdtp_out_stream_pcm_pointer ( struct amdtp_out_stream s)

amdtp_out_stream_pcm_pointer - get the PCM buffer position : the AMDTP output stream that transports the PCM data

Returns the current buffer position, in frames.

Definition at line 542 of file amdtp.c.

void amdtp_out_stream_pcm_prepare ( struct amdtp_out_stream s)

amdtp_out_stream_pcm_prepare - prepare PCM device for running : the AMDTP output stream

This function should be called from the PCM device's .prepare callback.

Definition at line 176 of file amdtp.c.

void amdtp_out_stream_set_pcm_format ( struct amdtp_out_stream s,
snd_pcm_format_t  format 
)

amdtp_out_stream_set_pcm_format - set the PCM format : the AMDTP output stream to configure : the format of the ALSA PCM device

The sample format must be set before the stream is started, and must not be changed while the stream is running.

Definition at line 150 of file amdtp.c.

void amdtp_out_stream_set_rate ( struct amdtp_out_stream s,
unsigned int  rate 
)

amdtp_out_stream_set_rate - set the sample rate : the AMDTP output stream to configure : the sample rate

The sample rate must be set before the stream is started, and must not be changed while the stream is running.

Definition at line 79 of file amdtp.c.

int amdtp_out_stream_start ( struct amdtp_out_stream s,
int  channel,
int  speed 
)

amdtp_out_stream_start - start sending packets : the AMDTP output stream to start : the isochronous channel on the bus : firewire speed code

The stream cannot be started until it has been configured with amdtp_out_stream_set_hw_params(), amdtp_out_stream_set_pcm(), and amdtp_out_stream_set_midi(); and it must be started before any PCM or MIDI device can be started.

Definition at line 462 of file amdtp.c.

void amdtp_out_stream_stop ( struct amdtp_out_stream s)

amdtp_out_stream_stop - stop sending packets : the AMDTP output stream to stop

All PCM and MIDI devices of the stream must be stopped before the stream itself can be stopped.

Definition at line 572 of file amdtp.c.

void amdtp_out_stream_update ( struct amdtp_out_stream s)

amdtp_out_stream_update - update the stream after a bus reset : the AMDTP output stream

Definition at line 558 of file amdtp.c.

EXPORT_SYMBOL ( amdtp_out_stream_init  )
EXPORT_SYMBOL ( amdtp_out_stream_destroy  )
EXPORT_SYMBOL ( amdtp_out_stream_set_rate  )
EXPORT_SYMBOL ( amdtp_out_stream_get_max_payload  )
EXPORT_SYMBOL ( amdtp_out_stream_set_pcm_format  )
EXPORT_SYMBOL ( amdtp_out_stream_pcm_prepare  )
EXPORT_SYMBOL ( amdtp_out_stream_start  )
EXPORT_SYMBOL ( amdtp_out_stream_pcm_pointer  )
EXPORT_SYMBOL ( amdtp_out_stream_update  )
EXPORT_SYMBOL ( amdtp_out_stream_stop  )
EXPORT_SYMBOL ( amdtp_out_stream_pcm_abort  )