xiuos/Ubiquitous/XiZi_IIoT/board/rzg2ul-m33/src/hal_entry.c

115 lines
5.0 KiB
C

/***********************************************************************************************************************
* Copyright [2020-2021] Renesas Electronics Corporation and/or its affiliates. All Rights Reserved.
*
* This software and documentation are supplied by Renesas Electronics Corporation and/or its affiliates and may only
* be used with products of Renesas Electronics Corp. and its affiliates ("Renesas"). No other uses are authorized.
* Renesas products are sold pursuant to Renesas terms and conditions of sale. Purchasers are solely responsible for
* the selection and use of Renesas products and Renesas assumes no liability. No license, express or implied, to any
* intellectual property right is granted by Renesas. This software is protected under all applicable laws, including
* copyright laws. Renesas reserves the right to change or discontinue this software and/or this documentation.
* THE SOFTWARE AND DOCUMENTATION IS DELIVERED TO YOU "AS IS," AND RENESAS MAKES NO REPRESENTATIONS OR WARRANTIES, AND
* TO THE FULLEST EXTENT PERMISSIBLE UNDER APPLICABLE LAW, DISCLAIMS ALL WARRANTIES, WHETHER EXPLICITLY OR IMPLICITLY,
* INCLUDING WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT, WITH RESPECT TO THE
* SOFTWARE OR DOCUMENTATION. RENESAS SHALL HAVE NO LIABILITY ARISING OUT OF ANY SECURITY VULNERABILITY OR BREACH.
* TO THE MAXIMUM EXTENT PERMITTED BY LAW, IN NO EVENT WILL RENESAS BE LIABLE TO YOU IN CONNECTION WITH THE SOFTWARE OR
* DOCUMENTATION (OR ANY PERSON OR ENTITY CLAIMING RIGHTS DERIVED FROM YOU) FOR ANY LOSS, DAMAGES, OR CLAIMS WHATSOEVER,
* INCLUDING, WITHOUT LIMITATION, ANY DIRECT, CONSEQUENTIAL, SPECIAL, INDIRECT, PUNITIVE, OR INCIDENTAL DAMAGES; ANY
* LOST PROFITS, OTHER ECONOMIC DAMAGE, PROPERTY DAMAGE, OR PERSONAL INJURY; AND EVEN IF RENESAS HAS BEEN ADVISED OF THE
* POSSIBILITY OF SUCH LOSS, DAMAGES, CLAIMS OR COSTS.
**********************************************************************************************************************/
#define USE_AMP
#include "hal_data.h"
#include <board.h>
#include <console.h>
#include <xizi.h>
#include <arch_interrupt.h>
#include <rpmsg_task.h>
#include <channel.h>
#include <shm.h>
// FSP_CPP_HEADER
void R_BSP_WarmStart(bsp_warm_start_event_t event);
// FSP_CPP_FOOTER
/*******************************************************************************************************************//**
* This function is called at various points during the startup process. This implementation uses the event that is
* called right before main() to set up the pins.
*
* @param[in] event Where at in the start up process the code is currently at
**********************************************************************************************************************/
void R_BSP_WarmStart (bsp_warm_start_event_t event) {
if (BSP_WARM_START_RESET == event)
{
}
if (BSP_WARM_START_POST_C == event)
{
/* C runtime environment and system clocks are setup. */
/* Configure pins. */
R_IOPORT_Open(&g_ioport_ctrl, &g_bsp_pin_cfg);
}
}
uint32_t loop = 0;
void XiZi_SysTick_Handler(void)
{
x_base lock = DISABLE_INTERRUPT();
TickAndTaskTimesliceUpdate();
ENABLE_INTERRUPT(lock);
}
/**
* main() is generated by the Configuration editor and is used to generate threads if an RTOS is used.
* This function is called by main() when no RTOS is used.
**********************************************************************************************************************/
void hal_entry(void)
{
/* system irq table must be inited before initialization of Hardware irq */
SysInitIsrManager();
/* init sharememory */
memset(XIUOS_SHM_TOTAL_ADDR_INFO->start,0,XIUOS_SHM_TOTAL_ADDR_INFO->len);
memset(XIUOS_2_LINUX_MSG_QUEUE_ADDR_INFO->start,0,XIUOS_2_LINUX_MSG_QUEUE_ADDR_INFO->len);
memset(XIUOS_2_XIUOS_MSG_QUEUE_ADDR_INFO->start,0,XIUOS_2_XIUOS_MSG_QUEUE_ADDR_INFO->len);
/* 初始化通道信息 */
channel_ops.channels_init();
#if PROTOCOL_CHOICE == PROTOCOL_AMP
/* 初始化共享内存 */
shm_ops.shm_init();
#endif /* PROTOCOL_CHOICE == PROTOCOL_PRIVATE */
InitBoardMemory((void *)HEAP_START, (void *)HEAP_END);
KPrintf("hal_entry: InitBoardMemory -- HEAP_START = %p, HEAP_END = %p, Size = %dKB !\n"
,(void *)HEAP_START,(void *)HEAP_END,(((void *)HEAP_END) - ((void *)HEAP_START)) / 1024);
#ifdef KERNEL_QUEUEMANAGE
QueuemanagerDoneRegister();
#endif
#ifdef KERNEL_BANNER
ShowBanner();
#endif
SysInitOsAssign();
CreateKServiceKTask();
CreateEnvInitTask();
KPrintf("hal_entry: init kernel envirement final!\n");
DISABLE_INTERRUPT();
KPrintf("hal_entry: disable interrupt now!\n");
g_timer2.p_api->open(g_timer2.p_ctrl, g_timer2.p_cfg);
g_timer2.p_api->callbackSet(g_timer2.p_ctrl, XiZi_SysTick_Handler, NULL, NULL);
g_timer2.p_api->start(g_timer2.p_ctrl);
KPrintf("hal_entry: enable interrupt!\n");
StartupOsAssign();
}