src/sdo.c
changeset 669 50da44ebaf00
parent 667 f48424ce2a5e
child 672 3bbc9aeba925
equal deleted inserted replaced
668:ba53613e94e4 669:50da44ebaf00
    45 #else
    45 #else
    46 #define INLINE inline
    46 #define INLINE inline
    47 #endif
    47 #endif
    48 
    48 
    49 /*Internals prototypes*/
    49 /*Internals prototypes*/
       
    50 
       
    51 UNS8 GetSDOClientFromNodeId( CO_Data* d, UNS8 nodeId );
    50 
    52 
    51 /*!
    53 /*!
    52  ** Called by writeNetworkDict
    54  ** Called by writeNetworkDict
    53  **
    55  **
    54  ** @param d
    56  ** @param d
   586  ** @param CliServNbr
   588  ** @param CliServNbr
   587  ** @param whoami
   589  ** @param whoami
   588  **
   590  **
   589  ** @return
   591  ** @return
   590  **/
   592  **/
   591 UNS8 closeSDOtransfer (CO_Data* d, UNS8 CliServNbr, UNS8 whoami)
   593 UNS8 closeSDOtransfer (CO_Data* d, UNS8 nodeId, UNS8 whoami)
   592 {
   594 {
   593 	UNS8 err;
   595 	UNS8 err;
   594 	UNS8 line;
   596 	UNS8 line;
   595 	err = getSDOlineToClose(d, CliServNbr, whoami, &line);
   597     UNS8 CliNbr;
       
   598 	/* First let's find the corresponding SDO client in our OD  */
       
   599 	CliNbr = GetSDOClientFromNodeId(d, nodeId);
       
   600 	if(CliNbr >= 0xFE)
       
   601 		return SDO_ABORTED_INTERNAL;
       
   602     err = getSDOlineToClose(d, CliNbr, whoami, &line);
   596 	if (err) {
   603 	if (err) {
   597 		MSG_WAR(0x2A30, "No SDO communication to close", 0);
   604 		MSG_WAR(0x2A30, "No SDO communication to close", 0);
   598 		return 0xFF;
   605 		return 0xFF;
   599 	}
   606 	}
   600 	resetSDOline(d, line);
   607 	resetSDOline(d, line);
  1887 	err = getSDOfreeLine( d, SDO_CLIENT, &line );
  1894 	err = getSDOfreeLine( d, SDO_CLIENT, &line );
  1888 	if (err) {
  1895 	if (err) {
  1889 		MSG_ERR(0x1AC5, "SDO error : No line free, too many SDO in progress. Aborted for node : ", nodeId);
  1896 		MSG_ERR(0x1AC5, "SDO error : No line free, too many SDO in progress. Aborted for node : ", nodeId);
  1890 		return (0xFF);
  1897 		return (0xFF);
  1891 	}
  1898 	}
       
  1899 	else
       
  1900 		MSG_WAR(0x3AE1, "Transmission on line : ", line);
  1892     if(useBlockMode) {
  1901     if(useBlockMode) {
  1893 	    initSDOline(d, line, CliNbr, index, subIndex, SDO_BLOCK_DOWNLOAD_IN_PROGRESS);
  1902 	    initSDOline(d, line, CliNbr, index, subIndex, SDO_BLOCK_DOWNLOAD_IN_PROGRESS);
  1894 	    d->transfers[line].objsize = count;
  1903 	    d->transfers[line].objsize = count;
  1895     }
  1904     }
  1896     else 
  1905     else