/** SGX

The   sss    gggg x   x   
     s      g      x x    Engine
      sss   g  gg   x
         s  g   g  x x          Copyright 1995-2008.
     ssss    gggg x   x         Steven Goodwin. All Rights Reserved.
    
This version has been released under the GNU Public License v2.0.

Please see the license files for details.

File: src/sgx/core/platform/hwplatform.cpp

*/

#include "sgx/core/core.hpp"

CHardwarePlatform *CHardwarePlatform::ms_pSingleton = NULL;

CHardwarePlatform::CHardwarePlatform() {}

CHardwarePlatform *CHardwarePlatform::get()
{
	if (!ms_pSingleton) {
		sgxError("You can not use hardware-specific information, until you've specified a h/w platform with CHardwarePlatformWinTel32::create() for example");
	}
    return ms_pSingleton;
}

void CHardwarePlatform::dumpStats(void)
{
    sgxTrace("SGX Engine - %s (%s)", getPlatform(), getPlatformID());
    sgxTrace(" Local docs : %s", getDocsURL());
    sgxTrace(" Remote site : %s", getDevelopmentURL());

    sgxTrace("Disc Response:"); 
    sgxTrace(" seek time (in ms) : %.2f", SGX_KILOBYTES*getDiscAccessSpeed());
    sgxTrace(" read time (in Mps) : %2.2f", getDiscReadSpeed()/SGX_MEGABYTES);

    sgxTrace("CPUs:"); 
    sgxTrace(" Number : %d", getNumCPUs());
    tUINT32 i;
    for(i=0; i<getNumCPUs(); ++i) {
        sgxTrace("  CPU %d speed : %d", i+1, getCPUSpeed(i));
    }

    sgxTrace("Memory banks:"); 
    sgxTrace(" Number : %d", getNumMemoryBanks());
    for(i=0; i<getNumMemoryBanks(); ++i) {
        sgxTrace("  Bank %d size : %d", i+1, getMemorySize(i));
    }
}

void CHardwarePlatform::getCRLF(tBYTE *pDest)
{
	*(pDest+0) = '\r';
	*(pDest+1) = '\n';
	*(pDest+2) = '\0';
}

