forked from nanoframework/nf-interpreter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nanoHAL_SystemInformation.cpp
69 lines (57 loc) · 2.26 KB
/
nanoHAL_SystemInformation.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
//
// Copyright (c) .NET Foundation and Contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#include <nanoHAL.h>
#include <targetHAL.h>
#include <nanoCLR_Runtime.h>
extern CLR_RT_ExecutionEngine g_CLR_RT_ExecutionEngine;
bool GetHalSystemInfo(HalSystemInfo &systemInfo)
{
#if defined(HAL_REDUCESIZE)
// No config update.
return FALSE;
#else
// NFReleaseInfo:
systemInfo.m_releaseInfo.Version.usMajor = VERSION_MAJOR;
systemInfo.m_releaseInfo.Version.usMinor = VERSION_MINOR;
systemInfo.m_releaseInfo.Version.usBuild = VERSION_BUILD;
systemInfo.m_releaseInfo.Version.usRevision = VERSION_REVISION;
size_t len = sizeof(systemInfo.m_releaseInfo.InfoString);
hal_strncpy_s((char *)&systemInfo.m_releaseInfo.InfoString[0], len, OEMSYSTEMINFOSTRING, len - 1);
len = sizeof(systemInfo.m_releaseInfo.PlatformName);
hal_strncpy_s((char *)&systemInfo.m_releaseInfo.PlatformName[0], len, TARGETNAMESTRING, len - 1);
len = sizeof(systemInfo.m_releaseInfo.TargetName);
hal_strncpy_s((char *)&systemInfo.m_releaseInfo.TargetName[0], len, PLATFORMNAMESTRING, len - 1);
// we are not supporting this at this time
// OEM_MODEL_SKU:
// memcpy((void*)&(systemInfo.m_OemModelInfo), (void*)&(g_ConfigurationSector.OEM_Model_SKU),
// sizeof(OEM_MODEL_SKU));
// we are not supporting this at this time
// OEM_SERIAL_NUMBERS:
// memcpy((void*)&(systemInfo.m_OemSerialNumbers), (void*)&(g_ConfigurationSector.OemSerialNumbers),
// sizeof(OEM_SERIAL_NUMBERS));
return TRUE;
#endif
}
bool Target_GetReleaseInfo(NFReleaseInfo &releaseInfo)
{
NFReleaseInfo::Init(
releaseInfo,
VERSION_MAJOR,
VERSION_MINOR,
VERSION_BUILD,
VERSION_REVISION,
TARGETINFOSTRING,
hal_strlen_s(TARGETINFOSTRING),
TARGETNAMESTRING,
hal_strlen_s(TARGETNAMESTRING),
PLATFORMNAMESTRING,
hal_strlen_s(PLATFORMNAMESTRING));
return TRUE; // alternatively, return false if you didn't initialize the releaseInfo structure.
}
bool DebuggerIsConnected()
{
return ((g_CLR_RT_ExecutionEngine.m_iDebugger_Conditions & CLR_RT_ExecutionEngine::c_fDebugger_Enabled) != 0);
}