blob: 8a050434f67d8f2d0646ec4896f87444ea1131d0 [file] [log] [blame]
#ifndef _KAL_INLINE_API_H
#define _KAL_INLINE_API_H
#include "kal_general_types.h"
#include "mips_ia_utils_public.h"
/*******************************************************************************
* <GROUP Functions>
*
* FUNCTION
* kal_query_boot_mode
* DESCRIPTION
* query system boot mode.
* PARAMETERS
* N/A
* SEE ALSO
* boot_mode_type
******************************************************************************/
INLINE_MODIFIER INLINE INLINE_ALWAYS boot_mode_type kal_query_boot_mode(void)
{
extern boot_mode_type system_boot_mode;
return system_boot_mode;
}
/*******************************************************************************
* <GROUP Functions>
*
* FUNCTION
* kal_set_boot_mode
* DESCRIPTION
* set system boot mode (for Seamless META Switch)
* PARAMETERS
* boot_mode_type
* SEE ALSO
* boot_mode_type
******************************************************************************/
INLINE_MODIFIER INLINE INLINE_ALWAYS void kal_set_boot_mode(boot_mode_type boot_mode)
{
extern boot_mode_type system_boot_mode;
system_boot_mode = boot_mode;
}
/*******************************************************************************
* <GROUP Functions>
*
* FUNCTION
* kal_get_current_core_id
* DESCRIPTION
* get current executed CORE ID
* PARAMETERS
* N/A
* RETURNS
* current executed CORE ID: 0 ~ 3.
******************************************************************************/
INLINE INLINE_ALWAYS static kal_uint32 kal_get_current_core_id(void)
{
#if defined(__MTK_TARGET__)
kal_uint32 cpu_id = 0;
cpu_id = miu_get_current_core_id();
return cpu_id;
#else
return 0;
#endif
}
/*******************************************************************************
* <GROUP Functions>
*
* FUNCTION
* kal_get_current_vpe_id
* DESCRIPTION
* get current executed VPE ID
* PARAMETERS
* N/A
* RETURNS
* current executed VPE ID: 0 ~ 7.
******************************************************************************/
INLINE INLINE_ALWAYS static kal_uint32 kal_get_current_vpe_id(void)
{
#if defined(__MTK_TARGET__)
kal_uint32 cpu_id = 0;
cpu_id = miu_get_current_vpe_id();
return cpu_id;
#else
return 0;
#endif
}
/*******************************************************************************
* <GROUP Functions>
*
* FUNCTION
* kal_get_current_tc_id
* DESCRIPTION
* get current executed TC ID
* PARAMETERS
* N/A
* RETURNS
* current executed TC ID: 0 ~ 3.
******************************************************************************/
INLINE INLINE_ALWAYS static kal_uint32 kal_get_current_tc_id(void)
{
#if defined(__MTK_TARGET__)
kal_uint32 tc_id = 0;
tc_id = miu_get_current_tc_id();
return tc_id;
#else
return 0;
#endif
}
/*******************************************************************************
* Category 1 : StdLib-like Function
*******************************************************************************/
INLINE_MODIFIER INLINE INLINE_ALWAYS void *kal_mem_cpy(void *dest, const void *src,
kal_uint32 size)
{
return memcpy(dest, src, size);
}
INLINE_MODIFIER INLINE INLINE_ALWAYS void *kal_mem_set(void *dest, kal_int32 value,
kal_uint32 size)
{
return memset(dest, value, size);
}
INLINE_MODIFIER INLINE INLINE_ALWAYS kal_int32 kal_mem_cmp(const void *src1, const void *src2,
kal_uint32 size)
{
return memcmp(src1, src2, size);
}
INLINE_MODIFIER INLINE INLINE_ALWAYS void *kal_mem_bwcpy(void *dest, const void *src,
kal_uint32 size)
{
char * destaddr = (char *)dest + (size - 1);
char const *srcaddr = (char *)src + (size - 1);
while (size-- > 0)
*destaddr-- = *srcaddr--;
return destaddr;
}
#endif