113 lines
2.1 KiB
C
113 lines
2.1 KiB
C
/*
|
|
* Copyright (C) 2012-2015 Apple Inc. All rights reserved.
|
|
*
|
|
* This document is the property of Apple Inc.
|
|
* It is considered confidential and proprietary.
|
|
*
|
|
* This document may not be reproduced or transmitted in any form,
|
|
* in whole or in part, without the express written permission of
|
|
* Apple Inc.
|
|
*/
|
|
#include <debug.h>
|
|
#include <drivers/flash_nor.h>
|
|
#include <drivers/iic.h>
|
|
#include <drivers/power.h>
|
|
#include <lib/devicetree.h>
|
|
#include <lib/env.h>
|
|
#include <lib/mib.h>
|
|
#include <lib/syscfg.h>
|
|
#include <platform.h>
|
|
#include <platform/gpio.h>
|
|
#include <platform/gpiodef.h>
|
|
#include <sys.h>
|
|
#include <sys/boot.h>
|
|
#include <sys/menu.h>
|
|
#include <target.h>
|
|
|
|
MIB_CONSTANT(kMIBTargetOsPictureScale, kOIDTypeUInt32, 2);
|
|
MIB_CONSTANT(kMIBTargetPictureRotate, kOIDTypeInt32, 0);
|
|
uint32_t display_config;
|
|
|
|
void target_early_init(void)
|
|
{
|
|
}
|
|
|
|
void target_late_init(void)
|
|
{
|
|
}
|
|
|
|
void target_init(void)
|
|
{
|
|
#if WITH_HW_FLASH_NOR
|
|
flash_nor_init(SPI_NOR0);
|
|
#endif
|
|
}
|
|
|
|
void target_quiesce_hardware(void)
|
|
{
|
|
}
|
|
|
|
void target_poweroff(void)
|
|
{
|
|
}
|
|
|
|
|
|
int target_bootprep(enum boot_target target)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
bool target_should_recover(void)
|
|
{
|
|
return platform_get_request_dfu2() && power_has_usb();
|
|
}
|
|
|
|
bool target_should_poweron(bool *cold_button_boot)
|
|
{
|
|
#if WITH_HW_POWER
|
|
if (power_get_boot_flag() == kPowerBootFlagColdButton) *cold_button_boot = true;
|
|
#else
|
|
*cold_button_boot = false;
|
|
#endif // WITH_HW_POWER
|
|
|
|
return !*cold_button_boot || platform_get_request_dfu1();
|
|
}
|
|
|
|
bool target_should_poweroff(bool at_boot)
|
|
{
|
|
return platform_get_request_dfu1() && (!at_boot || !power_has_usb());
|
|
}
|
|
|
|
#if APPLICATION_IBOOT
|
|
void target_watchdog_tickle(void)
|
|
{
|
|
uint32_t value = gpio_read(GPIO_WDOG_TICKLE);
|
|
gpio_write(GPIO_WDOG_TICKLE, value ^ 1);
|
|
}
|
|
#endif // APPLICATION_IBOOT
|
|
|
|
void * target_get_display_configuration(void)
|
|
{
|
|
display_config = 0x00000da2;
|
|
return ((void *)(&display_config));
|
|
}
|
|
#if WITH_ENV
|
|
|
|
void target_setup_default_environment(void)
|
|
{
|
|
env_set("boot-device", "asp_nand", 0);
|
|
env_set("display-color-space","RGB888", 0);
|
|
env_set("display-timing", "n51", 0);
|
|
}
|
|
|
|
#endif // WITH_ENV
|
|
|
|
#if WITH_DEVICETREE
|
|
|
|
int target_update_device_tree(void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
#endif // WITH_DEVICETREE
|