changeset 18:bb7db7d1b37c pygar svn.19

[svn r19] removed garbage
author rlm
date Tue, 27 Apr 2010 23:06:26 -0400
parents 9d1f38722f5b
children 9910c032f38d
files #AudioProcessor.cpp# #AudioProcessorRRR.rrr# #AudioProcessorTypes.bsv# AudioPipelineDefault.bsv AudioProcessor.bsv AudioProcessor.cpp AudioProcessor.h AudioProcessorRRR.cpp AudioProcessorRRR.h AudioProcessorRRR.rrr AudioProcessorTypes.bsv DFT.cpp SndfileWavUtil.cpp SndfileWavUtil.h audio_pipeline_default.awb audio_processor_hardware_system.awb audio_processor_software_system.awb audio_processor_types.awb
diffstat 18 files changed, 0 insertions(+), 888 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/#AudioProcessor.cpp#	Tue Apr 27 22:55:55 2010 -0400
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,104 +0,0 @@
     1.4 -#include <stdio.h>
     1.5 -#include <pthread.h>
     1.6 -#include <semaphore.h>
     1.7 -
     1.8 -#include "asim/provides/connected_application.h"
     1.9 -//#include "asim/provides/SndfileWavUtil.h"
    1.10 -
    1.11 -#include "asim/rrr/client_stub_AUDIOPROCESSORRRR.h"
    1.12 -
    1.13 -using namespace std;
    1.14 -
    1.15 -pthread_mutex_t CONNECTED_APPLICATION_CLASS::lock;
    1.16 -pthread_cond_t  CONNECTED_APPLICATION_CLASS::cond;
    1.17 -sem_t CONNECTED_APPLICATION_CLASS::throttle;
    1.18 -
    1.19 -// constructor
    1.20 -CONNECTED_APPLICATION_CLASS::CONNECTED_APPLICATION_CLASS(VIRTUAL_PLATFORM vp) :
    1.21 -    clientStub(new AUDIOPROCESSORRRR_CLIENT_STUB_CLASS(this))
    1.22 -{
    1.23 -œôøº}
    1.24 -œôøºœôøºœôøº
    1.25 -// destructor
    1.26 -CONNECTED_APPLICATION_CLASS::~CONNECTED_APPLICATION_CLASS()
    1.27 -{
    1.28 -}
    1.29 -
    1.30 -// init
    1.31 -void
    1.32 -CONNECTED_APPLICATION_CLASS::Init()
    1.33 -{
    1.34 -
    1.35 -  pthread_mutex_init(&lock, NULL);
    1.36 -  pthread_cond_init(&cond, NULL);
    1.37 -  sem_init(&throttle, 0, 64);
    1.38 -
    1.39 -}
    1.40 -
    1.41 -void
    1.42 -CONNECTED_APPLICATION_CLASS::UpdateSemaphore()
    1.43 -{
    1.44 -  sem_post(&throttle);
    1.45 -}
    1.46 -
    1.47 -void
    1.48 -CONNECTED_APPLICATION_CLASS::EndSimulation()
    1.49 -{
    1.50 -  printf("EndSimulation Called\n");
    1.51 -  fflush(stdout);
    1.52 -  pthread_mutex_lock(&lock);
    1.53 -  // Do something about the race occuring here
    1.54 -  pthread_cond_signal(&cond); 
    1.55 -  pthread_mutex_unlock(&lock);
    1.56 -  printf("EndSimulation done\n");
    1.57 -  fflush(stdout);  
    1.58 -}
    1.59 -
    1.60 -// main
    1.61 -void
    1.62 -CONNECTED_APPLICATION_CLASS::Main()
    1.63 -{
    1.64 -  FILE *inputFile;
    1.65 -  UINT16 sample;
    1.66 -  
    1.67 -  // Convert input wav to pcm
    1.68 -  generate_pcm("input.wav","input.pcm");
    1.69 -
    1.70 -  //Send data to the machine here.
    1.71 -  inputFile = fopen("input.pcm","r");
    1.72 -  assert(inputFile);
    1.73 -
    1.74 -
    1.75 -  int count = 0;
    1.76 -
    1.77 -  printf("main: about to enter loop %d\n", count);  
    1.78 -
    1.79 -  while(fread(&sample, 2, 1, inputFile)) {
    1.80 -    if(count%1000 == 0)
    1.81 -      printf("main: %d\n", count);
    1.82 -    count++;
    1.83 -    sem_wait(&throttle);
    1.84 -    clientStub->SendUnprocessedStream(Data,(UINT32)sample);
    1.85 -  } 
    1.86 -
    1.87 -  printf("main: out of loop\n");
    1.88 -
    1.89 -  // Need to put lock here to prevent potential race condition
    1.90 -  pthread_mutex_lock(&lock);
    1.91 -  clientStub->SendUnprocessedStream(EndOfFile,0);
    1.92 -
    1.93 -  printf("main: wait for end of file\n");
    1.94 -
    1.95 -  pthread_cond_wait(&cond, &lock);
    1.96 -  pthread_mutex_unlock(&lock);
    1.97 -
    1.98 -  printf("main: lastt data out\n");
    1.99 -
   1.100 -  // Convert input wav to pcm
   1.101 -  generate_wav("out_hw.pcm","input.wav","out_hw.wav");
   1.102 -
   1.103 -  printf("generate wav done\n");
   1.104 -
   1.105 -  fflush(stdout);
   1.106 -  exit(0);
   1.107 -}
     2.1 --- a/#AudioProcessorRRR.rrr#	Tue Apr 27 22:55:55 2010 -0400
     2.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.3 @@ -1,14 +0,0 @@
     2.4 -service AUDIOPROCESSORRRR
     2.5 -{
     2.6 -    server sw (cpp, method) <- hw (bsv, connection) 
     2.7 -    {
     2.8 -       method SendProcessedStream (in UINT32[32] ctrl, in UINT32[32] sample);
     2.9 -    };
    2.10 -
    2.11 -    server hw (bsv, connection) <- sw (cpp, method)
    2.12 -    {
    2.13 -        method SendUnprocessedStream (in UINT32[32] ctrl, in UINT32[32] sample);
    2.14 -    };
    2.15 -
    2.16 -
    2.17 - };
     3.1 --- a/#AudioProcessorTypes.bsv#	Tue Apr 27 22:55:55 2010 -0400
     3.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.3 @@ -1,52 +0,0 @@
     3.4 -
     3.5 -// The MIT License
     3.6 -
     3.7 -// Copyright (c) 2009 Massachusetts Institute of Technology
     3.8 -
     3.9 -// Permission is hereby granted, free of charge, to any person obtaining a copy
    3.10 -// of this software and associated documentation files (the "Software"), to deal
    3.11 -// in the Software without restriction, including without limitation the rights
    3.12 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    3.13 -// copies of the Software, and to permit persons to whom the Software is
    3.14 -// furnished to do so, subject to the following conditions:
    3.15 -
    3.16 -// The above copyright notice and this permission notice shall be included in
    3.17 -// all copies or substantial portions of the Software.
    3.18 -
    3.19 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    3.20 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    3.21 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    3.22 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    3.23 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    3.24 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    3.25 -// THE SOFTWARE.
    3.26 -
    3.27 -// Author: Kermin Fleming kfleming@mit.edu
    3.28 -
    3.29 -import Connectable::*;
    3.30 -import GetPut::*;
    3.31 -import ClientServer::*;
    3.32 -
    3.33 -typedef Int#(16) Sample;
    3.34 -
    3.35 -typedef enum {
    3.36 -  EndOfFile = 0,
    3.37 -  Data = 1
    3.38 -} AudioProcessorControl deriving (Bits,Eq);
    3.39 -
    3.40 -
    3.41 -typedef struct { 
    3.42 -  Sample left;
    3.43 -  Sample right;
    3.44 -} StereoSample deriving (Bits,Eq);
    3.45 -
    3.46 -typedef union tagged{
    3.47 - Sample Sample;
    3.48 - void EndOfFile;
    3.49 -} AudioProcessorUnit deriving (Bits,Eq);
    3.50 -
    3.51 -interface AudioPipeline;
    3.52 -  interface Put#(AudioProcessorUnit) sampleInput;
    3.53 -  interface Get#(AudioProcessorUnit) sampleOutput;
    3.54 -endinterface
    3.55 -
     4.1 --- a/AudioPipelineDefault.bsv	Tue Apr 27 22:55:55 2010 -0400
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,38 +0,0 @@
     4.4 -// The MIT License
     4.5 -
     4.6 -// Copyright (c) 2009 Massachusetts Institute of Technology
     4.7 -
     4.8 -// Permission is hereby granted, free of charge, to any person obtaining a copy
     4.9 -// of this software and associated documentation files (the "Software"), to deal
    4.10 -// in the Software without restriction, including without limitation the rights
    4.11 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    4.12 -// copies of the Software, and to permit persons to whom the Software is
    4.13 -// furnished to do so, subject to the following conditions:
    4.14 -
    4.15 -// The above copyright notice and this permission notice shall be included in
    4.16 -// all copies or substantial portions of the Software.
    4.17 -
    4.18 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    4.19 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    4.20 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    4.21 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    4.22 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    4.23 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    4.24 -// THE SOFTWARE.
    4.25 -
    4.26 -// Author: Kermin Fleming kfleming@mit.edu
    4.27 -
    4.28 -import Connectable::*;
    4.29 -import GetPut::*;
    4.30 -import ClientServer::*;
    4.31 -import FIFO::*;
    4.32 -
    4.33 -`include "asim/provides/audio_processor_types.bsh"
    4.34 -
    4.35 -module mkAudioPipeline (AudioPipeline);
    4.36 -  FIFO#(AudioProcessorUnit) fifo <- mkFIFO;
    4.37 -  
    4.38 -  interface sampleInput = fifoToPut(fifo);
    4.39 -  interface sampleOutput = fifoToGet(fifo);
    4.40 -
    4.41 -endmodule
     5.1 --- a/AudioProcessor.bsv	Tue Apr 27 22:55:55 2010 -0400
     5.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.3 @@ -1,77 +0,0 @@
     5.4 -// The MIT License
     5.5 -
     5.6 -// Copyright (c) 2009 Massachusetts Institute of Technology
     5.7 -
     5.8 -// Permission is hereby granted, free of charge, to any person obtaining a copy
     5.9 -// of this software and associated documentation files (the "Software"), to deal
    5.10 -// in the Software without restriction, including without limitation the rights
    5.11 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    5.12 -// copies of the Software, and to permit persons to whom the Software is
    5.13 -// furnished to do so, subject to the following conditions:
    5.14 -
    5.15 -// The above copyright notice and this permission notice shall be included in
    5.16 -// all copies or substantial portions of the Software.
    5.17 -
    5.18 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    5.19 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    5.20 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    5.21 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    5.22 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    5.23 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    5.24 -// THE SOFTWARE.
    5.25 -
    5.26 -import Connectable::*;
    5.27 -import GetPut::*;
    5.28 -import ClientServer::*;
    5.29 -
    5.30 -//AWB includes
    5.31 -`include "asim/provides/low_level_platform_interface.bsh"
    5.32 -`include "asim/provides/soft_connections.bsh"
    5.33 -`include "asim/provides/common_services.bsh"
    5.34 -
    5.35 -// Local includes
    5.36 -`include "asim/provides/audio_processor_types.bsh"
    5.37 -`include "asim/provides/audio_pipeline.bsh"
    5.38 -
    5.39 -`include "asim/rrr/remote_client_stub_AUDIOPROCESSORRRR.bsh"
    5.40 -`include "asim/rrr/remote_server_stub_AUDIOPROCESSORRRR.bsh"
    5.41 -
    5.42 -
    5.43 -module [CONNECTED_MODULE] mkConnectedApplication ();
    5.44 -
    5.45 -   // Instantiate the rrr stubs
    5.46 -   ClientStub_AUDIOPROCESSORRRR client_stub <- mkClientStub_AUDIOPROCESSORRRR();
    5.47 -   ServerStub_AUDIOPROCESSORRRR server_stub <- mkServerStub_AUDIOPROCESSORRRR();
    5.48 -
    5.49 -   // Instantiate the audio pipeline
    5.50 -   AudioPipeline pipeline <- mkAudioPipeline();
    5.51 -
    5.52 -   rule feedInput;
    5.53 -     let command <- server_stub.acceptRequest_SendUnprocessedStream();
    5.54 -     AudioProcessorControl ctrl = unpack(truncate(command.ctrl));
    5.55 -
    5.56 -     if(ctrl == EndOfFile)
    5.57 -       begin
    5.58 -         pipeline.sampleInput.put(tagged EndOfFile);
    5.59 -       end
    5.60 -     else 
    5.61 -       begin
    5.62 -         pipeline.sampleInput.put(tagged Sample unpack(truncate(command.sample)));
    5.63 -       end
    5.64 -   endrule
    5.65 -
    5.66 -   rule feedOutput;
    5.67 -     let pipelineData <- pipeline.sampleOutput.get();
    5.68 -     AudioProcessorControl endOfFileTag = EndOfFile;
    5.69 -     AudioProcessorControl sampleTag = Data;
    5.70 -
    5.71 -     case (pipelineData) matches
    5.72 -       tagged EndOfFile: client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(endOfFileTag)),?);
    5.73 -       tagged Sample .sample:client_stub.makeRequest_SendProcessedStream(zeroExtend(pack(sampleTag)),
    5.74 -                                                                         zeroExtend(pack(sample)));
    5.75 -     endcase
    5.76 -   endrule
    5.77 -
    5.78 -endmodule
    5.79 -
    5.80 -
     6.1 --- a/AudioProcessor.cpp	Tue Apr 27 22:55:55 2010 -0400
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,104 +0,0 @@
     6.4 -#include <stdio.h>
     6.5 -#include <pthread.h>
     6.6 -#include <semaphore.h>
     6.7 -
     6.8 -#include "asim/provides/connected_application.h"
     6.9 -//#include "asim/provides/SndfileWavUtil.h"
    6.10 -
    6.11 -#include "asim/rrr/client_stub_AUDIOPROCESSORRRR.h"
    6.12 -
    6.13 -using namespace std;
    6.14 -
    6.15 -pthread_mutex_t CONNECTED_APPLICATION_CLASS::lock;
    6.16 -pthread_cond_t  CONNECTED_APPLICATION_CLASS::cond;
    6.17 -sem_t CONNECTED_APPLICATION_CLASS::throttle;
    6.18 -
    6.19 -// constructor
    6.20 -CONNECTED_APPLICATION_CLASS::CONNECTED_APPLICATION_CLASS(VIRTUAL_PLATFORM vp) :
    6.21 -    clientStub(new AUDIOPROCESSORRRR_CLIENT_STUB_CLASS(this))
    6.22 -{
    6.23 -}
    6.24 -
    6.25 -// destructor
    6.26 -CONNECTED_APPLICATION_CLASS::~CONNECTED_APPLICATION_CLASS()
    6.27 -{
    6.28 -}
    6.29 -
    6.30 -// init
    6.31 -void
    6.32 -CONNECTED_APPLICATION_CLASS::Init()
    6.33 -{
    6.34 -
    6.35 -  pthread_mutex_init(&lock, NULL);
    6.36 -  pthread_cond_init(&cond, NULL);
    6.37 -  sem_init(&throttle, 0, 64);
    6.38 -
    6.39 -}
    6.40 -
    6.41 -void
    6.42 -CONNECTED_APPLICATION_CLASS::UpdateSemaphore()
    6.43 -{
    6.44 -  sem_post(&throttle);
    6.45 -}
    6.46 -
    6.47 -void
    6.48 -CONNECTED_APPLICATION_CLASS::EndSimulation()
    6.49 -{
    6.50 -  printf("EndSimulation Called\n");
    6.51 -  fflush(stdout);
    6.52 -  pthread_mutex_lock(&lock);
    6.53 -  // Do something about the race occuring here
    6.54 -  pthread_cond_signal(&cond); 
    6.55 -  pthread_mutex_unlock(&lock);
    6.56 -  printf("EndSimulation done\n");
    6.57 -  fflush(stdout);  
    6.58 -}
    6.59 -
    6.60 -// main
    6.61 -void
    6.62 -CONNECTED_APPLICATION_CLASS::Main()
    6.63 -{
    6.64 -  FILE *inputFile;
    6.65 -  UINT16 sample;
    6.66 -  
    6.67 -  // Convert input wav to pcm
    6.68 -  generate_pcm("input.wav","input.pcm");
    6.69 -
    6.70 -  //Send data to the machine here.
    6.71 -  inputFile = fopen("input.pcm","r");
    6.72 -  assert(inputFile);
    6.73 -
    6.74 -
    6.75 -  int count = 0;
    6.76 -
    6.77 -  printf("main: about to enter loop %d\n", count);  
    6.78 -
    6.79 -  while(fread(&sample, 2, 1, inputFile)) {
    6.80 -    if(count%1000 == 0)
    6.81 -      printf("main: %d\n", count);
    6.82 -    count++;
    6.83 -    sem_wait(&throttle);
    6.84 -    clientStub->SendUnprocessedStream(Data,(UINT32)sample);
    6.85 -  } 
    6.86 -
    6.87 -  printf("main: out of loop\n");
    6.88 -
    6.89 -  // Need to put lock here to prevent potential race condition
    6.90 -  pthread_mutex_lock(&lock);
    6.91 -  clientStub->SendUnprocessedStream(EndOfFile,0);
    6.92 -
    6.93 -  printf("main: wait for end of file\n");
    6.94 -
    6.95 -  pthread_cond_wait(&cond, &lock);
    6.96 -  pthread_mutex_unlock(&lock);
    6.97 -
    6.98 -  printf("main: lastt data out\n");
    6.99 -
   6.100 -  // Convert input wav to pcm
   6.101 -  generate_wav("out_hw.pcm","input.wav","out_hw.wav");
   6.102 -
   6.103 -  printf("generate wav done\n");
   6.104 -
   6.105 -  fflush(stdout);
   6.106 -  exit(0);
   6.107 -}
     7.1 --- a/AudioProcessor.h	Tue Apr 27 22:55:55 2010 -0400
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,56 +0,0 @@
     7.4 -//
     7.5 -// INTEL CONFIDENTIAL
     7.6 -// Copyright (c) 2008 Intel Corp.  Recipient is granted a non-sublicensable 
     7.7 -// copyright license under Intel copyrights to copy and distribute this code 
     7.8 -// internally only. This code is provided "AS IS" with no support and with no 
     7.9 -// warranties of any kind, including warranties of MERCHANTABILITY,
    7.10 -// FITNESS FOR ANY PARTICULAR PURPOSE or INTELLECTUAL PROPERTY INFRINGEMENT. 
    7.11 -// By making any use of this code, Recipient agrees that no other licenses 
    7.12 -// to any Intel patents, trade secrets, copyrights or other intellectual 
    7.13 -// property rights are granted herein, and no other licenses shall arise by 
    7.14 -// estoppel, implication or by operation of law. Recipient accepts all risks 
    7.15 -// of use.
    7.16 -//
    7.17 -
    7.18 -// possibly use include paths to hide existing modules?
    7.19 -
    7.20 -#ifndef __AUDIO_PROCESSOR_CONNECTED_APPLICATION__
    7.21 -#define __AUDIO_PROCESSOR_CONNECTED_APPLICATION__
    7.22 -
    7.23 -#include <stdio.h>
    7.24 -#include <pthread.h>
    7.25 -#include <semaphore.h>
    7.26 -
    7.27 -#include "asim/provides/virtual_platform.h"
    7.28 -
    7.29 -#include "asim/rrr/client_stub_AUDIOPROCESSORRRR.h"
    7.30 -
    7.31 -typedef enum {
    7.32 -  EndOfFile = 0,
    7.33 -  Data = 1
    7.34 -} AudioProcessorControl; 
    7.35 -
    7.36 -
    7.37 -typedef class CONNECTED_APPLICATION_CLASS* CONNECTED_APPLICATION;
    7.38 -class CONNECTED_APPLICATION_CLASS : public PLATFORMS_MODULE_CLASS
    7.39 -{
    7.40 -  private:
    7.41 -    AUDIOPROCESSORRRR_CLIENT_STUB clientStub;
    7.42 -    static sem_t throttle;
    7.43 -    static pthread_mutex_t lock;
    7.44 -    static pthread_cond_t  cond;    
    7.45 -
    7.46 -  public:
    7.47 -    CONNECTED_APPLICATION_CLASS(VIRTUAL_PLATFORM vp);
    7.48 -    ~CONNECTED_APPLICATION_CLASS();
    7.49 -    static void EndSimulation();
    7.50 -    static void UpdateSemaphore();
    7.51 -
    7.52 -    // init
    7.53 -    void Init();
    7.54 -
    7.55 -    // main
    7.56 -    void Main();
    7.57 -};
    7.58 -
    7.59 -#endif
     8.1 --- a/AudioProcessorRRR.cpp	Tue Apr 27 22:55:55 2010 -0400
     8.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.3 @@ -1,93 +0,0 @@
     8.4 -#include <cstdio>
     8.5 -#include <cstdlib>
     8.6 -#include <iostream>
     8.7 -#include <iomanip>
     8.8 -#include <stdio.h>
     8.9 -#include <sys/stat.h>
    8.10 -
    8.11 -#include "asim/rrr/service_ids.h"
    8.12 -
    8.13 -#include "asim/provides/connected_application.h"
    8.14 -
    8.15 -
    8.16 -
    8.17 -using namespace std;
    8.18 -
    8.19 -// ===== service instantiation =====
    8.20 -AUDIOPROCESSORRRR_SERVER_CLASS AUDIOPROCESSORRRR_SERVER_CLASS::instance;
    8.21 -
    8.22 -// constructor
    8.23 -AUDIOPROCESSORRRR_SERVER_CLASS::AUDIOPROCESSORRRR_SERVER_CLASS() :
    8.24 -    serverStub(new AUDIOPROCESSORRRR_SERVER_STUB_CLASS(this))
    8.25 -{
    8.26 -    // instantiate stub
    8.27 -    printf("AUDIOPROCESSORRR init called\n");
    8.28 -    outputFile = NULL;
    8.29 -}
    8.30 -
    8.31 -// destructor
    8.32 -AUDIOPROCESSORRRR_SERVER_CLASS::~AUDIOPROCESSORRRR_SERVER_CLASS()
    8.33 -{
    8.34 -    Cleanup();
    8.35 -}
    8.36 -
    8.37 -// init
    8.38 -void
    8.39 -AUDIOPROCESSORRRR_SERVER_CLASS::Init(PLATFORMS_MODULE p)
    8.40 -{
    8.41 -    parent = p;
    8.42 -}
    8.43 -
    8.44 -// uninit
    8.45 -void
    8.46 -AUDIOPROCESSORRRR_SERVER_CLASS::Uninit()
    8.47 -{
    8.48 -    Cleanup();
    8.49 -}
    8.50 -
    8.51 -// cleanup
    8.52 -void
    8.53 -AUDIOPROCESSORRRR_SERVER_CLASS::Cleanup()
    8.54 -{
    8.55 -    delete serverStub;
    8.56 -}
    8.57 -
    8.58 -
    8.59 -//
    8.60 -// RRR service methods
    8.61 -//
    8.62 -
    8.63 -void
    8.64 -AUDIOPROCESSORRRR_SERVER_CLASS::SendProcessedStream(UINT16 control, UINT16 data)
    8.65 -{
    8.66 -
    8.67 -  AudioProcessorControl audioProcessorControl = (AudioProcessorControl) control;
    8.68 -  switch(control) {
    8.69 -    case EndOfFile:
    8.70 -      if(outputFile != NULL) {
    8.71 -        fflush(outputFile);
    8.72 -        fclose(outputFile);
    8.73 -        outputFile = NULL;
    8.74 -      } else {
    8.75 -        outputFile = fopen("out_hw.pcm","w");
    8.76 -        assert(outputFile);
    8.77 -        fflush(outputFile);
    8.78 -        fclose(outputFile);
    8.79 -      }
    8.80 -
    8.81 -      CONNECTED_APPLICATION_CLASS::EndSimulation(); 
    8.82 -    break;
    8.83 -
    8.84 -    case Data:
    8.85 -      if(outputFile == NULL) {
    8.86 -        outputFile = fopen("out_hw.pcm","w");
    8.87 -        assert(outputFile);
    8.88 -      }
    8.89 -
    8.90 -      CONNECTED_APPLICATION_CLASS::UpdateSemaphore();  
    8.91 -      fwrite(&data, 2,1 , outputFile);
    8.92 -    break;
    8.93 -  }
    8.94 - 
    8.95 -}
    8.96 -
     9.1 --- a/AudioProcessorRRR.h	Tue Apr 27 22:55:55 2010 -0400
     9.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.3 @@ -1,50 +0,0 @@
     9.4 -
     9.5 -#ifndef _AUDIOPROCESSORRRR_
     9.6 -#define _AUDIOPROCESSORRRR_
     9.7 -
     9.8 -#include <stdio.h>
     9.9 -#include <sys/time.h>
    9.10 -
    9.11 -#include "asim/provides/low_level_platform_interface.h"
    9.12 -
    9.13 -#include "asim/provides/rrr.h"
    9.14 -
    9.15 -
    9.16 -
    9.17 -typedef class AUDIOPROCESSORRRR_SERVER_CLASS* AUDIOPROCESSORRRR_SERVER;
    9.18 -class AUDIOPROCESSORRRR_SERVER_CLASS: public RRR_SERVER_CLASS, public PLATFORMS_MODULE_CLASS
    9.19 -{
    9.20 -  private:
    9.21 -    // self-instantiation
    9.22 -    static AUDIOPROCESSORRRR_SERVER_CLASS instance;
    9.23 -    FILE *outputFile;
    9.24 -
    9.25 -    // server stub
    9.26 -    RRR_SERVER_STUB serverStub;
    9.27 -
    9.28 -    int count;    
    9.29 -
    9.30 -  public:
    9.31 -    AUDIOPROCESSORRRR_SERVER_CLASS();
    9.32 -    ~AUDIOPROCESSORRRR_SERVER_CLASS();
    9.33 -
    9.34 -    // static methods
    9.35 -    static AUDIOPROCESSORRRR_SERVER GetInstance() { return &instance; }
    9.36 -
    9.37 -    // required RRR methods
    9.38 -    void Init(PLATFORMS_MODULE);
    9.39 -    void Uninit();
    9.40 -    void Cleanup();
    9.41 -
    9.42 -    //
    9.43 -    // RRR service methods
    9.44 -    //
    9.45 -    void SendProcessedStream(UINT16 control, UINT16 data0);
    9.46 -};
    9.47 -
    9.48 -
    9.49 -
    9.50 -// include server stub
    9.51 -#include "asim/rrr/server_stub_AUDIOPROCESSORRRR.h"
    9.52 -
    9.53 -#endif
    10.1 --- a/AudioProcessorRRR.rrr	Tue Apr 27 22:55:55 2010 -0400
    10.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.3 @@ -1,14 +0,0 @@
    10.4 -service AUDIOPROCESSORRRR
    10.5 -{
    10.6 -    server sw (cpp, method) <- hw (bsv, connection) 
    10.7 -    {
    10.8 -       method SendProcessedStream (in UINT32[32] ctrl, in UINT32[32] sample);
    10.9 -    };
   10.10 -
   10.11 -    server hw (bsv, connection) <- sw (cpp, method)
   10.12 -    {
   10.13 -        method SendUnprocessedStream (in UINT32[32] ctrl, in UINT32[32] sample);
   10.14 -    };
   10.15 -
   10.16 -
   10.17 - };
    11.1 --- a/AudioProcessorTypes.bsv	Tue Apr 27 22:55:55 2010 -0400
    11.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.3 @@ -1,52 +0,0 @@
    11.4 -
    11.5 -// The MIT License
    11.6 -
    11.7 -// Copyright (c) 2009 Massachusetts Institute of Technology
    11.8 -
    11.9 -// Permission is hereby granted, free of charge, to any person obtaining a copy
   11.10 -// of this software and associated documentation files (the "Software"), to deal
   11.11 -// in the Software without restriction, including without limitation the rights
   11.12 -// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
   11.13 -// copies of the Software, and to permit persons to whom the Software is
   11.14 -// furnished to do so, subject to the following conditions:
   11.15 -
   11.16 -// The above copyright notice and this permission notice shall be included in
   11.17 -// all copies or substantial portions of the Software.
   11.18 -
   11.19 -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
   11.20 -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
   11.21 -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
   11.22 -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
   11.23 -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
   11.24 -// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
   11.25 -// THE SOFTWARE.
   11.26 -
   11.27 -// Author: Kermin Fleming kfleming@mit.edu
   11.28 -
   11.29 -import Connectable::*;
   11.30 -import GetPut::*;
   11.31 -import ClientServer::*;
   11.32 -
   11.33 -typedef Int#(16) Sample;
   11.34 -
   11.35 -typedef enum {
   11.36 -  EndOfFile = 0,
   11.37 -  Data = 1
   11.38 -} AudioProcessorControl deriving (Bits,Eq);
   11.39 -
   11.40 -
   11.41 -typedef struct { 
   11.42 -  Sample left;
   11.43 -  Sample right;
   11.44 -} StereoSample deriving (Bits,Eq);
   11.45 -
   11.46 -typedef union tagged{
   11.47 - Sample Sample;
   11.48 - void EndOfFile;
   11.49 -} AudioProcessorUnit deriving (Bits,Eq);
   11.50 -
   11.51 -interface AudioPipeline;
   11.52 -  interface Put#(AudioProcessorUnit) sampleInput;
   11.53 -  interface Get#(AudioProcessorUnit) sampleOutput;
   11.54 -endinterface
   11.55 -
    12.1 --- a/DFT.cpp	Tue Apr 27 22:55:55 2010 -0400
    12.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.3 @@ -1,46 +0,0 @@
    12.4 -#include <stdio.h>
    12.5 -#include <stdlib.h>
    12.6 -#include <math.h>
    12.7 -
    12.8 -
    12.9 -int DFT(int dir,int m,double *x1,double *y1)
   12.10 -{
   12.11 -   long i,k;
   12.12 -   double arg;
   12.13 -   double cosarg,sinarg;
   12.14 -   double *x2=NULL,*y2=NULL;
   12.15 -
   12.16 -   x2 = (double *)(malloc(m*sizeof(double)));
   12.17 -   y2 = (double *)(malloc(m*sizeof(double)));
   12.18 -   if (x2 == NULL || y2 == NULL)
   12.19 -      return 0;
   12.20 -
   12.21 -   for (i=0;i<m;i++) {
   12.22 -      x2[i] = 0;
   12.23 -      y2[i] = 0;
   12.24 -      arg = - dir * 2.0 * 3.141592654 * (double)i / (double)m;
   12.25 -      for (k=0;k<m;k++) {
   12.26 -         cosarg = cos(k * arg);
   12.27 -         sinarg = sin(k * arg);
   12.28 -         x2[i] += (x1[k] * cosarg - y1[k] * sinarg);
   12.29 -         y2[i] += (x1[k] * sinarg + y1[k] * cosarg);
   12.30 -      }
   12.31 -   }
   12.32 -
   12.33 -   /* Copy the data back */
   12.34 -   if (dir == 1) {
   12.35 -      for (i=0;i<m;i++) {
   12.36 -         x1[i] = x2[i];
   12.37 -         y1[i] = y2[i];
   12.38 -      }
   12.39 -   } else {
   12.40 -      for (i=0;i<m;i++) {
   12.41 -         x1[i] = x2[i];
   12.42 -         y1[i] = y2[i];
   12.43 -      }
   12.44 -   }
   12.45 -
   12.46 -   free(x2);
   12.47 -   free(y2);
   12.48 -   return 1;
   12.49 -}
    13.1 --- a/SndfileWavUtil.cpp	Tue Apr 27 22:55:55 2010 -0400
    13.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.3 @@ -1,125 +0,0 @@
    13.4 -#include <stdlib.h>
    13.5 -#include <string.h>
    13.6 -#include <errno.h>
    13.7 -#include <math.h>
    13.8 -#include <sndfile.h>
    13.9 -#include "SndfileWavUtil.h"
   13.10 -
   13.11 -void
   13.12 -generate_wav(const char * pcmfilename, const char * samplewavfilename, const char * outputwavfilename)
   13.13 -{
   13.14 -  char outfilename[2048];
   13.15 -  SNDFILE * outfile ;
   13.16 -  SNDFILE * wavfile ;
   13.17 -  SNDFILE * pcmfile ;
   13.18 -  SF_INFO wavinfo ;
   13.19 -  SF_INFO pcminfo ;
   13.20 -  int buff;
   13.21 -  SF_INSTRUMENT inst ;
   13.22 -  
   13.23 -  memset (&wavinfo, 0, sizeof (wavinfo)) ;
   13.24 -
   13.25 -  
   13.26 -  wavfile = sf_open(samplewavfilename, SFM_READ, &wavinfo);
   13.27 -
   13.28 -  if (wavfile == NULL){      
   13.29 -    printf ("\nERROR : Not able to open wav file named '%s' : %s/\n", samplewavfilename, sf_strerror (NULL)) ;
   13.30 -    exit (1) ;
   13.31 -  } ;
   13.32 -
   13.33 -  printf("WAV format: %x\n", wavinfo.format);
   13.34 -
   13.35 -  if (!((wavinfo.format & SF_FORMAT_PCM_16) && (wavinfo.channels == 1) && 
   13.36 -        (wavinfo.format & SF_FORMAT_WAV))){
   13.37 -    printf("\nERROR : .wav file must be SF_FORMAT_PCM_16 in mono\n");
   13.38 -  }
   13.39 -
   13.40 -  pcminfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
   13.41 -  pcminfo.samplerate = wavinfo.samplerate;
   13.42 -  pcminfo.channels = wavinfo.channels;
   13.43 -
   13.44 -  pcmfile = sf_open(pcmfilename, SFM_READ, &pcminfo);
   13.45 -
   13.46 -  if (pcmfile == NULL){      
   13.47 -    printf ("\nERROR : Not able to open pcm file named '%s' : %s/\n", pcmfilename, sf_strerror (NULL)) ;
   13.48 -    exit (1) ;
   13.49 -  } ;
   13.50 -
   13.51 -
   13.52 -
   13.53 -  outfile = sf_open(outputwavfilename, SFM_WRITE, &wavinfo);
   13.54 -
   13.55 -  memset (&inst, 0, sizeof (inst)) ;
   13.56 -
   13.57 -  for(int i = SF_STR_FIRST; i <= SF_STR_LAST; i = i + 1) { 
   13.58 -    const char * str =  sf_get_string(wavfile,i);
   13.59 -    if(str != NULL) {
   13.60 -      sf_set_string(outfile,i,str);
   13.61 -    }
   13.62 -  }
   13.63 -  
   13.64 -  if (outfile == NULL){      
   13.65 -    printf ("\nERROR : Not able to create wav file named '%s' : %s/\n", outfilename, sf_strerror (NULL)) ;
   13.66 -    exit (1) ;
   13.67 -  } ;
   13.68 -
   13.69 -  while(sf_read_int(pcmfile, &buff, 1) == 1){
   13.70 -    if(sf_write_int(outfile, &buff, 1) != 1){
   13.71 -      printf("\nERROR : unable to write to '%s' : %s/\n", outfilename, sf_strerror(NULL));
   13.72 -    }
   13.73 -  }
   13.74 -  
   13.75 -  sf_close (wavfile) ;
   13.76 -  sf_close (outfile) ;
   13.77 -  sf_close (pcmfile) ;
   13.78 -  
   13.79 -}
   13.80 -
   13.81 -
   13.82 -void
   13.83 -generate_pcm (const char * wavfilename, const char * pcmfilename)
   13.84 -{
   13.85 -	SNDFILE * wavfile ;
   13.86 -	SNDFILE * pcmfile ;
   13.87 -	SF_INFO wavinfo ;
   13.88 -	SF_INFO pcminfo ;
   13.89 -	int buff;
   13.90 -
   13.91 -	memset (&wavinfo, 0, sizeof (wavinfo)) ;
   13.92 -	memset (&pcminfo, 0, sizeof (pcminfo)) ;
   13.93 -
   13.94 -	wavfile = sf_open (wavfilename, SFM_READ, &wavinfo) ;
   13.95 -
   13.96 -	if (wavfile == NULL){      
   13.97 -	  printf ("\nERROR : Not able to open wav file named '%s' : %s/\n", wavfilename, sf_strerror (NULL)) ;
   13.98 -	  exit (1) ;
   13.99 -	} ;
  13.100 -
  13.101 -	pcminfo.format = SF_FORMAT_RAW | SF_FORMAT_PCM_16;
  13.102 -	pcminfo.samplerate = wavinfo.samplerate;
  13.103 -	pcminfo.channels = wavinfo.channels;
  13.104 -
  13.105 -	if ((!wavinfo.format & SF_FORMAT_PCM_16) || (!wavinfo.channels == 1)){
  13.106 -	  printf("\nERROR : .wav file must be SF_FORMAT_PCM_16 and mono\n");
  13.107 -	}
  13.108 -
  13.109 -	pcmfile = sf_open (pcmfilename, SFM_WRITE, &pcminfo) ;
  13.110 -
  13.111 -	if (pcmfile == NULL){      
  13.112 -	  printf ("\nERROR : Not able to create pcm file named '%s' : %s/\n", pcmfilename, sf_strerror (NULL)) ;
  13.113 -	  exit (1) ;
  13.114 -	} ;
  13.115 -	
  13.116 -	while(sf_read_int(wavfile, &buff, 1) == 1){
  13.117 -	  if(sf_write_int(pcmfile, &buff, 1) != 1){
  13.118 -	    printf("\nERROR : unable to write to '%s' : %s/\n", pcmfilename, sf_strerror(NULL));
  13.119 -	  }
  13.120 -	}
  13.121 -
  13.122 -	sf_close (wavfile) ;
  13.123 -	sf_close (pcmfile) ;
  13.124 -} 
  13.125 -
  13.126 -
  13.127 -
  13.128 -
    14.1 --- a/SndfileWavUtil.h	Tue Apr 27 22:55:55 2010 -0400
    14.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.3 @@ -1,9 +0,0 @@
    14.4 -#ifndef _SNDFILE_WAV_UTIL_
    14.5 -#define _SNDFILE_WAV_UTIL_
    14.6 -
    14.7 -int guess_direction (const char * filename1, const char * filename2) ;
    14.8 -int guess_major_format (const char * filename) ;
    14.9 -void generate_pcm(const char * wavfilename, const char * pcmfilename);
   14.10 -void generate_wav(const char * pcmfilename, const char * samplewavfilename, const char * outputwavfilename);
   14.11 -
   14.12 -#endif
    15.1 --- a/audio_pipeline_default.awb	Tue Apr 27 22:55:55 2010 -0400
    15.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.3 @@ -1,10 +0,0 @@
    15.4 -%name Default Audio Pipeline
    15.5 -%desc A basic copy-though audio pipeline
    15.6 -
    15.7 -%provides audio_pipeline
    15.8 -
    15.9 -%attributes 6_375
   15.10 -
   15.11 -%public AudioPipelineDefault.bsv
   15.12 -
   15.13 -
    16.1 --- a/audio_processor_hardware_system.awb	Tue Apr 27 22:55:55 2010 -0400
    16.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.3 @@ -1,19 +0,0 @@
    16.4 -%name Audio Processor Application
    16.5 -%desc Top level audio processor. This module wraps an Audio Pipeline, providing communications between host and audio processor
    16.6 -
    16.7 -%provides connected_application
    16.8 -
    16.9 -%requires audio_processor_types
   16.10 -%requires audio_pipeline
   16.11 -
   16.12 -%attributes 6_375
   16.13 -
   16.14 -%sources -t H    -v PUBLIC  AudioProcessor.h
   16.15 -%sources -t H    -v PUBLIC  AudioProcessorRRR.h
   16.16 -%sources -t H    -v PUBLIC  SndfileWavUtil.h
   16.17 -%sources -t BSV  -v PUBLIC  AudioProcessor.bsv
   16.18 -%sources -t CPP  -v PRIVATE AudioProcessor.cpp
   16.19 -%sources -t CPP  -v PRIVATE AudioProcessorRRR.cpp
   16.20 -%sources -t CPP  -v PRIVATE SndfileWavUtil.cpp
   16.21 -%sources -t RRR  -v PUBLIC  AudioProcessorRRR.rrr
   16.22 -%library /usr/lib/libsndfile.so
    17.1 --- a/audio_processor_software_system.awb	Tue Apr 27 22:55:55 2010 -0400
    17.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.3 @@ -1,16 +0,0 @@
    17.4 -********************************************************************
    17.5 -* Awb module specification
    17.6 -********************************************************************
    17.7 -
    17.8 -%AWB_START
    17.9 -
   17.10 -%name Audio Processor Software
   17.11 -%desc Audio Processor Software 
   17.12 -%provides software_system
   17.13 -
   17.14 -%attributes 6_375
   17.15 -
   17.16 -%public AudioProcessor.cpp
   17.17 -%public AudioProcessor.h
   17.18 -
   17.19 -%AWB_END
    18.1 --- a/audio_processor_types.awb	Tue Apr 27 22:55:55 2010 -0400
    18.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.3 @@ -1,9 +0,0 @@
    18.4 -%name Audio Processor Types
    18.5 -%desc Audio Processing Pipeline Types
    18.6 -
    18.7 -%provides audio_processor_types
    18.8 -
    18.9 -%attributes 6_375
   18.10 -
   18.11 -%public AudioProcessorTypes.bsv
   18.12 -