linux/sound/firewire/cmp.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Connection Management Procedures (IEC 61883-1) helper functions
 *
 * Copyright (c) Clemens Ladisch <[email protected]>
 */

#include <linux/device.h>
#include <linux/firewire.h>
#include <linux/firewire-constants.h>
#include <linux/module.h>
#include <linux/sched.h>
#include "lib.h"
#include "iso-resources.h"
#include "cmp.h"

/* MPR common fields */
#define MPR_SPEED_MASK
#define MPR_SPEED_SHIFT
#define MPR_XSPEED_MASK
#define MPR_XSPEED_SHIFT
#define MPR_PLUGS_MASK

/* PCR common fields */
#define PCR_ONLINE
#define PCR_BCAST_CONN
#define PCR_P2P_CONN_MASK
#define PCR_P2P_CONN_SHIFT
#define PCR_CHANNEL_MASK
#define PCR_CHANNEL_SHIFT

/* oPCR specific fields */
#define OPCR_XSPEED_MASK
#define OPCR_XSPEED_SHIFT
#define OPCR_SPEED_MASK
#define OPCR_SPEED_SHIFT
#define OPCR_OVERHEAD_ID_MASK
#define OPCR_OVERHEAD_ID_SHIFT

enum bus_reset_handling {};

static __printf(2, 3)
void cmp_error(struct cmp_connection *c, const char *fmt, ...)
{}

static u64 mpr_address(struct cmp_connection *c)
{}

static u64 pcr_address(struct cmp_connection *c)
{}

static int pcr_modify(struct cmp_connection *c,
		      __be32 (*modify)(struct cmp_connection *c, __be32 old),
		      int (*check)(struct cmp_connection *c, __be32 pcr),
		      enum bus_reset_handling bus_reset_handling)
{}


/**
 * cmp_connection_init - initializes a connection manager
 * @c: the connection manager to initialize
 * @unit: a unit of the target device
 * @direction: input or output
 * @pcr_index: the index of the iPCR/oPCR on the target device
 */
int cmp_connection_init(struct cmp_connection *c,
			struct fw_unit *unit,
			enum cmp_direction direction,
			unsigned int pcr_index)
{}
EXPORT_SYMBOL();

/**
 * cmp_connection_check_used - check connection is already esablished or not
 * @c: the connection manager to be checked
 * @used: the pointer to store the result of checking the connection
 */
int cmp_connection_check_used(struct cmp_connection *c, bool *used)
{}
EXPORT_SYMBOL();

/**
 * cmp_connection_destroy - free connection manager resources
 * @c: the connection manager
 */
void cmp_connection_destroy(struct cmp_connection *c)
{}
EXPORT_SYMBOL();

int cmp_connection_reserve(struct cmp_connection *c,
			   unsigned int max_payload_bytes)
{}
EXPORT_SYMBOL();

void cmp_connection_release(struct cmp_connection *c)
{}
EXPORT_SYMBOL();

static __be32 ipcr_set_modify(struct cmp_connection *c, __be32 ipcr)
{}

static int get_overhead_id(struct cmp_connection *c)
{}

static __be32 opcr_set_modify(struct cmp_connection *c, __be32 opcr)
{}

static int pcr_set_check(struct cmp_connection *c, __be32 pcr)
{}

/**
 * cmp_connection_establish - establish a connection to the target
 * @c: the connection manager
 *
 * This function establishes a point-to-point connection from the local
 * computer to the target by allocating isochronous resources (channel and
 * bandwidth) and setting the target's input/output plug control register.
 * When this function succeeds, the caller is responsible for starting
 * transmitting packets.
 */
int cmp_connection_establish(struct cmp_connection *c)
{}
EXPORT_SYMBOL();

/**
 * cmp_connection_update - update the connection after a bus reset
 * @c: the connection manager
 *
 * This function must be called from the driver's .update handler to
 * reestablish any connection that might have been active.
 *
 * Returns zero on success, or a negative error code.  On an error, the
 * connection is broken and the caller must stop transmitting iso packets.
 */
int cmp_connection_update(struct cmp_connection *c)
{}
EXPORT_SYMBOL();

static __be32 pcr_break_modify(struct cmp_connection *c, __be32 pcr)
{}

/**
 * cmp_connection_break - break the connection to the target
 * @c: the connection manager
 *
 * This function deactives the connection in the target's input/output plug
 * control register, and frees the isochronous resources of the connection.
 * Before calling this function, the caller should cease transmitting packets.
 */
void cmp_connection_break(struct cmp_connection *c)
{}
EXPORT_SYMBOL();