clang-format on most of kernel/

This commit is contained in:
Ben Vanik
2014-08-17 13:13:03 -07:00
parent 854bcdb60a
commit 1c4dcd5e0e
76 changed files with 2075 additions and 3169 deletions

View File

@@ -11,15 +11,11 @@
#include <xenia/cpu/processor.h>
namespace xe {
namespace kernel {
using namespace xe;
using namespace xe::kernel;
XTimer::XTimer(KernelState* kernel_state) :
XObject(kernel_state, kTypeTimer),
handle_(NULL) {
}
XTimer::XTimer(KernelState* kernel_state)
: XObject(kernel_state, kTypeTimer), handle_(NULL) {}
XTimer::~XTimer() {
if (handle_) {
@@ -32,33 +28,32 @@ void XTimer::Initialize(uint32_t timer_type) {
bool manual_reset = false;
switch (timer_type) {
case 0: // NotificationTimer
manual_reset = true;
break;
case 1: // SynchronizationTimer
manual_reset = false;
break;
default:
assert_always();
break;
case 0: // NotificationTimer
manual_reset = true;
break;
case 1: // SynchronizationTimer
manual_reset = false;
break;
default:
assert_always();
break;
}
handle_ = CreateWaitableTimer(NULL, manual_reset, NULL);
}
X_STATUS XTimer::SetTimer(
int64_t due_time, uint32_t period_ms,
uint32_t routine, uint32_t routine_arg, bool resume) {
X_STATUS XTimer::SetTimer(int64_t due_time, uint32_t period_ms,
uint32_t routine, uint32_t routine_arg, bool resume) {
// Stash routine for callback.
current_routine_ = routine;
current_routine_arg_ = routine_arg;
LARGE_INTEGER due_time_li;
due_time_li.QuadPart = due_time;
BOOL result = SetWaitableTimer(
handle_, &due_time_li, period_ms,
routine ? (PTIMERAPCROUTINE)CompletionRoutine : NULL, this,
resume ? TRUE : FALSE);
BOOL result =
SetWaitableTimer(handle_, &due_time_li, period_ms,
routine ? (PTIMERAPCROUTINE)CompletionRoutine : NULL,
this, resume ? TRUE : FALSE);
// Caller is checking for STATUS_TIMER_RESUME_IGNORED.
// This occurs if result == TRUE but error is set.
@@ -69,8 +64,8 @@ X_STATUS XTimer::SetTimer(
return result ? X_STATUS_SUCCESS : X_STATUS_UNSUCCESSFUL;
}
void XTimer::CompletionRoutine(
XTimer* timer, DWORD timer_low, DWORD timer_high) {
void XTimer::CompletionRoutine(XTimer* timer, DWORD timer_low,
DWORD timer_high) {
assert_true(timer->current_routine_);
// Queue APC to call back routine with (arg, low, high).
@@ -81,6 +76,9 @@ void XTimer::CompletionRoutine(
}
X_STATUS XTimer::Cancel() {
return CancelWaitableTimer(handle_) == 0 ?
X_STATUS_SUCCESS : X_STATUS_UNSUCCESSFUL;
return CancelWaitableTimer(handle_) == 0 ? X_STATUS_SUCCESS
: X_STATUS_UNSUCCESSFUL;
}
} // namespace kernel
} // namespace xe