您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ CRITICAL_REGION_EXIT函数代码示例

51自学网 2021-06-01 20:05:28
  C++
这篇教程C++ CRITICAL_REGION_EXIT函数代码示例写得很实用,希望能帮到您。

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

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

示例1: nrf_drv_clock_hfclk_request

void nrf_drv_clock_hfclk_request(nrf_drv_clock_handler_item_t * p_handler_item){    ASSERT(m_clock_cb.module_initialized);    if (m_clock_cb.hfclk_on)    {        if (p_handler_item)        {            p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_HFCLK_STARTED);        }        CRITICAL_REGION_ENTER();        ++(m_clock_cb.hfclk_requests);        CRITICAL_REGION_EXIT();    }    else    {        CRITICAL_REGION_ENTER();        if (p_handler_item)        {            item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_hf_head,                p_handler_item);        }        if (m_clock_cb.hfclk_requests == 0)        {            hfclk_start();        }        ++(m_clock_cb.hfclk_requests);        CRITICAL_REGION_EXIT();    }    ASSERT(m_clock_cb.hfclk_requests > 0);}
开发者ID:CWBudde,项目名称:Espruino,代码行数:32,


示例2: nrf_drv_ppi_channel_include_in_group

uint32_t nrf_drv_ppi_channel_include_in_group(nrf_ppi_channel_t       channel,                                              nrf_ppi_channel_group_t group){    uint32_t err_code;#if (NRF_PPI_RESTRICTED > 0)    uint32_t ch_mask;#endif    if (!is_app_group(group))    {        err_code = NRF_ERROR_INVALID_PARAM;    }    else if (!is_allocated_group(group))    {        err_code = NRF_ERROR_INVALID_STATE;    }    else if (!is_app_channel(channel))    {        err_code = NRF_ERROR_INVALID_PARAM;    }    else    {#if (NRF_PPI_RESTRICTED > 0)        CRITICAL_REGION_ENTER();        err_code = sd_ppi_group_get((uint8_t) group, &ch_mask);        if (err_code != NRF_SUCCESS)        {            err_code = NRF_ERROR_INVALID_PARAM;        }        else        {            ch_mask |= channel_to_mask(channel);            err_code = sd_ppi_group_assign((uint8_t) group, ch_mask);            if (err_code != NRF_SUCCESS)            {                err_code = NRF_ERROR_INVALID_PARAM;            }        }        CRITICAL_REGION_EXIT();#else        CRITICAL_REGION_ENTER();        nrf_ppi_channel_include_in_group(channel, group);        CRITICAL_REGION_EXIT();        err_code = NRF_SUCCESS;#endif    }    return err_code;}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:53,


示例3: nrf_drv_ppi_channels_remove_from_group

uint32_t nrf_drv_ppi_channels_remove_from_group(uint32_t channel_mask,                                                nrf_ppi_channel_group_t group){    uint32_t err_code;    if (!is_app_group(group))    {        err_code = NRF_ERROR_INVALID_PARAM;    }    else if (!is_allocated_group(group))    {        err_code = NRF_ERROR_INVALID_STATE;    }    else if (!are_app_channels(channel_mask))    {        err_code = NRF_ERROR_INVALID_PARAM;    }    else    {#if (NRF_PPI_RESTRICTED > 0)        uint32_t channels_in_group = 0;        CRITICAL_REGION_ENTER();        err_code = sd_ppi_group_get((uint8_t) group, &channels_in_group);        if (err_code != NRF_SUCCESS)        {            err_code = NRF_ERROR_INVALID_PARAM;        }        else        {            channels_in_group &= ~channel_mask;            err_code = sd_ppi_group_assign((uint8_t) group, channels_in_group);            if (err_code != NRF_SUCCESS)            {                err_code = NRF_ERROR_INVALID_PARAM;            }        }        CRITICAL_REGION_EXIT();#else        CRITICAL_REGION_ENTER();        nrf_ppi_channels_remove_from_group(channel_mask, group);        CRITICAL_REGION_EXIT();        err_code = NRF_SUCCESS;#endif    }    return err_code;}
开发者ID:BlueSkyGjj,项目名称:nRF52,代码行数:51,


示例4: nrf_drv_clock_calibration_abort

ret_code_t nrf_drv_clock_calibration_abort(void){#if CALIBRATION_SUPPORT    CRITICAL_REGION_ENTER();    switch(m_clock_cb.cal_state)    {    case CAL_STATE_CT:        nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK);        nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTOP);        m_clock_cb.cal_state = CAL_STATE_IDLE;        if (m_clock_cb.cal_done_handler)        {            m_clock_cb.cal_done_handler(NRF_DRV_CLOCK_EVT_CAL_ABORTED);        }        break;    case CAL_STATE_HFCLK_REQ:        /* fall through. */    case CAL_STATE_CAL:        m_clock_cb.cal_state = CAL_STATE_ABORT;        break;    default:        break;    }    CRITICAL_REGION_EXIT();    return NRF_SUCCESS;#else //CALIBRATION_SUPPORT    return NRF_ERROR_FORBIDDEN;#endif}
开发者ID:Hom-Wang,项目名称:NRF5x,代码行数:29,


示例5: nrf_drv_clock_lfclk_request

void nrf_drv_clock_lfclk_request(nrf_drv_clock_handler_item_t * p_handler_item){    ASSERT(m_clock_cb.module_initialized);#ifndef SOFTDEVICE_PRESENT    ASSERT(m_clock_cb.lfclk_requests != INT_MAX);    CRITICAL_REGION_ENTER();    if (m_clock_cb.lfclk_on)    {        if (p_handler_item)        {            p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED);        }    }    else    {        if (p_handler_item)        {            item_enqueue((nrf_drv_clock_handler_item_t **)&m_clock_cb.p_lf_head, p_handler_item);        }        if (m_clock_cb.lfclk_requests == 0)        {            lfclk_start();        }    }    m_clock_cb.lfclk_requests++;    CRITICAL_REGION_EXIT();#else    if (p_handler_item)    {        p_handler_item->event_handler(NRF_DRV_CLOCK_EVT_LFCLK_STARTED);    }#endif // SOFTDEVICE_PRESENT}
开发者ID:Hom-Wang,项目名称:NRF5x,代码行数:34,


示例6: timer_stop_op_schedule

/**@brief Function for scheduling a Timer Stop operation. * * @param[in]  timer_id   Id of timer to stop. * @param[in]  op_type    Type of stop operation * * @return NRF_SUCCESS on successful scheduling a timer stop operation. NRF_ERROR_NO_MEM when there *         is no memory left to schedule the timer stop operation. */static uint32_t timer_stop_op_schedule(timer_node_t * p_node,                                       timer_user_op_type_t op_type){    uint8_t last_index;    uint32_t err_code = NRF_SUCCESS;    CRITICAL_REGION_ENTER();    timer_user_op_t * p_user_op = user_op_alloc(&last_index);    if (p_user_op == NULL)    {        err_code = NRF_ERROR_NO_MEM;    }    else    {        p_user_op->op_type  = op_type;        p_user_op->p_node = p_node;        user_op_enque(last_index);    }    CRITICAL_REGION_EXIT();    if (err_code == NRF_SUCCESS)    {        timer_list_handler_sched();    }    return err_code;}
开发者ID:CWBudde,项目名称:Espruino,代码行数:36,


示例7: timer_start_op_schedule

static uint32_t timer_start_op_schedule(timer_node_t * p_node,                                        uint32_t        timeout_initial,                                        uint32_t        timeout_periodic,                                        void *          p_context){    uint8_t last_index;    uint32_t err_code = NRF_SUCCESS;    CRITICAL_REGION_ENTER();    timer_user_op_t * p_user_op = user_op_alloc(&last_index);    if (p_user_op == NULL)    {        err_code = NRF_ERROR_NO_MEM;    }    else    {        p_user_op->op_type                              = TIMER_USER_OP_TYPE_START;        p_user_op->p_node                               = p_node;        p_user_op->params.start.ticks_at_start          = rtc1_counter_get();        p_user_op->params.start.ticks_first_interval    = timeout_initial;        p_user_op->params.start.ticks_periodic_interval = timeout_periodic;        p_user_op->params.start.p_context               = p_context;        user_op_enque(last_index);    }    CRITICAL_REGION_EXIT();    if (err_code == NRF_SUCCESS)    {        timer_list_handler_sched();    }    return err_code;}
开发者ID:CWBudde,项目名称:Espruino,代码行数:35,


示例8: hid_kbd_on_set_report

/** * @brief @ref app_usbd_hid_interface_t::hid_kbd_on_set_report */static ret_code_t hid_kbd_on_set_report(app_usbd_class_inst_t const * p_inst,                                        app_usbd_setup_evt_t const *  p_setup_ev){    app_usbd_hid_kbd_t const * p_kbd = hid_kbd_get(p_inst);    /*Request setup data*/    app_usbd_hid_report_buffer_t const * p_rep_buff;    p_rep_buff = app_usbd_hid_rep_buff_out_get(&p_kbd->specific.inst.hid_inst);    p_rep_buff->p_buff[0] = 0;    NRF_DRV_USBD_TRANSFER_OUT(transfer, p_rep_buff->p_buff + 1, p_rep_buff->size - 1);    ret_code_t ret;    CRITICAL_REGION_ENTER();    ret = app_usbd_core_setup_data_transfer(NRF_DRV_USBD_EPOUT0, &transfer);    if (ret == NRF_SUCCESS)    {        app_usbd_core_setup_data_handler_desc_t desc = {                .handler = hid_kbd_on_set_report_data_cb,                .p_context = (app_usbd_hid_kbd_t *)p_kbd        };        ret = app_usbd_core_setup_data_handler_set(NRF_DRV_USBD_EPOUT0, &desc);    }    CRITICAL_REGION_EXIT();    return ret;}
开发者ID:TanekLiang,项目名称:rt-thread,代码行数:31,


示例9: hid_kbd_transfer_set

/** * @brief Triggers IN endpoint transfer. * * @param[in] p_kbd HID keyboard instance. * * @return Standard error code. */static inline ret_code_t hid_kbd_transfer_set(app_usbd_hid_kbd_t const * p_kbd){    app_usbd_class_inst_t const * p_inst = (app_usbd_class_inst_t const *)p_kbd;    app_usbd_hid_kbd_ctx_t *      p_kbd_ctx = hid_kbd_ctx_get(p_kbd);    nrf_drv_usbd_ep_t ep_addr = app_usbd_hid_epin_addr_get(p_inst);    app_usbd_hid_state_flag_clr(&p_kbd_ctx->hid_ctx, APP_USBD_HID_STATE_FLAG_TRANS_IN_PROGRESS);    if (!hid_kbd_transfer_next(p_kbd))    {        /* Transfer buffer hasn't changed since last transfer. No need to setup         * next transfer.         * */        return NRF_SUCCESS;    }    app_usbd_hid_report_buffer_t const * p_rep_buffer = hid_kbd_rep_buffer_get(p_kbd);    NRF_DRV_USBD_TRANSFER_IN(transfer, p_rep_buffer->p_buff, p_rep_buffer->size);    ret_code_t ret;    CRITICAL_REGION_ENTER();    ret = app_usbd_core_ep_transfer(ep_addr, &transfer);    if (ret == NRF_SUCCESS)    {        app_usbd_hid_state_flag_set(&p_kbd_ctx->hid_ctx, APP_USBD_HID_STATE_FLAG_TRANS_IN_PROGRESS);    }    CRITICAL_REGION_EXIT();    return ret;}
开发者ID:TanekLiang,项目名称:rt-thread,代码行数:38,


示例10: nrf_drv_clock_calibration_abort

ret_code_t nrf_drv_clock_calibration_abort(void){    ret_code_t err_code = NRF_SUCCESS;#if CALIBRATION_SUPPORT    CRITICAL_REGION_ENTER();    switch (m_clock_cb.cal_state)    {    case CAL_STATE_CT:        nrf_clock_int_disable(NRF_CLOCK_INT_CTTO_MASK);        nrf_clock_task_trigger(NRF_CLOCK_TASK_CTSTOP);        m_clock_cb.cal_state = CAL_STATE_IDLE;        if (m_clock_cb.cal_done_handler)        {            m_clock_cb.cal_done_handler(NRF_DRV_CLOCK_EVT_CAL_ABORTED);        }        break;    case CAL_STATE_HFCLK_REQ:        /* fall through. */    case CAL_STATE_CAL:        m_clock_cb.cal_state = CAL_STATE_ABORT;        break;    default:        break;    }    CRITICAL_REGION_EXIT();        NRF_LOG_INFO("Function: %s, error code: %s./r/n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code));    return err_code;#else    err_code = NRF_ERROR_FORBIDDEN;    NRF_LOG_WARNING("Function: %s, error code: %s./r/n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code));    return err_code;#endif // CALIBRATION_SUPPORT}
开发者ID:CWBudde,项目名称:Espruino,代码行数:34,


示例11: ser_phy_tx_pkt_send

/* ser_phy API function */uint32_t ser_phy_tx_pkt_send(const uint8_t * p_buffer, uint16_t num_of_bytes){    if (p_buffer == NULL)    {        return NRF_ERROR_NULL;    }    if (num_of_bytes == 0)    {        return NRF_ERROR_INVALID_PARAM;    }    if (mp_tx_buffer != NULL)    {        return NRF_ERROR_BUSY;    }    //ser_phy_interrupts_disable();    CRITICAL_REGION_ENTER();    mp_tx_buffer       = (uint8_t *)p_buffer;    m_tx_buf_len       = num_of_bytes;    m_pend_tx_api_flag = true;    SET_PendSV();    //ser_phy_interrupts_enable();    CRITICAL_REGION_EXIT();    return NRF_SUCCESS;}
开发者ID:AveryLouie,项目名称:flashware,代码行数:29,


示例12: nrf_queue_in

size_t nrf_queue_in(nrf_queue_t const * p_queue,                    void              * p_data,                    size_t              element_count){    ASSERT(p_queue != NULL);    ASSERT(p_data != NULL);    if (element_count == 0)    {        return 0;    }    CRITICAL_REGION_ENTER();    if (p_queue->mode == NRF_QUEUE_MODE_OVERFLOW)    {        element_count = MIN(element_count, p_queue->size);    }    else    {        size_t available = nrf_queue_available_get(p_queue);        element_count    = MIN(element_count, available);    }    queue_write(p_queue, p_data, element_count);    CRITICAL_REGION_EXIT();    return element_count;}
开发者ID:CWBudde,项目名称:Espruino,代码行数:30,


示例13: buf_prealloc

/** * @brief Allocates chunk in a buffer for one entry and injects overflow if * there is no room for requested entry. * * @param nargs    Number of 32bit arguments. In case of allocating for hex dump it * is the size of the buffer in 32bit words (ceiled). * @param p_wr_idx Pointer to write index. * * @return True if successful allocation, false otherwise. * */static inline bool buf_prealloc(uint32_t nargs, uint32_t * p_wr_idx){    nargs += HEADER_SIZE;    uint32_t ovflw_tag_size = HEADER_SIZE;    bool     ret            = true;    CRITICAL_REGION_ENTER();    *p_wr_idx = m_log_data.wr_idx;    uint32_t available_words = (m_log_data.mask + 1) - (m_log_data.wr_idx - m_log_data.rd_idx);    uint32_t required_words  = nargs + ovflw_tag_size; // room for current entry and overflow    if (required_words > available_words)    {        if (available_words >= HEADER_SIZE)        {            // Overflow entry is injected            STD_HEADER_DEF(header, m_overflow_info, NRF_LOG_LEVEL_INTERNAL, 0);            m_log_data.buffer[m_log_data.wr_idx++ & m_log_data.mask] =                header.raw;#if NRF_LOG_USES_TIMESTAMP            m_log_data.buffer[m_log_data.wr_idx++ & m_log_data.mask] =                m_log_data.timestamp_func();#endif //NRF_LOG_USES_TIMESTAMP        }        // overflow case        ret = false;    }    else    {        m_log_data.wr_idx += nargs;    }    CRITICAL_REGION_EXIT();    return ret;}
开发者ID:CWBudde,项目名称:Espruino,代码行数:43,


示例14: nrf_drv_ppi_channel_alloc

uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel){    uint32_t err_code = NRF_SUCCESS;    nrf_ppi_channel_t channel;    uint32_t mask = 0;    err_code = NRF_ERROR_NO_MEM;    mask = NRF_PPI_PROG_APP_CHANNELS_MASK;    for (channel = NRF_PPI_CHANNEL0; mask != 0; mask &= ~nrf_drv_ppi_channel_to_mask(channel), channel++)    {        CRITICAL_REGION_ENTER();        if ((mask & nrf_drv_ppi_channel_to_mask(channel)) && (!is_allocated_channel(channel)))        {            channel_allocated_set(channel);            *p_channel = channel;            err_code   = NRF_SUCCESS;        }        CRITICAL_REGION_EXIT();        if (err_code == NRF_SUCCESS)        {            NRF_LOG_INFO("Allocated channel: %d./r/n", channel);            break;        }    }    NRF_LOG_INFO("Function: %s, error code: %s./r/n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code));    return err_code;}
开发者ID:Archcady,项目名称:mbed-os,代码行数:29,


示例15: nrf_drv_ppi_group_free

uint32_t nrf_drv_ppi_group_free(nrf_ppi_channel_group_t group){    uint32_t err_code;    if (!is_app_group(group))    {        err_code = NRF_ERROR_INVALID_PARAM;    }    else if (!is_allocated_group(group))    {        err_code = NRF_ERROR_INVALID_STATE;    }    else    {#if (NRF_PPI_RESTRICTED > 0)        err_code = sd_ppi_group_task_disable((uint8_t) group);#else        nrf_ppi_group_disable(group);        err_code = NRF_SUCCESS;#endif        CRITICAL_REGION_ENTER();        group_allocated_clr(group);        CRITICAL_REGION_EXIT();    }    return err_code;}
开发者ID:dhruvkakadiya,项目名称:OpenSJ_Bluz,代码行数:27,


示例16: nrf_queue_write

ret_code_t nrf_queue_write(nrf_queue_t const * p_queue,                           void const        * p_data,                           size_t              element_count){    ret_code_t status = NRF_SUCCESS;    ASSERT(p_queue != NULL);    ASSERT(p_data != NULL);    ASSERT(element_count <= p_queue->size);    if (element_count == 0)    {        return NRF_SUCCESS;    }    CRITICAL_REGION_ENTER();    if ((nrf_queue_available_get(p_queue) >= element_count)     || (p_queue->mode == NRF_QUEUE_MODE_OVERFLOW))    {        queue_write(p_queue, p_data, element_count);    }    else    {        status = NRF_ERROR_NO_MEM;    }    CRITICAL_REGION_EXIT();    return status;}
开发者ID:CWBudde,项目名称:Espruino,代码行数:31,


示例17: nrf_drv_ppi_group_alloc

uint32_t nrf_drv_ppi_group_alloc(nrf_ppi_channel_group_t * p_group){    uint32_t err_code;    uint32_t mask = 0;    nrf_ppi_channel_group_t group;    err_code = NRF_ERROR_NO_MEM;    mask = NRF_PPI_ALL_APP_GROUPS_MASK;    for (group = NRF_PPI_CHANNEL_GROUP0; mask != 0; mask &= ~group_to_mask(group), group++)    {        CRITICAL_REGION_ENTER();        if ((mask & group_to_mask(group)) && (!is_allocated_group(group)))        {            group_allocated_set(group);            *p_group = group;            err_code = NRF_SUCCESS;        }        CRITICAL_REGION_EXIT();        if (err_code == NRF_SUCCESS)        {            NRF_LOG_INFO("Allocated group: %d./r/n", group);            break;        }    }    NRF_LOG_INFO("Function: %s, error code: %s./r/n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code));    return err_code;}
开发者ID:Archcady,项目名称:mbed-os,代码行数:29,


示例18: nrf_queue_read

ret_code_t nrf_queue_read(nrf_queue_t const * p_queue,                          void              * p_data,                          size_t              element_count){    ret_code_t status = NRF_SUCCESS;    ASSERT(p_queue != NULL);    ASSERT(p_data != NULL);    if (element_count == 0)    {        return NRF_SUCCESS;    }    CRITICAL_REGION_ENTER();    if (element_count <= queue_utilization_get(p_queue))    {        queue_read(p_queue, p_data, element_count);    }    else    {        status = NRF_ERROR_NOT_FOUND;    }    CRITICAL_REGION_EXIT();    return status;}
开发者ID:CWBudde,项目名称:Espruino,代码行数:29,


示例19: nrf_drv_ppi_channels_include_in_group

uint32_t nrf_drv_ppi_channels_include_in_group(uint32_t channel_mask,                                               nrf_ppi_channel_group_t group){    ret_code_t err_code = NRF_SUCCESS;        if (!is_app_group(group))    {        err_code = NRF_ERROR_INVALID_PARAM;    }    else if (!is_allocated_group(group))    {        err_code = NRF_ERROR_INVALID_STATE;    }    else if (!are_app_channels(channel_mask))    {        err_code = NRF_ERROR_INVALID_PARAM;    }    else    {           CRITICAL_REGION_ENTER();        nrf_ppi_channels_include_in_group(channel_mask, group);        CRITICAL_REGION_EXIT();    }    NRF_LOG_INFO("Function: %s, error code: %s./r/n", (uint32_t)__func__, (uint32_t)ERR_TO_STR(err_code));    return err_code;}
开发者ID:Archcady,项目名称:mbed-os,代码行数:26,


示例20: nrf_drv_ppi_group_alloc

uint32_t nrf_drv_ppi_group_alloc(nrf_ppi_channel_group_t * p_group){    uint32_t err_code;    uint32_t mask = 0;    nrf_ppi_channel_group_t group;    err_code = NRF_ERROR_NO_MEM;    mask = NRF_PPI_ALL_APP_GROUPS_MASK;    for (group = NRF_PPI_CHANNEL_GROUP0; mask != 0; mask &= ~group_to_mask(group), group++)    {        CRITICAL_REGION_ENTER();        if ((mask & group_to_mask(group)) && (!is_allocated_group(group)))        {            group_allocated_set(group);            *p_group = group;            err_code = NRF_SUCCESS;        }        CRITICAL_REGION_EXIT();        if (err_code == NRF_SUCCESS)        {            break;        }    }    return err_code;}
开发者ID:BLEHexapod,项目名称:nrf_sdk,代码行数:27,


示例21: nrf_drv_ppi_channel_alloc

uint32_t nrf_drv_ppi_channel_alloc(nrf_ppi_channel_t * p_channel){    uint32_t err_code;    nrf_ppi_channel_t channel;    uint32_t mask = 0;    err_code = NRF_ERROR_NO_MEM;    mask = NRF_PPI_PROG_APP_CHANNELS_MASK;    for (channel = NRF_PPI_CHANNEL0; mask != 0; mask &= ~nrf_drv_ppi_channel_to_mask(channel), channel++)    {        CRITICAL_REGION_ENTER();        if ((mask & nrf_drv_ppi_channel_to_mask(channel)) && (!is_allocated_channel(channel)))        {            channel_allocated_set(channel);            *p_channel = channel;            err_code   = NRF_SUCCESS;        }        CRITICAL_REGION_EXIT();        if (err_code == NRF_SUCCESS)        {            break;        }    }    return err_code;}
开发者ID:BLEHexapod,项目名称:nrf_sdk,代码行数:27,


示例22: app_sched_event_put

uint32_t app_sched_event_put(void                    * p_event_data,                             uint16_t                  event_data_size,                             app_sched_event_handler_t handler){    uint32_t err_code;    if (event_data_size <= m_queue_event_size)    {        uint16_t event_index = 0xFFFF;        CRITICAL_REGION_ENTER();        if (!APP_SCHED_QUEUE_FULL())        {            event_index       = m_queue_end_index;            m_queue_end_index = next_index(m_queue_end_index);        #ifdef APP_SCHEDULER_WITH_PROFILER            // This function call must be protected with critical region because            // it modifies 'm_max_queue_utilization'.            queue_utilization_check();        #endif        }        CRITICAL_REGION_EXIT();        if (event_index != 0xFFFF)        {            // NOTE: This can be done outside the critical region since the event consumer will            //       always be called from the main loop, and will thus never interrupt this code.            m_queue_event_headers[event_index].handler = handler;            if ((p_event_data != NULL) && (event_data_size > 0))            {                memcpy(&m_queue_event_data[event_index * m_queue_event_size],                       p_event_data,                       event_data_size);                m_queue_event_headers[event_index].event_data_size = event_data_size;            }            else            {                m_queue_event_headers[event_index].event_data_size = 0;            }            err_code = NRF_SUCCESS;        }        else        {            err_code = NRF_ERROR_NO_MEM;        }    }    else    {        err_code = NRF_ERROR_INVALID_LENGTH;    }    return err_code;}
开发者ID:zoujixing,项目名称:nRF52-Arduino,代码行数:57,


示例23: lumen_task_led_show

void lumen_task_led_show(void * context, uint16_t size) {		CRITICAL_REGION_ENTER();		lumen_leds_show();		CRITICAL_REGION_EXIT();}
开发者ID:lavallc,项目名称:ion,代码行数:9,


示例24: nrf_queue_generic_pop

ret_code_t nrf_queue_generic_pop(nrf_queue_t const * p_queue,                                 void              * p_element,                                 bool                just_peek){    ret_code_t status = NRF_SUCCESS;    ASSERT(p_queue != NULL);    ASSERT(p_element != NULL);    CRITICAL_REGION_ENTER();    if (!nrf_queue_is_empty(p_queue))    {        // Get read position.        size_t read_pos = p_queue->p_cb->front;        // Update next read position.        if (!just_peek)        {            p_queue->p_cb->front = nrf_queue_next_idx(p_queue, p_queue->p_cb->front);        }        // Read element.        switch (p_queue->element_size)        {            case sizeof(uint8_t):                *((uint8_t *)p_element) = ((uint8_t *)p_queue->p_buffer)[read_pos];                break;            case sizeof(uint16_t):                *((uint16_t *)p_element) = ((uint16_t *)p_queue->p_buffer)[read_pos];                break;            case sizeof(uint32_t):                *((uint32_t *)p_element) = ((uint32_t *)p_queue->p_buffer)[read_pos];                break;            case sizeof(uint64_t):                *((uint64_t *)p_element) = ((uint64_t *)p_queue->p_buffer)[read_pos];                break;            default:                memcpy(p_element,                       (void const *)((size_t)p_queue->p_buffer + read_pos * p_queue->element_size),                       p_queue->element_size);                break;        }    }    else    {        status = NRF_ERROR_NOT_FOUND;    }    CRITICAL_REGION_EXIT();    return status;}
开发者ID:CWBudde,项目名称:Espruino,代码行数:57,


示例25: ser_phy_hci_slip_tx_pkt_send

uint32_t ser_phy_hci_slip_tx_pkt_send(const ser_phy_hci_pkt_params_t * p_header,                                      const ser_phy_hci_pkt_params_t * p_payload,                                      const ser_phy_hci_pkt_params_t * p_crc){    /* Block TXRDY interrupts at this point*/    // NRF_UART0->INTENCLR = (UART_INTENCLR_TXDRDY_Clear << UART_INTENCLR_TXDRDY_Pos);    CRITICAL_REGION_ENTER();    if (p_header == NULL)    {        return NRF_ERROR_NULL;    }    /* Check if no tx is ongoing */    if (!m_tx_busy)    {        m_header = *p_header;        if (p_payload != NULL)        {            m_payload = *p_payload;        }        if (p_crc != NULL)        {            m_crc = *p_crc;        }    }    /* Tx is ongoing, schedule transmission as pending */    else    {        if (p_crc != NULL)        {            m_crc_pending = *p_crc;        }        if (p_payload != NULL)        {            m_payload_pending = *p_payload;        }        m_header_pending = *p_header;    }    /* Start packet transmission only if no other tx is ongoing */    if (!m_tx_busy)    {        m_tx_busy = true;        (void)ser_phy_hci_tx_byte();    }    /* Enable TXRDY interrupts at this point*/    // NRF_UART0->INTENSET = (UART_INTENSET_TXDRDY_Set << UART_INTENSET_TXDRDY_Pos);    CRITICAL_REGION_EXIT();    return NRF_SUCCESS;}
开发者ID:lyncxy119,项目名称:Sentry,代码行数:56,


示例26: app_sched_resume

void app_sched_resume(void){    CRITICAL_REGION_ENTER();    if (m_scheduler_paused_counter > 0)    {        m_scheduler_paused_counter--;    }    CRITICAL_REGION_EXIT();}
开发者ID:TanekLiang,项目名称:rt-thread,代码行数:10,


示例27: app_sched_pause

void app_sched_pause(void){    CRITICAL_REGION_ENTER();    if (m_scheduler_paused_counter < UINT32_MAX)    {        m_scheduler_paused_counter++;    }    CRITICAL_REGION_EXIT();}
开发者ID:TanekLiang,项目名称:rt-thread,代码行数:10,


示例28: nrf_queue_reset

void nrf_queue_reset(nrf_queue_t const * p_queue){    ASSERT(p_queue != NULL);    CRITICAL_REGION_ENTER();    memset(p_queue->p_cb, 0, sizeof(nrf_queue_cb_t));    CRITICAL_REGION_EXIT();}
开发者ID:CWBudde,项目名称:Espruino,代码行数:10,


示例29: app_usbd_cdc_acm_serial_state_notify

ret_code_t app_usbd_cdc_acm_serial_state_notify(app_usbd_cdc_acm_t const *      p_cdc_acm,                                                app_usbd_cdc_acm_serial_state_t serial_state,                                                bool                            value){    app_usbd_cdc_acm_ctx_t * p_cdc_acm_ctx = cdc_acm_ctx_get(p_cdc_acm);    ret_code_t ret;    CRITICAL_REGION_ENTER();    ret = NRF_SUCCESS;    switch (serial_state)    {        case APP_USBD_CDC_ACM_SERIAL_STATE_DCD:        case APP_USBD_CDC_ACM_SERIAL_STATE_DSR:        case APP_USBD_CDC_ACM_SERIAL_STATE_BREAK:        case APP_USBD_CDC_ACM_SERIAL_STATE_RING:        case APP_USBD_CDC_ACM_SERIAL_STATE_FRAMING:        case APP_USBD_CDC_ACM_SERIAL_STATE_PARITY:        case APP_USBD_CDC_ACM_SERIAL_STATE_OVERRUN:            if (value)            {                p_cdc_acm_ctx->serial_state |= serial_state;            }            else            {                p_cdc_acm_ctx->serial_state &= ~serial_state;            }            break;        default:            ret = NRF_ERROR_NOT_SUPPORTED;            break;    }    if (ret == NRF_SUCCESS)    {        app_usbd_cdc_acm_notify_t * notify = &p_cdc_acm_ctx->request.payload.notify;        notify->cdc_notify.bmRequestType = app_usbd_setup_req_val(APP_USBD_SETUP_REQREC_INTERFACE,                                                                  APP_USBD_SETUP_REQTYPE_CLASS,                                                                  APP_USBD_SETUP_REQDIR_IN);        notify->cdc_notify.bmRequest = APP_USBD_CDC_NOTIF_SERIAL_STATE;        notify->cdc_notify.wValue = 0;        notify->cdc_notify.wIndex = 0;        notify->cdc_notify.wLength = sizeof(notify->serial_state);        notify->serial_state = p_cdc_acm_ctx->serial_state;        ret = cdc_acm_serial_state_notify(p_cdc_acm);    }    CRITICAL_REGION_EXIT();    return ret;}
开发者ID:petersonev,项目名称:keyboard,代码行数:53,


示例30: nrf_drv_ppi_channel_free

uint32_t nrf_drv_ppi_channel_free(nrf_ppi_channel_t channel){    if (!is_programmable_app_channel(channel))    {        return NRF_ERROR_INVALID_PARAM;    }    // First disable this channel    nrf_ppi_channel_disable(channel);    CRITICAL_REGION_ENTER();    channel_allocated_clr(channel);    CRITICAL_REGION_EXIT();    return NRF_SUCCESS;}
开发者ID:BLEHexapod,项目名称:nrf_sdk,代码行数:13,



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


C++ CRITICAL_REGION_LOCAL函数代码示例
C++ CRIT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。