42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
// +FHDR------------------------------------------------------------
|
|
// Copyright (c) 2022 SmartLogic.
|
|
// ALL RIGHTS RESERVED
|
|
// -----------------------------------------------------------------
|
|
// Filename : ucp_utility.h
|
|
// Author : xianfeng.du
|
|
// Created On : 2022-06-25
|
|
// Last Modified :
|
|
// -----------------------------------------------------------------
|
|
// Description:
|
|
//
|
|
//
|
|
// -FHDR------------------------------------------------------------
|
|
|
|
|
|
#ifndef __UCP_UTILITY_H__
|
|
#define __UCP_UTILITY_H__
|
|
|
|
#include "typedef.h"
|
|
#include "ospHeap.h"
|
|
|
|
#ifdef UCP_SPIN_LOCK
|
|
#include <pthread.h>
|
|
#define ucp_spin_lock(x) pthread_spin_lock((pthread_spinlock_t *)x)
|
|
#define ucp_spin_unlock(x) pthread_spin_unlock((pthread_spinlock_t *)x)
|
|
extern pthread_spinlock_t lock_dl_tx_alloc;
|
|
extern pthread_spinlock_t lock_dl_tx_put;
|
|
#else
|
|
#define ucp_spin_lock(x)
|
|
#define ucp_spin_unlock(x)
|
|
#endif
|
|
void ucp_spinlock_init();
|
|
|
|
int32_t isPowerOf2(uint32_t n);
|
|
|
|
//cache
|
|
void ucp_cache_writeback(uint8_t* buf, uint32_t length);
|
|
void ucp_cache_invalid(uint8_t* buf, uint32_t length);
|
|
void ucp_cache_flush(uint8_t* buf, uint32_t length);
|
|
|
|
#endif
|