If you pack the struct on one side and not the other, you'll obviously
have issues. I don't think the TI compilers support packed structs (I
could be wrong).
In this case, it looks like you're trying to use the data buffers to
send meta-data about the buffer as well. If this meta-data doesn't
logically fall into any of the ISPHENC_InArgs or ISPHENC_OutArgs fields,
I'd suggest you extend the ISPHENC_InArgs and/or ISPHENC_OutArgs
(depending on whether this data is input or output). Then _just_ send
the data in the CMEM buffer.
[ Note that "InArgs" and "OutArgs" really do mean just that, you can't
send input to the codec in OutArgs, nor return output from the codec in
InArgs - because 1) that's the xDM spec(!), and 2) the VISA skeletons
only do the "right thing" (think cache maintenance) depending on whether
structs are for input and output. Note that this is also true for
InBufs and OutBufs! ]
There is an example of an xDM algorithm extending the IVIDENC_InArgs in
the xDAIS 5.10 product (examples/ti/xdais/dm/examples/videnc1_copy).
Basically, you grow the struct, and indicate the new larger struct size
using the .size field at the beginning of each struct.
xDAIS 5.10 has not yet been integrated into a DVEVM release, but is
available - with examples - here:
https://www-a.ti.com/downloads/sds_support/targetcontent/xdais/xdais_5_1
0/index.html
If you have further questions, please post sample code (both sides) so
we can help... some of those xDM structures (like XDM_BufDesc) are a bit
tricky to get right. :)
Chris
________________________________
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Andy Ngo
Sent: Friday, January 26, 2007 6:21 PM
To: Wan, Vincent
Cc: davinci-linux-open-source
Subject: Packed data structure across CMEMK not working
Vincent,
Thanks for your help. I have another question I wanted to ask
you or anyone else who can help.
Let's say I want to typecast the input buffer to my dec codec as
this:
// message format
struct MyMessage
{
unsigned char data1;
unsigned short data2;
unsigned int data3;
unsigned int data4;
unsigned char buf[105];
} __attribute__ ((packed));
In my ARM application, I allocated the input buffer from the
CMEMK pool like this:
inBuf = (XDAS_Int8 *)Memory_contigAlloc(sizeof(struct
MyMessage), Memory_DEFAULTALIGNMENT);
and set ((struct MyMessage *)inBuf)->buf with some values. When
I called SPHENC_process with
that buffer, my vendor specific function "MYDEC_TI_process" in
my dec codec doesn't see the
same values in (struct MyMessage *)inBufs->bufs[0])->buf:
XDAS_Int32 MYDEC_TI_process(ISPHDEC_Handle h, XDM_BufDesc
*inBufs,
XDM_BufDesc *outBufs,
ISPHDEC_InArgs *inArgs, ISPHDEC_OutArgs *outArgs)
{
// do processing on ((struct AudioMessage
*)inBufs->bufs[0])->buf;
return (ISPHDEC_EOK);
}
Is there a memory alignment, typecasting, or indianess issue?
Also, I had to comment out the
__attribute__ ((packed)) or else the DSP compiler won't compile
correctly. Please advise. Thanks!
Regards,
Andy
----- Original Message ----
From: "Wan, Vincent" <[EMAIL PROTECTED]>
To: Andy Ngo <[EMAIL PROTECTED]>
Cc: davinci-linux-open-source
<[email protected]>
Sent: Friday, January 26, 2007 5:21:05 PM
Subject: RE: Linking/mapping data to IRAM or L1SDRAM on the DSP
Hi Andy,
You can try this:
In package.bld, set the lopts (linker options) in the
addExecutable call:
....
if (targ.os == "Linux") {
libraries = "-lm";
}
else {
libraries = "";
}
Pkg.addExecutable(name, targ, plat, {
cfgScript: cfg,
lopts: libraries,
....
Fyi, there is also something called copts that allows you to set
compiler flags.
Alternatively, if you are more comfortable with makefiles, you
can take a look at the video_copy/dualcpu example to see how you can
directly specify -lm, etc. next to the rule for app.out, where -lphread
is specified.
Best regards,
Vincent
________________________________
From: Andy Ngo [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 25, 2007 2:16 PM
To: Wan, Vincent
Cc: davinci-linux-open-source
Subject: Re: Linking/mapping data to IRAM or L1SDRAM on the DSP
Hi Vincent,
Thanks for you help. I have another question that maybe you can
help. I want to add
a library (i.e. mylib.a) to the ARM application but I couldn't
figure it out. I know I need
to modify the package.bld file. For example, in the
dvevm_1_10/codec_engine_1_02/examples/apps/speech_copy folder, I see all
the
source files are added in package.bld via Pkg.addobjects). How
do I add my library
and other system libraries (like -lm -lc -ldl -rt). Otherwise,
I have to manually modify
the package.mak that automatically gets generated (my changes
get wiped out if I
modify package.bld again).
Thanks!
Regards,
Andy
_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source