Share header for DMA?

Investigation into how Linux on the PS3 might lead to homebrew development.

Moderators: cheriff, emoon

Post Reply
kroe
Posts: 6
Joined: Mon Apr 02, 2007 12:22 pm

Share header for DMA?

Post by kroe »

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
IronPeter
Posts: 207
Joined: Mon Aug 06, 2007 12:46 am
Contact:

Post by IronPeter »

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.c ... /structs.h in http://spu-cell-rasterizer.googlecode.com/svn/trunk/
ldesnogu
Posts: 94
Joined: Sat Apr 17, 2004 10:37 pm

Post by ldesnogu »

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
Post Reply