Changeset 522


Ignore:
Timestamp:
Mar 10, 2015, 3:17:57 PM (10 years ago)
Author:
alain
Message:

Simplification in the mapping_info.h file:
The coproc and cp_port objects have been removed,
because the coprocessors are now described as peripherals.

The xml parser and driver have been modified accordingly.

Location:
soft/giet_vm/giet_xml
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • soft/giet_vm/giet_xml/mapping_info.h

    r511 r522  
    88//
    99// 1) a description of a clusterized hardware architecture.
    10 // The number of cluster is variable (can be one). The number of processors
    11 // per cluster is variable (can be one). The number of peripherals per cluser
    12 // and coprocessor per cluster is variable. The number of physical memory
    13 // banks per cluster is variable.
     10// The number of cluster is variable (can be one).
     11// The number of processors per cluster is variable (can be zero).
     12// The number of peripherals per cluster is variable (can be zero),
     13// The number of physical memory bank per cluster is variable.
    1414//
    1515// 2/ a description of the applications (called vspaces) to be - statically -
    1616// launched on the platform. The number of parallel tasks per application is
    17 // variable (can be one). Multi-Writer/Multi-Reader communication channels
    18 // betwwen tasks are supported. Each vspace contains a variable number
    19 // of virtual segments (called vsegs). The number of virtual space can be one.
     17// variable (can be one). Each vspace contains a variable number
     18// of virtual segments (called vsegs).
    2019//
    2120// 3/ the mapping directives: both tasks on processors, and software objects
    22 // (called vsegs) on the physical memory banks (called psegs).
     21// (vsegs) on the physical memory banks (psegs).
    2322//
    2423// The mapping_info data structure is organised as the concatenation of
    25 // a fixed size header, and 11 variable size arrays:
     24// a fixed size header, and 8 variable size arrays:
    2625//
    2726// - mapping_cluster_t  cluster[] 
     
    3231// - mapping_proc_t     proc[] 
    3332// - mapping_irq_t      irq[]   
    34 // - mapping_coproc_t   coproc[]
    35 // - mapping_cp_port_t  cp_port[]
    3633// - mapping_periph_t   periph[]
    3734//
     
    5047#define MAPPING_PROC_SIZE     sizeof(mapping_proc_t)
    5148#define MAPPING_IRQ_SIZE      sizeof(mapping_irq_t)
    52 #define MAPPING_COPROC_SIZE   sizeof(mapping_coproc_t)
    53 #define MAPPING_CP_PORT_SIZE  sizeof(mapping_cp_port_t)
     49#define MAPPING_PERIPH_SIZE   sizeof(mapping_periph_t)
    5450
    5551#define C_MODE_MASK  0b1000   // cacheable
     
    8682};
    8783
     84
    8885enum psegType
    8986{
    9087    PSEG_TYPE_RAM  = 0,
    91     PSEG_TYPE_ROM  = 1,      // deprecated => you should use PSEG_TYPE_PERI 
    9288    PSEG_TYPE_PERI = 2,
    9389};
    9490
    95 // The enum definitions for psegType and periphType must be kept
    96 // consistent with the definitions in the xml_driver.c file...
    97 
    98 enum periphType
     91
     92////////////////////////////////////////////////////////////////////
     93// These enum must be coherent with the values in
     94// xml_driver.c / xml_parser.c / mapping.py
     95///////////////////////////////////////////////////////////////////
     96enum periphTypes
    9997{
    10098    PERIPH_TYPE_CMA       = 0,
     
    117115};
    118116
    119 enum periphSubtype
    120 {
    121     PERIPH_SUBTYPE_BDV       = 0,
    122     PERIPH_SUBTYPE_HBA       = 1,
    123     PERIPH_SUBTYPE_SPI       = 2,
    124     PERIPH_SUBTYPE_NONE      = 3,
    125 };
    126 
    127 enum mwmrPortDirection
    128 {
    129     PORT_TO_COPROC   = 0, // status register
    130     PORT_FROM_COPROC = 1, // config register
    131 };
    132 
     117enum iocTypes
     118{
     119    IOC_SUBTYPE_BDV    = 0,
     120    IOC_SUBTYPE_HBA    = 1,
     121    IOC_SUBTYPE_SPI    = 2,
     122    IOC_SUBTYPE_NONE   = 3,
     123};
     124
     125enum mwrTypes
     126{
     127    MWR_SUBTYPE_GCD       = 0,
     128    MWR_SUBTYPE_DCT       = 1,
     129};
     130
     131//////////////////////////////////////////////////////////
     132// This enum must be coherent with the values in
     133// mwr_driver.h               
     134//////////////////////////////////////////////////////////
     135enum MwmrDmaModes
     136{
     137    MODE_MWMR             = 0,
     138    MODE_DMA_IRQ          = 1,
     139    MODE_DMA_NO_IRQ       = 2,
     140};
    133141
    134142////////////////////////////////////////////////////////
     
    149157    unsigned int vsegs;              // total number of virtual segments
    150158    unsigned int tasks;              // total number of tasks
    151     unsigned int procs;              // total number of procs
     159    unsigned int procs;              // total number of processors
    152160    unsigned int irqs;               // total number of irqs
    153     unsigned int coprocs;            // total number of coprocs
    154     unsigned int cp_ports;           // total number of cp_ports
    155161    unsigned int periphs;            // total number of peripherals
    156162    char name[32];                   // mapping name
     
    165171
    166172    unsigned int    psegs;           // number of psegs in cluster
    167     unsigned int    pseg_offset;     // global index of first pseg in psegs
     173    unsigned int    pseg_offset;     // global index of first pseg in cluster
    168174
    169175    unsigned int    procs;           // number of processors in cluster
    170     unsigned int    proc_offset;     // global index of first proc in procs
     176    unsigned int    proc_offset;     // global index of first proc in cluster
    171177 
    172     unsigned int    coprocs;         // number of coprocessors in cluster
    173     unsigned int    coproc_offset;   // global index of first coproc in coprocs
    174 
    175178    unsigned int    periphs;         // number of peripherals in cluster
    176     unsigned int    periph_offset;   // global index of first coproc in periphs
     179    unsigned int    periph_offset;   // global index of first coproc in cluster
    177180} mapping_cluster_t;
    178181
     
    241244
    242245////////////////////////////////////////////////////////
    243 typedef struct __attribute__((packed))  mapping_coproc_s
    244 {
    245     char            name[32];        // coprocessor name (probablement inutile AG)
    246     unsigned int    psegid;          // global pseg index
    247     unsigned int    ports;           // number of MWMR ports used by coprocessor
    248     unsigned int    port_offset;     // global index of first MWMR port
    249 } mapping_coproc_t;
    250 
    251 
    252 /////////////////////////////////////////////////////////
    253 typedef struct __attribute__((packed))  mapping_cp_port_s
    254 {
    255     unsigned int    direction;       // TO_COPROC == 0 / FROM_COPROC == 1
    256     unsigned int    vspaceid;        // index of the vspace containing MWMR channel
    257     unsigned int    mwmr_vseg_id;    // global index of vseg containing MWMR channel
    258 } mapping_cp_port_t;
    259 
    260 
    261 ////////////////////////////////////////////////////////
    262246typedef struct __attribute__((packed))  mapping_periph_s
    263247{
     
    266250    unsigned int    psegid;          // pseg index in cluster
    267251    unsigned int    channels;        // number of channels
    268     unsigned int    arg;             // argument depending on peripheral type
     252    unsigned int    arg0;            // semantic depends on peripheral type
     253    unsigned int    arg1;            // semantic depends on peripheral type
     254    unsigned int    arg2;            // semantic depends on peripheral type
     255    unsigned int    arg3;            // semantic depends on peripheral type
    269256    unsigned int    irqs;            // number of input IRQs (for XCU or PIC)
    270257    unsigned int    irq_offset;      // index of first IRQ
  • soft/giet_vm/giet_xml/xml_driver.c

    r511 r522  
    2424    {
    2525        "ELF",        // binary code generated by GCC
    26         "BLOB",       // binary code generated by GCC
     26        "BLOB",       // binary
    2727        "PTAB",       // page table
    2828        "PERI",       // hardware component
     
    5252    };
    5353
    54     // mnemonics defined in irq_handler.h
     54    // These mnemonics must be consistent with values in
     55    // irq_handler.h / irq_handler.c / mapping.py
    5556    const char * isr_type[] =
    5657    {
     
    6869        "ISR_DMA",
    6970        "ISR_SPI",
    70     };
    71 
    72     // mnemonics defined in mapping_info.h
     71        "ISR_MWR",
     72    };
     73
     74    const char * mwr_subtype[] =
     75    {
     76        "GCD",
     77        "DCT",
     78    };
     79
    7380    const char * periph_type[] =
    7481    {
     
    96103        "SPI",
    97104        "NONE",
    98     };
    99 
    100     const char * port_direction[] =
    101     {
    102         "TO_COPROC",
    103         "FROM_COPROC",
    104105    };
    105106
     
    131132    unsigned int proc_id;
    132133    unsigned int irq_id;
    133     unsigned int coproc_id;
    134     unsigned int port_id;
    135134    unsigned int periph_id;
    136135
     
    142141    mapping_proc_t * proc;
    143142    mapping_irq_t * irq;   
    144     mapping_coproc_t * coproc;
    145     mapping_cp_port_t * cp_port;
    146143    mapping_periph_t * periph;
    147144
     
    195192            MAPPING_PROC_SIZE * header->procs);
    196193
    197     // computes the base address for coprocs array
    198     coproc = (mapping_coproc_t *) ((char *) header +
     194    // computes the base address for periphs array
     195    periph = (mapping_periph_t *) ((char *) header +
    199196            MAPPING_HEADER_SIZE +
    200197            MAPPING_CLUSTER_SIZE * header->x_size * header->y_size +
     
    205202            MAPPING_PROC_SIZE * header->procs +
    206203            MAPPING_IRQ_SIZE * header->irqs);
    207 
    208     // computes the base address for cp_ports array
    209     cp_port = (mapping_cp_port_t *) ((char *) header +
    210             MAPPING_HEADER_SIZE +
    211             MAPPING_CLUSTER_SIZE * header->x_size * header->y_size +
    212             MAPPING_PSEG_SIZE * header->psegs +
    213             MAPPING_VSPACE_SIZE * header->vspaces +
    214             MAPPING_VSEG_SIZE * header->vsegs +
    215             MAPPING_TASK_SIZE * header->tasks +
    216             MAPPING_PROC_SIZE * header->procs +
    217             MAPPING_IRQ_SIZE * header->irqs +
    218             MAPPING_COPROC_SIZE * header->coprocs);
    219 
    220     // computes the base address for periphs array
    221     periph = (mapping_periph_t *) ((char *) header +
    222             MAPPING_HEADER_SIZE +
    223             MAPPING_CLUSTER_SIZE * header->x_size * header->y_size +
    224             MAPPING_PSEG_SIZE * header->psegs +
    225             MAPPING_VSPACE_SIZE * header->vspaces +
    226             MAPPING_VSEG_SIZE * header->vsegs +
    227             MAPPING_TASK_SIZE * header->tasks +
    228             MAPPING_PROC_SIZE * header->procs +
    229             MAPPING_IRQ_SIZE * header->irqs +
    230             MAPPING_COPROC_SIZE * header->coprocs +
    231             MAPPING_CP_PORT_SIZE * header->cp_ports);
    232204
    233205    ///////////////////////// header /////////////////////////////////////////////
     
    276248        }
    277249
    278         ///////////////////// coprocessors ///////////////////////////////////////////
    279 
    280         for (coproc_id = cluster[cluster_id].coproc_offset;
    281              coproc_id < cluster[cluster_id].coproc_offset + cluster[cluster_id].coprocs;
    282              coproc_id++)
    283         {
    284             fprintf(fpout, "            <coproc name=\"%s\"", coproc[coproc_id].name);
    285             fprintf(fpout, " psegname=\"%s\" >\n", pseg[coproc[coproc_id].psegid].name);
    286             for (port_id = coproc[coproc_id].port_offset;
    287                  port_id < coproc[coproc_id].port_offset + coproc[coproc_id].ports;
    288                  port_id++)
    289             {
    290                 unsigned int vseg_id = cp_port[port_id].mwmr_vseg_id;
    291                 fprintf(fpout, "             <port direction=\"%s\"", port_direction[cp_port[port_id].direction]);
    292                 fprintf(fpout, " vspacename=\"%s\"", vspace[cp_port[port_id].vspaceid].name);
    293                 fprintf(fpout, " vsegname=\"%s\" />\n",  vseg[vseg_id].name);
    294             }
    295             fprintf(fpout, "            </coproc>\n" );
    296         }
    297 
    298250        ///////////////////// periphs  ///////////////////////////////////////////////
    299251
     
    307259                fprintf(fpout, " subtype=\"%s\"", ioc_subtype[periph[periph_id].subtype]);
    308260
     261            if (periph[periph_id].type == PERIPH_TYPE_MWR)
     262                fprintf(fpout, " subtype=\"%s\"", mwr_subtype[periph[periph_id].subtype]);
     263
    309264            fprintf(fpout, " psegname=\"%s\"", pseg[periph[periph_id].psegid].name);
    310265            fprintf(fpout, " channels=\"%d\"",  periph[periph_id].channels);
    311             fprintf(fpout, " arg=\"%d\" >\n",  periph[periph_id].arg);
     266            fprintf(fpout, " arg0=\"%d\" >\n",  periph[periph_id].arg0);
     267            fprintf(fpout, " arg1=\"%d\" >\n",  periph[periph_id].arg1);
     268            fprintf(fpout, " arg2=\"%d\" >\n",  periph[periph_id].arg2);
     269            fprintf(fpout, " arg3=\"%d\" >\n",  periph[periph_id].arg3);
    312270            if ( (periph[periph_id].type == PERIPH_TYPE_PIC) ||
    313271                 (periph[periph_id].type == PERIPH_TYPE_XCU) )
  • soft/giet_vm/giet_xml/xml_parser.c

    r511 r522  
    3434#define MAX_PROCS      1024
    3535#define MAX_IRQS       8192
    36 #define MAX_COPROCS    4096
    37 #define MAX_CP_PORTS   8192
    3836#define MAX_PERIPHS    8192
    3937
     
    5250mapping_proc_t *     proc[MAX_PROCS];        // proc array
    5351mapping_irq_t *      irq[MAX_IRQS];          // irq array
    54 mapping_coproc_t *   coproc[MAX_COPROCS];    // coproc array
    55 mapping_cp_port_t *  cp_port[MAX_CP_PORTS];  // coproc port array
    5652mapping_periph_t *   periph[MAX_PERIPHS];    // peripheral array
    5753
     
    6965unsigned int irq_loc_index  = 0;
    7066
    71 unsigned int coproc_index = 0;
    72 unsigned int coproc_loc_index = 0;
    73 
    74 unsigned int cp_port_index = 0;
    75 unsigned int cp_port_loc_index = 0;
    76 
    7767unsigned int periph_index = 0;
    7868unsigned int periph_loc_index = 0;
     
    8373unsigned int task_index = 0;
    8474unsigned int task_loc_index = 0;
    85 
    86 
    87 //////////////////////////////
    88 // for replicated peripheral
    89 //////////////////////////////
    90 char found_timer = 0;
    91 char found_icu   = 0;
    92 char found_xcu   = 0;
    93 char found_dma   = 0;
    94 char found_mmc   = 0;
    95 
    96 /*
    97 ////////////////////////////////////////////////////////////////////////
    98 // These variables are used to generate the hard_config.h file.
    99 ////////////////////////////////////////////////////////////////////////
    100 
    101 
    102 unsigned int tim_channels     = 0; // number of user timers  (per cluster)
    103 unsigned int dma_channels     = 0; // number of DMA channels (per cluster)
    104 
    105 unsigned int tty_channels     = 0; // number of TTY channels
    106 unsigned int ioc_channels     = 0; // number of HBA channels
    107 unsigned int nic_channels     = 0; // number of NIC channels
    108 unsigned int cma_channels     = 0; // number of CMA channels
    109 unsigned int pic_channels     = 0; // number of PIC channels
    110 
    111 unsigned int use_iob          = 0; // using IOB component
    112 unsigned int use_pic          = 0; // using PIC component
    113 unsigned int use_xcu          = 0; // using XCU (not ICU)
    114 unsigned int use_fbf          = 0; // using Frame Buffer
    115 
    116 // These variables define the IOC peripheral subtype
    117 
    118 unsigned int use_hba          = 0; // using SoClib AHCI controller
    119 unsigned int use_bdv          = 0; // using SoCLIB block device controller
    120 unsigned int use_spi          = 0; // using SDCard-SPI
    121 
    122 ////////////////////////////////////////////////////////////////
    123 // These variables are used to generate the giet_vseg.ld file
    124 ////////////////////////////////////////////////////////////////
    125 
    126 unsigned int periph_vbase_array[PERIPH_TYPE_MAX_VALUE]
    127          = { [0 ... (PERIPH_TYPE_MAX_VALUE - 1)] = 0xFFFFFFFF };
    128 */
    12975
    13076
     
    967913
    968914
    969 
    970 ////////////////////////////////////////
    971 void cpPortNode(xmlTextReaderPtr reader)
    972 {
    973     char * str;
    974     unsigned int ok;
    975 
    976     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    977 
    978     if (cp_port_index >= MAX_CP_PORTS)
    979     {
    980         printf("[XML ERROR] The number of ports (for coprocs) is larger than %d\n",
    981                  MAX_CP_PORTS);
    982         exit(1);
    983     }
    984 
    985 #if XML_PARSER_DEBUG
    986 printf("\n  port %d\n", cp_port_index);
    987 #endif
    988 
    989     cp_port[cp_port_index] = (mapping_cp_port_t *) malloc(sizeof(mapping_cp_port_t));
    990 
    991     ///////// get direction attribute
    992     str = getStringValue(reader, "direction", &ok);
    993     if (ok)
    994     {
    995 #if XML_PARSER_DEBUG
    996 printf("      direction = %s\n", str);
    997 #endif
    998         if (strcmp(str, "TO_COPROC")   ==  0)
    999         {
    1000             cp_port[cp_port_index]->direction = PORT_TO_COPROC;
    1001         }
    1002         else if (strcmp(str, "FROM_COPROC") ==  0)
    1003         {
    1004             cp_port[cp_port_index]->direction = PORT_FROM_COPROC;
    1005         }
    1006         else
    1007         {
    1008             printf("[XML ERROR] illegal <direction> for cp_port %d in cluster %d\n",
    1009                     cp_port_index, cluster_index);
    1010             exit(1);
    1011         }
    1012     } 
    1013     else
    1014     {
    1015         printf("[XML ERROR] missing <direction> for cp_port %d in cluster %d\n",
    1016                 cp_port_index, cluster_index);
    1017         exit(1);
    1018     }
    1019 
    1020     cp_port_index++;
    1021     cp_port_loc_index++;
    1022 } // end cpPortNode()
    1023 
    1024915////////////////////////////////////////
    1025916void periphNode(xmlTextReaderPtr reader)
     
    1059950    }
    1060951
    1061     ///////// get arg attribute (optionnal : 0 if missing)
    1062     value = getIntValue(reader, "arg", &ok);
    1063     if (ok)
    1064     {
    1065 #if XML_PARSER_DEBUG
    1066 printf("      arg         = %d\n", value);
    1067 #endif
    1068         periph[periph_index]->arg = value;
    1069     }
    1070     else
    1071     {
    1072         periph[periph_index]->arg = 1;
     952    ///////// get arg0 attribute (optionnal : undefined if missing)
     953    value = getIntValue(reader, "arg0", &ok);
     954    if (ok)
     955    {
     956#if XML_PARSER_DEBUG
     957printf("      arg0        = %d\n", value);
     958#endif
     959        periph[periph_index]->arg0 = value;
     960    }
     961
     962    ///////// get arg1 attribute (optionnal : undefined if missing)
     963    value = getIntValue(reader, "arg1", &ok);
     964    if (ok)
     965    {
     966#if XML_PARSER_DEBUG
     967printf("      arg1        = %d\n", value);
     968#endif
     969        periph[periph_index]->arg1 = value;
     970    }
     971
     972    ///////// get arg2 attribute (optionnal : undefined if missing)
     973    value = getIntValue(reader, "arg2", &ok);
     974    if (ok)
     975    {
     976#if XML_PARSER_DEBUG
     977printf("      arg2        = %d\n", value);
     978#endif
     979        periph[periph_index]->arg2 = value;
     980    }
     981
     982    ///////// get arg3 attribute (optionnal : undefined if missing)
     983    value = getIntValue(reader, "arg3", &ok);
     984    if (ok)
     985    {
     986#if XML_PARSER_DEBUG
     987printf("      arg3        = %d\n", value);
     988#endif
     989        periph[periph_index]->arg3 = value;
    1073990    }
    1074991
     
    11081025#endif
    11091026        if      (strcmp(str, "CMA" ) == 0) periph[periph_index]->type = PERIPH_TYPE_CMA;
     1027        else if (strcmp(str, "DMA" ) == 0) periph[periph_index]->type = PERIPH_TYPE_DMA;
    11101028        else if (strcmp(str, "FBF" ) == 0) periph[periph_index]->type = PERIPH_TYPE_FBF;
    11111029        else if (strcmp(str, "IOB" ) == 0) periph[periph_index]->type = PERIPH_TYPE_IOB;
    11121030        else if (strcmp(str, "IOC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_IOC;
     1031        else if (strcmp(str, "MMC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_MMC;
     1032        else if (strcmp(str, "MWR" ) == 0) periph[periph_index]->type = PERIPH_TYPE_MWR;
    11131033        else if (strcmp(str, "NIC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_NIC;
    11141034        else if (strcmp(str, "ROM" ) == 0) periph[periph_index]->type = PERIPH_TYPE_ROM;
    11151035        else if (strcmp(str, "SIM" ) == 0) periph[periph_index]->type = PERIPH_TYPE_SIM;
     1036        else if (strcmp(str, "SIM" ) == 0) periph[periph_index]->type = PERIPH_TYPE_TIM;
    11161037        else if (strcmp(str, "TTY" ) == 0) periph[periph_index]->type = PERIPH_TYPE_TTY;
     1038        else if (strcmp(str, "XCU" ) == 0) periph[periph_index]->type = PERIPH_TYPE_XCU;
    11171039        else if (strcmp(str, "PIC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_PIC;
    1118         else if (strcmp(str, "DMA" ) == 0) periph[periph_index]->type = PERIPH_TYPE_DMA;
    1119         else if (strcmp(str, "MMC" ) == 0) periph[periph_index]->type = PERIPH_TYPE_MMC;
    1120         else if (strcmp(str, "XCU" ) == 0) periph[periph_index]->type = PERIPH_TYPE_XCU;
    11211040        else if (strcmp(str, "DROM") == 0) periph[periph_index]->type = PERIPH_TYPE_DROM;
    11221041        else
     
    11381057#endif
    11391058            if      (strcmp(subtype, "BDV") == 0)
    1140             periph[periph_index]->subtype = PERIPH_SUBTYPE_BDV;
     1059            periph[periph_index]->subtype = IOC_SUBTYPE_BDV;
    11411060            else if (strcmp(subtype, "HBA") == 0)
    1142             periph[periph_index]->subtype = PERIPH_SUBTYPE_HBA;
     1061            periph[periph_index]->subtype = IOC_SUBTYPE_HBA;
    11431062            else if (strcmp(subtype, "SPI") == 0)
    1144             periph[periph_index]->subtype = PERIPH_SUBTYPE_SPI;
     1063            periph[periph_index]->subtype = IOC_SUBTYPE_SPI;
    11451064        }
    11461065        else
    11471066        {
    11481067            printf("[XML ERROR] illegal subtype for IOC peripheral\n");
     1068            exit(1);
     1069        }
     1070    }
     1071    else
     1072    {
     1073        periph[periph_index]->subtype = 0XFFFFFFFF;
     1074    }
     1075
     1076    ////////// get subtype if MWR
     1077    if (periph[periph_index]->type == PERIPH_TYPE_MWR )
     1078    {
     1079        char* subtype = getStringValue(reader, "subtype", &ok);
     1080        if (ok)
     1081        {
     1082#if XML_PARSER_DEBUG
     1083printf("      subtype     = %s\n", str);
     1084#endif
     1085            if      (strcmp(subtype, "GCD") == 0)
     1086            periph[periph_index]->subtype = MWR_SUBTYPE_GCD;
     1087            else if (strcmp(subtype, "DCT") == 0)
     1088            periph[periph_index]->subtype = MWR_SUBTYPE_DCT;
     1089        }
     1090        else
     1091        {
     1092            printf("[XML ERROR] illegal subtype for MWR peripheral\n");
    11491093            exit(1);
    11501094        }
     
    12031147} // end periphNode
    12041148
    1205 ////////////////////////////////////////
    1206 void coprocNode(xmlTextReaderPtr reader)
    1207 {
    1208     char * str;
    1209     unsigned int ok;
    1210 
    1211     cp_port_loc_index = 0;
    1212 
    1213     if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) return;
    1214 
    1215     if (coproc_index >= MAX_COPROCS)
    1216     {
    1217         printf("[XML ERROR] The number of coprocs is larger than %d\n", MAX_COPROCS);
    1218         exit(1);
    1219     }
    1220 
    1221 #if XML_PARSER_DEBUG
    1222 printf("\n  coproc %d\n", coproc_index);
    1223 #endif
    1224 
    1225     coproc[coproc_index] = (mapping_coproc_t *) malloc(sizeof(mapping_coproc_t));
    1226 
    1227     /////////// get name attribute
    1228     str = getStringValue(reader, "name", &ok);
    1229     if (ok)
    1230     {
    1231 #if XML_PARSER_DEBUG
    1232 printf("      name = %s\n", str);
    1233 #endif
    1234         strncpy(coproc[coproc_index]->name, str, 31);
    1235     }
    1236     else
    1237     {
    1238         printf("[XML ERROR] illegal or missing <name> for coproc %d in cluster %d\n",
    1239                 coproc_index, cluster_index);
    1240         exit(1);
    1241     }
    1242 
    1243     /////////// get psegname attribute
    1244     str = getStringValue(reader, "psegname", &ok);
    1245     if (ok == 0)
    1246     {
    1247         printf("[XML ERROR] illegal or missing <psegname> for coproc %d in cluster %d\n",
    1248                 coproc_index, cluster_index);
    1249         exit(1);
    1250     }
    1251 
    1252     /////////// set psegid attribute
    1253     int index = getPsegId( cluster[cluster_index]->x, cluster[cluster_index]->y, str);
    1254     if (index >= 0)
    1255     {
    1256 #if XML_PARSER_DEBUG
    1257 printf("      clusterid = %d\n", cluster_index);
    1258 printf("      psegname  = %s\n", str);
    1259 printf("      psegid    = %d\n", index);
    1260 #endif
    1261         coproc[coproc_index]->psegid = index;
    1262         assert(pseg[index]->type == PSEG_TYPE_PERI &&
    1263         "coproc psegname attribute must refer to a pseg of type PERI" );
    1264     }
    1265     else
    1266     {
    1267         printf("[XML ERROR] pseg not found for coproc %d / clusterid = %d / psegname = %s\n",
    1268                 coproc_index, cluster_index, str );
    1269         exit(1);
    1270     } 
    1271 
    1272     ////////// set port_offset
    1273     coproc[coproc_index]->port_offset = cp_port_index;
    1274 
    1275 #if XML_PARSER_DEBUG
    1276 printf("      port_offset = %d\n", cp_port_index);
    1277 #endif
    1278 
    1279     int status = xmlTextReaderRead(reader);
    1280     while (status == 1)
    1281     {
    1282         const char * tag = (const char *) xmlTextReaderConstName(reader);
    1283 
    1284         if (strcmp(tag, "port") == 0 )
    1285         {
    1286             cpPortNode(reader);
    1287         }
    1288         else if (strcmp(tag, "#text")    == 0 ) { }
    1289         else if (strcmp(tag, "#comment") == 0 ) { }
    1290         else if (strcmp(tag, "coproc") == 0 )
    1291         {
    1292             coproc[coproc_index]->ports = cp_port_loc_index;
    1293             cluster[cluster_index]->coprocs++;
    1294             coproc_loc_index++;
    1295             coproc_index++;
    1296             return;
    1297         }
    1298         else
    1299         {
    1300             printf("[XML ERROR] Unknown tag %s", tag);
    1301             exit(1);
    1302         }
    1303         status = xmlTextReaderRead(reader);
    1304     }
    1305 } // end coprocNode()
    1306 
    1307 
    13081149//////////////////////////////////////
    13091150void procNode(xmlTextReaderPtr reader)
     
    14551296    coproc_loc_index = 0;
    14561297    periph_loc_index = 0;
    1457 
    1458     // for replicated periph
    1459     found_timer = 0;
    1460     found_icu   = 0;
    1461     found_xcu   = 0;
    1462     found_dma   = 0;
    1463     found_mmc   = 0;
    14641298
    14651299    if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT)  return;
     
    15781412            header->irqs = irq_index;
    15791413            header->coprocs = coproc_index;
    1580             header->cp_ports = cp_port_index;
    15811414            header->periphs = periph_index;
    15821415            return;
     
    18381671    header->irqs      = 0;
    18391672    header->coprocs   = 0;
    1840     header->cp_ports  = 0;
    18411673    header->periphs   = 0;
    18421674
     
    19651797    //building coprocs array
    19661798    BuildTable(fdout, "coproc", coproc_index, sizeof(mapping_coproc_t), (char **) coproc);
    1967     //building cp_ports array
    1968     BuildTable(fdout, "cp_port", cp_port_index, sizeof(mapping_cp_port_t),(char **) cp_port);
    19691799    //building periphs array
    19701800    BuildTable(fdout, "periph", periph_index, sizeof(mapping_periph_t), (char **) periph);
Note: See TracChangeset for help on using the changeset viewer.