~ubuntu-branches/ubuntu/utopic/fftw3/utopic

« back to all changes in this revision

Viewing changes to cell/spu/main.spuc

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2011-12-14 13:21:22 UTC
  • mfrom: (3.1.5 sid)
  • Revision ID: package-import@ubuntu.com-20111214132122-l4avyl2kkr7vq5aj
Tags: 3.3-1ubuntu1
* Merge with Debian; remaining changes:
  - Revert the ARM workaround.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- C -*- */
2
 
/*
3
 
 * Copyright (c) 2007 Massachusetts Institute of Technology
4
 
 *
5
 
 * This program is free software; you can redistribute it and/or modify
6
 
 * it under the terms of the GNU General Public License as published by
7
 
 * the Free Software Foundation; either version 2 of the License, or
8
 
 * (at your option) any later version.
9
 
 *
10
 
 * This program is distributed in the hope that it will be useful,
11
 
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
 * GNU General Public License for more details.
14
 
 *
15
 
 * You should have received a copy of the GNU General Public License
16
 
 * along with this program; if not, write to the Free Software
17
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
 
 *
19
 
 */
20
 
 
21
 
#include <stdlib.h>
22
 
#include <spu_intrinsics.h>
23
 
#include <spu_mfcio.h>
24
 
#include "fftw-spu.h"
25
 
#include "../fftw-cell.h"
26
 
 
27
 
static void wait(void)
28
 
{
29
 
     (void) spu_read_in_mbox();
30
 
}
31
 
 
32
 
int main(unsigned long long spu_id, unsigned long long parm)
33
 
{  
34
 
     static struct spu_context ctx __attribute__ ((aligned (ALIGNMENT)));
35
 
     UNUSED(spu_id);
36
 
     spu_writech(MFC_WrTagMask, -1);
37
 
 
38
 
     for (;;) {
39
 
          wait();
40
 
 
41
 
          /* obtain context */
42
 
          X(spu_dma1d)(&ctx, parm, sizeof(ctx), MFC_GET_CMD);
43
 
 
44
 
          switch (ctx.op) {
45
 
              case FFTW_SPE_DFT:
46
 
                   X(spu_do_dft)(&ctx.u.dft);
47
 
                   break;
48
 
 
49
 
              case FFTW_SPE_TRANSPOSE:
50
 
                   X(spu_do_transpose)(&ctx.u.transpose);
51
 
                   break;
52
 
 
53
 
              case FFTW_SPE_COPY:
54
 
                   X(spu_do_copy)(&ctx.u.copy);
55
 
                   break;
56
 
 
57
 
              case FFTW_SPE_EXIT:
58
 
                   return 0;
59
 
          }
60
 
 
61
 
          /* signal completion: */
62
 
          ctx.done = 1;
63
 
          X(spu_dma1d)(&ctx, parm, sizeof(ctx), MFC_PUTF_CMD);
64
 
     }
65
 
}