YB_Platform/public/rtos/inc/spinlock.h
xinxin.li 61a8435a6d > 1. 增加cpri模式,帧头提前2ms的功能,UCP4008-SL-EVB New Feature #926;
> 2. 系统平台lib库更新;
> 3. 增加单模模式下,双小区的删建功能;
> 4. 回归测试case:case21/case22(NR15K)/case34/case37/case68(LTE)
2023-08-18 20:30:52 +08:00

113 lines
2.1 KiB
C
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef KERNEL_API_INC_SPINLOCK_H_
#define KERNEL_API_INC_SPINLOCK_H_
#include <ucps2-intrin.h>
typedef enum
{
SLOCK_L3 = 0,
SLOCK_MAX = 15
}ape_spin_lock_index;
typedef struct{
union
{
unsigned int slock;
};
}spinlock_t;
#define APE_NR 12
typedef struct{
unsigned int spinlock_count;
unsigned int unspinlock_count;
unsigned int spinlock_loop;
unsigned int g_spin_count;
// unsigned int unspinlock_loop;
}spin_db_info ;
typedef struct{
// spin_db_info spin_per_ape[APE_NR];
spin_db_info spin_per_ape;
}spin_debug_t;
typedef struct
{
int lock_addr; //锁物理地址
int flag_addr; // 锁标志物理地址
}ddr_spinlock_t;
extern int smart_spinlock_init(int lock_index);
extern void smart_spinlock(int lock_index);
extern void smart_spinunlock(int lock_index);
extern int smart_spin_debug_init(int lock_idx,unsigned int debug_base_addr, int len_bytes);
/*
参数:lock_idx
参数范围1--15
*/
extern int smart_get_spin_loop_cnt(int lock_idx);
/*
参数:lock_idx
参数范围1--15
*/
extern int smart_get_spin_cnt(int lock_idx);
/*
参数:lock_idx
参数范围1--15
*/
extern int smart_get_spinlock_cnt(int lock_idx);
/*
参数:lock_idx
参数范围1--15
*/
extern int smart_get_unspinlock_cnt(int lock_idx);
extern int smart_ddr_spin_lock_init(ddr_spinlock_t *val);
extern void smart_ddr_spinlock(ddr_spinlock_t *val);
extern void smart_ddr_spinunlock(ddr_spinlock_t *val);
static inline void smart_ddr_spinlock_irq(ddr_spinlock_t *val)
{
__ucps2_IntEn(f_Disable);
smart_ddr_spinlock(val);
}
static inline void smart_ddr_spinunlock_irqrestore(ddr_spinlock_t *val)
{
smart_ddr_spinunlock(val);
__ucps2_IntEn(f_Enable);
}
static inline void smart_spinlock_irq(int lock)
{
__ucps2_IntEn(f_Disable);
smart_spinlock(lock);
}
static inline void smart_spinunlock_irqrestore(int lock)
{
smart_spinunlock(lock);
__ucps2_IntEn(f_Enable);
}
#endif /* KERNEL_API_INC_SPINLOCK_H_ */