Changeset 21
- Timestamp:
- 11/24/04 14:13:21 (18 years ago)
- Files:
-
- trunk/freebob/src/avdescriptor.cpp (modified) (4 diffs)
- trunk/freebob/src/avdescriptor.h (modified) (1 diff)
- trunk/freebob/src/avdevice.cpp (modified) (1 diff)
- trunk/freebob/src/avinfoblock.cpp (added)
- trunk/freebob/src/avinfoblock.h (added)
- trunk/freebob/src/avmusicidentifierdescriptor.cpp (added)
- trunk/freebob/src/avmusicidentifierdescriptor.h (added)
- trunk/freebob/src/avmusicstatusdescriptor.cpp (added)
- trunk/freebob/src/avmusicstatusdescriptor.h (added)
- trunk/freebob/src/debugmodule.h (modified) (1 diff)
- trunk/freebob/src/ieee1394service.cpp (modified) (3 diffs)
- trunk/freebob/src/ieee1394service.h (modified) (1 diff)
- trunk/freebob/src/Makefile.am (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/freebob/src/avdescriptor.cpp
r18 r21 163 163 iLength=response[2] & 0xFFFF; 164 164 165 //fprintf(stderr,"Descriptor length=0x%04X %d\n",*descriptor_length,*descriptor_length);165 fprintf(stderr,"Descriptor length=0x%04X %d\n",iLength,iLength); 166 166 167 167 // now get the rest of the descriptor … … 169 169 170 170 while(bytes_read<iLength) { 171 fprintf(stderr,"."); 171 172 // apparently the lib modifies the request, so redefine it completely 172 173 request[0] = AVC1394_CTYPE_CONTROL | qTarget … … 184 185 } 185 186 } 187 fprintf(stderr,"\n"); 188 186 189 187 190 bLoaded=true; 188 191 } 192 193 bool AvDescriptor::isPresent() { 194 quadlet_t *response; 195 quadlet_t request[2]; 196 197 if (!cParent) { 198 return false; 199 } 200 201 request[0] = AVC1394_CTYPE_STATUS | qTarget | AVC1394_COMMAND_OPEN_DESCRIPTOR | (iType & 0xFF); 202 request[1] = 0xFFFFFFFF; 203 response = cParent->avcExecuteTransaction(request, 2, 2); 204 205 if (((response[0] & 0xFF000000)==AVC1394_RESPONSE_NOT_IMPLEMENTED) || ((response[1] & 0xFF000000)==0x04)) { 206 fprintf(stderr,"Descriptor not present.\n"); 207 return false; 208 } 209 return true; 210 } 211 189 212 190 213 bool AvDescriptor::isOpen() { … … 215 238 if(cParent && bLoaded && aContents) { 216 239 word=(*(aContents+address)<<8)+*(aContents+address+1); 217 return *(aContents+address);240 return word; 218 241 } else { 219 242 return 0; // what to do with this? trunk/freebob/src/avdescriptor.h
r18 r21 42 42 bool canWrite(); 43 43 44 pr ivate:44 protected: 45 45 AvDevice *cParent; 46 46 unsigned int iType; trunk/freebob/src/avdevice.cpp
r18 r21 81 81 response = avc1394_transaction_block(m_handle, iNodeId, request, request_len, 2); 82 82 if (request != NULL) { 83 fprintf(stderr," REQUEST: "); 83 debugPrint (DEBUG_LEVEL_TRANSFERS, " Created...\n"); 84 debugPrint (DEBUG_LEVEL_TRANSFERS," REQUEST: "); 84 85 /* request is in machine byte order. this function is for intel architecure */ 85 86 for (i=0;i<request_len;i++) { 86 87 request_pos=(unsigned char *)(request+i); 87 fprintf(stderr, "0x%02X%02X%02X%02X ", *(request_pos),*(request_pos+1),*(request_pos+2),*(request_pos+3));88 debugPrint (DEBUG_LEVEL_TRANSFERS, "0x%02X%02X%02X%02X ", *(request_pos),*(request_pos+1),*(request_pos+2),*(request_pos+3)); 88 89 } 89 fprintf(stderr,"\n");90 fprintf(stderr," => ");91 fprintf(stderr," ");90 debugPrint (DEBUG_LEVEL_TRANSFERS,"\n"); 91 debugPrint (DEBUG_LEVEL_TRANSFERS," => "); 92 debugPrint (DEBUG_LEVEL_TRANSFERS," "); 92 93 request_pos=(unsigned char *)(request); 93 fprintf(stderr, "subunit_type=%02X subunit_id=%02X opcode=%02X",((*(request_pos+1))>>3)&0x1F,(*(request_pos+1))&0x07,(*(request_pos+2))&0xFF);94 fprintf(stderr,"\n");94 debugPrint (DEBUG_LEVEL_TRANSFERS, "subunit_type=%02X subunit_id=%02X opcode=%02X",((*(request_pos+1))>>3)&0x1F,(*(request_pos+1))&0x07,(*(request_pos+2))&0xFF); 95 debugPrint (DEBUG_LEVEL_TRANSFERS,"\n"); 95 96 } 96 97 if (response != NULL) { 97 98 /* response is in order of receiving, i.e. msb first */ 98 fprintf(stderr," -> RESPONSE: ");99 debugPrint (DEBUG_LEVEL_TRANSFERS," -> RESPONSE: "); 99 100 for (i=0;i<response_len;i++) { 100 fprintf(stderr, "0x%08X ", response[i]);101 debugPrint (DEBUG_LEVEL_TRANSFERS, "0x%08X ", response[i]); 101 102 } 102 fprintf(stderr,"\n");103 fprintf(stderr," => ");103 debugPrint (DEBUG_LEVEL_TRANSFERS,"\n"); 104 debugPrint (DEBUG_LEVEL_TRANSFERS," => "); 104 105 switch (response[0]&0xFF000000) { 105 106 case AVC1394_RESPONSE_NOT_IMPLEMENTED: 106 fprintf(stderr,"Not Implemented ");107 debugPrint (DEBUG_LEVEL_TRANSFERS,"Not Implemented "); 107 108 break; 108 109 case AVC1394_RESPONSE_ACCEPTED: 109 fprintf(stderr,"Accepted ");110 debugPrint (DEBUG_LEVEL_TRANSFERS,"Accepted "); 110 111 break; 111 112 case AVC1394_RESPONSE_REJECTED: 112 fprintf(stderr,"Rejected ");113 debugPrint (DEBUG_LEVEL_TRANSFERS,"Rejected "); 113 114 break; 114 115 case AVC1394_RESPONSE_IN_TRANSITION: 115 fprintf(stderr,"In Transition ");116 debugPrint (DEBUG_LEVEL_TRANSFERS,"In Transition "); 116 117 break; 117 118 case AVC1394_RESPONSE_IMPLEMENTED: 118 fprintf(stderr,"Implemented / Stable ");119 debugPrint (DEBUG_LEVEL_TRANSFERS,"Implemented / Stable "); 119 120 break; 120 121 case AVC1394_RESPONSE_CHANGED: 121 fprintf(stderr,"Changed ");122 debugPrint (DEBUG_LEVEL_TRANSFERS,"Changed "); 122 123 break; 123 124 case AVC1394_RESPONSE_INTERIM: 124 fprintf(stderr,"Interim ");125 debugPrint (DEBUG_LEVEL_TRANSFERS,"Interim "); 125 126 break; 126 127 default: 127 fprintf(stderr,"Unknown response ");128 debugPrint (DEBUG_LEVEL_TRANSFERS,"Unknown response "); 128 129 break; 129 130 } 130 fprintf(stderr, "subunit_type=%02X subunit_id=%02X opcode=%02X",(response[0]>>19)&0x1F,(response[0]>>16)&0x07,(response[0]>>8)&0xFF);131 fprintf(stderr,"\n");131 debugPrint (DEBUG_LEVEL_TRANSFERS, "subunit_type=%02X subunit_id=%02X opcode=%02X",(response[0]>>19)&0x1F,(response[0]>>16)&0x07,(response[0]>>8)&0xFF); 132 debugPrint (DEBUG_LEVEL_TRANSFERS,"\n"); 132 133 } 133 134 return response; trunk/freebob/src/debugmodule.h
r18 r21 25 25 #include "ieee1394service.h" 26 26 27 #define DEBUG_LEVEL_INFO 5 27 #define DEBUG_LEVEL_INFO 5 28 #define DEBUG_LEVEL_TRANSFERS 6 29 30 #define DEBUG_LEVEL DEBUG_LEVEL_INFO 28 31 29 32 #define debugError(format, args...) fprintf( stderr, format, ##args ) 30 #define debugPrint(Level, format, args...) printf( format, ##args ) 33 #define debugPrint(Level, format, args...) if(DEBUG_LEVEL>=Level) printf( format, ##args ); 34 35 unsigned char toAscii(unsigned char c); 36 void quadlet2char(quadlet_t quadlet,unsigned char* buff); 37 void hexDump(unsigned char *data_start, unsigned int length); 38 31 39 32 40 #endif trunk/freebob/src/ieee1394service.cpp
r19 r21 27 27 #include "avdevice.h" 28 28 #include "avdescriptor.h" 29 #include "avmusicidentifierdescriptor.h" 30 #include "avmusicstatusdescriptor.h" 31 #include "avinfoblock.h" 29 32 30 33 Ieee1394Service* Ieee1394Service::m_pInstance = 0; … … 145 148 // Remark: the AvDevice and AvDescriptor aren't debugged thouroughly yet! 146 149 // the following code is the only debug I had time for... to be continued! (later this week) 147 148 150 debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvDevice...\n"); 151 149 152 AvDevice *test=new AvDevice(m_iPort, iNodeId); 150 153 debugPrint (DEBUG_LEVEL_INFO, " Created...\n"); … … 157 160 debugPrint (DEBUG_LEVEL_INFO, " Opening...\n"); 158 161 testdesc->OpenReadOnly(); 159 160 161 debugPrint (DEBUG_LEVEL_INFO, " Closing...\n"); 162 163 debugPrint (DEBUG_LEVEL_INFO, " Loading...\n"); 164 165 testdesc->Load(); 166 167 debugPrint (DEBUG_LEVEL_INFO, " Trying to create another AvDescriptor...\n"); 168 AvDescriptor *testdesc2=new AvDescriptor(test,AVC1394_SUBUNIT_TYPE_MUSIC | AVC1394_SUBUNIT_ID_0,0x80); 169 debugPrint (DEBUG_LEVEL_INFO, " Created...\n"); 170 debugPrint (DEBUG_LEVEL_INFO, " Opening...\n"); 171 testdesc2->OpenReadOnly(); 172 173 debugPrint (DEBUG_LEVEL_INFO, " Loading...\n"); 174 175 testdesc2->Load(); 176 177 unsigned char *buff=new unsigned char[testdesc->getLength()]; 178 179 testdesc->readBuffer(0,testdesc->getLength(),buff); 180 debugPrint (DEBUG_LEVEL_INFO, " AvDescriptor 1 Contents:\n"); 181 182 hexDump(buff,testdesc->getLength()); 183 184 delete buff; 185 186 buff=new unsigned char[testdesc2->getLength()]; 187 188 testdesc2->readBuffer(0,testdesc2->getLength(),buff); 189 190 debugPrint (DEBUG_LEVEL_INFO, " AvDescriptor 2 Contents:\n"); 191 hexDump(buff,testdesc2->getLength()); 192 delete buff; 193 194 195 debugPrint (DEBUG_LEVEL_INFO, " Closing AvDescriptors...\n"); 196 162 197 testdesc->Close(); 163 164 debugPrint (DEBUG_LEVEL_INFO, " Deleting AvDescriptor...\n"); 198 testdesc2->Close(); 199 200 debugPrint (DEBUG_LEVEL_INFO, " Deleting AvDescriptors...\n"); 201 165 202 delete testdesc; 166 203 delete testdesc2; 204 205 // test the AvMusicIdentifierDescriptor 206 debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvMusicIdentifierDescriptor...\n"); 207 AvMusicIdentifierDescriptor *testdesc_mid=new AvMusicIdentifierDescriptor(test); 208 debugPrint (DEBUG_LEVEL_INFO, " Created...\n"); 209 testdesc_mid->printCapabilities(); 210 debugPrint (DEBUG_LEVEL_INFO, " Deleting AvMusicIdentifierDescriptor...\n"); 211 delete testdesc_mid; 212 213 // test the AvMusicStatusDescriptor 214 debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvMusicStatusDescriptor...\n"); 215 AvMusicStatusDescriptor *testdesc_mid2=new AvMusicStatusDescriptor(test); 216 debugPrint (DEBUG_LEVEL_INFO, " Created...\n"); 217 testdesc_mid2->printCapabilities(); 218 219 // test the AvInfoBlock 220 debugPrint (DEBUG_LEVEL_INFO, " Trying to create an AvInfoBlock...\n"); 221 222 AvInfoBlock *testblock1=new AvInfoBlock(testdesc_mid2,0); 223 debugPrint (DEBUG_LEVEL_INFO, " Length: 0x%04X (%d) Type: 0x%04X\n",testblock1->getLength(),testblock1->getLength(),testblock1->getType()); 224 225 debugPrint (DEBUG_LEVEL_INFO, " Trying to fetch next block...\n"); 226 // PP: might be better to have something like AvInfoBlock::moveToNextBlock(); 227 AvInfoBlock *testblock2=new AvInfoBlock(testdesc_mid2,2+testblock1->getLength()); 228 229 debugPrint (DEBUG_LEVEL_INFO, " Length: 0x%04X (%d) Type: 0x%04X\n",testblock2->getLength(),testblock2->getLength(),testblock2->getType()); 230 231 debugPrint (DEBUG_LEVEL_INFO, " Deleting AvInfoBlocks...\n"); 232 delete testblock1; 233 delete testblock2; 234 235 debugPrint (DEBUG_LEVEL_INFO, " Deleting AvMusicStatusDescriptor...\n"); 236 delete testdesc_mid2; 167 237 } 168 238 debugPrint (DEBUG_LEVEL_INFO, " Deleting AvDevice...\n"); trunk/freebob/src/ieee1394service.h
r17 r21 35 35 #define AVC1394_SUBUNIT_TYPE_CAMERA_STORAGE (0xB <<19) 36 36 #define AVC1394_SUBUNIT_TYPE_MUSIC (0xC <<19) 37 38 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_GENERAL (1<<0) 39 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIO (1<<1) 40 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_MIDI (1<<2) 41 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_SMPTE (1<<3) 42 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_SAMPLECOUNT (1<<4) 43 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC (1<<5) 44 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_RESERVED (1<<6) 45 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_MORE (1<<7) 46 47 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_NONBLOCKING (1<<0) 48 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_BLOCKING (1<<1) 49 50 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC_BUS (1<<0) 51 #define AVC1394_SUBUNIT_MUSIC_CAPABILITY_AUDIOSYNC_EXTERNAL (1<<0) 37 52 38 53 class Ieee1394Service { trunk/freebob/src/Makefile.am
r20 r21 37 37 avdescriptor.h \ 38 38 avdescriptor.cpp \ 39 avmusicidentifierdescriptor.h \ 40 avmusicidentifierdescriptor.cpp \ 41 avmusicstatusdescriptor.h \ 42 avmusicstatusdescriptor.cpp \ 43 avinfoblock.h \ 44 avinfoblock.cpp \ 39 45 debugmodule.cpp \ 40 46 main.cpp