2008-01-09 07:24:43 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
* $Id$
|
|
|
|
*
|
|
|
|
* Copyright (C) 2006 by Barry Wardell
|
|
|
|
*
|
2008-06-28 18:10:04 +00:00
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2008-01-09 07:24:43 +00:00
|
|
|
*
|
|
|
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
* KIND, either express or implied.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "cpu.h"
|
|
|
|
#include <stdbool.h>
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "system.h"
|
|
|
|
#include "power.h"
|
|
|
|
#include "logf.h"
|
|
|
|
#include "usb.h"
|
2009-07-26 14:26:14 +00:00
|
|
|
#include "lcd-remote-target.h"
|
2008-01-09 07:24:43 +00:00
|
|
|
|
|
|
|
void power_init(void)
|
|
|
|
{
|
2008-03-07 16:05:22 +00:00
|
|
|
/* Enable power-off bit */
|
|
|
|
GPIOB_ENABLE |= 0x80;
|
|
|
|
GPIOB_OUTPUT_VAL &= ~0x80;
|
|
|
|
GPIOB_OUTPUT_EN |= 0x80;
|
2008-01-09 07:24:43 +00:00
|
|
|
}
|
|
|
|
|
2008-12-03 19:54:25 +00:00
|
|
|
unsigned int power_input_status(void)
|
|
|
|
{
|
|
|
|
return (GPIOL_INPUT_VAL & 0x24) ?
|
|
|
|
POWER_INPUT_MAIN_CHARGER : POWER_INPUT_NONE;
|
2008-01-09 07:24:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void ide_power_enable(bool on)
|
|
|
|
{
|
|
|
|
(void)on;
|
2008-01-11 21:48:01 +00:00
|
|
|
/* We do nothing */
|
2008-01-09 07:24:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
bool ide_powered(void)
|
|
|
|
{
|
2008-01-11 21:48:01 +00:00
|
|
|
/* pretend we are always powered - we don't turn it off */
|
2008-01-09 07:24:43 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void power_off(void)
|
|
|
|
{
|
2009-07-26 14:26:14 +00:00
|
|
|
#ifdef HAVE_REMOTE_LCD
|
|
|
|
lcd_remote_off();
|
|
|
|
#endif
|
|
|
|
|
2008-02-03 00:04:02 +00:00
|
|
|
/* Disable interrupts on this core */
|
2008-03-31 06:00:23 +00:00
|
|
|
disable_interrupt(IRQ_FIQ_STATUS);
|
2008-02-03 00:04:02 +00:00
|
|
|
|
|
|
|
/* Mask them on both cores */
|
2008-06-03 05:08:24 +00:00
|
|
|
CPU_INT_DIS = -1;
|
|
|
|
COP_INT_DIS = -1;
|
2008-02-03 00:04:02 +00:00
|
|
|
|
|
|
|
while (1)
|
|
|
|
GPIOB_OUTPUT_VAL |= 0x80;
|
2008-01-09 07:24:43 +00:00
|
|
|
}
|