コード例 #1
0
ファイル: yfifo.c プロジェクト: algefaen/enop
void yFifoCleanup(yFifoBuf *buf)
{
#ifdef YFIFO_USE_MUTEX
    yDeleteCriticalSection(&(buf->cs));
#endif
    memset(buf,0,sizeof(yFifoBuf));
}
コード例 #2
0
ファイル: ymemory.c プロジェクト: lucasroitman/rosyocto3d
void  ySafeMemoryStop(void)
{
    yDeleteCriticalSection(&yMapCS);
    free(yMap);
    yMap=NULL;
    yMapSize = yMapUsed = 0;
}
コード例 #3
0
static void stopHIDManager(OSX_HID_REF *hid)
{
    if (hid->manager) {
        IOHIDManagerClose(hid->manager, kIOHIDOptionsTypeNone );
        CFRelease( hid->manager);
        hid->manager=NULL;
        yDeleteCriticalSection(&hid->hidMCS);
    }
}
コード例 #4
0
ファイル: ypkt_osx.c プロジェクト: octet8/yoctolib_cpp
void yyyPacketShutdown(yInterfaceSt  *iface)
{
    
    yEnterCriticalSection(&iface->yyyCS);
    if(iface->devref!=NULL){
        IOHIDDeviceRegisterInputReportCallback( iface->devref,              // IOHIDDeviceRef for the HID device
                                            (u8*) &iface->tmprxpkt,   // pointer to the report data (uint8_t's)
                                            USB_PKT_SIZE,              // number of bytes in the report (CFIndex)
                                            NULL,   // the callback routine
                                            iface);                      // context passed to callback
        IOHIDDeviceClose(iface->devref, kIOHIDOptionsTypeNone);
        iface->devref=NULL;
    }
    yLeaveCriticalSection(&iface->yyyCS);
    yDeleteCriticalSection(&iface->yyyCS);
    yyyFreePktQueue(iface);

}
コード例 #5
0
ファイル: ypkt_osx.c プロジェクト: octet8/yoctolib_cpp
int yUSB_stop(yContextSt *ctx,char *errmsg)
{

    if ( ctx->hidM ) {
        IOHIDManagerUnscheduleFromRunLoop(ctx->hidM, ctx->usb_run_loop, kCFRunLoopDefaultMode);
        CFRelease( ctx->hidM );
        ctx->hidM=NULL;
    }
    
    
    if(ctx->usb_thread_state == USB_THREAD_RUNNING){
        ctx->usb_thread_state = USB_THREAD_MUST_STOP;
        CFRunLoopStop(ctx->usb_run_loop);       
    }
    pthread_join(ctx->usb_thread,NULL); 
    YASSERT(ctx->usb_thread_state == USB_THREAD_STOPED);

    yDeleteCriticalSection(&ctx->hidMCS);
    yReleaseGlobalAccess(ctx);

    return 0;
}
コード例 #6
0
ファイル: ypkt_lin.c プロジェクト: apgoetz/node-yoctopuce
int yyyUSB_stop(yContextSt *ctx,char *errmsg)
{
    int i;
    stringCacheSt *c = stringCache;

    if(ctx->usb_thread_state == USB_THREAD_RUNNING){
        ctx->usb_thread_state = USB_THREAD_MUST_STOP;
        pthread_join(ctx->usb_thread,NULL);
    }
    YASSERT(ctx->usb_thread_state == USB_THREAD_STOPED);

    libusb_exit(ctx->libusb);
    yReleaseGlobalAccess(ctx);
    for (i = 0; i < STRING_CACHE_SIZE; i++, c++) {
        if(c->string) {
            yFree(c->string);
        }
    }
    yDeleteCriticalSection(&ctx->string_cache_cs);

    return YAPI_SUCCESS;
}