@@ -55,22 +55,22 @@ bool _wireProtocolStopProcess;
55
55
// ///////////////////////////////////////////////////////////////////////////
56
56
57
57
// All solutions are expected to provide an implementation of this
58
- bool Target_GetReleaseInfo (NFReleaseInfo &releaseInfo)
58
+ bool Target_GetReleaseInfo (NFReleaseInfo &releaseInfo)
59
59
{
60
- NFReleaseInfo::Init (
61
- releaseInfo,
62
- VERSION_MAJOR,
63
- VERSION_MINOR,
64
- VERSION_BUILD,
65
- VERSION_REVISION,
66
- OEMSYSTEMINFOSTRING,
67
- hal_strlen_s (OEMSYSTEMINFOSTRING),
68
- TARGETNAMESTRING,
69
- hal_strlen_s (TARGETNAMESTRING),
70
- PLATFORMNAMESTRING,
71
- hal_strlen_s (PLATFORMNAMESTRING));
72
-
73
- return true ; // alternatively, return false if you didn't initialize the releaseInfo structure.
60
+ NFReleaseInfo::Init (
61
+ releaseInfo,
62
+ VERSION_MAJOR,
63
+ VERSION_MINOR,
64
+ VERSION_BUILD,
65
+ VERSION_REVISION,
66
+ OEMSYSTEMINFOSTRING,
67
+ hal_strlen_s (OEMSYSTEMINFOSTRING),
68
+ TARGETNAMESTRING,
69
+ hal_strlen_s (TARGETNAMESTRING),
70
+ PLATFORMNAMESTRING,
71
+ hal_strlen_s (PLATFORMNAMESTRING));
72
+
73
+ return true ; // alternatively, return false if you didn't initialize the releaseInfo structure.
74
74
}
75
75
76
76
// ///////////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -80,152 +80,152 @@ bool Target_GetReleaseInfo (NFReleaseInfo &releaseInfo)
80
80
// and the declarations @ nanoCLR_native.h
81
81
// ////////////////////////////////////////////////////////////////////////////////////////////////////////////
82
82
83
- void nanoCLR_Run (NANO_CLR_SETTINGS nanoClrSettings)
83
+ void nanoCLR_Run (NANO_CLR_SETTINGS nanoClrSettings)
84
84
{
85
85
86
86
#if _DEBUG
87
- // only show this in debug build
88
- DWORD pid = GetCurrentProcessId ();
89
- CLR_Debug::Printf (" Process ID: %d\r\n " , pid);
87
+ // only show this in debug build
88
+ DWORD pid = GetCurrentProcessId ();
89
+ CLR_Debug::Printf (" Process ID: %d\r\n " , pid);
90
90
#endif
91
91
92
- CLR_Debug::Printf (
93
- " \r\n Loading nanoCLR v%d.%d.%d.%d\r\n ..." ,
94
- VERSION_MAJOR,
95
- VERSION_MINOR,
96
- VERSION_BUILD,
97
- VERSION_REVISION);
92
+ CLR_Debug::Printf (
93
+ " \r\n Loading nanoCLR v%d.%d.%d.%d\r\n ..." ,
94
+ VERSION_MAJOR,
95
+ VERSION_MINOR,
96
+ VERSION_BUILD,
97
+ VERSION_REVISION);
98
98
99
- // initialize nanoHAL
100
- nanoHAL_Initialize ();
99
+ // initialize nanoHAL
100
+ nanoHAL_Initialize ();
101
101
102
- // take care of block storage here as we are RAM based
103
- BlockStorageList_Initialize ();
104
- BlockStorage_AddDevices ();
105
- BlockStorageList_InitializeDevices ();
102
+ // take care of block storage here as we are RAM based
103
+ BlockStorageList_Initialize ();
104
+ BlockStorage_AddDevices ();
105
+ BlockStorageList_InitializeDevices ();
106
106
107
- CLR_SETTINGS clrSettings;
108
- ZeroMemory (&clrSettings, sizeof (CLR_SETTINGS));
107
+ CLR_SETTINGS clrSettings;
108
+ ZeroMemory (&clrSettings, sizeof (CLR_SETTINGS));
109
109
110
- clrSettings.MaxContextSwitches = nanoClrSettings.MaxContextSwitches ;
111
- clrSettings.WaitForDebugger = nanoClrSettings.WaitForDebugger ;
112
- clrSettings.EnterDebuggerLoopAfterExit = nanoClrSettings.EnterDebuggerLoopAfterExit ;
113
- clrSettings.PerformGarbageCollection = nanoClrSettings.PerformGarbageCollection ;
114
- clrSettings.PerformHeapCompaction = nanoClrSettings.PerformHeapCompaction ;
110
+ clrSettings.MaxContextSwitches = nanoClrSettings.MaxContextSwitches ;
111
+ clrSettings.WaitForDebugger = nanoClrSettings.WaitForDebugger ;
112
+ clrSettings.EnterDebuggerLoopAfterExit = nanoClrSettings.EnterDebuggerLoopAfterExit ;
113
+ clrSettings.PerformGarbageCollection = nanoClrSettings.PerformGarbageCollection ;
114
+ clrSettings.PerformHeapCompaction = nanoClrSettings.PerformHeapCompaction ;
115
115
116
- ClrStartup (clrSettings);
116
+ ClrStartup (clrSettings);
117
117
118
118
#if !defined(BUILD_RTM)
119
- CLR_Debug::Printf (" Exiting.\r\n " );
119
+ CLR_Debug::Printf (" Exiting.\r\n " );
120
120
#endif
121
121
}
122
122
123
- void nanoCLR_SetDebugPrintCallback (DebugPrintCallback debugPrintCallback)
123
+ void nanoCLR_SetDebugPrintCallback (DebugPrintCallback debugPrintCallback)
124
124
{
125
- gDebugPrintCallback = debugPrintCallback;
125
+ gDebugPrintCallback = debugPrintCallback;
126
126
}
127
127
128
- void nanoCLR_SetWireProtocolReceiveCallback (WireReceiveCallback receiveCallback)
128
+ void nanoCLR_SetWireProtocolReceiveCallback (WireReceiveCallback receiveCallback)
129
129
{
130
- WireProtocolReceiveCallback = receiveCallback;
130
+ WireProtocolReceiveCallback = receiveCallback;
131
131
}
132
132
133
- void nanoCLR_SetWireProtocolTransmitCallback (WireTransmitCallback transmitCallback)
133
+ void nanoCLR_SetWireProtocolTransmitCallback (WireTransmitCallback transmitCallback)
134
134
{
135
- WireProtocolTransmitCallback = transmitCallback;
135
+ WireProtocolTransmitCallback = transmitCallback;
136
136
}
137
137
138
- void nanoCLR_WireProtocolProcess ()
138
+ void nanoCLR_WireProtocolProcess ()
139
139
{
140
- while (!_wireProtocolStopProcess)
141
- {
142
- WP_Message_Process ();
143
- }
140
+ while (!_wireProtocolStopProcess)
141
+ {
142
+ WP_Message_Process ();
143
+ }
144
144
}
145
145
146
- void nanoCLR_WireProtocolOpen ()
146
+ void nanoCLR_WireProtocolOpen ()
147
147
{
148
- WP_Message_PrepareReception ();
148
+ WP_Message_PrepareReception ();
149
149
150
- _wireProtocolStopProcess = false ;
150
+ _wireProtocolStopProcess = false ;
151
151
}
152
152
153
- void nanoCLR_WireProtocolClose ()
153
+ void nanoCLR_WireProtocolClose ()
154
154
{
155
- // request to stop
156
- _wireProtocolStopProcess = true ;
155
+ // request to stop
156
+ _wireProtocolStopProcess = true ;
157
157
}
158
158
159
- const char *nanoCLR_GetVersion ()
159
+ const char *nanoCLR_GetVersion ()
160
160
{
161
- char buffer[128 ];
161
+ char buffer[128 ];
162
162
163
- char *pszVersion = nullptr ;
164
- pszVersion = (char *)CoTaskMemAlloc (std::size (buffer));
163
+ char *pszVersion = nullptr ;
164
+ pszVersion = (char *)CoTaskMemAlloc (std::size (buffer));
165
165
166
- if (pszVersion != nullptr )
167
- {
168
- const auto result = std::format_to_n (
169
- buffer,
170
- std::size (buffer) - 1 ,
171
- " {}.{}.{}.{}" ,
172
- VERSION_MAJOR,
173
- VERSION_MINOR,
174
- VERSION_BUILD,
175
- VERSION_REVISION);
176
- *result.out = ' \0 ' ;
166
+ if (pszVersion != nullptr )
167
+ {
168
+ const auto result = std::format_to_n (
169
+ buffer,
170
+ std::size (buffer) - 1 ,
171
+ " {}.{}.{}.{}" ,
172
+ VERSION_MAJOR,
173
+ VERSION_MINOR,
174
+ VERSION_BUILD,
175
+ VERSION_REVISION);
176
+ *result.out = ' \0 ' ;
177
177
178
- const std::string_view str{ buffer, result.out };
178
+ const std::string_view str{buffer, result.out };
179
179
180
- std::memcpy (pszVersion, buffer, result.size );
181
- }
180
+ std::memcpy (pszVersion, buffer, result.size );
181
+ }
182
182
183
- return pszVersion;
183
+ return pszVersion;
184
184
}
185
185
186
- uint16_t nanoCLR_GetNativeAssemblyCount ()
186
+ uint16_t nanoCLR_GetNativeAssemblyCount ()
187
187
{
188
- return g_CLR_InteropAssembliesCount;
188
+ return g_CLR_InteropAssembliesCount;
189
189
}
190
190
191
- bool nanoCLR_GetNativeAssemblyInformation (const CLR_UINT8 *data, size_t size)
191
+ bool nanoCLR_GetNativeAssemblyInformation (const CLR_UINT8 *data, size_t size)
192
192
{
193
- if (data == nullptr )
194
- {
195
- return false ;
196
- }
193
+ if (data == nullptr )
194
+ {
195
+ return false ;
196
+ }
197
197
198
- const size_t requiredSize = g_CLR_InteropAssembliesCount * (5 * sizeof (CLR_UINT16) + 128 );
199
- if (size < requiredSize)
200
- {
201
- // Buffer too small
202
- return false ;
203
- }
198
+ const size_t requiredSize = g_CLR_InteropAssembliesCount * (5 * sizeof (CLR_UINT16) + 128 );
199
+ if (size < requiredSize)
200
+ {
201
+ // Buffer too small
202
+ return false ;
203
+ }
204
204
205
- // clear buffer memory
206
- memset ((void *)data, 0 , size);
205
+ // clear buffer memory
206
+ memset ((void *)data, 0 , size);
207
207
208
- // fill the array
209
- for (uint32_t i = 0 ; i < g_CLR_InteropAssembliesCount; i++)
210
- {
211
- memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_checkSum , sizeof (CLR_UINT32));
212
- data += sizeof (CLR_UINT32);
208
+ // fill the array
209
+ for (uint32_t i = 0 ; i < g_CLR_InteropAssembliesCount; i++)
210
+ {
211
+ memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_checkSum , sizeof (CLR_UINT32));
212
+ data += sizeof (CLR_UINT32);
213
213
214
- memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iMajorVersion , sizeof (CLR_UINT16));
215
- data += sizeof (CLR_UINT16);
214
+ memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iMajorVersion , sizeof (CLR_UINT16));
215
+ data += sizeof (CLR_UINT16);
216
216
217
- memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iMinorVersion , sizeof (CLR_UINT16));
218
- data += sizeof (CLR_UINT16);
217
+ memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iMinorVersion , sizeof (CLR_UINT16));
218
+ data += sizeof (CLR_UINT16);
219
219
220
- memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iBuildNumber , sizeof (CLR_UINT16));
221
- data += sizeof (CLR_UINT16);
220
+ memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iBuildNumber , sizeof (CLR_UINT16));
221
+ data += sizeof (CLR_UINT16);
222
222
223
- memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iRevisionNumber , sizeof (CLR_UINT16));
224
- data += sizeof (CLR_UINT16);
223
+ memcpy ((void *)data, &g_CLR_InteropAssembliesNativeData[i]->m_Version .iRevisionNumber , sizeof (CLR_UINT16));
224
+ data += sizeof (CLR_UINT16);
225
225
226
- hal_strcpy_s ((char *)data, 128 , g_CLR_InteropAssembliesNativeData[i]->m_szAssemblyName );
227
- data += 128 ;
228
- }
226
+ hal_strcpy_s ((char *)data, 128 , g_CLR_InteropAssembliesNativeData[i]->m_szAssemblyName );
227
+ data += 128 ;
228
+ }
229
229
230
- return true ; // Success
230
+ return true ; // Success
231
231
}
0 commit comments