本文整理汇总了C++中rtdm_lock_put_irqrestore函数的典型用法代码示例。如果您正苦于以下问题:C++ rtdm_lock_put_irqrestore函数的具体用法?C++ rtdm_lock_put_irqrestore怎么用?C++ rtdm_lock_put_irqrestore使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtdm_lock_put_irqrestore函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rt_ip_route_del_host
/***
* rt_ip_route_del_host - deletes specified host route
*/
int rt_ip_route_del_host(u32 addr, struct rtnet_device *rtdev)
{
rtdm_lockctx_t context;
struct host_route *rt;
struct host_route **last_ptr;
unsigned int key;
key = ntohl(addr) & HOST_HASH_KEY_MASK;
last_ptr = &host_hash_tbl[key];
rtdm_lock_get_irqsave(&host_table_lock, context);
rt = host_hash_tbl[key];
while (rt != NULL) {
if ((rt->dest_host.ip == addr) &&
(!rtdev || (rt->dest_host.rtdev->local_ip == rtdev->local_ip))) {
*last_ptr = rt->next;
rt_free_host_route(rt);
rtdm_lock_put_irqrestore(&host_table_lock, context);
return 0;
}
last_ptr = &rt->next;
rt = rt->next;
}
rtdm_lock_put_irqrestore(&host_table_lock, context);
return -ENOENT;
}
示例2: rt_ip_route_get_host
/***
* rt_ip_route_get_host - check if specified host route is resolved
*/
int rt_ip_route_get_host(u32 addr, char *if_name, unsigned char *dev_addr,
struct rtnet_device *rtdev)
{
rtdm_lockctx_t context;
struct host_route *rt;
unsigned int key;
key = ntohl(addr) & HOST_HASH_KEY_MASK;
rtdm_lock_get_irqsave(&host_table_lock, context);
rt = host_hash_tbl[key];
while (rt != NULL) {
if ((rt->dest_host.ip == addr) &&
(!rtdev || rt->dest_host.rtdev->local_ip == rtdev->local_ip)) {
memcpy(dev_addr, rt->dest_host.dev_addr,
rt->dest_host.rtdev->addr_len);
strncpy(if_name, rt->dest_host.rtdev->name, IFNAMSIZ);
rtdm_lock_put_irqrestore(&host_table_lock, context);
return 0;
}
rt = rt->next;
}
rtdm_lock_put_irqrestore(&host_table_lock, context);
return -ENOENT;
}
示例3: cpdma_chan_start
int cpdma_chan_start(struct cpdma_chan *chan)
{
struct cpdma_ctlr *ctlr = chan->ctlr;
struct cpdma_desc_pool *pool = ctlr->pool;
rtdm_lockctx_t context;
rtdm_lock_get_irqsave(&chan->lock, context);
if (chan->state != CPDMA_STATE_IDLE) {
rtdm_lock_put_irqrestore(&chan->lock, context);
return -EBUSY;
}
if (ctlr->state != CPDMA_STATE_ACTIVE) {
rtdm_lock_put_irqrestore(&chan->lock, context);
return -EINVAL;
}
dma_reg_write(ctlr, chan->int_set, chan->mask);
chan->state = CPDMA_STATE_ACTIVE;
if (chan->head) {
chan_write(chan, hdp, desc_phys(pool, chan->head));
if (chan->rxfree)
chan_write(chan, rxfree, chan->count);
}
rtdm_lock_put_irqrestore(&chan->lock, context);
return 0;
}
示例4: cfgInitialDelaySet
static int32_t cfgInitialDelaySet(
struct rtdm_dev_context * ctx,
enum xspiInitialDelay delay) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set initial delay to %d", delay);
if (!CFG_ARG_IS_VALID(delay, XSPI_INITIAL_DELAY_0, XSPI_INITIAL_DELAY_32)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->cfg.delay = delay;
lldInitialDelaySet(
ctx->device,
(uint32_t)delay);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例5: cfgChannelModeSet
static int32_t cfgChannelModeSet(
struct rtdm_dev_context * ctx,
enum xspiChannelMode channelMode) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set initial delay to %d", channelMode);
if (!CFG_ARG_IS_VALID(channelMode, XSPI_CHANNEL_MODE_MULTI, XSPI_CHANNEL_MODE_SINGLE)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->cfg.delay = channelMode;
lldChannelModeSet(
ctx->device,
(uint32_t)channelMode);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例6: cfgCsModeSet
static int32_t cfgCsModeSet(
struct rtdm_dev_context * ctx,
enum xspiCsMode csMode) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set CS mode to %d", csMode);
if (!CFG_ARG_IS_VALID(csMode, XSPI_CS_MODE_ENABLED, XSPI_CS_MODE_DISABLED)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->cfg.csMode = csMode;
lldCsModeSet(
ctx->device,
(int32_t)csMode);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例7: do_slot_job
static void do_slot_job(struct tdma_priv *tdma, struct tdma_slot *job,
rtdm_lockctx_t lockctx)
{
struct rtskb *rtskb;
if ((job->period != 1) &&
(tdma->current_cycle % job->period != job->phasing))
return;
rtdm_lock_put_irqrestore(&tdma->lock, lockctx);
/* wait for slot begin, then send one pending packet */
rtdm_task_sleep_abs(tdma->current_cycle_start + SLOT_JOB(job)->offset,
RTDM_TIMERMODE_REALTIME);
rtdm_lock_get_irqsave(&tdma->lock, lockctx);
rtskb = __rtskb_prio_dequeue(SLOT_JOB(job)->queue);
if (!rtskb)
return;
rtdm_lock_put_irqrestore(&tdma->lock, lockctx);
rtmac_xmit(rtskb);
rtdm_lock_get_irqsave(&tdma->lock, lockctx);
}
示例8: cfgModeSet
static int32_t cfgModeSet(
struct rtdm_dev_context * ctx,
enum xspiMode mode) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set SPI mode to %d", mode);
if (!CFG_ARG_IS_VALID(mode, XSPI_MODE_MASTER, XSPI_MODE_SLAVE)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->cfg.mode = mode;
cfgApply(
ctx);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例9: cfgChnWordLengthSet
static int32_t cfgChnWordLengthSet(
struct rtdm_dev_context * ctx,
uint32_t length) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set word length to %d", length);
if (!CFG_ARG_IS_VALID(length, 4u, 32u)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->chn[devCtx->cfg.chn].cfg.wordLength = length;
lldChnCsDelaySet(
ctx->device,
devCtx->cfg.chn,
(uint32_t)length);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例10: cfgChnPinLayoutSet
static int32_t cfgChnPinLayoutSet(
struct rtdm_dev_context * ctx,
enum xspiPinLayout pinLayout) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set pin layout to %d", pinLayout);
if (!CFG_ARG_IS_VALID(pinLayout, XSPI_PIN_LAYOUT_TX_RX, XSPI_PIN_LAYOUT_RX_TX)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->chn[devCtx->cfg.chn].cfg.pinLayout = pinLayout;
lldChnPinLayoutSet(
ctx->device,
devCtx->cfg.chn,
(uint32_t)pinLayout);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例11: cfgChnCsPolaritySet
static int32_t cfgChnCsPolaritySet(
struct rtdm_dev_context * ctx,
enum xspiCsPolarity csPolarity) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set CS polarity to %d", csPolarity);
if (!CFG_ARG_IS_VALID(csPolarity, XSPI_CS_POLARITY_ACTIVE_HIGH, XSPI_CS_POLAROTY_ACTIVE_LOW)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->chn[devCtx->cfg.chn].cfg.wordLength = csPolarity;
lldChnCsPolaritySet(
ctx->device,
devCtx->cfg.chn,
(uint32_t)csPolarity);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例12: cfgChnCsDelaySet
static int32_t cfgChnCsDelaySet(
struct rtdm_dev_context * ctx,
enum xspiCsDelay delay) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set CS delay to %d", delay);
if (!CFG_ARG_IS_VALID(delay, XSPI_CS_DELAY_0_5, XSPI_CS_DELAY_3_5)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->chn[devCtx->cfg.chn].cfg.csDelay = delay;
lldChnCsDelaySet(
ctx->device,
devCtx->cfg.chn,
(uint32_t)delay);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例13: cfgChnTransferModeSet
static int32_t cfgChnTransferModeSet(
struct rtdm_dev_context * ctx,
enum xspiTransferMode transferMode) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set transfer mode to %d", transferMode);
if (!CFG_ARG_IS_VALID(transferMode, XSPI_TRANSFER_MODE_TX_AND_RX, XSPI_TRANSFER_MODE_TX_ONLY)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->chn[devCtx->cfg.chn].cfg.transferMode = transferMode;
lldChnTransferModeSet(
ctx->device,
devCtx->cfg.chn,
(uint32_t)transferMode);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
示例14: cpdma_chan_stop
int cpdma_chan_stop(struct cpdma_chan *chan)
{
struct cpdma_ctlr *ctlr = chan->ctlr;
struct cpdma_desc_pool *pool = ctlr->pool;
rtdm_lockctx_t context;
int ret;
unsigned long timeout;
rtdm_lock_get_irqsave(&chan->lock, context);
if (chan->state != CPDMA_STATE_ACTIVE) {
rtdm_lock_put_irqrestore(&chan->lock, context);
return -EINVAL;
}
chan->state = CPDMA_STATE_TEARDOWN;
dma_reg_write(ctlr, chan->int_clear, chan->mask);
/* trigger teardown */
dma_reg_write(ctlr, chan->td, chan_linear(chan));
/* wait for teardown complete */
timeout = jiffies + HZ/10; /* 100 msec */
while (time_before(jiffies, timeout)) {
u32 cp = chan_read(chan, cp);
if ((cp & CPDMA_TEARDOWN_VALUE) == CPDMA_TEARDOWN_VALUE)
break;
cpu_relax();
}
WARN_ON(!time_before(jiffies, timeout));
chan_write(chan, cp, CPDMA_TEARDOWN_VALUE);
/* handle completed packets */
rtdm_lock_put_irqrestore(&chan->lock, context);
do {
ret = __cpdma_chan_process(chan);
if (ret < 0)
break;
} while ((ret & CPDMA_DESC_TD_COMPLETE) == 0);
rtdm_lock_get_irqsave(&chan->lock, context);
/* remaining packets haven't been tx/rx'ed, clean them up */
while (chan->head) {
struct cpdma_desc __iomem *desc = chan->head;
dma_addr_t next_dma;
next_dma = desc_read(desc, hw_next);
chan->head = desc_from_phys(pool, next_dma);
chan->count--;
chan->stats.teardown_dequeue++;
/* issue callback without locks held */
rtdm_lock_put_irqrestore(&chan->lock, context);
__cpdma_chan_free(chan, desc, 0, -ENOSYS);
rtdm_lock_get_irqsave(&chan->lock, context);
}
chan->state = CPDMA_STATE_IDLE;
rtdm_lock_put_irqrestore(&chan->lock, context);
return 0;
}
示例15: cfgChnCsStateSet
static int32_t cfgChnCsStateSet(
struct rtdm_dev_context * ctx,
enum xspiCsState state) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
int32_t ret;
LOG_DBG("CFG: set CS state to %d", state);
if (!CFG_ARG_IS_VALID(state, XSPI_CS_STATE_INACTIVE, XSPI_CS_STATE_ACTIVE)) {
return (-EINVAL);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
if (XSPI_ACTIVITY_RUNNIG == devCtx->actvCnt) {
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (-EAGAIN);
}
devCtx->chn[devCtx->cfg.chn].cfg.csState = state;
ret = lldChnCsStateSet(
ctx->device,
devCtx->cfg.chn,
(uint32_t)state);
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (ret);
}