2021-03-15 09:57:36 -04:00
|
|
|
/*
|
2020-12-01 20:01:14 -05:00
|
|
|
* This file is part of the MicroPython project, http://micropython.org/
|
|
|
|
*
|
|
|
|
* The MIT License (MIT)
|
|
|
|
*
|
|
|
|
* Copyright (c) 2018 by Roy Hooper
|
|
|
|
* furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
* THE SOFTWARE.
|
|
|
|
*/
|
2018-05-14 17:41:17 -04:00
|
|
|
|
|
|
|
#include "reload.h"
|
|
|
|
#include "py/mpstate.h"
|
|
|
|
|
|
|
|
void mp_raise_reload_exception(void) {
|
|
|
|
MP_STATE_VM(mp_pending_exception) = MP_OBJ_FROM_PTR(&MP_STATE_VM(mp_reload_exception));
|
2021-03-15 09:57:36 -04:00
|
|
|
#if MICROPY_ENABLE_SCHEDULER
|
2018-05-14 17:41:17 -04:00
|
|
|
if (MP_STATE_VM(sched_state) == MP_SCHED_IDLE) {
|
|
|
|
MP_STATE_VM(sched_state) = MP_SCHED_PENDING;
|
|
|
|
}
|
2021-03-15 09:57:36 -04:00
|
|
|
#endif
|
2018-05-14 17:41:17 -04:00
|
|
|
|
|
|
|
}
|