forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Share header for DMA?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development
View previous topic :: View next topic  
Author Message
kroe



Joined: 02 Apr 2007
Posts: 6

PostPosted: Wed Aug 15, 2007 2:10 pm    Post subject: Share header for DMA? Reply with quote

I am using SPE initiated DMA to pull across arguments. I have a structure that holds my arguments. DMA works fine with the identical struct defined in both the SPE and PPE code, but the redundancy bothers me.

Is there a simple way (must be) to have a single header file and use it in my SPE and PPE code?

I have two projects: PPE and SPE. Where would I put the header file containing my struct and what would the includes be on the SPE and PPE sides?

Thanks,
-Ken
Back to top
View user's profile Send private message
IronPeter



Joined: 06 Aug 2007
Posts: 207

PostPosted: Wed Aug 15, 2007 4:14 pm    Post subject: Reply with quote

Yes, you can use single C/C++ header for both projects.

Assume your workfolders are:

ppe_project
spe_project
common_headers

Just put the line #include "../common_headers/structs.h" in your code.

For example, http://spu-cell-rasterizer.googlecode.com/svn/trunk/structs.h in http://spu-cell-rasterizer.googlecode.com/svn/trunk/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ldesnogu



Joined: 17 Apr 2004
Posts: 95

PostPosted: Wed Aug 15, 2007 8:38 pm    Post subject: Reply with quote

Follow what IronPeter said, but keep in mind one thing: your SPU compiler may compile for a 32 bit (SPU) target while your PPU compiler may compile for a 64 bit (PPU) target.
The result is that struct layout will be different.

To solve that pass -m32 to your PPU compiler.
_________________
Laurent
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS3 Linux Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group