mirror of
https://github.com/RPCS3/libusb.git
synced 2026-01-31 01:25:19 +01:00
WinCE: Post integration cleanup
* Update copyrights and switch to UTF-8 everywhere * Add SleepEx() to missing.h, and move include to libusbi.h * Remove ifdef for GetSystemTimeAsFileTime()
This commit is contained in:
@@ -33,9 +33,6 @@
|
||||
#endif
|
||||
|
||||
#include "libusbi.h"
|
||||
#ifdef HAVE_MISSING_H
|
||||
#include "missing.h"
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX)
|
||||
const struct usbi_os_backend * const usbi_backend = &linux_usbfs_backend;
|
||||
|
||||
@@ -31,6 +31,9 @@
|
||||
#include <poll.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_MISSING_H
|
||||
#include "missing.h"
|
||||
#endif
|
||||
#include "libusb.h"
|
||||
#include "version.h"
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* poll_windows: poll compatibility wrapper for Windows
|
||||
* Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
* Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
|
||||
*
|
||||
@@ -52,7 +53,7 @@
|
||||
#else
|
||||
// MSVC++ < 2005 cannot use a variadic argument and non MSVC
|
||||
// compilers produce warnings if parenthesis are ommitted.
|
||||
#if defined(_MSC_VER) && _MSC_VER < 1400
|
||||
#if defined(_MSC_VER) && (_MSC_VER < 1400)
|
||||
#define poll_dbg
|
||||
#else
|
||||
#define poll_dbg(...)
|
||||
@@ -63,12 +64,6 @@
|
||||
#pragma warning(disable:28719)
|
||||
#endif
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
#define usbi_sleep(ms) Sleep(ms)
|
||||
#else
|
||||
#define usbi_sleep(ms) SleepEx(ms, TRUE)
|
||||
#endif
|
||||
|
||||
#define CHECK_INIT_POLLING do {if(!is_polling_set) init_polling();} while(0)
|
||||
|
||||
// public fd data
|
||||
@@ -157,7 +152,7 @@ void init_polling(void)
|
||||
int i;
|
||||
|
||||
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
|
||||
usbi_sleep(0);
|
||||
SleepEx(0, TRUE);
|
||||
}
|
||||
if (!is_polling_set) {
|
||||
setup_cancel_io();
|
||||
@@ -225,7 +220,7 @@ void exit_polling(void)
|
||||
int i;
|
||||
|
||||
while (InterlockedExchange((LONG *)&compat_spinlock, 1) == 1) {
|
||||
usbi_sleep(0);
|
||||
SleepEx(0, TRUE);
|
||||
}
|
||||
if (is_polling_set) {
|
||||
is_polling_set = FALSE;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
/*
|
||||
* Windows compat: POSIX compatibility wrapper
|
||||
* Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
* Copyright © 2009-2010 Pete Batard <pete@akeo.ie>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of poll implementation from libusb-win32, by Stephan Meyer et al.
|
||||
*
|
||||
|
||||
@@ -25,12 +25,6 @@
|
||||
|
||||
#include "libusbi.h"
|
||||
|
||||
#if defined(_WIN32_WCE)
|
||||
#define usbi_sleep(ms) Sleep(ms)
|
||||
#else
|
||||
#define usbi_sleep(ms) SleepEx(ms, TRUE)
|
||||
#endif
|
||||
|
||||
extern const uint64_t epoch_time;
|
||||
|
||||
int usbi_mutex_init(usbi_mutex_t *mutex,
|
||||
@@ -77,7 +71,7 @@ int usbi_mutex_unlock(usbi_mutex_t *mutex) {
|
||||
int usbi_mutex_static_lock(usbi_mutex_static_t *mutex) {
|
||||
if(!mutex) return ((errno=EINVAL));
|
||||
while (InterlockedExchange((LONG *)mutex, 1) == 1) {
|
||||
usbi_sleep(0);
|
||||
SleepEx(0, TRUE);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -87,8 +81,6 @@ int usbi_mutex_static_unlock(usbi_mutex_static_t *mutex) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int usbi_cond_init(usbi_cond_t *cond,
|
||||
const usbi_condattr_t *attr) {
|
||||
UNUSED(attr);
|
||||
@@ -190,13 +182,10 @@ int usbi_cond_timedwait(usbi_cond_t *cond,
|
||||
struct timespec cur_time_ns;
|
||||
DWORD millis;
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
// GetSystemTimeAsFileTime() is not available on CE
|
||||
SYSTEMTIME st;
|
||||
GetSystemTime(&st);
|
||||
SystemTimeToFileTime(&st, &filetime);
|
||||
#else
|
||||
GetSystemTimeAsFileTime(&filetime);
|
||||
#endif
|
||||
rtime.LowPart = filetime.dwLowDateTime;
|
||||
rtime.HighPart = filetime.dwHighDateTime;
|
||||
rtime.QuadPart -= epoch_time;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Windows CE backend for libusb 1.0
|
||||
* Copyright (C) 2011-2012 RealVNC Ltd.
|
||||
* Windows CE backend for libusbx 1.0
|
||||
* Copyright © 2011-2013 RealVNC Ltd.
|
||||
* Large portions taken from Windows backend, which is
|
||||
* Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
|
||||
* Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
|
||||
* Major code testing contribution by Xiaofan Chen
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Windows CE backend for libusb 1.0
|
||||
* Copyright (C) 2011-2012 RealVNC Ltd.
|
||||
* Windows CE backend for libusbx 1.0
|
||||
* Copyright © 2011-2013 RealVNC Ltd.
|
||||
* Portions taken from Windows backend, which is
|
||||
* Copyright (C) 2009-2010 Pete Batard <pbatard@gmail.com>
|
||||
* Copyright © 2009-2010 Pete Batard <pbatard@gmail.com>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
|
||||
* Major code testing contribution by Xiaofan Chen
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
*
|
||||
* This file brings together header code common between
|
||||
* the desktop Windows and Windows CE backends.
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
* Copyright © 2009-2012 Pete Batard <pete@akeo.ie>
|
||||
* With contributions from Michael Plante, Orin Eman et al.
|
||||
* Parts of this code adapted from libusb-win32-v1 by Stephan Meyer
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define LIBUSB_NANO 10621
|
||||
#define LIBUSB_NANO 10622
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Header file for missing WinCE functionality
|
||||
* Copyright © 2012 RealVNC Ltd.
|
||||
* Copyright © 2012-2013 RealVNC Ltd.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
@@ -20,6 +20,9 @@
|
||||
#ifndef MISSING_H
|
||||
#define MISSING_H
|
||||
|
||||
/* Windows CE doesn't have SleepEx() - Fallback to Sleep() */
|
||||
#define SleepEx(m, a) Sleep(m)
|
||||
|
||||
/* Windows CE doesn't have any APIs to query environment variables.
|
||||
*
|
||||
* This contains a registry based implementation of getenv.
|
||||
|
||||
Reference in New Issue
Block a user