Target Requirements : Data Types Related to I/O Cards

Data Types Related to I/O Cards

The following data structure describes the I/O card:

 
typedef struct card_desc_elem {
card_drvp card_drv; /* -- card driver function */
card_funcp card_init; /* -- card init functions */
card_funcp card_close; /* -- card closing function */
char* base_addr; /* -- base of the target memory
location */
report_link* pin_array; /* -- array of pins of this card/
array of associated model
elements */
genptr user_data; /* -- user-defined misc data */
} card_desc_elem;
 
 

This declaration is also copied from types.h file of the Intrinsics library. The variable of this type is called “card element”. It contains all the information about the I/O card. The purpose of the user_data field is to allow users to add whatever data they want to the card element, because card elements are visible to user-written functions.

Each card element contains information about all its ports. It is represented as an array of report elements, each of which describes a single port of the card. Thus, the cross-referenced data structure is built in the generated code. Each report element involved in I/O mapping has a pointer to its card element, whereas each card element has an array of pointers to the report elements that are its I/O ports. This data relation is static and is initialized in the init() functions generated in the code.

It is assumed that each card is controlled by three functions that do the following: