Suggestions for USBDM

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Suggestions for USBDM

1,476件の閲覧回数
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)
タグ(2)
0 件の賞賛
3 返答(返信)

441件の閲覧回数
simonqian
Contributor I
0 件の賞賛

441件の閲覧回数
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 件の賞賛

441件の閲覧回数
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 件の賞賛