/*******************************************************************************
 * Copyright (c) 2018-2021 Renesas Electronics Corporation. All rights reserved.
 *
 *     RENESAS ELECTRONICS CONFIDENTIAL AND PROPRIETARY
 *
 * This software is provided as reference/sample code under the license
 * agreement between Renesas Electronics Corporation and licensee (the
 * "License Agreement") and shall be treated as specified in the License
 * Agreement.
 * These instructions, statements, and software are the confidential
 * information of Renesas Electronics Corporation. They must be used and
 * modified solely for the purpose for which it was furnished by Renesas
 * Electronics Corporation. All or part of these instructions, statements and
 * software must not be reproduced nor disclosed to any third party in any
 * form, unless permitted by the License Agreement.
 *
 * THIS SOFTWARE IS PROVIDED BY RENESAS ELEOCTRONICS CORPORATION "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
 * SATISFACTORY QUALITY, ACCURACY, TITLE AND NON-INFRINGEMENT ARE DISCLAIMED.
 * IN NO EVENT SHALL RENESAS ELECTRONICS CORPORATION BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, PUNITIVE, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 ******************************************************************************/

/*******************************************************************************
 * DESCRIPTION   : boot ROM API
 ******************************************************************************/
/******************************************************************************
 * @file          rom_api.c
 * - Version      : 0.01
 * @brief         1.Call ROM_SecureBootAPI.
 *                2.Call ROM_GetLcsAPI.
 * .
 *****************************************************************************/
/******************************************************************************
 * History : DD.MM.YYYY Version  Description
 *         : 03.07.2020 0.01     First Release
 *****************************************************************************/

#include <stdint.h>
#include <mem_io.h>
#include <rcar_def.h>
#include <rom_api.h>
#include <log.h>
#include <mfis_register.h>



uint32_t ROM_SecureBootAPI(uint32_t *pContentCert)
{
    /* Secure Boot API address */
    static const uintptr_t s_rom_secureboot_api_addr = ROM_SECUREBOOT_API_V3H;
    ROM_SECURE_BOOT_API func;

    func = (ROM_SECURE_BOOT_API)s_rom_secureboot_api_addr;

    return func((uint32_t *)LOGICAL_BOOT_KEY_ADDR, pContentCert, (void *)0U);
}
/* End of function ROM_SecureBootAPI(uint32_t *pContentCert) */

uint32_t ROM_GetLcs(uint32_t *pLcs)
{
    /* Get LCS stete API address */
    static const uintptr_t s_rom_getlcs_addr = ROM_GET_LCS_V3H;
    ROM_GETLCS_API func;

    func = (ROM_GETLCS_API)s_rom_getlcs_addr;

    return func(pLcs);
}
/* End of function ROM_GetLcs(uint32_t *pLcs) */
