示例#1
0
void eventOS_scheduler_idle(void)
{
    //tr_debug("idle");
    eventOS_scheduler_mutex_release();
    osThreadFlagsWait(1, 0, osWaitForever);
    eventOS_scheduler_mutex_wait();
}
示例#2
0
void mesh_system_init(void)
{
    if (mesh_initialized == false) {
        ns_hal_init(app_stack_heap, MBED_MESH_API_HEAP_SIZE,
                    mesh_system_heap_error_handler, NULL);
        eventOS_scheduler_mutex_wait();
        net_init_core();
        eventOS_scheduler_mutex_release();
        mesh_initialized = true;
    }
}
示例#3
0
void eventOS_scheduler_idle(void)
{
    //tr_debug("idle");
    eventOS_scheduler_mutex_release();

#if MBED_CONF_NANOSTACK_HAL_EVENT_LOOP_DISPATCH_FROM_APPLICATION
    osEventFlagsWait(event_flag_id, 1, osFlagsWaitAny, osWaitForever);
#else
    osThreadFlagsWait(1, 0, osWaitForever);
#endif

    eventOS_scheduler_mutex_wait();
}
示例#4
0
文件: mesh_system.c 项目: betzw/mbed
void mesh_system_init(void)
{
    if (mesh_initialized == false) {
#if MBED_CONF_MBED_MESH_API_USE_MALLOC_FOR_HEAP
        app_stack_heap = malloc(MBED_CONF_MBED_MESH_API_HEAP_SIZE+1);
        MBED_ASSERT(app_stack_heap);
#endif
        ns_hal_init(app_stack_heap, MBED_CONF_MBED_MESH_API_HEAP_SIZE,
                    mesh_system_heap_error_handler, MBED_CONF_MBED_MESH_API_HEAP_STAT_INFO);
        eventOS_scheduler_mutex_wait();
        net_init_core();
        eventOS_scheduler_mutex_release();
        mesh_initialized = true;
    }
}
M2MConnectionHandlerPimpl::M2MConnectionHandlerPimpl(M2MConnectionHandler* base, M2MConnectionObserver &observer,
                                                     M2MConnectionSecurity* sec,
                                                     M2MInterface::BindingMode mode,
                                                     M2MInterface::NetworkStack stack)
:_base(base),
 _observer(observer),
 _security_impl(sec),
 _security(NULL),
 _use_secure_connection(false),
 _binding_mode(mode),
 _socket(0),
 _is_handshaking(false),
 _listening(true),
 _server_type(M2MConnectionObserver::LWM2MServer),
 _server_port(0),
 _listen_port(0),
 _running(false),
 _net_iface(0),
_socket_state(ESocketStateDisconnected)
{
#ifndef PAL_NET_TCP_AND_TLS_SUPPORT
    if (is_tcp_connection()) {
        tr_error("ConnectionHandler: TCP support not available.");
        return;
    }
#endif

    if(PAL_SUCCESS != pal_init()){
        tr_error("PAL init failed.");
    }

    memset(&_address, 0, sizeof _address);
    memset(&_socket_address, 0, sizeof _socket_address);
    memset(&_ipV4Addr, 0, sizeof(palIpV4Addr_t));
    memset(&_ipV6Addr, 0, sizeof(palIpV6Addr_t));
    memset(&_recv_buffer, 0, BUFFER_LENGTH);

    connection_handler = this;
    eventOS_scheduler_mutex_wait();
    if (M2MConnectionHandlerPimpl::_tasklet_id == -1) {
        M2MConnectionHandlerPimpl::_tasklet_id = eventOS_event_handler_create(&connection_event_handler, ESocketIdle);
    }
    eventOS_scheduler_mutex_release();
}
示例#6
0
void mesh_system_init(void)
{
    if (mesh_initialized == false) {
#ifndef YOTTA_CFG
        ns_hal_init(app_stack_heap, MBED_MESH_API_HEAP_SIZE,
                    mesh_system_heap_error_handler, NULL);
        eventOS_scheduler_mutex_wait();
        net_init_core();
        eventOS_scheduler_mutex_release();
#else
        ns_dyn_mem_init(app_stack_heap, MBED_MESH_API_HEAP_SIZE,
                        mesh_system_heap_error_handler, NULL);
        randLIB_seed_random();
        platform_timer_enable();
        eventOS_scheduler_init();
        trace_init(); // trace system needs to be initialized right after eventOS_scheduler_init
        net_init_core();
        /* initialize 6LoWPAN socket adaptation layer */
        ns_sal_init_stack();
#endif
        mesh_initialized = true;
    }
}