Пример #1
0
static inline void log_dpram_status(struct dpram_link_device *dpld)
{
	pr_info("mif: %s: FMT T{I:%u O:%u} R{I:%u O:%u}, "
		"RAW T{I:%u O:%u} R{I:%u O:%u}\n", dpld->ld.name,
		get_tx_head(dpld, IPC_FMT), get_tx_tail(dpld, IPC_FMT),
		get_rx_head(dpld, IPC_FMT), get_rx_tail(dpld, IPC_FMT),
		get_tx_head(dpld, IPC_RAW), get_tx_tail(dpld, IPC_RAW),
		get_rx_head(dpld, IPC_RAW), get_rx_tail(dpld, IPC_RAW));
}
Пример #2
0
/*
** Functions for debugging
*/
static inline void log_dpram_status(struct dpram_link_device *dpld)
{
	pr_info("mif: %s: {M:0x%X A:%d} {FMT TI:%u TO:%u RI:%u RO:%u} "
		"{RAW TI:%u TO:%u RI:%u RO:%u} {INT:0x%X}\n",
		dpld->ld.mc->name,
		get_magic(dpld), get_access(dpld),
		get_tx_head(dpld, IPC_FMT), get_tx_tail(dpld, IPC_FMT),
		get_rx_head(dpld, IPC_FMT), get_rx_tail(dpld, IPC_FMT),
		get_tx_head(dpld, IPC_RAW), get_tx_tail(dpld, IPC_RAW),
		get_rx_head(dpld, IPC_RAW), get_rx_tail(dpld, IPC_RAW),
		recv_intr(dpld));
}
Пример #3
0
static void set_dpram_map(struct dpram_link_device *dpld,
	struct mif_irq_map *map)
{
	map->magic = get_magic(dpld);
	map->access = get_access(dpld);

	map->fmt_tx_in = get_tx_head(dpld, IPC_FMT);
	map->fmt_tx_out = get_tx_tail(dpld, IPC_FMT);
	map->fmt_rx_in = get_rx_head(dpld, IPC_FMT);
	map->fmt_rx_out = get_rx_tail(dpld, IPC_FMT);
	map->raw_tx_in = get_tx_head(dpld, IPC_RAW);
	map->raw_tx_out = get_tx_tail(dpld, IPC_RAW);
	map->raw_rx_in = get_rx_head(dpld, IPC_RAW);
	map->raw_rx_out = get_rx_tail(dpld, IPC_RAW);

	map->cp2ap = recv_intr(dpld);
}
Пример #4
0
/* get free space in the TXQ as well as in & out pointers */
static inline int get_txq_space(struct dpram_link_device *dpld, int dev,
		u32 qsize, u32 *in, u32 *out)
{
	struct link_device *ld = &dpld->ld;
	int cnt = 3;
	int space;

	do {
		*in = get_tx_head(dpld, dev);
		*out = get_tx_tail(dpld, dev);

		if (dpram_circ_valid(qsize, *in, *out)) {
			space = (*in < *out) ? (*out - *in - 1) :
				(qsize + *out - *in - 1);
			return space;
		}

		mif_info("%s: CAUTION! <%pf> "
			"%s_TXQ invalid (size:%d in:%d out:%d)\n",
			ld->name, __builtin_return_address(0),
			get_dev_name(dev), qsize, *in, *out);

		udelay(100);
	} while (cnt--);

	if (dev == IPC_FMT) {
		dpram_trigger_force_cp_crash(dpld);
	} else {
		set_tx_head(dpld, dev, 0);
		set_tx_tail(dpld, dev, 0);
	}

	*in = 0;
	*out = 0;
	return -EINVAL;
}
Пример #5
0
/* Get free space in the TXQ as well as in & out pointers */
static inline int dpram_get_txq_space(struct dpram_link_device *dpld, int dev,
		u32 qsize, u32 *in, u32 *out)
{
	struct link_device *ld = &dpld->ld;
	int cnt = 3;
	u32 head;
	u32 tail;
	int space;

	do {
		head = get_tx_head(dpld, dev);
		tail = get_tx_tail(dpld, dev);

		space = (head < tail) ? (tail - head - 1) :
			(qsize + tail - head - 1);
		mif_debug("%s: %s_TXQ qsize[%u] in[%u] out[%u] space[%u]\n",
			ld->name, get_dev_name(dev), qsize, head, tail, space);

		if (dpram_circ_valid(qsize, head, tail)) {
			*in = head;
			*out = tail;
			return space;
		}

		mif_info("%s: CAUTION! <%pf> "
			"%s_TXQ invalid (size:%d in:%d out:%d)\n",
			ld->name, __builtin_return_address(0),
			get_dev_name(dev), qsize, head, tail);

		udelay(100);
	} while (cnt--);

	*in = 0;
	*out = 0;
	return -EINVAL;
}