Suggestions for USBDM

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Suggestions for USBDM

1,462 次查看
simonqian
Contributor I

I'm porting USBDM to my programming tool, most code is portable and do not need to be changed.

But the endianness is not concerned in the USBDM code.

 

For example:

U8 f_CMD_GET_CAPABILITIES(void)
{
   *(U16*)(commandBuffer+1) = CAPABILITY;  // Returns 16-bit value
   returnSize = 3;
   return BDM_RC_OK;
}

 

How about:

U8 f_CMD_GET_CAPABILITIES(void)
{
   SET_BE_U16(&commandBuffer[1], CAPABILITY);  // Returns 16-bit value
   returnSize = 3;
   return BDM_RC_OK;
}

 

Here, BE means big endian.

SET_BE_U16 can be defined to swap the endian if controller is not big endian.

And it can be no effect on original controller, because no swap is done if controller is big endian.

 

And GET_BE_U16 chould be defined to read a U16 value from a BE buffer, example:

U16 addr       = GET_BE_U16(&commandBuffer[6]);

 

BTW:

Does USBDM accpet patches? Does it has a SVN or GIT?

I can try to modify such code and provide the patch.

With these changes, the code will be more generic.

标记 (2)
0 项奖励
3 回复数

427 次查看
simonqian
Contributor I
0 项奖励

427 次查看
pgo
Senior Contributor V

Dear simonqian,

 

I suggest you leave this for the moment.  I am currently working on V4 which has significant changes including:

 

Linux support.

DSC targets

Use of libusbV2

 

You may find a great deal of work to re-do.

 

bye

0 项奖励

427 次查看
simonqian
Contributor I

HCS08 and HCS12(X) port is ready on Versaloon, it takes about 2 days, because most code is unchanged. You did great job.

 

Yes, V4 sounds exciting. I'll wait for this version and prepare patches if acceptable.

0 项奖励