Initialization
The following is a sequence of initialization actions required for I/O mapping:
● Initialize all card description elements. At this stage, thepin_array
field is set so correspondence between card elements and their pin arrays is established.
● For every module, initialize report elements that belong to the module. At the same moment, the corresponding element of the pin array is set to be a pointer to the current report element. The pin arrays are completely initialized. Thecard_p
field of the report element is also initialized. The cross-referenced data structure is built.
● Call the card initialization routines provided by the user. Note that at this moment, all data structures related to the I/O mapping in the code are built.The following portions of
r2main.c
andm1.c
illustrate these points:init_card_desc(&card_card_1_desc,
card_generic_driver, card_generic_init,
“card_1",pins_card_1_desc);init_card_desc(&card_card_2_desc,
card_generic_driver,card_generic_init,
“card_2",pins_card_2_desc);init_report(&rep_X_IN1,"A2:X_IN1","",&X_IN1,
el_enumer,0,trace_f,FALSE,&card_card_1_desc,
"0x0012","1",2,input_mapf,NULL,NULL,FALSE,FALSE);init_report(&rep_X_IN2,"A2:X_IN2","",&X_IN2,
el_enumer,0,NULL,FALSE,&card_card_2_desc,
"0x0012","1",2,input_mapf,NULL,NULL,FALSE,FALSE);init_report(&rep_X_OUT1,"A2:X_OUT1","",&X_OUT1,
el_enumer,0,trace_f,FALSE,
&card_card_1_desc,"0x0013","2",1,NULL,
NULL,output_mapf,FALSE,FALSE);init_report(&rep_X_OUT2,"A2:X_OUT2","",&X_OUT2,
el_enumer,0,NULL,FALSE,&card_card_2_desc,
"0x0013","2", 1,NULL,NULL,output_mapf,
FALSE,FALSE);