Exemplo n.º 1
0
static void pfpu_start(struct pfpu_td *td)
{
	load_program(td->program, td->progsize);
	load_registers(td->registers);
	CSR_PFPU_MESHBASE = (unsigned int)td->output;
	CSR_PFPU_HMESHLAST = td->hmeshlast;
	CSR_PFPU_VMESHLAST = td->vmeshlast;

	CSR_PFPU_CTL = PFPU_CTL_START;
}
Exemplo n.º 2
0
static rtems_status_code pfpu_execute(struct pfpu_td *td)
{
  rtems_status_code sc;

  load_program(td->program, td->progsize);
  load_registers(td->registers);
  MM_WRITE(MM_PFPU_MESHBASE, (unsigned int)td->output);
  MM_WRITE(MM_PFPU_HMESHLAST, td->hmeshlast);
  MM_WRITE(MM_PFPU_VMESHLAST, td->vmeshlast);
  MM_WRITE(MM_PFPU_CTL, PFPU_CTL_START);

  sc = rtems_semaphore_obtain(done_sem, RTEMS_WAIT, 10);
  if (sc != RTEMS_SUCCESSFUL)
    return sc;

  if (td->update)
    update_registers(td->registers);
    if (td->invalidate) {
      __asm__ volatile( /* Invalidate Level-1 data cache */
      "wcsr DCC, r0\n"
      "nop\n"
    );
  }
Exemplo n.º 3
0
void cfft(int trnsfrm_dir, int npnt, int window,
    SAMPLE *source_buf, int source_form, int source_scale,
    SAMPLE *result_buf, int result_form, int result_scale, int debug)

/* modifies: result_buf
   effects:  Computes npnt FFT specified by form, scale, and dir parameters.  
         Source samples (single precision float) are taken from soure_buf and 
         the transfrmd representation is stored in result_buf (single precision
         float).  The parameters are defined as follows:
        
         trnsfrm_dir = FORWARD | INVERSE
         npnt        = 2^k for some any positive integer k
         window      = HANNING | RECTANGULAR
         (RECT = real and imag parts, POLAR = magnitude and phase)
         source_form = REAL | IMAG | RECT | POLAR  
         result_form = REAL | IMAG | RECT | MAG | PHASE | POLAR
         xxxxxx_scale= LINEAR | DB ( 20log10 |mag| )
         
         The input/output buffers are stored in a form appropriate to the type.
         For example: REAL  => {real, real, real ...}, 
                      MAG   => {mag, mag, mag, ... },
                      RECT  => {real, imag, real, imag, ... },
                      POLAR => {mag, phase, mag, phase, ... }.

         To look at the magnitude (in db) of a 1024 point FFT of a real time 
         signal we have:

         fft(FORWARD, 1024, RECTANGULAR, input, REAL, LINEAR, output, MAG, DB)

         All possible input and output combinations are possible given the 
         choice of type and scale parameters.
*/

{
         FFT_NET         *thisnet = (FFT_NET *)0;
         FFT_NET         *lastnet = (FFT_NET *)0;
         
         /* A linked list of fft networks of different sizes is maintained to
            avoid building with every call.  The network is built on the first
            call but reused for subsequent calls requesting the same size 
            transformation.
         */
   
         thisnet=firstnet;
         while (thisnet) {
             if (!(thisnet->n == npnt) || !(thisnet->window_type == window)) { 
               /* current net doesn't match size or window type */
               lastnet=thisnet;
               thisnet=thisnet->next;
               continue;                  /* keep looking */
             }

             else {                       /* network matches desired size */
               load_registers(thisnet, source_buf, source_form, source_scale, 
                              trnsfrm_dir);
               compute_fft(thisnet);      /* do transformation */
               store_registers(thisnet, result_buf, result_form, result_scale,debug);
               return;
             }
         }           

         /* none of existing networks match required size*/

         if (lastnet) {                 /* add new network to end of list */
           thisnet = (FFT_NET *)malloc(sizeof(FFT_NET));      /* allocate */
           thisnet->next = 0;
           lastnet->next = thisnet;     /* add to end of list             */
         }
         else {                         /* first network to be created    */
           thisnet=firstnet=(FFT_NET *)malloc(sizeof(FFT_NET)); /* alloc. */
           thisnet->next = 0;
         }

         /* build new network and compute transformation */
         build_fft_network(thisnet, npnt, window);
         load_registers(thisnet, source_buf, source_form, source_scale, 
                        trnsfrm_dir);
         compute_fft(thisnet);
         store_registers(thisnet, result_buf, result_form, result_scale,debug);
         return;
}