PROGRAMMER'S GUIDECache library
Back | ■
Cache library

2. Reference


2.1 Function list

 function
 Function name
 number
 High standard
 Cache initialization
 CSH_Init
 1
 Clear all cache
 CSH_AllClr
 2
 Associative purge of target area
 CSH_Purge
 3

2.2 Function format macro list

 function
 Function format macro name
 number
 Low level
 Get cache register
 CSH_GetCcr
 1
 Cache register setting
 CSH_SetCcr
 2
 Cache enable control
 CSH_SetEnable
 3
 Instruction fill control
 CSH_SetCodeFill
 Four
 Data fill control
 CSH_SetDataFill
 Five
 Switching between 2- and 4-way set associates
 CSH_SetWayMode
 6
 Address array accessway selection
 CSH_SetAcsWay
 7 


2.3 Function specifications

High standard
 List
 Title

Function specifications

 Function

Cache initialization

 Function name

CSH_Init

 No

1

Form
void CSH_Init (Uint16 sw)
input
sw: Way mode

 Constant name
 explanation
 CSH_4WAY
 4-way set associate
 CSH_2WAY
 2-way set associate

output
none
Function value
none
function
Initialize the cache. Clears the valid bits of all cache lines, enables instruction fill and data fill, and enables cache.

 List
 Title

Function specifications

 Function

Clear all cache

 Function Name

CSH_AllClr

 No

2

Form
void CSH_AllClr (void)
input
none
output
none
Function value
none
function
Clear the valid bits of all cash lines on all ways. This function internally disables the cache, then executes it, and enables the cache after clearing.
remarks
The address array is updated, but the data array is not.

 List
 Title

Function specifications

 Function

Associative purge of target area

 Function Name

CSH_Purge

 No

3

Form
void CSH_Purge (void * address, Uint32 p_size)
input
* address: Start address p_size: Number of purge bytes
output
none
Function value
none
function
Purges the area of the number of bytes p_size from the address address.

2.4 Function format macro specifications

Low level


 List
 Title

Function specifications

 Function

Get cache register

 Function Name

CSH_GetCcr

 No

1

Form
Uint16 CSH_GetCcr (void)
input
none
output
none
Function value
Contents of cache register
function
Gets the contents of the CCR and returns it as a function value.

 List
 Title

Function specifications

 Function

Cache register settings

 Function Name

CSH_SetCcr

 No

2

Form
Uint16 CSH_SetCcr (Uint16 reg)
input
reg: Set value
output
none
Function value
Returns the contents of reg.
function
Set reg to CCR. You can set each state of the cache at once.

 List
 Title

Function specifications

 Function

Cache enable control

 Function Name

CSH_SetEnable

 No

3

Form
void CSH_SetEnable (Uint16 sw)
input
sw: Cache enable switch

Cache enable switch constant name
 Constant name
 explanation
 CSH_DISABLE
 Cache disabled
 CSH_ENABLE
 Cache enable

output
none
Function value
none
function
The specified cache enable switch controls the behavior of the cache.


 List
 Title

Function specifications

 Function

Instruction fill control

 Function Name

CSH_SetCodeFill

 No

Four

Form
void CSH_SetCodeFill (Uint16 sw)
input
sw: Instruction fill prohibition switch
Instruction fill prohibition switch constant name
 Constant name
 explanation
 CSH_CODE_ENABLE
 Perform instruction fill
 CSH_CODE_DISABLE
 Do not fill instructions

output
none
Function value
none
function
Controls the cache fill operation during instruction fetch.

 List
 Title

Function specifications

 Function

Data fill control

 Function Name

CSH_SetDataFill

 No

Five

Form
CSH_SetDataFill (Uint16 sw)
input
sw: Data fill prohibition switch
Data fill prohibition switch constant name
 Constant name
 explanation
 CSH_DATA_ENABLE
 Perform data fill
 CSH_DATA_DISABLE
 Do not fill data

output
none
Function value
none
function
Controls the cache fill operation when reading data.

 List
 Title

Function specifications

 Function

Switching between 2- and 4-way set associates

 Function Name

CSH_SetWayMode

 No

6

Form
void CSH_SetWayMode (Uint16 sw)
input
sw: way mode
Way mode constant name
 Constant name
 explanation
 CSH_4WAY
 4-way set associate
 CSH_2WAY
 2-way set associate

output
none
Function value
none
function
Select 2-way or 4-way.

 List
 Title

Function specifications

 Function

Address array accessway selection

 Function Name

CSH_SetAcsWay

 No

7

Form
void CSH_SetAcsWay (Uint16 way)
input
way: way (0-3)
output
none
Function value
none
function
Used to select the access way when reading / writing the address array.

Back | ■
PROGRAMMER'S GUIDECache library
Copyright SEGA ENTERPRISES, LTD., 1997