Skip to content

Commit 2073a71

Browse files
committed
Fix merge
1 parent bd10161 commit 2073a71

File tree

2 files changed

+11
-121
lines changed

2 files changed

+11
-121
lines changed

src/DeviceInterfaces/System.Net/sys_net_native_System_Net_NetworkInformation_Wireless80211Configuration.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ HRESULT Library_sys_net_native_System_Net_NetworkInformation_Wireless80211Config
124124
hal_strncpy_s((char *)config.Ssid, WIRELESS82011_CONFIG_MAX_SSID_LEN, hbSsid->StringText(), ssidLength);
125125

126126
// store configuration
127-
if (ConfigurationManager_UpdateConfigurationBlock(
128-
&config,
129-
DeviceConfigurationOption_Wireless80211Network,
130-
configurationIndex) != TRUE)
127+
if ((ConfigurationManager_UpdateConfigurationBlock(
128+
&config,
129+
DeviceConfigurationOption_Wireless80211Network,
130+
configurationIndex) == UpdateConfigurationResult_Failed))
131131
{
132132
NANOCLR_SET_AND_LEAVE(CLR_E_FAIL);
133133
}

targets/ChibiOS/_nanoCLR/System.Device.I2c/sys_dev_i2c_native_System_Device_I2c_I2cDevice.cpp

Lines changed: 7 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -556,123 +556,13 @@ HRESULT Library_sys_dev_i2c_native_System_Device_I2c_I2cDevice::
556556
}
557557
else
558558
{
559-
if (palI2c->ReadSize == 0)
560-
{
561-
// this is Write only transaction
562-
transactionResult = i2cMasterTransmitTimeout(
563-
palI2c->Driver,
564-
palI2c->Address,
565-
palI2c->WriteBuffer,
566-
palI2c->WriteSize,
567-
NULL,
568-
0,
569-
TIME_MS2I(20));
570-
}
571-
else
572-
{
573-
// this is a Read only transaction
574-
transactionResult = i2cMasterReceiveTimeout(
575-
palI2c->Driver,
576-
palI2c->Address,
577-
palI2c->ReadBuffer,
578-
palI2c->ReadSize,
579-
TIME_MS2I(20));
580-
}
581-
}
582-
}
583-
584-
while (eventResult)
585-
{
586-
if (!isLongRunningOperation)
587-
{
588-
// this is not a long running operation so nothing to do here
589-
break;
590-
}
591-
592-
if (palI2c->WorkingThread->state == CH_STATE_FINAL)
593-
{
594-
// I2C working thread is now complete
595-
break;
596-
}
597-
598-
// non-blocking wait allowing other threads to run while we wait for the I2C transaction to complete
599-
NANOCLR_CHECK_HRESULT(
600-
g_CLR_RT_ExecutionEngine.WaitEvents(stack.m_owningThread, *timeout, Event_I2cMaster, eventResult));
601-
}
602-
603-
if (isLongRunningOperation)
604-
{
605-
// pop timeout heap block from stack
606-
stack.PopValue();
607-
}
608-
609-
if (eventResult || !isLongRunningOperation)
610-
{
611-
// event occurred
612-
// OR this is NOT a long running operation
613-
614-
i2cReleaseBus(palI2c->Driver);
615-
616-
// create the return object (I2cTransferResult)
617-
// only at this point we are sure that there will be a return from this thread so it's OK to use the
618-
// managed stack
619-
CLR_RT_HeapBlock &top = stack.PushValueAndClear();
620-
NANOCLR_CHECK_HRESULT(
621-
g_CLR_RT_ExecutionEngine.NewObjectFromIndex(top, g_CLR_RT_WellKnownTypes.I2cTransferResult));
622-
result = top.Dereference();
623-
FAULT_ON_NULL(result);
624-
625-
if (isLongRunningOperation)
626-
{
627-
// ChibiOS requirement: need to call chThdWait for I2C working thread in order to have it's memory
628-
// released to the heap, otherwise it won't be returned
629-
transactionResult = chThdWait(palI2c->WorkingThread);
630-
}
631-
632-
// get the result from the working thread execution
633-
if (transactionResult != MSG_OK)
634-
{
635-
// error in transaction
636-
int errors = i2cGetErrors(palI2c->Driver);
637-
638-
// figure out what was the error and set the status field
639-
switch (errors)
640-
{
641-
case I2C_ACK_FAILURE:
642-
result[I2cTransferResult::FIELD___status].SetInteger(
643-
(CLR_UINT32)I2cTransferStatus_SlaveAddressNotAcknowledged);
644-
break;
645-
646-
case I2C_TIMEOUT:
647-
result[I2cTransferResult::FIELD___status].SetInteger(
648-
(CLR_UINT32)I2cTransferStatus_ClockStretchTimeout);
649-
break;
650-
651-
default:
652-
result[I2cTransferResult::FIELD___status].SetInteger(
653-
(CLR_UINT32)I2cTransferStatus_UnknownError);
654-
}
655-
656-
// set the bytes transferred count to 0 because we don't have a way to know how many bytes were
657-
// actually sent/received
658-
result[I2cTransferResult::FIELD___bytesTransferred].SetInteger(0);
659-
}
660-
else
661-
{
662-
// successful transaction
663-
// set the result field
664-
result[I2cTransferResult::FIELD___status].SetInteger((CLR_UINT32)I2cTransferStatus_FullTransfer);
665-
666-
// set the bytes transferred field
667-
result[I2cTransferResult::FIELD___bytesTransferred].SetInteger(
668-
(CLR_UINT32)(palI2c->WriteSize + palI2c->ReadSize));
669-
}
670-
671-
if (palI2c->ReadSize > 0)
672-
{
673-
// invalidate cache over read buffer to ensure that content from DMA is read
674-
// (only required for Cortex-M7)
675-
cacheBufferInvalidate(palI2c->ReadBuffer, palI2c->ReadSize);
559+
// this is a Read only transaction
560+
transactionResult = i2cMasterReceiveTimeout(
561+
palI2c->Driver,
562+
palI2c->Address,
563+
palI2c->ReadBuffer,
564+
palI2c->ReadSize,
565+
TIME_MS2I(20));
676566
}
677567
}
678568
}

0 commit comments

Comments
 (0)