本文整理汇总了C++中rtdm_lock_get_irqsave函数的典型用法代码示例。如果您正苦于以下问题:C++ rtdm_lock_get_irqsave函数的具体用法?C++ rtdm_lock_get_irqsave怎么用?C++ rtdm_lock_get_irqsave使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了rtdm_lock_get_irqsave函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: 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);
}
开发者ID:hiddeate2m,项目名称:rtnet,代码行数:25,代码来源:tdma_worker.c
示例2: rt_loopback_xmit
/***
* rt_loopback_xmit - begin packet transmission
* @skb: packet to be sent
* @dev: network device to which packet is sent
*
*/
static int rt_loopback_xmit(struct rtskb *skb, struct rtnet_device *rtdev)
{
unsigned short hash;
struct rtpacket_type *pt_entry;
rtdm_lockctx_t context;
/* write transmission stamp - in case any protocol ever gets the idea to
ask the lookback device for this service... */
if (skb->xmit_stamp)
*skb->xmit_stamp = cpu_to_be64(rtdm_clock_read() + *skb->xmit_stamp);
/* make sure that critical fields are re-intialised */
skb->chain_end = skb;
/* parse the Ethernet header as usual */
skb->protocol = rt_eth_type_trans(skb, rtdev);
skb->nh.raw = skb->data;
rtdev_reference(rtdev);
rtcap_report_incoming(skb);
hash = ntohs(skb->protocol) & RTPACKET_HASH_KEY_MASK;
rtdm_lock_get_irqsave(&rt_packets_lock, context);
list_for_each_entry(pt_entry, &rt_packets[hash], list_entry)
if (pt_entry->type == skb->protocol) {
pt_entry->refcount++;
rtdm_lock_put_irqrestore(&rt_packets_lock, context);
pt_entry->handler(skb, pt_entry);
rtdm_lock_get_irqsave(&rt_packets_lock, context);
pt_entry->refcount--;
rtdm_lock_put_irqrestore(&rt_packets_lock, context);
goto out;
}
rtdm_lock_put_irqrestore(&rt_packets_lock, context);
/* don't warn if running in promiscuous mode (RTcap...?) */
if ((rtdev->flags & IFF_PROMISC) == 0)
rtdm_printk("RTnet: unknown layer-3 protocol\n");
kfree_rtskb(skb);
out:
rtdev_dereference(rtdev);
return 0;
}
开发者ID:BackupTheBerlios,项目名称:rtnet-svn,代码行数:59,代码来源:rt_loopback.c
示例3: tdma_worker
void tdma_worker(void *arg)
{
struct tdma_priv *tdma = (struct tdma_priv *)arg;
struct tdma_job *job;
rtdm_lockctx_t lockctx;
rtdm_event_wait(&tdma->worker_wakeup);
rtdm_lock_get_irqsave(&tdma->lock, lockctx);
job = tdma->first_job;
while (!test_bit(TDMA_FLAG_SHUTDOWN, &tdma->flags)) {
job->ref_count++;
switch (job->id) {
case WAIT_ON_SYNC:
rtdm_lock_put_irqrestore(&tdma->lock, lockctx);
rtdm_event_wait(&tdma->sync_event);
rtdm_lock_get_irqsave(&tdma->lock, lockctx);
break;
case XMIT_REQ_CAL:
job = do_request_cal_job(tdma, REQUEST_CAL_JOB(job), lockctx);
break;
#ifdef CONFIG_RTNET_TDMA_MASTER
case XMIT_SYNC:
do_xmit_sync_job(tdma, lockctx);
break;
case BACKUP_SYNC:
do_backup_sync_job(tdma, lockctx);
break;
case XMIT_RPL_CAL:
job = do_reply_cal_job(tdma, REPLY_CAL_JOB(job), lockctx);
break;
#endif /* CONFIG_RTNET_TDMA_MASTER */
default:
do_slot_job(tdma, SLOT_JOB(job), lockctx);
break;
}
job->ref_count--;
job = tdma->current_job =
list_entry(job->entry.next, struct tdma_job, entry);
}
rtdm_lock_put_irqrestore(&tdma->lock, lockctx);
}
开发者ID:hiddeate2m,项目名称:rtnet,代码行数:52,代码来源:tdma_worker.c
示例4: do_xmit_sync_job
static void do_xmit_sync_job(struct tdma_priv *tdma, rtdm_lockctx_t lockctx)
{
rtdm_lock_put_irqrestore(&tdma->lock, lockctx);
/* wait for beginning of next cycle, then send sync */
rtdm_task_sleep_abs(tdma->current_cycle_start + tdma->cycle_period,
RTDM_TIMERMODE_REALTIME);
rtdm_lock_get_irqsave(&tdma->lock, lockctx);
tdma->current_cycle++;
tdma->current_cycle_start += tdma->cycle_period;
rtdm_lock_put_irqrestore(&tdma->lock, lockctx);
tdma_xmit_sync_frame(tdma);
rtdm_lock_get_irqsave(&tdma->lock, lockctx);
}
开发者ID:hiddeate2m,项目名称:rtnet,代码行数:16,代码来源:tdma_worker.c
示例5: tims_clock_ioctl
int tims_clock_ioctl(rtdm_user_info_t *user_info, unsigned int request,
void *arg)
{
rtdm_lockctx_t lock_ctx;
nanosecs_rel_t result = 0;
switch(clock_sync_mode) {
case SYNC_RTNET:
sync_dev_ctx->ops->ioctl_rt(sync_dev_ctx, NULL,
RTMAC_RTIOC_TIMEOFFSET, &result);
break;
case SYNC_CAN_SLAVE:
case SYNC_SER_SLAVE:
rtdm_lock_get_irqsave(&sync_lock, lock_ctx);
result = clock_offset;
rtdm_lock_put_irqrestore(&sync_lock, lock_ctx);
break;
}
result += sync_delay;
if (request == TIMS_RTIOC_GETTIME)
result += rtdm_clock_read();
return rtdm_safe_copy_to_user(user_info, arg, &result, sizeof(result));
}
开发者ID:BackupTheBerlios,项目名称:rack-svn,代码行数:28,代码来源:tims_clock.c
示例6: cfgChnSet
static int32_t cfgChnSet(
struct rtdm_dev_context * ctx,
enum xspiChn chn) {
struct devCtx * devCtx;
rtdm_lockctx_t lockCtx;
LOG_DBG("CFG: set current channel to %d", chn);
if (!CFG_ARG_IS_VALID(chn, XSPI_CHN_0, XSPI_CHN_3)) {
return (-EINVAL);
}
if (FALSE == portChnIsOnline(ctx->device, chn)) {
return (-EIDRM);
}
devCtx = getDevCtx(
ctx);
rtdm_lock_get_irqsave(&devCtx->lock, lockCtx);
devCtx->cfg.chn = chn;
rtdm_lock_put_irqrestore(&devCtx->lock, lockCtx);
return (0);
}
开发者ID:netico-solutions,项目名称:xdrv-spi,代码行数:26,代码来源:x_spi.c
示例7: rt_packet_rcv
/***
* rt_packet_rcv
*/
int rt_packet_rcv(struct rtskb *skb, struct rtpacket_type *pt)
{
struct rtsocket *sock = (struct rtsocket *)(((u8 *)pt) -
((u8 *)&((struct rtsocket *)0)->prot.packet));
int ifindex = sock->prot.packet.ifindex;
void (*callback_func)(struct rtdm_dev_context *, void *);
void *callback_arg;
rtdm_lockctx_t context;
if (((ifindex != 0) && (ifindex != skb->rtdev->ifindex)) ||
(rtskb_acquire(skb, &sock->skb_pool) != 0))
kfree_rtskb(skb);
else {
rtdev_reference(skb->rtdev);
rtskb_queue_tail(&sock->incoming, skb);
rtdm_sem_up(&sock->pending_sem);
rtdm_lock_get_irqsave(&sock->param_lock, context);
callback_func = sock->callback_func;
callback_arg = sock->callback_arg;
rtdm_lock_put_irqrestore(&sock->param_lock, context);
if (callback_func)
callback_func(rt_socket_context(sock), callback_arg);
}
return 0;
}
开发者ID:BackupTheBerlios,项目名称:rtnet-svn,代码行数:31,代码来源:af_packet.c
示例8: 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);
}
开发者ID:netico-solutions,项目名称:xdrv-spi,代码行数:31,代码来源:x_spi.c
示例9: 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);
}
开发者ID:netico-solutions,项目名称:xdrv-spi,代码行数:31,代码来源:x_spi.c
示例10: rt_udp_close
/***
* rt_udp_close
*/
int rt_udp_close(struct rtdm_dev_context *sockctx,
rtdm_user_info_t *user_info)
{
struct rtsocket *sock = (struct rtsocket *)&sockctx->dev_private;
struct rtskb *del;
int port;
rtdm_lockctx_t context;
rtdm_lock_get_irqsave(&udp_socket_base_lock, context);
sock->prot.inet.state = TCP_CLOSE;
if (sock->prot.inet.reg_index >= 0) {
port = sock->prot.inet.reg_index;
clear_bit(port % 32, &port_bitmap[port / 32]);
free_ports++;
sock->prot.inet.reg_index = -1;
}
rtdm_lock_put_irqrestore(&udp_socket_base_lock, context);
/* cleanup already collected fragments */
rt_ip_frag_invalidate_socket(sock);
/* free packets in incoming queue */
while ((del = rtskb_dequeue(&sock->incoming)) != NULL)
kfree_rtskb(del);
return rt_socket_cleanup(sockctx);
}
开发者ID:BackupTheBerlios,项目名称:rtnet-svn,代码行数:36,代码来源:udp.c
示例11: 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);
}
开发者ID:netico-solutions,项目名称:xdrv-spi,代码行数:30,代码来源:x_spi.c
示例12: 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;
}
开发者ID:hiddeate2m,项目名称:rtnet,代码行数:37,代码来源:route.c
示例13: 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);
}
开发者ID:netico-solutions,项目名称:xdrv-spi,代码行数:29,代码来源:x_spi.c
示例14: 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);
}
开发者ID:netico-solutions,项目名称:xdrv-spi,代码行数:31,代码来源:x_spi.c
示例15: 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;
}
开发者ID:hiddeate2m,项目名称:rtnet,代码行数:34,代码来源:route.c
示例16: 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;
}
开发者ID:G-Ray,项目名称:xenomai-boneblack-rtnet-drivers,代码行数:26,代码来源:davinci_cpdma.c
示例17: cpdma_ctlr_stop
int cpdma_ctlr_stop(struct cpdma_ctlr *ctlr)
{
rtdm_lockctx_t context;
int i;
rtdm_lock_get_irqsave(&ctlr->lock, context);
if (ctlr->state != CPDMA_STATE_ACTIVE) {
rtdm_lock_put_irqrestore(&ctlr->lock, context);
return -EINVAL;
}
ctlr->state = CPDMA_STATE_TEARDOWN;
for (i = 0; i < ARRAY_SIZE(ctlr->channels); i++) {
if (ctlr->channels[i])
cpdma_chan_stop(ctlr->channels[i]);
}
dma_reg_write(ctlr, CPDMA_RXINTMASKCLEAR, 0xffffffff);
dma_reg_write(ctlr, CPDMA_TXINTMASKCLEAR, 0xffffffff);
dma_reg_write(ctlr, CPDMA_TXCONTROL, 0);
dma_reg_write(ctlr, CPDMA_RXCONTROL, 0);
ctlr->state = CPDMA_STATE_IDLE;
rtdm_lock_put_irqrestore(&ctlr->lock, context);
return 0;
}
开发者ID:G-Ray,项目名称:xenomai-boneblack-rtnet-drivers,代码行数:29,代码来源:davinci_cpdma.c
示例18: rt_packet_close
/***
* rt_packet_close
*/
int rt_packet_close(struct rtdm_dev_context *sockctx,
rtdm_user_info_t *user_info)
{
struct rtsocket *sock = (struct rtsocket *)&sockctx->dev_private;
struct rtpacket_type *pt = &sock->prot.packet.packet_type;
struct rtskb *del;
int ret = 0;
rtdm_lockctx_t context;
rtdm_lock_get_irqsave(&sock->param_lock, context);
if ((pt->type != 0) && ((ret = rtdev_remove_pack(pt)) == 0))
pt->type = 0;
rtdm_lock_put_irqrestore(&sock->param_lock, context);
/* free packets in incoming queue */
while ((del = rtskb_dequeue(&sock->incoming)) != NULL) {
rtdev_dereference(del->rtdev);
kfree_rtskb(del);
}
if (ret == 0)
ret = rt_socket_cleanup(sockctx);
return ret;
}
开发者ID:BackupTheBerlios,项目名称:rtnet-svn,代码行数:31,代码来源:af_packet.c
示例19: 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);
}
开发者ID:netico-solutions,项目名称:xdrv-spi,代码行数:31,代码来源:x_spi.c
示例20: __list_del
static struct tdma_job *do_reply_cal_job(struct tdma_priv *tdma,
struct tdma_reply_cal *job,
rtdm_lockctx_t lockctx)
{
struct tdma_job *prev_job;
if (job->reply_cycle > tdma->current_cycle)
return &job->head;
/* remove the job */
__list_del(job->head.entry.prev, job->head.entry.next);
job->head.ref_count--;
prev_job = tdma->current_job =
list_entry(job->head.entry.prev, struct tdma_job, entry);
prev_job->ref_count++;
tdma->job_list_revision++;
rtdm_lock_put_irqrestore(&tdma->lock, lockctx);
if (job->reply_cycle == tdma->current_cycle) {
/* send reply in the assigned slot */
rtdm_task_sleep_abs(tdma->current_cycle_start + job->reply_offset,
RTDM_TIMERMODE_REALTIME);
rtmac_xmit(job->reply_rtskb);
} else {
/* cleanup if cycle already passed */
kfree_rtskb(job->reply_rtskb);
}
rtdm_lock_get_irqsave(&tdma->lock, lockctx);
return prev_job;
}
开发者ID:hiddeate2m,项目名称:rtnet,代码行数:33,代码来源:tdma_worker.c
注:本文中的rtdm_lock_get_irqsave函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论