2023-09-25 09:46:27 +08:00
|
|
|
// +FHDR------------------------------------------------------------
|
|
|
|
// Copyright (c) 2022 SmartLogic.
|
|
|
|
// ALL RIGHTS RESERVED
|
|
|
|
// -----------------------------------------------------------------
|
|
|
|
// Filename : ape_top.c
|
|
|
|
// Author : xianfeng.du
|
|
|
|
// Created On : 2022-06-25
|
|
|
|
// Last Modified :
|
|
|
|
// -----------------------------------------------------------------
|
|
|
|
// Description:
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// -FHDR------------------------------------------------------------
|
|
|
|
|
|
|
|
#include "typedef.h"
|
|
|
|
#include "smartos.h"
|
|
|
|
#include "ape_drv.h"
|
|
|
|
#include "ucp_handshake.h"
|
|
|
|
#include "ucp_utility.h"
|
|
|
|
#include "ucp_printf.h"
|
|
|
|
#include "msg_transfer_mem.h"
|
|
|
|
#include "msg_transfer_queue.h"
|
|
|
|
#include "pet_sm_mgt.h"
|
|
|
|
#include "osp_init.h"
|
|
|
|
|
|
|
|
static int32_t gCoreId = 0;
|
2023-07-13 11:27:03 +08:00
|
|
|
ALWAYS_INLINE int32_t get_core_id(void)
|
2023-09-25 09:46:27 +08:00
|
|
|
{
|
|
|
|
return gCoreId;
|
|
|
|
}
|
|
|
|
|
|
|
|
void set_core_id(void)
|
|
|
|
{
|
|
|
|
__ucps2_iCacheConfig(f_DoubleEnable, f_BypassEnable);
|
|
|
|
|
2023-07-13 11:27:03 +08:00
|
|
|
gCoreId = smart_get_cpuid();
|
2023-09-25 09:46:27 +08:00
|
|
|
if (0 > gCoreId)
|
|
|
|
{
|
|
|
|
debug_write(DBG_DDR_ERR_IDX(0, 13), gCoreId);
|
|
|
|
}
|
|
|
|
UCP_PRINT_EMPTY("Hello world from APE,coreId[0x%x]", gCoreId);
|
|
|
|
|
|
|
|
__ucps2_synch(0);
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int32_t soc_drv_init()
|
|
|
|
{
|
|
|
|
int apeId = get_core_id();
|
|
|
|
if (0 == apeId)
|
|
|
|
{
|
|
|
|
pet_sm_init();
|
|
|
|
|
|
|
|
osp_var_init();
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void spu_drv_init(void)
|
|
|
|
{
|
|
|
|
pet_sm_alloc();
|
|
|
|
|
|
|
|
ape_drv_init();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void spu_msg_transfer_init(void)//ape level
|
|
|
|
{
|
|
|
|
msg_transfer_mem_alloc();
|
|
|
|
|
|
|
|
handshake_slave_with_master();
|
|
|
|
|
|
|
|
msg_transfer_queue_init();
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|