Datasheet

Writing ARMulator models
3-6 Copyright © 1999-2001 ARM Limited. All rights reserved. ARM DUI0058D
3.2.3 Initialization, finalization, and state macros
To help you to write new ARMulator models, the following six macros are provided in
minperip.h
:
BEGIN_INIT()
END_INIT()
BEGIN_EXIT()
END_EXIT()
BEGIN_STATE_DECL()
END_STATE_DECL()
.
Use the following to define an initialization function for your model:
BEGIN_INIT(your_model)
{
/*
* (your initialization code here)
*/
}
END_INIT(your_model)
Use the following to define a finalization function for your model:
BEGIN_EXIT(your_model)
{
/*
* (your finalization code here)
*/
}
END_EXIT(your_model)
The
BEGIN_INIT()
macro defines a structure to hold any private data used by your model,
and the
END_EXIT()
macro frees it. Declare the data structure using:
BEGIN_STATE_DECL(your_model)
/*
* (your private data here)
*/
END_STATE_DECL(your_model)
3.2.4 Registering your model
Your model must register itself by calling
registerPeripFunc()
. This enables
ARMulator to call your model with accesses to memory locations that belong to your
model. See ARMul_BusRegisterPeripFunc on page 4-41.