examples/win32test/main.c
changeset 739 4faa0bb578e0
parent 733 121da23e97d8
equal deleted inserted replaced
738:396839c5d70f 739:4faa0bb578e0
   105    char* dll_file_name;
   105    char* dll_file_name;
   106 
   106 
   107    /* process command line arguments */
   107    /* process command line arguments */
   108    if (argc < 2)
   108    if (argc < 2)
   109       {
   109       {
   110       printf("USAGE: win32test <node_id> [can driver dll filename [baud rate]]\n");
   110       printf("USAGE: win32test <node_id> [can driver dll filename [baud rate[bus name]]]\n");
   111       return 1;
   111       return 1;
   112       }
   112       }
   113 
   113 
   114    node_id = atoi(argv[1]);
   114    node_id = atoi(argv[1]);
   115    if (node_id < 2 || node_id > 127)
   115    if (node_id < 2 || node_id > 127)
   123    else
   123    else
   124       dll_file_name = "can_uvccm_win32.dll";
   124       dll_file_name = "can_uvccm_win32.dll";
   125 
   125 
   126    if (argc > 3)
   126    if (argc > 3)
   127       MasterBoard.baudrate = argv[3];
   127       MasterBoard.baudrate = argv[3];
       
   128 
       
   129    if (argc > 4)
       
   130 	  MasterBoard.busname = argv[4];
   128 
   131 
   129    // load can driver
   132    // load can driver
   130    if (!LoadCanDriver(dll_file_name))
   133    if (!LoadCanDriver(dll_file_name))
   131       {
   134       {
   132       printf("ERROR: could not load diver %s\n", dll_file_name);
   135       printf("ERROR: could not load diver %s\n", dll_file_name);
   156       if (GetChangeStateResults(node_id, Operational, 3000) != 0xFF)
   159       if (GetChangeStateResults(node_id, Operational, 3000) != 0xFF)
   157          {
   160          {
   158          /* modify Client SDO 1 Parameter */
   161          /* modify Client SDO 1 Parameter */
   159          UNS32 COB_ID_Client_to_Server_Transmit_SDO = 0x600 + node_id;
   162          UNS32 COB_ID_Client_to_Server_Transmit_SDO = 0x600 + node_id;
   160          UNS32 COB_ID_Server_to_Client_Receive_SDO  = 0x580 + node_id;
   163          UNS32 COB_ID_Server_to_Client_Receive_SDO  = 0x580 + node_id;
   161          UNS32 Node_ID_of_the_SDO_Server = node_id;
   164          UNS8 Node_ID_of_the_SDO_Server = node_id;
   162          UNS32 ExpectedSize = sizeof (UNS32);
   165          UNS32 ExpectedSize = sizeof(UNS32);
       
   166          UNS32 ExpectedSizeNodeId = sizeof (UNS8);
   163 
   167 
   164          if (OD_SUCCESSFUL ==  writeLocalDict(&win32test_Data, 0x1280, 1, &COB_ID_Client_to_Server_Transmit_SDO, &ExpectedSize, RW) 
   168          if (OD_SUCCESSFUL ==  writeLocalDict(&win32test_Data, 0x1280, 1, &COB_ID_Client_to_Server_Transmit_SDO, &ExpectedSize, RW) 
   165               && OD_SUCCESSFUL ==  writeLocalDict(&win32test_Data, 0x1280, 2, &COB_ID_Server_to_Client_Receive_SDO, &ExpectedSize, RW) 
   169               && OD_SUCCESSFUL ==  writeLocalDict(&win32test_Data, 0x1280, 2, &COB_ID_Server_to_Client_Receive_SDO, &ExpectedSize, RW) 
   166               && OD_SUCCESSFUL ==  writeLocalDict(&win32test_Data, 0x1280, 3, &Node_ID_of_the_SDO_Server, &ExpectedSize, RW))
   170               && OD_SUCCESSFUL ==  writeLocalDict(&win32test_Data, 0x1280, 3, &Node_ID_of_the_SDO_Server, &ExpectedSizeNodeId, RW))
   167             {
   171             {
   168             UNS32 dev_type = 0;
   172             UNS32 dev_type = 0;
   169             char device_name[64]="";
   173             char device_name[64]="";
   170             char hw_ver[64]="";
   174             char hw_ver[64]="";
   171             char sw_ver[64]="";   
   175             char sw_ver[64]="";