src/lss.c
changeset 89 11dda1450e09
parent 0 4472ee7c6c3e
equal deleted inserted replaced
88:b6e0b91d073a 89:11dda1450e09
   124 		[0] = 4 (for switch mode global)
   124 		[0] = 4 (for switch mode global)
   125 		[1] = 0 for operation mode, = 1 for configuration mode
   125 		[1] = 0 for operation mode, = 1 for configuration mode
   126 		[2..7] = 0 reserved
   126 		[2..7] = 0 reserved
   127 	*/
   127 	*/
   128 	
   128 	
   129 	if (!(d->iam_a_slave))
   129 	if (! *(d->iam_a_slave))
   130 	{
   130 	{
   131 		msg.cob_id.w = 0x07E5 /* 2021 */;
   131 		msg.cob_id.w = 0x07E5 /* 2021 */;
   132 
   132 
   133 		msg.len = 2;
   133 		msg.len = 2;
   134 		msg.data[0] = 4;
   134 		msg.data[0] = 4;
   155 */
   155 */
   156 {
   156 {
   157 	Message msg;
   157 	Message msg;
   158 	lss_init_msg(&msg);
   158 	lss_init_msg(&msg);
   159 
   159 
   160 	if (d->iam_a_slave) /* not the master */
   160 	if (*(d->iam_a_slave)) /* not the master */
   161 		return; 
   161 		return; 
   162 
   162 
   163 	msg.cob_id.w = 0x07E5 /* 2021 */;
   163 	msg.cob_id.w = 0x07E5 /* 2021 */;
   164 	msg.len=5;
   164 	msg.len=5;
   165 
   165 
   269 */
   269 */
   270 {
   270 {
   271 	Message msg;
   271 	Message msg;
   272 	lss_init_msg(&msg);
   272 	lss_init_msg(&msg);
   273 
   273 
   274 	if (!(d->iam_a_slave))
   274 	if (!*(d->iam_a_slave))
   275 	{
   275 	{
   276 		msg.cob_id.w = 0x07E5 /* 2021 */;
   276 		msg.cob_id.w = 0x07E5 /* 2021 */;
   277 
   277 
   278 		msg.len = 2;
   278 		msg.len = 2;
   279 		msg.data[0] = 17;
   279 		msg.data[0] = 17;
   318 */
   318 */
   319 {
   319 {
   320 	Message msg;
   320 	Message msg;
   321 	lss_init_msg(&msg);
   321 	lss_init_msg(&msg);
   322 
   322 
   323 	if (!(d->iam_a_slave))
   323 	if (!*(d->iam_a_slave))
   324 	{
   324 	{
   325 		msg.cob_id.w = 0x07E5 /* 2021 */;
   325 		msg.cob_id.w = 0x07E5 /* 2021 */;
   326 
   326 
   327 		msg.len = 3;
   327 		msg.len = 3;
   328 		msg.data[0] = 19;
   328 		msg.data[0] = 19;
   370 */
   370 */
   371 {
   371 {
   372 	Message msg;
   372 	Message msg;
   373 	lss_init_msg(&msg);
   373 	lss_init_msg(&msg);
   374 
   374 
   375 	if (d->iam_a_slave)
   375 	if (*(d->iam_a_slave))
   376 		return;
   376 		return;
   377 	
   377 	
   378 	msg.cob_id.w = 0x07E5 /* 2021 */;
   378 	msg.cob_id.w = 0x07E5 /* 2021 */;
   379 
   379 
   380 	msg.len = 3;
   380 	msg.len = 3;
   409 */
   409 */
   410 {
   410 {
   411 	Message msg;
   411 	Message msg;
   412 	lss_init_msg(&msg);
   412 	lss_init_msg(&msg);
   413 
   413 
   414 	if (!(d->iam_a_slave))
   414 	if (!*(d->iam_a_slave))
   415 	{
   415 	{
   416 		msg.cob_id.w = 0x07E5 /* 2021 */;
   416 		msg.cob_id.w = 0x07E5 /* 2021 */;
   417 
   417 
   418 		msg.len = 1;
   418 		msg.len = 1;
   419 		msg.data[0] = 23;
   419 		msg.data[0] = 23;
   448 */
   448 */
   449 {
   449 {
   450 	Message msg;
   450 	Message msg;
   451 	lss_init_msg(&msg);
   451 	lss_init_msg(&msg);
   452 
   452 
   453 	if (!(d->iam_a_slave))
   453 	if (!*(d->iam_a_slave))
   454 	{
   454 	{
   455 		msg.cob_id.w = 0x07E5 /* 2021 */;
   455 		msg.cob_id.w = 0x07E5 /* 2021 */;
   456 
   456 
   457 		msg.len = 1;
   457 		msg.len = 1;
   458 		msg.data[0] = 90 + flag;
   458 		msg.data[0] = 90 + flag;
   466 int lss_InquireLSSAddress_slave(CO_Data *d, int cs)
   466 int lss_InquireLSSAddress_slave(CO_Data *d, int cs)
   467 {
   467 {
   468 	Message msg;
   468 	Message msg;
   469 	lss_init_msg(&msg);
   469 	lss_init_msg(&msg);
   470 
   470 
   471 	if (!(d->iam_a_slave)) /* not a slave */
   471 	if (!*(d->iam_a_slave)) /* not a slave */
   472 		return -1;
   472 		return -1;
   473 
   473 
   474 	UNS32 value = 0;
   474 	UNS32 value = 0;
   475 
   475 
   476 	switch(cs)
   476 	switch(cs)
   520 */
   520 */
   521 {
   521 {
   522 	Message msg;
   522 	Message msg;
   523 	lss_init_msg(&msg);
   523 	lss_init_msg(&msg);
   524 
   524 
   525 	if (!(d->iam_a_slave))
   525 	if (!*(d->iam_a_slave))
   526 	{
   526 	{
   527 		/*
   527 		/*
   528 			request answers from all slaves corresponding
   528 			request answers from all slaves corresponding
   529 			to the revision and serial range of values
   529 			to the revision and serial range of values
   530 		*/
   530 		*/