Formatting

This commit is contained in:
Maschell 2020-06-03 18:36:02 +02:00
parent 5ac51ef3ce
commit 6c5a2edf6d
4 changed files with 249 additions and 241 deletions

View File

@ -27,10 +27,7 @@ public:
//! constructor
CThread(int32_t iAttr, int32_t iPriority = 16, int32_t iStackSize = 0x8000, CThread::Callback callback = NULL, void *callbackArg = NULL)
: pThread(NULL)
, pThreadStack(NULL)
, pCallback(callback)
, pCallbackArg(callbackArg) {
: pThread(NULL), pThreadStack(NULL), pCallback(callback), pCallbackArg(callbackArg) {
//! save attribute assignment
iAttributes = iAttr;
//! allocate the thread
@ -56,35 +53,42 @@ public:
virtual void *getThread() const {
return pThread;
}
//! Thread entry function
virtual void executeThread(void) {
if (pCallback)
pCallback(this, pCallbackArg);
}
//! Suspend thread
virtual void suspendThread(void) {
if (isThreadSuspended()) return;
if (pThread) OSSuspendThread(pThread);
}
//! Resume thread
virtual void resumeThread(void) {
if (!isThreadSuspended()) return;
if (pThread) OSResumeThread(pThread);
}
//! Set thread priority
virtual void setThreadPriority(int32_t prio) {
if (pThread) OSSetThreadPriority(pThread, prio);
}
//! Check if thread is suspended
virtual bool isThreadSuspended(void) const {
if (pThread) return OSIsThreadSuspended(pThread);
return false;
}
//! Check if thread is terminated
virtual bool isThreadTerminated(void) const {
if (pThread) return OSIsThreadTerminated(pThread);
return false;
}
//! Check if thread is running
virtual bool isThreadRunning(void) const {
return !isThreadSuspended() && !isThreadRunning();
@ -115,6 +119,7 @@ public:
pThread = NULL;
pThreadStack = NULL;
}
//! Thread attributes
enum eCThreadAttributes {
eAttributeNone = 0x07,
@ -130,6 +135,7 @@ private:
((CThread *) arg)->executeThread();
return 0;
}
int32_t iAttributes;
OSThread *pThread;
uint8_t *pThreadStack;

View File

@ -38,6 +38,7 @@ void MemoryMappingFree(void* ptr){
uint32_t MemoryMappingEffectiveToPhysical(uint32_t address) {
return MemoryMapping::EffectiveToPhysical(address);
}
uint32_t MemoryMappingPhysicalToEffective(uint32_t address) {
return MemoryMapping::PhysicalToEffective(address);
}

View File

@ -132,7 +132,8 @@ void MemoryMapping::searchEmptyMemoryRegions() {
}
}
if (startGood != 0 && (startGood != ea_start_address + ea_size)) {
DEBUG_FUNCTION_LINE("+ Good between 0x%08X and 0x%08X size: %u kB",startGood - MEMORY_START_BASE,((uint32_t)(ea_start_address + ea_size) - (uint32_t)MEMORY_START_BASE),((uint32_t)(ea_start_address + ea_size) - (uint32_t)startGood)/1024);
DEBUG_FUNCTION_LINE("+ Good between 0x%08X and 0x%08X size: %u kB", startGood - MEMORY_START_BASE, ((uint32_t) (ea_start_address + ea_size) - (uint32_t) MEMORY_START_BASE),
((uint32_t) (ea_start_address + ea_size) - (uint32_t) startGood) / 1024);
} else if (inFailRange) {
DEBUG_FUNCTION_LINE("- Used between 0x%08X and 0x%08X size: %u kB", startFailing, ea_start_address + ea_size, ((uint32_t) (ea_start_address + ea_size) - (uint32_t) startFailing) / 1024);
}