HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_Port::get_Id___MicrosoftSPOTHardwareCpuPin( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); CLR_RT_HeapBlock* pThis = stack.This(); FAULT_ON_NULL(pThis); // Read port ID from the managed object. Application can get it in managed code, but we support backward compatibility. stack.SetResult( pThis[ FIELD__m_portId ].NumericByRefConst().u4, DATATYPE_U4 ); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_Cpu::get_SystemClock___STATIC__U4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); stack.SetResult( ::CPU_SystemClock(), DATATYPE_U4 ); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_InterruptPort::get_Interrupt___MicrosoftSPOTHardwarePortInterruptMode( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_HARDWARE(); TINYCLR_HEADER(); CLR_RT_HeapBlock* pThis = stack.This(); FAULT_ON_NULL(pThis); stack.SetResult( pThis[ Library_spot_hardware_native_Microsoft_SPOT_Hardware_Port::FIELD__m_interruptMode ].NumericByRefConst().s4, DATATYPE_U4 ); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_native_Microsoft_SPOT_Reflection::GetTypeHash___STATIC__U4__mscorlibSystemType( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_UINT32 hash; if(CLR_RT_ReflectionDef_Index::Convert( stack.Arg0(), hash ) == false) { hash = 0; } stack.SetResult( hash, DATATYPE_U4 ); TINYCLR_NOCLEANUP_NOLABEL(); }
HRESULT Library_spot_native_Microsoft_SPOT_Hardware_Utility::InsertOrExtractValueFromArray( CLR_RT_StackFrame& stack, bool fInsert ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* array; CLR_INT32 offset; CLR_INT32 size; CLR_UINT32 res; array = stack.Arg0().DereferenceArray(); FAULT_ON_NULL(array); offset = stack.Arg1().NumericByRefConst().s4; size = stack.Arg2().NumericByRefConst().s4; res = 0; switch(size) { case 1: case 2: case 4: if(offset >= 0 && (CLR_UINT32)(offset + size) <= array->m_numOfElements) { CLR_UINT8* ptr = array->GetElement( offset ); if(fInsert) { res = stack.Arg3().NumericByRef().u4; memcpy( ptr, &res, size ); } else { memcpy( &res, ptr, size ); stack.SetResult( res, DATATYPE_U4 ); } TINYCLR_SET_AND_LEAVE(S_OK); } break; } TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); TINYCLR_NOCLEANUP(); }
HRESULT Library_corlib_native_System_BitConverter::ToUInt16___STATIC__U2__SZARRAY_U1__I4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray(); FAULT_ON_NULL_ARG(pArray); int index; index = stack.Arg1().NumericByRefConst().s4; if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); if ((unsigned int)index + 2 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER); BYTE* p; p = pArray->GetFirstElement(); stack.SetResult(*reinterpret_cast<unsigned short*>(p + index), DATATYPE_U2); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_native_Microsoft_SPOT_Hardware_Utility::ComputeCRC___STATIC__U4__SZARRAY_U1__I4__I4__U4( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_HeapBlock* pArgs; CLR_RT_HeapBlock_Array* array; int offset; int length; CLR_UINT32 crc; int totLength; pArgs = &(stack.Arg0()); array = pArgs[ 0 ].DereferenceArray(); FAULT_ON_NULL(array); offset = pArgs[ 1 ].NumericByRef().s4; length = pArgs[ 2 ].NumericByRef().s4; crc = pArgs[ 3 ].NumericByRef().u4; totLength = array->m_numOfElements; if(offset < 0 || offset > totLength) { TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); } if(length == -1) { length = totLength - offset; } else { if(length < 0 || (offset+length) > totLength) { TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE); } } crc = SUPPORT_ComputeCRC( array->GetElement( offset ), length, crc ); stack.SetResult( crc, DATATYPE_U4 ); TINYCLR_NOCLEANUP(); }
HRESULT Library_spot_native_Microsoft_SPOT_Reflection::GetAssemblyHash___STATIC__U4__mscorlibSystemReflectionAssembly( CLR_RT_StackFrame& stack ) { NATIVE_PROFILE_CLR_CORE(); TINYCLR_HEADER(); CLR_RT_Assembly_Instance inst; CLR_UINT32 hash; if(CLR_RT_ReflectionDef_Index::Convert( stack.Arg0(), inst )) { hash = inst.m_assm->ComputeAssemblyHash(); } else { hash = 0; } stack.SetResult( hash, DATATYPE_U4 ); TINYCLR_NOCLEANUP_NOLABEL(); }
void SetResult_UINT32( CLR_RT_StackFrame &stackFrame, UINT32 value ) { NATIVE_PROFILE_CLR_CORE(); stackFrame.SetResult( value, DATATYPE_U4 ); }
void SetResult_INT16( CLR_RT_StackFrame &stackFrame, INT16 value ) { NATIVE_PROFILE_CLR_CORE(); stackFrame.SetResult( value, DATATYPE_I2 ); }
void SetResult_CHAR( CLR_RT_StackFrame &stackFrame, CHAR value ) { NATIVE_PROFILE_CLR_CORE(); stackFrame.SetResult( value, DATATYPE_I1 ); }