diff --git a/Host/Source/MicroBoot/interfaces/can/lawicel/openblt_can_lawicel.dpr b/Host/Source/MicroBoot/interfaces/can/lawicel/openblt_can_lawicel.dpr index 6af1359f..dd449f09 100644 --- a/Host/Source/MicroBoot/interfaces/can/lawicel/openblt_can_lawicel.dpr +++ b/Host/Source/MicroBoot/interfaces/can/lawicel/openblt_can_lawicel.dpr @@ -325,6 +325,10 @@ begin // check if the user cancelled if stopRequest then begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); MbiCallbackOnError('Programming session cancelled by user.'); Exit; end; @@ -354,6 +358,17 @@ begin for regionCnt := 0 to datafile.GetRegionCnt-1 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // obtain the region info datafile.GetRegionInfo(regionCnt, addr, len); @@ -386,6 +401,17 @@ begin bufferOffset := 0; while len > 0 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // set the current write length taking into account kMaxProgLen currentWriteCnt := len mod kMaxProgLen; if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen; @@ -437,7 +463,6 @@ begin MbiCallbackOnProgress(progress); MbiCallbackOnLog('File successfully downloaded t='+ShortString(TimeToStr(Time))); MbiCallbackOnDone; - end; //*** end of OnTimeout *** @@ -515,10 +540,6 @@ procedure MbiStop; stdcall; begin // set stop request stopRequest := true; - - // disconnect the transport layer - MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); - loader.Disconnect; end; //*** end of MbiStop *** diff --git a/Host/Source/MicroBoot/interfaces/can/peak/openblt_can_peak.dpr b/Host/Source/MicroBoot/interfaces/can/peak/openblt_can_peak.dpr index aeb81d0f..ae3171d0 100644 --- a/Host/Source/MicroBoot/interfaces/can/peak/openblt_can_peak.dpr +++ b/Host/Source/MicroBoot/interfaces/can/peak/openblt_can_peak.dpr @@ -326,6 +326,10 @@ begin // check if the user cancelled if stopRequest then begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); MbiCallbackOnError('Programming session cancelled by user.'); Exit; end; @@ -355,6 +359,17 @@ begin for regionCnt := 0 to datafile.GetRegionCnt-1 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // obtain the region info datafile.GetRegionInfo(regionCnt, addr, len); @@ -387,6 +402,17 @@ begin bufferOffset := 0; while len > 0 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // set the current write length taking into account kMaxProgLen currentWriteCnt := len mod kMaxProgLen; if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen; @@ -438,7 +464,6 @@ begin MbiCallbackOnProgress(progress); MbiCallbackOnLog('File successfully downloaded t='+ShortString(TimeToStr(Time))); MbiCallbackOnDone; - end; //*** end of OnTimeout *** @@ -516,10 +541,6 @@ procedure MbiStop; stdcall; begin // set stop request stopRequest := true; - - // disconnect the transport layer - MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); - loader.Disconnect; end; //*** end of MbiStop *** diff --git a/Host/Source/MicroBoot/interfaces/net/openblt_net.dpr b/Host/Source/MicroBoot/interfaces/net/openblt_net.dpr index 13f96c10..b646f13b 100644 --- a/Host/Source/MicroBoot/interfaces/net/openblt_net.dpr +++ b/Host/Source/MicroBoot/interfaces/net/openblt_net.dpr @@ -274,6 +274,7 @@ begin Sleep(5); if stopRequest then begin + MbiCallbackOnLog('Transport layer connection cancelled by user. t='+ShortString(TimeToStr(Time))); MbiCallbackOnError('Transport layer connection cancelled by user.'); Exit; end; @@ -319,6 +320,7 @@ begin Sleep(5); if stopRequest then begin + MbiCallbackOnLog('Transport layer connection cancelled by user. t='+ShortString(TimeToStr(Time))); MbiCallbackOnError('Transport layer connection cancelled by user.'); Exit; end; @@ -361,6 +363,10 @@ begin // check if the user cancelled if stopRequest then begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); MbiCallbackOnError('Programming session cancelled by user.'); Exit; end; @@ -390,6 +396,17 @@ begin for regionCnt := 0 to datafile.GetRegionCnt-1 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // obtain the region info datafile.GetRegionInfo(regionCnt, addr, len); @@ -422,6 +439,17 @@ begin bufferOffset := 0; while len > 0 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // set the current write length taking into account kMaxProgLen currentWriteCnt := len mod kMaxProgLen; if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen; @@ -551,10 +579,6 @@ procedure MbiStop; stdcall; begin // set stop request stopRequest := true; - - // disconnect the transport layer - MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); - loader.Disconnect; end; //*** end of MbiStop *** diff --git a/Host/Source/MicroBoot/interfaces/uart/openblt_uart.dpr b/Host/Source/MicroBoot/interfaces/uart/openblt_uart.dpr index 2a372fd8..e37dfc03 100644 --- a/Host/Source/MicroBoot/interfaces/uart/openblt_uart.dpr +++ b/Host/Source/MicroBoot/interfaces/uart/openblt_uart.dpr @@ -303,6 +303,10 @@ begin // check if the user cancelled if stopRequest then begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); MbiCallbackOnError('Programming session cancelled by user.'); Exit; end; @@ -331,6 +335,17 @@ begin for regionCnt := 0 to datafile.GetRegionCnt-1 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // obtain the region info datafile.GetRegionInfo(regionCnt, addr, len); @@ -363,6 +378,17 @@ begin bufferOffset := 0; while len > 0 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // set the current write length taking into account kMaxProgLen currentWriteCnt := len mod kMaxProgLen; if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen; @@ -491,10 +517,6 @@ procedure MbiStop; stdcall; begin // set stop request stopRequest := true; - - // disconnect the transport layer - MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); - loader.Disconnect; end; //*** end of MbiStop *** diff --git a/Host/Source/MicroBoot/interfaces/usb/openblt_usb.dpr b/Host/Source/MicroBoot/interfaces/usb/openblt_usb.dpr index deb150eb..58bb2658 100644 --- a/Host/Source/MicroBoot/interfaces/usb/openblt_usb.dpr +++ b/Host/Source/MicroBoot/interfaces/usb/openblt_usb.dpr @@ -308,6 +308,10 @@ begin // check if the user cancelled if stopRequest then begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); MbiCallbackOnError('Programming session cancelled by user.'); Exit; end; @@ -336,6 +340,17 @@ begin for regionCnt := 0 to datafile.GetRegionCnt-1 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // obtain the region info datafile.GetRegionInfo(regionCnt, addr, len); @@ -368,6 +383,17 @@ begin bufferOffset := 0; while len > 0 do begin + // check if the user cancelled + if stopRequest then + begin + // disconnect the transport layer + MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); + loader.Disconnect; + MbiCallbackOnLog('Programming session cancelled by user. t='+ShortString(TimeToStr(Time))); + MbiCallbackOnError('Programming session cancelled by user.'); + Exit; + end; + // set the current write length taking into account kMaxProgLen currentWriteCnt := len mod kMaxProgLen; if currentWriteCnt = 0 then currentWriteCnt := kMaxProgLen; @@ -419,7 +445,6 @@ begin MbiCallbackOnProgress(progress); MbiCallbackOnLog('File successfully downloaded t='+ShortString(TimeToStr(Time))); MbiCallbackOnDone; - end; //*** end of OnTimeout *** @@ -497,10 +522,6 @@ procedure MbiStop; stdcall; begin // set stop request stopRequest := true; - - // disconnect the transport layer - MbiCallbackOnLog('Disconnecting the transport layer. t='+ShortString(TimeToStr(Time))); - loader.Disconnect; end; //*** end of MbiStop *** diff --git a/Host/openblt_can_lawicel.dll b/Host/openblt_can_lawicel.dll index c5c75fbf..edfdf222 100644 Binary files a/Host/openblt_can_lawicel.dll and b/Host/openblt_can_lawicel.dll differ diff --git a/Host/openblt_can_peak.dll b/Host/openblt_can_peak.dll index d73863ad..02b59ab7 100644 Binary files a/Host/openblt_can_peak.dll and b/Host/openblt_can_peak.dll differ diff --git a/Host/openblt_net.dll b/Host/openblt_net.dll index 918ad048..66d1a32d 100644 Binary files a/Host/openblt_net.dll and b/Host/openblt_net.dll differ diff --git a/Host/openblt_uart.dll b/Host/openblt_uart.dll index 5be5c212..7fbfd916 100644 Binary files a/Host/openblt_uart.dll and b/Host/openblt_uart.dll differ diff --git a/Host/openblt_usb.dll b/Host/openblt_usb.dll index d8cf1002..cb22b3ac 100644 Binary files a/Host/openblt_usb.dll and b/Host/openblt_usb.dll differ