Mercurial > pygar
comparison modules/bluespec/Pygar/core/AudioCoreRRR.cpp @ 23:90197e3375e2 pygar svn.24
[svn r24] added testing, but something is wrong with our c++ file.
author | rlm |
---|---|
date | Wed, 28 Apr 2010 08:19:09 -0400 |
parents | 0cfbb1e2de22 |
children | 220c14f5963c |
comparison
equal
deleted
inserted
replaced
22:0cfbb1e2de22 | 23:90197e3375e2 |
---|---|
17 // constructor | 17 // constructor |
18 AUDIOCORERRR_SERVER_CLASS::AUDIOCORERRR_SERVER_CLASS() : | 18 AUDIOCORERRR_SERVER_CLASS::AUDIOCORERRR_SERVER_CLASS() : |
19 serverStub(new AUDIOCORERRR_SERVER_STUB_CLASS(this)) | 19 serverStub(new AUDIOCORERRR_SERVER_STUB_CLASS(this)) |
20 { | 20 { |
21 // instantiate stub | 21 // instantiate stub |
22 printf("AUDIOCORERRR init called\n"); | 22 |
23 printf("rlm: init called\n\n"); | |
23 outputFile = NULL; | 24 outputFile = NULL; |
24 memory = NULL; | 25 memory = NULL; |
25 fflush(stdout); | 26 fflush(stdout); |
26 } | 27 } |
27 | 28 |
28 // destructor | 29 // destructor |
29 AUDIOCORERRR_SERVER_CLASS::~AUDIOCORERRR_SERVER_CLASS() | 30 AUDIOCORERRR_SERVER_CLASS::~AUDIOCORERRR_SERVER_CLASS() |
30 { | 31 { |
32 printf("rlm: AUDIOCORERRR_SERVER_CLASS::~AUDIOCORERRR_SERVER_CLASS()\n"); | |
31 Cleanup(); | 33 Cleanup(); |
32 } | 34 } |
33 | 35 |
34 // init | 36 // init |
35 void | 37 void |
36 AUDIOCORERRR_SERVER_CLASS::Init(PLATFORMS_MODULE p) | 38 AUDIOCORERRR_SERVER_CLASS::Init(PLATFORMS_MODULE p) |
37 { | 39 { |
38 parent = p; | 40 printf("rlm: AUDIOCORERRR_SERVER_CLASS::Init(PLATFORMS_MODULE p)\n"); |
41 parent = p; | |
39 } | 42 } |
40 | 43 |
41 // uninit | 44 // uninit |
42 void | 45 void |
43 AUDIOCORERRR_SERVER_CLASS::Uninit() | 46 AUDIOCORERRR_SERVER_CLASS::Uninit() |
44 { | 47 { |
45 Cleanup(); | 48 printf("rlm: AUDIOCORERRR_SERVER_CLASS::Uninit()\n"); |
49 Cleanup(); | |
46 } | 50 } |
47 | 51 |
48 // cleanup | 52 // cleanup |
49 void | 53 void |
50 AUDIOCORERRR_SERVER_CLASS::Cleanup() | 54 AUDIOCORERRR_SERVER_CLASS::Cleanup() |
51 { | 55 { |
52 delete serverStub; | 56 printf("rlm: AUDIOCORERRR_SERVER_CLASS::Cleanup() \n\n"); |
57 delete serverStub; | |
53 } | 58 } |
54 | 59 |
55 | 60 |
56 // | 61 // |
57 // RRR service methods | 62 // RRR service methods |
59 | 64 |
60 UINT32 | 65 UINT32 |
61 AUDIOCORERRR_SERVER_CLASS::MemoryRequestLoad (UINT32 address) | 66 AUDIOCORERRR_SERVER_CLASS::MemoryRequestLoad (UINT32 address) |
62 { | 67 { |
63 UINT32 returnVal; | 68 UINT32 returnVal; |
64 | 69 printf("rlm: AUDIOCORERRR_SERVER_CLASS::MemoryRequestLoad (UINT32 address)\n"); |
65 if(memory == NULL) { | 70 if(memory == NULL) { |
66 memory = new FUNCP_SIMULATED_MEMORY_CLASS(); | 71 memory = new FUNCP_SIMULATED_MEMORY_CLASS(); |
67 } | 72 } |
68 | 73 |
69 | 74 |
72 } | 77 } |
73 | 78 |
74 void | 79 void |
75 AUDIOCORERRR_SERVER_CLASS::MemoryRequestStore (UINT32 address, UINT32 data) | 80 AUDIOCORERRR_SERVER_CLASS::MemoryRequestStore (UINT32 address, UINT32 data) |
76 { | 81 { |
82 printf("rlm: AUDIOCORERRR_SERVER_CLASS::MemoryRequestStore (UINT32 address, UINT32 data)\n"); | |
77 if(memory == NULL) { | 83 if(memory == NULL) { |
78 memory = new FUNCP_SIMULATED_MEMORY_CLASS(); | 84 memory = new FUNCP_SIMULATED_MEMORY_CLASS(); |
79 } | 85 } |
80 | 86 |
81 memory->Write(0,(UINT64) address, sizeof(UINT32), &data); | 87 memory->Write(0,(UINT64) address, sizeof(UINT32), &data); |
84 void | 90 void |
85 | 91 |
86 AUDIOCORERRR_SERVER_CLASS::SendProcessedStream(UINT16 control, UINT16 data) | 92 AUDIOCORERRR_SERVER_CLASS::SendProcessedStream(UINT16 control, UINT16 data) |
87 { | 93 { |
88 | 94 |
95 printf("rlm: SendProcessedStream called,\n"); | |
89 AudioProcessorControl audioProcessorControl = (AudioProcessorControl) control; | 96 AudioProcessorControl audioProcessorControl = (AudioProcessorControl) control; |
90 switch(control) { | 97 switch(control) { |
91 case EndOfFile: | 98 case EndOfFile: |
92 if(outputFile != NULL) { | 99 if(outputFile != NULL) { |
100 printf("rlm: FILE is NULL\n"); | |
93 fflush(outputFile); | 101 fflush(outputFile); |
94 fclose(outputFile); | 102 fclose(outputFile); |
95 outputFile = NULL; | 103 outputFile = NULL; |
96 } else { | 104 } else { |
105 printf("rlm: Opening file for output.\n"); | |
97 outputFile = fopen("out_hw.pcm","w"); | 106 outputFile = fopen("out_hw.pcm","w"); |
98 assert(outputFile); | 107 assert(outputFile); |
99 fflush(outputFile); | 108 fflush(outputFile); |
100 fclose(outputFile); | 109 fclose(outputFile); |
101 } | 110 } |
108 if(outputFile == NULL) { | 117 if(outputFile == NULL) { |
109 outputFile = fopen("out_hw.pcm","w"); | 118 outputFile = fopen("out_hw.pcm","w"); |
110 assert(outputFile); | 119 assert(outputFile); |
111 } | 120 } |
112 | 121 |
113 CONNECTED_APPLICATION_CLASS::UpdateSemaphore(); | 122 CONNECTED_APPLICATION_CLASS::UpdateSemaphore(); |
123 printf("rlm: writing data to out_hw.pcm\n"); | |
114 fwrite(&data, 2,1 , outputFile); | 124 fwrite(&data, 2,1 , outputFile); |
115 break; | 125 break; |
116 } | 126 } |
117 } | 127 } |