/**
 * \file  dspcache.h
 *
 * \brief Contains DSP cache API declarations and parameter definitions.
 */

/*  Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
 *  ALL RIGHTS RESERVED. */

#ifndef CACHE_H_
#define CACHE_H_

#ifdef __cplusplus
extern "C" {
#endif

/******************************************************************************
** 							INTERNAL MACRO DEFINITIONS
******************************************************************************/
/* Defines used for 'memCfg' defines -- make 'memCfg' defines unique */
#define L1P_MEM_UNIQUE			(0x1 << 0)
#define L1D_MEM_UNIQUE			(0x1 << 1)
#define L2_MEM_UNIQUE			(0x1 << 2)


/******************************************************************************
** 							EXTERNAL MACRO DEFINITIONS
******************************************************************************/
/*
 * API Parameter: memCfg
 *
 * Brief: Used to select L1P, L1D, and/or L2 cache configuration.
 *
 * Functions: TBD
 *
 * NOTE: User can perform a logical OR using the below parameters to configure
 *		 L1P, L1D, and L2 with one call. 
 *		 Ex: (L1PCFG_L1PMODE_4K | L1DCFG_L1DMODE_16K | L2CFG_L2MODE_256K) */
/* L1P (Choose 1) */
#define L1PCFG_L1PMODE_4K		(0x1 << ((L1P_MEM_UNIQUE >> 1) * 4))
#define L1PCFG_L1PMODE_8K		(0x2 << ((L1P_MEM_UNIQUE >> 1) * 4))
#define L1PCFG_L1PMODE_16K		(0x3 << ((L1P_MEM_UNIQUE >> 1) * 4))
#define L1PCFG_L1PMODE_32K		(0x4 << ((L1P_MEM_UNIQUE >> 1) * 4))
/* OR L1D (Choose 1) */
#define L1DCFG_L1DMODE_4K		(0x1 << ((L1D_MEM_UNIQUE >> 1) * 4))
#define L1DCFG_L1DMODE_8K		(0x2 << ((L1D_MEM_UNIQUE >> 1) * 4))
#define L1DCFG_L1DMODE_16K		(0x3 << ((L1D_MEM_UNIQUE >> 1) * 4))
#define L1DCFG_L1DMODE_32K		(0x4 << ((L1D_MEM_UNIQUE >> 1) * 4))
/* OR L2 (Choose 1) */
#define L2CFG_L2MODE_32K		(0x1 << ((L2_MEM_UNIQUE >> 1) * 4))
#define L2CFG_L2MODE_64K		(0x2 << ((L2_MEM_UNIQUE >> 1) * 4))
#define L2CFG_L2MODE_128K		(0x3 << ((L2_MEM_UNIQUE >> 1) * 4))
#define L2CFG_L2MODE_256K		(0x4 << ((L2_MEM_UNIQUE >> 1) * 4))


/******************************************************************************
** 							FUNCTION DEFINITIONS
******************************************************************************/
extern void CacheEnable (unsigned int memCfg);
extern void CacheEnableMAR (unsigned int baseAddr, unsigned int byteSize);
extern void CacheDisableMAR (unsigned int baseAddr, unsigned int byteSize);
extern void CacheInvL1pAll (void);
extern void CacheWBAll (void);
extern void CacheWBInvAll (void);
extern void CacheInv (unsigned int baseAddr, unsigned int byteSize);
extern void CacheWB (unsigned int baseAddr, unsigned int byteSize);
extern void CacheWBInv (unsigned int baseAddr, unsigned int byteSize);

#ifdef __cplusplus
}
#endif

#endif
