#include <linux/device.h>
#include <linux/err.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <sound/pcm.h>
#include <sound/pcm_params.h>
#include "amdtp-stream.h"
#define TICKS_PER_CYCLE …
#define CYCLES_PER_SECOND …
#define TICKS_PER_SECOND …
#define OHCI_SECOND_MODULUS …
#define CREATE_TRACE_POINTS
#include "amdtp-stream-trace.h"
#define TRANSFER_DELAY_TICKS …
#define ISO_DATA_LENGTH_SHIFT …
#define TAG_NO_CIP_HEADER …
#define TAG_CIP …
#define CIP_HEADER_QUADLETS …
#define CIP_EOH_SHIFT …
#define CIP_EOH …
#define CIP_EOH_MASK …
#define CIP_SID_SHIFT …
#define CIP_SID_MASK …
#define CIP_DBS_MASK …
#define CIP_DBS_SHIFT …
#define CIP_SPH_MASK …
#define CIP_SPH_SHIFT …
#define CIP_DBC_MASK …
#define CIP_FMT_SHIFT …
#define CIP_FMT_MASK …
#define CIP_FDF_MASK …
#define CIP_FDF_SHIFT …
#define CIP_FDF_NO_DATA …
#define CIP_SYT_MASK …
#define CIP_SYT_NO_INFO …
#define CIP_SYT_CYCLE_MODULUS …
#define CIP_NO_DATA …
#define CIP_HEADER_SIZE …
#define CIP_FMT_AM …
#define AMDTP_FDF_NO_DATA …
#define IR_CTX_HEADER_DEFAULT_QUADLETS …
#define IR_CTX_HEADER_SIZE_NO_CIP …
#define IR_CTX_HEADER_SIZE_CIP …
#define HEADER_TSTAMP_MASK …
#define IT_PKT_HEADER_SIZE_CIP …
#define IT_PKT_HEADER_SIZE_NO_CIP …
#define IR_JUMBO_PAYLOAD_MAX_SKIP_CYCLES …
static void pcm_period_work(struct work_struct *work);
int amdtp_stream_init(struct amdtp_stream *s, struct fw_unit *unit,
enum amdtp_stream_direction dir, unsigned int flags,
unsigned int fmt,
amdtp_stream_process_ctx_payloads_t process_ctx_payloads,
unsigned int protocol_size)
{ … }
EXPORT_SYMBOL(…);
void amdtp_stream_destroy(struct amdtp_stream *s)
{ … }
EXPORT_SYMBOL(…);
const unsigned int amdtp_syt_intervals[CIP_SFC_COUNT] = …;
EXPORT_SYMBOL(…);
const unsigned int amdtp_rate_table[CIP_SFC_COUNT] = …;
EXPORT_SYMBOL(…);
static int apply_constraint_to_size(struct snd_pcm_hw_params *params,
struct snd_pcm_hw_rule *rule)
{ … }
int amdtp_stream_add_pcm_hw_constraints(struct amdtp_stream *s,
struct snd_pcm_runtime *runtime)
{ … }
EXPORT_SYMBOL(…);
int amdtp_stream_set_parameters(struct amdtp_stream *s, unsigned int rate,
unsigned int data_block_quadlets, unsigned int pcm_frame_multiplier)
{ … }
EXPORT_SYMBOL(…);
static int amdtp_stream_get_max_ctx_payload_size(struct amdtp_stream *s)
{ … }
unsigned int amdtp_stream_get_max_payload(struct amdtp_stream *s)
{ … }
EXPORT_SYMBOL(…);
void amdtp_stream_pcm_prepare(struct amdtp_stream *s)
{ … }
EXPORT_SYMBOL(…);
#define prev_packet_desc(s, desc) …
static void pool_blocking_data_blocks(struct amdtp_stream *s, struct seq_desc *descs,
unsigned int size, unsigned int pos, unsigned int count)
{ … }
static void pool_ideal_nonblocking_data_blocks(struct amdtp_stream *s, struct seq_desc *descs,
unsigned int size, unsigned int pos,
unsigned int count)
{ … }
static unsigned int calculate_syt_offset(unsigned int *last_syt_offset,
unsigned int *syt_offset_state, enum cip_sfc sfc)
{ … }
static void pool_ideal_syt_offsets(struct amdtp_stream *s, struct seq_desc *descs,
unsigned int size, unsigned int pos, unsigned int count)
{ … }
static unsigned int compute_syt_offset(unsigned int syt, unsigned int cycle,
unsigned int transfer_delay)
{ … }
static unsigned int calculate_cached_cycle_count(struct amdtp_stream *s, unsigned int head)
{ … }
static void cache_seq(struct amdtp_stream *s, const struct pkt_desc *src, unsigned int desc_count)
{ … }
static void pool_ideal_seq_descs(struct amdtp_stream *s, struct seq_desc *descs, unsigned int size,
unsigned int pos, unsigned int count)
{ … }
static void pool_replayed_seq(struct amdtp_stream *s, struct seq_desc *descs, unsigned int size,
unsigned int pos, unsigned int count)
{ … }
static void pool_seq_descs(struct amdtp_stream *s, struct seq_desc *descs, unsigned int size,
unsigned int pos, unsigned int count)
{ … }
static void update_pcm_pointers(struct amdtp_stream *s,
struct snd_pcm_substream *pcm,
unsigned int frames)
{ … }
static void pcm_period_work(struct work_struct *work)
{ … }
static int queue_packet(struct amdtp_stream *s, struct fw_iso_packet *params,
bool sched_irq)
{ … }
static inline int queue_out_packet(struct amdtp_stream *s,
struct fw_iso_packet *params, bool sched_irq)
{ … }
static inline int queue_in_packet(struct amdtp_stream *s,
struct fw_iso_packet *params)
{ … }
static void generate_cip_header(struct amdtp_stream *s, __be32 cip_header[2],
unsigned int data_block_counter, unsigned int syt)
{ … }
static void build_it_pkt_header(struct amdtp_stream *s, unsigned int cycle,
struct fw_iso_packet *params, unsigned int header_length,
unsigned int data_blocks,
unsigned int data_block_counter,
unsigned int syt, unsigned int index, u32 curr_cycle_time)
{ … }
static int check_cip_header(struct amdtp_stream *s, const __be32 *buf,
unsigned int payload_length,
unsigned int *data_blocks,
unsigned int *data_block_counter, unsigned int *syt)
{ … }
static int parse_ir_ctx_header(struct amdtp_stream *s, unsigned int cycle,
const __be32 *ctx_header,
unsigned int *data_blocks,
unsigned int *data_block_counter,
unsigned int *syt, unsigned int packet_index, unsigned int index,
u32 curr_cycle_time)
{ … }
static inline u32 compute_ohci_iso_ctx_cycle_count(u32 tstamp)
{ … }
static inline u32 compute_ohci_cycle_count(__be32 ctx_header_tstamp)
{ … }
static inline u32 increment_ohci_cycle_count(u32 cycle, unsigned int addend)
{ … }
static inline u32 decrement_ohci_cycle_count(u32 minuend, u32 subtrahend)
{ … }
static int compare_ohci_cycle_count(u32 lval, u32 rval)
{ … }
static inline u32 compute_ohci_it_cycle(const __be32 ctx_header_tstamp,
unsigned int queue_size)
{ … }
static int generate_tx_packet_descs(struct amdtp_stream *s, struct pkt_desc *desc,
const __be32 *ctx_header, unsigned int packet_count,
unsigned int *desc_count)
{ … }
static unsigned int compute_syt(unsigned int syt_offset, unsigned int cycle,
unsigned int transfer_delay)
{ … }
static void generate_rx_packet_descs(struct amdtp_stream *s, struct pkt_desc *desc,
const __be32 *ctx_header, unsigned int packet_count)
{ … }
static inline void cancel_stream(struct amdtp_stream *s)
{ … }
static snd_pcm_sframes_t compute_pcm_extra_delay(struct amdtp_stream *s,
const struct pkt_desc *desc, unsigned int count)
{ … }
static void process_ctx_payloads(struct amdtp_stream *s,
const struct pkt_desc *desc,
unsigned int count)
{ … }
static void process_rx_packets(struct fw_iso_context *context, u32 tstamp, size_t header_length,
void *header, void *private_data)
{ … }
static void skip_rx_packets(struct fw_iso_context *context, u32 tstamp, size_t header_length,
void *header, void *private_data)
{ … }
static void irq_target_callback(struct fw_iso_context *context, u32 tstamp, size_t header_length,
void *header, void *private_data);
static void process_rx_packets_intermediately(struct fw_iso_context *context, u32 tstamp,
size_t header_length, void *header, void *private_data)
{ … }
static void process_tx_packets(struct fw_iso_context *context, u32 tstamp, size_t header_length,
void *header, void *private_data)
{ … }
static void drop_tx_packets(struct fw_iso_context *context, u32 tstamp, size_t header_length,
void *header, void *private_data)
{ … }
static void process_tx_packets_intermediately(struct fw_iso_context *context, u32 tstamp,
size_t header_length, void *header, void *private_data)
{ … }
static void drop_tx_packets_initially(struct fw_iso_context *context, u32 tstamp,
size_t header_length, void *header, void *private_data)
{ … }
static void process_ctxs_in_domain(struct amdtp_domain *d)
{ … }
static void irq_target_callback(struct fw_iso_context *context, u32 tstamp, size_t header_length,
void *header, void *private_data)
{ … }
static void irq_target_callback_intermediately(struct fw_iso_context *context, u32 tstamp,
size_t header_length, void *header, void *private_data)
{ … }
static void irq_target_callback_skip(struct fw_iso_context *context, u32 tstamp,
size_t header_length, void *header, void *private_data)
{ … }
static void amdtp_stream_first_callback(struct fw_iso_context *context,
u32 tstamp, size_t header_length,
void *header, void *private_data)
{ … }
static int amdtp_stream_start(struct amdtp_stream *s, int channel, int speed,
unsigned int queue_size, unsigned int idle_irq_interval)
{ … }
unsigned long amdtp_domain_stream_pcm_pointer(struct amdtp_domain *d,
struct amdtp_stream *s)
{ … }
EXPORT_SYMBOL_GPL(…);
int amdtp_domain_stream_pcm_ack(struct amdtp_domain *d, struct amdtp_stream *s)
{ … }
EXPORT_SYMBOL_GPL(…);
void amdtp_stream_update(struct amdtp_stream *s)
{ … }
EXPORT_SYMBOL(…);
static void amdtp_stream_stop(struct amdtp_stream *s)
{ … }
void amdtp_stream_pcm_abort(struct amdtp_stream *s)
{ … }
EXPORT_SYMBOL(…);
int amdtp_domain_init(struct amdtp_domain *d)
{ … }
EXPORT_SYMBOL_GPL(…);
void amdtp_domain_destroy(struct amdtp_domain *d)
{ … }
EXPORT_SYMBOL_GPL(…);
int amdtp_domain_add_stream(struct amdtp_domain *d, struct amdtp_stream *s,
int channel, int speed)
{ … }
EXPORT_SYMBOL_GPL(…);
static int make_association(struct amdtp_domain *d)
{ … }
int amdtp_domain_start(struct amdtp_domain *d, unsigned int tx_init_skip_cycles, bool replay_seq,
bool replay_on_the_fly)
{ … }
EXPORT_SYMBOL_GPL(…);
void amdtp_domain_stop(struct amdtp_domain *d)
{ … }
EXPORT_SYMBOL_GPL(…);