Changeset f928a8a in mainline


Ignore:
Timestamp:
2010-04-22T11:00:40Z (14 years ago)
Author:
Lenka Trochtova <trochtova.lenka@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1f8657b
Parents:
5fe1c32
Message:

ISA pseudo enumeration - fixed a bug.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/drivers/isa/isa.c

    r5fe1c32 rf928a8a  
    131131
    132132static char * read_dev_conf(const char *conf_path)
    133 {
    134         printf(NAME ": read_dev_conf conf_path = %s.\n", conf_path);
    135                
     133{               
    136134        bool suc = false;       
    137135        char *buf = NULL;
     
    182180}
    183181
    184 static char * str_get_line(char *str, char **next) {
     182static char * str_get_line(char *str, char **next) {   
    185183        char *line = str;
     184       
     185        if (NULL == str) {
     186                *next = NULL;
     187                return NULL;
     188        }
     189       
    186190        while (0 != *str && '\n' != *str) {
    187191                str++;
     
    192196        } else {
    193197                *next = NULL;
    194         }
    195        
    196         *str = 0;       
     198        }       
     199       
     200        *str = 0;
    197201       
    198202        return line;
     
    254258               
    255259                data->hw_resources.count++;
     260               
     261                printf(NAME ": added irq 0x%x to device %s\n", irq, dev->name);
    256262        }       
    257263}
     
    268274                resources[count].res.io_range.address = addr;
    269275                resources[count].res.io_range.size = len;
    270                 resources[count].res.io_range.endianness = LITTLE_ENDIAN;               
     276                resources[count].res.io_range.endianness = LITTLE_ENDIAN;       
     277               
    271278                data->hw_resources.count++;
     279               
     280                printf(NAME ": added io range (addr=0x%x, size=0x%x) to device %s\n", addr, len, dev->name);
    272281        }       
    273282}
     
    314323        while (!isspace(*end)) {
    315324                end++;
    316         }       
    317         *end = 0;
    318        
    319         size_t size = str_size(val) + 1;
     325        }               
     326        size_t size = end - val + 1;
    320327        *id = (char *)malloc(size);
    321328        str_cpy(*id, size, val);       
     
    353360        match_id->score = score;
    354361       
    355         printf(NAME ": adding match id %s with score %d to device %s\n", id, score, dev->name);
     362        printf(NAME ": adding match id '%s' with score %d to device %s\n", id, score, dev->name);
    356363        add_match_id(&dev->match_ids, match_id);
    357364}
     
    372379static void get_dev_prop(device_t *dev, char *line)
    373380{
    374         printf(NAME " get_dev_prop from line '%s'\n", line);
    375381        // skip leading spaces
    376382        line = skip_spaces(line);
     
    380386                !read_dev_prop(dev, line, "match", &get_dev_match_id)
    381387        ) {             
    382                 printf(NAME " error undefined device property at line %s\n", line);
     388                printf(NAME " error undefined device property at line '%s'\n", line);
    383389        }       
    384390}
     
    411417        }
    412418       
    413         printf(NAME ": next line ='%s'\n", dev_conf);
    414         printf(NAME ": current line ='%s'\n", line);
    415        
    416419        // get device name
    417420        dev_name = get_device_name(line);
     
    432435        // get properties of the device (match ids, irq and io range)
    433436        while (true) {         
    434                 line = str_get_line(dev_conf, &dev_conf);
     437                line = str_get_line(dev_conf, &dev_conf);               
    435438               
    436439                if (line_empty(line)) {
     
    442445                get_dev_prop(dev, line);
    443446               
    444                 printf(NAME ": next line ='%s'\n", dev_conf);
    445                 printf(NAME ": current line ='%s'\n", line);           
     447                //printf(NAME ": next line ='%s'\n", dev_conf);
     448                //printf(NAME ": current line ='%s'\n", line);         
    446449        }
    447450       
     
    449452        dev->class = &isa_child_class;
    450453       
     454        printf(NAME ": child_device_register(dev, parent); device is %s.\n", dev->name);
    451455        child_device_register(dev, parent);     
    452456       
     
    456460static char * parse_dev_conf(char *conf, device_t *parent)
    457461{
    458         while (NULL != conf) {
     462        while (NULL != conf && 0 != *conf) {
    459463                conf = read_isa_dev_info(conf, parent);
    460464        }       
Note: See TracChangeset for help on using the changeset viewer.