• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ rt_hw_interrupt_disable函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中rt_hw_interrupt_disable函数的典型用法代码示例。如果您正苦于以下问题:C++ rt_hw_interrupt_disable函数的具体用法?C++ rt_hw_interrupt_disable怎么用?C++ rt_hw_interrupt_disable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了rt_hw_interrupt_disable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: sys_arch_protect

sys_prot_t sys_arch_protect(void)
{
    rt_base_t level;

    /* disable interrupt */
    level = rt_hw_interrupt_disable();

    return level;
}
开发者ID:haitao52198,项目名称:HD-Elastos,代码行数:9,代码来源:sys_arch.c


示例2: SECTION

SECTION("itcm") status_t flexspi_nor_flash_erase_sector(FLEXSPI_Type *base, uint32_t address) 
{
    status_t status;
    flexspi_transfer_t flashXfer;
    rt_uint32_t level;
    level = rt_hw_interrupt_disable();
    FLEXSPI_Enable(FLEXSPI, false);
    CLOCK_DisableClock(FLEXSPI_CLOCK);
    CLOCK_SetDiv(kCLOCK_FlexspiDiv, 3); /* flexspi clock 332M, DDR mode, internal clock 166M. */
    CLOCK_EnableClock(FLEXSPI_CLOCK);
    FLEXSPI_Enable(FLEXSPI, true);
    /* Write enable */
    status = flexspi_nor_write_enable(base, address);

    if (status != kStatus_Success)
    {
        FLEXSPI_Enable(FLEXSPI, false);
        CLOCK_DisableClock(FLEXSPI_CLOCK);
        CLOCK_SetDiv(kCLOCK_FlexspiDiv, 0); /* flexspi clock 332M, DDR mode, internal clock 166M. */
        CLOCK_EnableClock(FLEXSPI_CLOCK);
        FLEXSPI_Enable(FLEXSPI, true);
        FLEXSPI_SoftwareReset(FLEXSPI);
        rt_hw_interrupt_enable(level);
        return status;
    }

    flashXfer.deviceAddress = address;
    flashXfer.port = kFLEXSPI_PortA1;
    flashXfer.cmdType = kFLEXSPI_Command;
    flashXfer.SeqNumber = 4;
    flashXfer.seqIndex = HYPERFLASH_CMD_LUT_SEQ_IDX_ERASESECTOR;
    status = FLEXSPI_TransferBlocking(base, &flashXfer);

    if (status != kStatus_Success)
    {
        FLEXSPI_Enable(FLEXSPI, false);
        CLOCK_DisableClock(FLEXSPI_CLOCK);
        CLOCK_SetDiv(kCLOCK_FlexspiDiv, 0); /* flexspi clock 332M, DDR mode, internal clock 166M. */
        CLOCK_EnableClock(FLEXSPI_CLOCK);
        FLEXSPI_Enable(FLEXSPI, true);
        FLEXSPI_SoftwareReset(FLEXSPI);
        rt_hw_interrupt_enable(level);
        return status;
    }

    status = flexspi_nor_wait_bus_busy(base);
    rt_hw_cpu_dcache_ops(RT_HW_CACHE_INVALIDATE,(void *)(FLEXSPI_AMBA_BASE+address),FLEXSPI_NOR_SECTOR_SIZE);
    rt_hw_cpu_icache_ops(RT_HW_CACHE_INVALIDATE,(void *)(FLEXSPI_AMBA_BASE+address),FLEXSPI_NOR_SECTOR_SIZE);
    FLEXSPI_Enable(FLEXSPI, false);
    CLOCK_DisableClock(FLEXSPI_CLOCK);
    CLOCK_SetDiv(kCLOCK_FlexspiDiv, 0); /* flexspi clock 332M, DDR mode, internal clock 166M. */
    CLOCK_EnableClock(FLEXSPI_CLOCK);
    FLEXSPI_Enable(FLEXSPI, true);
    FLEXSPI_SoftwareReset(FLEXSPI);
    rt_hw_interrupt_enable(level);
    return status;
}
开发者ID:geniusgogo,项目名称:rt-thread,代码行数:57,代码来源:drv_flexspi_hyper.c


示例3: rt_thread_kill

int rt_thread_kill(rt_thread_t tid, int sig)
{
    siginfo_t si;
	rt_base_t level;
	struct siginfo_node *si_node;

    RT_ASSERT(tid != RT_NULL);
    if (!sig_valid(sig)) return -RT_EINVAL;

    dbg_log(DBG_INFO, "send signal: %d\n", sig);
    si.si_errno = RT_EINTR;
    si.si_signo = sig;
    si.si_code  = SI_USER;
    si.si_value.sival_ptr = RT_NULL;

	level = rt_hw_interrupt_disable();
    if (tid->sig_pending & sig_mask(sig))
    {
        /* whether already emits this signal? */
        struct rt_slist_node *node;
        struct siginfo_node  *entry;

		node = (struct rt_slist_node *)tid->si_list;
		rt_hw_interrupt_enable(level);

		/* update sig infor */
		rt_enter_critical();
        for (; (node) != RT_NULL; node = node->next)
        {
            entry = rt_slist_entry(node, struct siginfo_node, list);
            if (entry->si.si_signo == sig)
            {
                memcpy(&(entry->si), &si, sizeof(siginfo_t));
				rt_exit_critical();
                return 0;
            }
        }
		rt_exit_critical();

		/* disable interrupt to protect tcb */
		level = rt_hw_interrupt_disable();
    }
	else
	{
开发者ID:onelife,项目名称:rt-thread,代码行数:44,代码来源:signal.c


示例4: rt_serial_read

static rt_size_t rt_serial_read(rt_device_t dev, rt_off_t pos, void* buffer, rt_size_t size)
{
	rt_uint8_t* ptr;
	struct rt_ppc405_serial* device;

	device = (struct rt_ppc405_serial*) dev;
	RT_ASSERT(device != RT_NULL);

	/* point to buffer */
	ptr = (rt_uint8_t*) buffer;

	if (dev->flag & RT_DEVICE_FLAG_INT_RX)
	{
		while (size)
		{
			/* interrupt receive */
			rt_base_t level;

			/* disable interrupt */
			level = rt_hw_interrupt_disable();
			if (device->read_index != device->save_index)
			{
				*ptr = device->rx_buffer[device->read_index];

				device->read_index ++;
				if (device->read_index >= RT_UART_RX_BUFFER_SIZE)
					device->read_index = 0;
			}
			else
			{
				/* no data in rx buffer */

				/* enable interrupt */
				rt_hw_interrupt_enable(level);
				break;
			}

			/* enable interrupt */
			rt_hw_interrupt_enable(level);

			ptr ++; size --;
		}

		return (rt_uint32_t)ptr - (rt_uint32_t)buffer;
	}
	else if (dev->flag & RT_DEVICE_FLAG_DMA_RX)
	{
		/* not support right now */
		RT_ASSERT(0);
	}

	/* polling mode */
	RT_ASSERT(0);

	return (rt_size_t)ptr - (rt_size_t)buffer;
}
开发者ID:634351070,项目名称:rt-thread,代码行数:56,代码来源:serial.c


示例5: main

int main(void)
{
	/* disable interrupt first */
	rt_hw_interrupt_disable();

	/* startup RT-Thread RTOS */
	rtthread_startup();

	return 0;
}
开发者ID:304471720,项目名称:rt-thread,代码行数:10,代码来源:startup.c


示例6: rt_thread_handle_sig

void rt_thread_handle_sig(rt_bool_t clean_state)
{
	rt_base_t level;

    rt_thread_t tid = rt_thread_self();
    struct siginfo_node *si_node;

	level = rt_hw_interrupt_disable();
    while (tid->sig_pending & tid->sig_mask)
    {
        int signo, error;
        rt_sighandler_t handler;

		si_node = (struct siginfo_node *)tid->si_list;
		if (!si_node) break;

		/* remove this sig info node from list */
        if (si_node->list.next == RT_NULL)
            tid->si_list = RT_NULL;
        else
            tid->si_list = (void*)rt_slist_entry(si_node->list.next, struct siginfo_node, list);

        signo   = si_node->si.si_signo;
        handler = tid->sig_vectors[signo];
		rt_hw_interrupt_enable(level);

        dbg_log(DBG_LOG, "handle signal: %d, handler 0x%08x\n", signo, handler);
        if (handler) handler(signo);

		level = rt_hw_interrupt_disable();
        tid->sig_pending &= ~sig_mask(signo);
        error = si_node->si.si_errno;

        rt_mp_free(si_node); /* release this siginfo node */
        /* set errno in thread tcb */
        tid->error = error;
    }

	/* whether clean signal status */
	if (clean_state == RT_TRUE) tid->stat &= ~RT_THREAD_STAT_SIGNAL;

	rt_hw_interrupt_enable(level);
}
开发者ID:onelife,项目名称:rt-thread,代码行数:43,代码来源:signal.c


示例7: _vcom_reset_state

static void _vcom_reset_state(void)
{
    int lvl = rt_hw_interrupt_disable();
    tx_ringbuffer.read_mirror  = tx_ringbuffer.read_index = 0;
    tx_ringbuffer.write_mirror = tx_ringbuffer.write_index = 0;
    vcom_connected = RT_FALSE;
    vcom_in_sending = RT_FALSE;
    /*rt_kprintf("reset USB serial\n", cnt);*/
    rt_hw_interrupt_enable(lvl);
}
开发者ID:dtyangcm,项目名称:rtt-stm32f103c8,代码行数:10,代码来源:cdc_serial.c


示例8: rt_interrupt_enter

/**
 * This function will be invoked by BSP, when enter interrupt service routine
 *
 * @note please don't invoke this routine in application
 *
 * @see rt_interrupt_leave
 */
void rt_interrupt_enter()
{
    rt_base_t level;

    RT_DEBUG_LOG(RT_DEBUG_IRQ,("irq comming..., irq nest:%d\n", rt_interrupt_nest));

    level = rt_hw_interrupt_disable();
    rt_interrupt_nest ++;
    rt_hw_interrupt_enable(level);
}
开发者ID:comrid1987,项目名称:jb3500,代码行数:17,代码来源:irq.c


示例9: rt_interrupt_leave

/**
 * This function will be invoked by BSP, when leave interrupt service routine
 *
 * @note please don't invoke this routine in application
 *
 * @see rt_interrupt_enter
 */
void rt_interrupt_leave()
{
    rt_base_t level;

    RT_DEBUG_LOG(RT_DEBUG_IRQ,("irq leave, irq nest:%d\n", rt_interrupt_nest));

    level = rt_hw_interrupt_disable();
    rt_interrupt_nest --;
    rt_hw_interrupt_enable(level);
}
开发者ID:comrid1987,项目名称:jb3500,代码行数:17,代码来源:irq.c


示例10: main

int main(void)
{
	rt_uint32_t level UNUSED;

	/* disable interrupt first */
	level = rt_hw_interrupt_disable();
	rtthread_startup();

	return 0;
}
开发者ID:SmartPeach,项目名称:net-sdr,代码行数:10,代码来源:startup.c


示例11: rt_completion_init

void rt_completion_init(struct rt_completion *completion)
{
    rt_base_t level;
    RT_ASSERT(completion != RT_NULL);

    level = rt_hw_interrupt_disable();
    completion->flag = RT_UNCOMPLETED;
    rt_list_init(&completion->suspended_list);
    rt_hw_interrupt_enable(level);
}
开发者ID:nathanlnw,项目名称:tw705_HB_gghypt,代码行数:10,代码来源:completion.c


示例12: main

int main(void)
{
	/* disable interrupt first */
	rt_hw_interrupt_disable();

	/* invoke rtthread_startup */
	rtthread_startup();
	
	return 0;
}
开发者ID:bright-pan,项目名称:smart-lock,代码行数:10,代码来源:startup.c


示例13: rt_hw_cpu_shutdown

/** shutdown CPU */
void rt_hw_cpu_shutdown()
{
	rt_uint32_t level;
	rt_kprintf("shutdown...\n");

	level = rt_hw_interrupt_disable();
	while (level)
	{
		RT_ASSERT(0);
	}
}
开发者ID:csz-cmy,项目名称:rt-thread,代码行数:12,代码来源:cpu.c


示例14: rt_signal_mask

void rt_signal_mask(int signo)
{
    rt_base_t level;
    rt_thread_t tid = rt_thread_self();

    level = rt_hw_interrupt_disable();

    tid->sig_mask &= ~sig_mask(signo);

    rt_hw_interrupt_enable(level);
}
开发者ID:onelife,项目名称:rt-thread,代码行数:11,代码来源:signal.c


示例15: serial_ringbuffer_size

rt_inline rt_uint32_t serial_ringbuffer_size(struct serial_ringbuffer *rbuffer)
{
    rt_uint32_t size;
    rt_base_t level;

    level = rt_hw_interrupt_disable();
    size = (rbuffer->put_index - rbuffer->get_index) & (RT_SERIAL_RB_BUFSZ - 1);
    rt_hw_interrupt_enable(level);

    return size;
}
开发者ID:634351070,项目名称:rt-thread,代码行数:11,代码来源:serial.c


示例16: bsp_init

/*
 * Setup system tick for OS required.
 */
void bsp_init(void)
{
	/* disable interrupt first */
	rt_hw_interrupt_disable();

//	drv_uart_init();
	rt_hw_usart_init();
	rt_console_set_device(RT_CONSOLE_DEVICE_NAME);

	/* System tick init */
	BSP_Tmr_TickInit(0x1, (MB_PCLK / RT_TICK_PER_SECOND), IRQ_SYS_TICK_VECTOR, SysTick_Handler);
}
开发者ID:blueskycoco,项目名称:rtt,代码行数:15,代码来源:board.c


示例17: codec_write

static rt_size_t codec_write(rt_device_t dev, rt_off_t pos,
                             const void* buffer, rt_size_t size)
{
    struct codec_device* device;
    struct codec_data_node* node;
    rt_uint32_t level;
    rt_uint16_t next_index;

    device = (struct codec_device*) dev;
    RT_ASSERT(device != RT_NULL);

    next_index = device->put_index + 1;
    if (next_index >= DATA_NODE_MAX)
        next_index = 0;

    /* check data_list full */
    if (next_index == device->read_index)
    {
        rt_set_errno(-RT_EFULL);
        return 0;
    }

    level = rt_hw_interrupt_disable();
    node = &device->data_list[device->put_index];
    device->put_index = next_index;

    /* set node attribute */
    node->data_ptr = (rt_uint16_t*) buffer;
    node->data_size = size >> 1; /* size is byte unit, convert to half word unit */

    next_index = device->read_index + 1;
    if (next_index >= DATA_NODE_MAX)
        next_index = 0;

    /* check data list whether is empty */
    if (next_index == device->put_index)
    {
        DMA_Configuration((rt_uint32_t) node->data_ptr, node->data_size);

#if CODEC_MASTER_MODE
        if ((r06 & MS) == 0)
        {
            CODEC_I2S_PORT->I2SCFGR |= SPI_I2SCFGR_I2SE;
            r06 |= MS;
            codec_send(r06);
        }
#endif
    }
    rt_hw_interrupt_enable(level);

    return size;
}
开发者ID:Manish-cimcon,项目名称:micro,代码行数:52,代码来源:codec.c


示例18: rt_hw_uart_isr

void rt_hw_uart_isr(struct rt_lm3s_serial* serial)
{
    rt_device_t device;
    rt_uint32_t status;

    device = (struct rt_device*)serial;
    status = MAP_UARTIntStatus(serial->hw_base, true);

    /* clear interrupt status */
    MAP_UARTIntClear(serial->hw_base, status);

    if (device->flag & RT_DEVICE_FLAG_INT_RX)
    {
        char ch;
		rt_base_t level;

        while (MAP_UARTCharsAvail(serial->hw_base))
        {
            ch = MAP_UARTCharGetNonBlocking(serial->hw_base);

            /* disable interrupt */
			level = rt_hw_interrupt_disable();

			/* read character */
			serial->rx_buffer[serial->save_index] = ch;
			serial->save_index ++;
			if (serial->save_index >= RT_UART_RX_BUFFER_SIZE)
				serial->save_index = 0;

			/* if the next position is read index, discard this 'read char' */
			if (serial->save_index == serial->read_index)
			{
				serial->read_index ++;
				if (serial->read_index >= RT_UART_RX_BUFFER_SIZE)
					serial->read_index = 0;
			}

			/* enable interrupt */
			rt_hw_interrupt_enable(level);
        }

		/* invoke callback */
		if(device->rx_indicate != RT_NULL)
		{
		    rt_int32_t length;

		    length = serial->save_index - serial->read_index;
		    if (length < 0) length += RT_UART_RX_BUFFER_SIZE;
            device->rx_indicate(device, length);
		}
    }
}
开发者ID:comrid1987,项目名称:jb3500,代码行数:52,代码来源:serial.c


示例19: finsh_set_password

/**
 * set a new password for finsh
 *
 * @param password new password
 *
 * @return result, RT_EOK on OK, -RT_ERROR on the new password length is less than
 *  FINSH_PASSWORD_MIN or greater than FINSH_PASSWORD_MAX
 */
rt_err_t finsh_set_password(const char *password) {
    rt_ubase_t level;
    rt_size_t pw_len = rt_strlen(password);

    if (pw_len < FINSH_PASSWORD_MIN || pw_len > FINSH_PASSWORD_MAX)
        return -RT_ERROR;

    level = rt_hw_interrupt_disable();
    rt_strncpy(shell->password, password, FINSH_PASSWORD_MAX);
    rt_hw_interrupt_enable(level);

    return RT_EOK;
}
开发者ID:onelife,项目名称:rt-thread,代码行数:21,代码来源:shell.c


示例20: main

/***************************************************************************//**
 * @brief
 *  Program entry point
 *
 * @details
 *
 * @note
 *
 ******************************************************************************/
int main(void)
{
    /* disable interrupt first */
    rt_hw_interrupt_disable();

    /* init system setting */
    SystemInit();

    /* startup RT-Thread RTOS */
    rtthread_startup();

    return 0;
}
开发者ID:bright-pan,项目名称:smart-lock,代码行数:22,代码来源:startup.c



注:本文中的rt_hw_interrupt_disable函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ rt_hw_serial_isr函数代码示例发布时间:2022-05-30
下一篇:
C++ rt_hw_board_init函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap