413 if len(SlaveIDs) == 0: |
413 if len(SlaveIDs) == 0: |
414 # define post_SlaveBootup lookup functions |
414 # define post_SlaveBootup lookup functions |
415 format_dict["slavebootups"] += ( |
415 format_dict["slavebootups"] += ( |
416 "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){}\n"%(nodename)) |
416 "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){}\n"%(nodename)) |
417 else: |
417 else: |
418 for id in SlaveIDs: |
418 # for id in SlaveIDs: |
419 format_dict["slavebootups"] += ( |
419 # format_dict["slavebootups"] += ( |
420 "int %s_slave_%d_booted = 0;\n"%(nodename, id)) |
420 # "int %s_slave_%d_booted = 0;\n"%(nodename, id)) |
421 # define post_SlaveBootup lookup functions |
421 # define post_SlaveBootup lookup functions |
422 format_dict["slavebootups"] += ( |
422 format_dict["slavebootups"] += ( |
423 "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n"%(nodename)+ |
423 "static void %s_post_SlaveBootup(CO_Data* d, UNS8 nodeId){\n"%(nodename)+ |
424 " switch(nodeId){\n") |
424 " check_and_start_node(d, nodeId);\n"+ |
425 # one case per declared node, mark node as booted |
|
426 for id in SlaveIDs: |
|
427 format_dict["slavebootups"] += ( |
|
428 " case %d:\n"%(id)+ |
|
429 " %s_slave_%d_booted = 1;\n"%(nodename, id)+ |
|
430 " break;\n") |
|
431 format_dict["slavebootups"] += ( |
|
432 " default:\n"+ |
|
433 " break;\n"+ |
|
434 " }\n"+ |
|
435 " if( ") |
|
436 # expression to test if all declared nodes booted |
|
437 format_dict["slavebootups"] += " && ".join(["%s_slave_%d_booted"%(nodename, id) for id in SlaveIDs]) |
|
438 format_dict["slavebootups"] += " )\n" + ( |
|
439 " Master_post_SlaveBootup(d,nodeId);\n"+ |
|
440 "}\n") |
425 "}\n") |
441 # register previously declared func as post_SlaveBootup callback for that node |
426 # register previously declared func as post_SlaveBootup callback for that node |
442 format_dict["slavebootup_register"] += ( |
427 format_dict["slavebootup_register"] += ( |
443 "%s_Data.post_SlaveBootup = %s_post_SlaveBootup;\n"%(nodename,nodename)) |
428 "%s_Data.post_SlaveBootup = %s_post_SlaveBootup;\n"%(nodename,nodename)) |
444 else: |
429 else: |