69 lines
1.8 KiB
C
69 lines
1.8 KiB
C
// +FHDR------------------------------------------------------------
|
|
// Copyright (c) 2022 SmartLogic.
|
|
// ALL RIGHTS RESERVED
|
|
// -----------------------------------------------------------------
|
|
// Filename : arm_csu.c
|
|
// Author : xiafeng.du
|
|
// Created On : 2022-11-23
|
|
// Last Modified :
|
|
// -----------------------------------------------------------------
|
|
// Description:
|
|
//
|
|
//
|
|
// -FHDR------------------------------------------------------------
|
|
#include "typedef.h"
|
|
#include "arm_csu.h"
|
|
#include "ospHeap.h"
|
|
#include "ucp_printf.h"
|
|
#include "memcpy_csu.h"
|
|
|
|
//STACK mem type:cacheable, MSG mem type:non-cacheable,
|
|
//the function only works for the transfer between cacheable STACK mem and MSG non-cacheable mem
|
|
void memcpy_csu_stack2stack(uint64_t dst_phy_addr, uint64_t src_phy_addr, uint32_t size,uint8_t check_flag)
|
|
{
|
|
uint8_t tag = arm_csu_dma_1D_transfer(src_phy_addr, dst_phy_addr, size);
|
|
|
|
if (check_flag)
|
|
{
|
|
arm_csu_wait_done(tag);
|
|
}
|
|
return;
|
|
}
|
|
|
|
|
|
void memcpy_csu_stack_and_msg(uint64_t stack_phy_addr, uint64_t msg_virt_addr, uint32_t size,UcpMemcpyCsuType_e type, uint8_t check_flag)
|
|
{
|
|
uint64_t msg_phy_addr = 0;
|
|
uint64_t src_phy_addr = 0;
|
|
uint64_t dst_phy_addr = 0;
|
|
uint8_t tag = 0;
|
|
|
|
osp_virt_to_phy(ARM_APE_MSG, msg_virt_addr, &msg_phy_addr);
|
|
|
|
switch(type)
|
|
{
|
|
case STACK2MSG:
|
|
src_phy_addr = stack_phy_addr;
|
|
dst_phy_addr = msg_phy_addr;
|
|
break;
|
|
case MSG2STACK:
|
|
src_phy_addr = msg_phy_addr;
|
|
dst_phy_addr = stack_phy_addr;
|
|
break;
|
|
default:
|
|
UCP_PRINT_ERROR("memcpy_csu type[%d] error.",type);
|
|
return;
|
|
//break;
|
|
}
|
|
tag = arm_csu_dma_1D_transfer(src_phy_addr, dst_phy_addr, size);
|
|
|
|
if (check_flag) {
|
|
arm_csu_wait_done(tag);
|
|
}
|
|
return;
|
|
}
|
|
|
|
|
|
|
|
|