Newer
Older
Atmosphere / exosphere / rebootstub / src / shutdown.c
@Michael Scire Michael Scire on 21 Feb 2019 884 bytes exo/bpc.mitm: Add support for proper shutdown.
/*
 * Copyright (c) 2018 Atmosphère-NX
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms and conditions of the GNU General Public License,
 * version 2, as published by the Free Software Foundation.
 *
 * This program is distributed in the hope it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
#include "utils.h"
#include "i2c.h"
#include "timer.h"

void do_shutdown(void) {
    /* Initialize i2c. */
    i2c_init();
    
    /* Stop alarm, shutdown. */
    i2c_stop_rtc_alarm();
    i2c_send_shutdown_cmd();
    
    while (true) { }
}