93 lines
1.7 KiB
C
93 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2013-2014 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/power.h>
|
|
#include <lib/env.h>
|
|
#include <lib/mib.h>
|
|
#include <platform.h>
|
|
#include <platform/gpiodef.h>
|
|
#include <platform/soc/chipid.h>
|
|
#include <target.h>
|
|
#include <platform/soc/hwclocks.h>
|
|
|
|
MIB_CONSTANT(kMIBTargetOsPictureScale, kOIDTypeUInt32, 2);
|
|
MIB_CONSTANT(kMIBTargetPictureRotate, kOIDTypeInt32, 0);
|
|
|
|
void target_early_init(void)
|
|
{
|
|
}
|
|
|
|
void target_late_init(void)
|
|
{
|
|
clock_gate(CLK_UART7, 0);
|
|
}
|
|
|
|
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 (power_get_boot_flag() == kPowerBootFlagColdButton)
|
|
*cold_button_boot = true;
|
|
|
|
return true;
|
|
}
|
|
|
|
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
|
|
|
|
#if WITH_ENV
|
|
void target_setup_default_environment(void)
|
|
{
|
|
// boot-device is set in platform's init.c
|
|
env_set("wifiaddr", "7E:77:77:77:77:77", 0);
|
|
}
|
|
#endif
|
|
|
|
#if WITH_DEVICETREE
|
|
int target_update_device_tree(void)
|
|
{
|
|
return 0;
|
|
}
|
|
#endif // WITH_DEVICETREE
|