Japanese
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 List of function-like macros

 function
 Function-like macro name
 number
 low standard
 Get cash register
 CSH_GetCcr
 1
 Cash register settings
 CSH_SetCcr
 2
 cache enable control
 CSH_SetEnable
 3
 instruction fill control
 CSH_SetCodeFill
 4
 Data fill control
 CSH_SetDataFill
 5
 2, 4 way set associative switching
 CSH_SetWayMode
 6
 Address array access way selection
 CSH_SetAcsWay
 7 


2.3 Function specifications

high standard
 one
View
table
 Title

function specification

 Function

Initialize cache

 Function name

CSH_Init

 No

1

Format
void CSH_Init(Uint16 sw)
input
sw: way mode

 constant name
 explanation
 CSH_4WAY
 4 way set associative
 CSH_2WAY
 2 way set associative

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

 one
View
table
 Title

function specification

 Function

Clear all cache

 Function name

CSH_AllClr

 No

2

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

 one
View
table
 Title

function specification

 Function

Associative purge of target area

 Function name

CSH_Purge

 No

3

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

2.4 Functional macro specifications

low standard


 one
View
table
 Title

function specification

 Function

Get cash register

 Function name

CSH_GetCcr

 No

1

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

 one
View
table
 Title

function specification

 Function

Cash register settings

 Function name

CSH_SetCcr

 No

2

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

 one
View
table
 Title

function specification

 Function

cache enable control

 Function name

CSH_SetEnable

 No

3

Format
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
Controls cache behavior through the specified cache enable switch.


 one
View
table
 Title

function specification

 Function

instruction fill control

 Function name

CSH_SetCodeFill

 No

4

Format
void CSH_SetCodeFill(Uint16 sw)
input
sw: Instruction fill prohibition switch
Instruction fill inhibit switch constant name
 constant name
 explanation
 CSH_CODE_ENABLE
 perform instruction fill
 CSH_CODE_DISABLE
 Do not perform instruction fill

output
none
function value
none
function
Controls cache fill behavior during instruction fetch.

 one
View
table
 Title

function specification

 Function

Data fill control

 Function name

CSH_SetDataFill

 No

5

Format
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 perform data fill

output
none
function value
none
function
Controls cache fill behavior when reading data.

 one
View
table
 Title

function specification

 Function

2, 4 way set
Associative switching

 Function name

CSH_SetWayMode

 No

6

Format
void CSH_SetWayMode(Uint16 sw)
input
sw:way mode
way mode constant name
 constant name
 explanation
 CSH_4WAY
 4 way set associative
 CSH_2WAY
 2 way set associative

output
none
function value
none
function
Choose 2-way or 4-way.

 one
View
table
 Title

function specification

 Function

Address array access way selection

 Function name

CSH_SetAcsWay

 No

7

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

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