/** * struct hi3660_chan_info - Hi3660 mailbox channel information * @dst_irq: Interrupt vector for remote processor * @ack_irq: Interrupt vector for local processor * * A channel can be used for TX or RX, it can trigger remote * processor interrupt to notify remote processor and can receive * interrupt if it has an incoming message.
*/ struct hi3660_chan_info { unsignedint dst_irq; unsignedint ack_irq;
};
/** * struct hi3660_mbox - Hi3660 mailbox controller data * @dev: Device to which it is attached * @base: Base address of the register mapping region * @chan: Representation of channels in mailbox controller * @mchan: Representation of channel info * @controller: Representation of a communication channel controller * * Mailbox controller includes 32 channels and can allocate * channel for message transferring.
*/ struct hi3660_mbox { struct device *dev; void __iomem *base; struct mbox_chan chan[MBOX_CHAN_MAX]; struct hi3660_chan_info mchan[MBOX_CHAN_MAX]; struct mbox_controller controller;
};
for (retry = 10; retry; retry--) { /* Check if channel is in idle state */ if (readl(base + MBOX_MODE_REG) & MBOX_STATE_IDLE) {
writel(BIT(mchan->ack_irq), base + MBOX_SRC_REG);
/* Check ack bit has been set successfully */
val = readl(base + MBOX_SRC_REG); if (val & BIT(mchan->ack_irq)) break;
}
}
if (!retry)
dev_err(mbox->dev, "%s: failed to acquire channel\n", __func__);
return retry ? 0 : -ETIMEDOUT;
}
staticint hi3660_mbox_startup(struct mbox_chan *chan)
{ int ret;
ret = hi3660_mbox_unlock(chan); if (ret) return ret;
ret = hi3660_mbox_acquire_channel(chan); if (ret) return ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.