Changeset 27

Show
Ignore:
Timestamp:
11/28/04 13:23:07 (18 years ago)
Author:
pieterpalmers
Message:

- Fix the build problem (sorry guys)
- added some test functions to obtain plug and connection information

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freebob/src/avdevice.cpp

    r26 r27  
    108108                if (response != NULL) { 
    109109                        // this way of processing the table entries assumes that the subunit type is not "extended" 
     110                                 
     111                        // stop processing when a "not implemented" is received (according to spec) 
     112                        if((response[0]&0xFF000000) == AVC1394_RESPONSE_NOT_IMPLEMENTED) break; 
    110113                         
    111114                        // warning: don't do unsigned int j! comparison >= 0 is always true for uint 
     
    129132                                                        case 0x0C: // music subunit 
    130133                                                                tmpAvDeviceSubunit=new AvDeviceMusicSubunit(this,subunit_id); 
     134                                                                { // just a test 
     135                                                                AvDeviceMusicSubunit tmpAvDeviceSubunit2(this,subunit_id); 
     136                                                                tmpAvDeviceSubunit2.printMusicPlugInfo(); 
     137                                                                tmpAvDeviceSubunit2.printMusicPlugConfigurations(); 
     138                                                                tmpAvDeviceSubunit2.test(); 
     139                                                                } 
    131140                                                        break; 
    132141                                                         
     
    138147                                                if(tmpAvDeviceSubunit && tmpAvDeviceSubunit->isValid()) { 
    139148                                                        cSubUnits.push_back(tmpAvDeviceSubunit); 
     149                                                         
     150                                                         
    140151                                                } else { 
    141152                                                        if (tmpAvDeviceSubunit) { 
     
    185196        response = avc1394_transaction_block(m_handle, iNodeId, request, request_len, 2); 
    186197        if (request != NULL) { 
    187                 debugPrint (DEBUG_LEVEL_TRANSFERS, "    Created...\n"); 
     198                debugPrint (DEBUG_LEVEL_TRANSFERS, "\n------- TRANSACTION START -------\n"); 
    188199                debugPrint (DEBUG_LEVEL_TRANSFERS,"  REQUEST:     "); 
    189200                /* request is in machine byte order. this function is for intel architecure */ 
     
    236247                debugPrint (DEBUG_LEVEL_TRANSFERS,"\n"); 
    237248        } 
     249        debugPrint (DEBUG_LEVEL_TRANSFERS, "------- TRANSACTION END -------\n"); 
    238250        return response; 
    239251 
  • trunk/freebob/src/avdevicemusicsubunit.cpp

    r26 r27  
    2828#include "avmusicidentifierdescriptor.h" 
    2929 
     30#define CORRECT_INTEGER_ENDIANNESS(value) (((((value)>>8) & 0xFF)) | ((((value)) & 0xFF)<<8)) 
    3031 
    3132void AvDeviceMusicSubunit::test() { 
     
    3435        quadlet_t *response; 
    3536         
     37        unsigned char opcr=0; 
     38         
     39        debugPrint(DEBUG_LEVEL_SUBUNIT,"AvDeviceMusicSubunit: Serial bus iso output plug connections:\n"); 
     40        for(opcr=0;opcr<0x1E;opcr++) {   
     41                request[0] = AVC1394_CTYPE_STATUS | ((iTarget & 0x1F) << 19) | ((iId & 0x07) << 16) 
     42                                                | (0x1A << 8) | 0xFF; 
     43                //request[1] = ((iTarget & 0x1F) << 27) | ((iId & 0x07) << 24) | 0x00FF7F; 
     44                request[1]=0xFFFEFF00 | opcr; 
     45                response = cParent->avcExecuteTransaction(request, 2, 4); 
     46                if ((response != NULL) && ((response[0]&0xFF000000)==0x0C000000)) { 
     47                        unsigned char output_status=(response[0]&0xE0) >> 5; 
     48                        unsigned char conv=(response[0]&0x10) >> 4; 
     49                        unsigned char signal_status=(response[0]&0x0F); 
     50                         
     51                        unsigned int signal_source=((response[1]>>16)&0xFFFF); 
     52                        unsigned int signal_destination=((response[1])&0xFFFF); 
     53                        debugPrint(DEBUG_LEVEL_SUBUNIT,"  oPCR %d: output_status=%d,conv=%d,signal_status=%d,signal_source=0x%04X,signal_destination=0x%04X\n",opcr,output_status,conv,signal_status,signal_source,signal_destination); 
     54                } 
     55        } 
     56        debugPrint(DEBUG_LEVEL_SUBUNIT,"AvDeviceMusicSubunit: Serial bus external output plug connections:\n"); 
     57        for(opcr=0x80;opcr<0x9E;opcr++) {        
     58                request[0] = AVC1394_CTYPE_STATUS | ((iTarget & 0x1F) << 19) | ((iId & 0x07) << 16) 
     59                                                | (0x1A << 8) | 0xFF; 
     60                //request[1] = ((iTarget & 0x1F) << 27) | ((iId & 0x07) << 24) | 0x00FF7F; 
     61                request[1]=0xFFFEFF00 | opcr; 
     62                response = cParent->avcExecuteTransaction(request, 2, 4); 
     63                if ((response != NULL) && ((response[0]&0xFF000000)==0x0C000000)) { 
     64                        unsigned char output_status=(response[0]&0xE0) >> 5; 
     65                        unsigned char conv=(response[0]&0x10) >> 4; 
     66                        unsigned char signal_status=(response[0]&0x0F); 
     67                         
     68                        unsigned int signal_source=((response[1]>>16)&0xFFFF); 
     69                        unsigned int signal_destination=((response[1])&0xFFFF); 
     70                        debugPrint(DEBUG_LEVEL_SUBUNIT,"  oPCR %02X: output_status=%d,conv=%d,signal_status=%d,signal_source=0x%04X,signal_destination=0x%04X\n",opcr,output_status,conv,signal_status,signal_source,signal_destination); 
     71                } 
     72        } 
     73 
     74} 
     75void AvDeviceMusicSubunit::printMusicPlugConfigurations() { 
     76        unsigned char byte; 
     77        quadlet_t request[6]; 
     78        quadlet_t *response; 
     79         
     80        unsigned int subunit_plug_id; 
     81         
     82        debugPrint(DEBUG_LEVEL_SUBUNIT,"AvDeviceMusicSubunit: Source Plug configurations:\n"); 
     83                 
     84        for (subunit_plug_id=0;subunit_plug_id < getNbSourcePlugs() ;subunit_plug_id++) { 
     85                // get source plug configure status 
     86                request[0] = AVC1394_CTYPE_STATUS | ((iTarget & 0x1F) << 19) | ((iId & 0x07) << 16) 
     87                                                | (0x43 << 8) | subunit_plug_id; 
     88                request[1] = 0xFFFFFF00; 
     89                request[2] = 0x0000FFFF; 
     90                request[3] = 0xFFFFFFFF; 
     91                response = cParent->avcExecuteTransaction(request, 1, 4); 
     92                if (response != NULL) { 
     93                         
     94                        unsigned int start_of_music_plug_ID=CORRECT_INTEGER_ENDIANNESS(response[1]); 
     95                        unsigned int end_of_music_plug_ID=CORRECT_INTEGER_ENDIANNESS(response[1]>>16); 
     96                         
     97                        debugPrint(DEBUG_LEVEL_SUBUNIT," Subunit source plug %d: start_of_music_plug_ID=%d, end_of_music_plug_ID=%d\n",subunit_plug_id,start_of_music_plug_ID,end_of_music_plug_ID); 
     98                         
     99                        unsigned char *table_pointer=((unsigned char *)response)+8; 
     100                         
     101                        for(unsigned int i=0;i<(end_of_music_plug_ID-start_of_music_plug_ID)+1;i++) { 
     102                                unsigned char music_plug_type=(*(table_pointer)) & 0xFF; 
     103                                unsigned int music_plug_ID=((*(table_pointer+1))<<8)+((*(table_pointer+2))); 
     104                                unsigned int stream_position=((*(table_pointer+3))<<8)+((*(table_pointer+4))); 
     105                                 
     106                                debugPrint(DEBUG_LEVEL_SUBUNIT,"  %02d: Type=0x%02X, ID=%02d, Position=0x%04X\n",i+start_of_music_plug_ID,music_plug_type,music_plug_ID,stream_position); 
     107                                 
     108                                table_pointer+=5; 
     109                        } 
     110                } 
     111        } 
     112         
     113        debugPrint(DEBUG_LEVEL_SUBUNIT,"AvDeviceMusicSubunit: Destination Plug configurations:\n"); 
     114        for (subunit_plug_id=0;subunit_plug_id < getNbDestinationPlugs() ;subunit_plug_id++) { 
     115                // get source plug configure status 
     116                request[0] = AVC1394_CTYPE_STATUS | ((iTarget & 0x1F) << 19) | ((iId & 0x07) << 16) 
     117                                                | (0x42 << 8) | subunit_plug_id; 
     118                request[1] = 0xFFFFFF00; 
     119                request[2] = 0x0000FFFF; 
     120                request[3] = 0xFFFFFFFF; 
     121                response = cParent->avcExecuteTransaction(request, 1, 4); 
     122                if (response != NULL) { 
     123                         
     124                        unsigned int start_of_music_plug_ID=CORRECT_INTEGER_ENDIANNESS(response[1]); 
     125                        unsigned int end_of_music_plug_ID=CORRECT_INTEGER_ENDIANNESS(response[1]>>16); 
     126                         
     127                        debugPrint(DEBUG_LEVEL_SUBUNIT," Subunit destination plug %d: start_of_music_plug_ID=%d, end_of_music_plug_ID=%d\n",subunit_plug_id,start_of_music_plug_ID,end_of_music_plug_ID); 
     128                         
     129                        unsigned char *table_pointer=((unsigned char *)response)+8; 
     130                         
     131                        for(unsigned int i=0;i<(end_of_music_plug_ID-start_of_music_plug_ID)+1;i++) { 
     132                                unsigned char music_plug_type=(*(table_pointer)) & 0xFF; 
     133                                unsigned int music_plug_ID=((*(table_pointer+1))<<8)+((*(table_pointer+2))); 
     134                                unsigned int stream_position=((*(table_pointer+3))<<8)+((*(table_pointer+4))); 
     135                                 
     136                                debugPrint(DEBUG_LEVEL_SUBUNIT,"  %02d: Type=0x%02X, ID=%02d, Position=0x%04X\n",i+start_of_music_plug_ID,music_plug_type,music_plug_ID,stream_position); 
     137                                 
     138                                table_pointer+=5; 
     139                        } 
     140                } 
     141        }        
     142 
     143} 
     144 
     145void AvDeviceMusicSubunit::printMusicPlugInfo() { 
     146        unsigned char byte; 
     147        quadlet_t request[6]; 
     148        quadlet_t *response; 
     149         
     150        debugPrint(DEBUG_LEVEL_SUBUNIT,"AvDeviceMusicSubunit: Plug Information\n"); 
     151                 
     152        // get music plug info (verified & working) 
    36153        request[0] = AVC1394_CTYPE_STATUS | ((iTarget & 0x1F) << 19) | ((iId & 0x07) << 16) 
    37                                         | AVC1394_COMMAND_PLUG_INFO | 0x00
    38         request[1] = 0xFFFFFFFF
    39         response = cParent->avcExecuteTransaction(request, 2, 2); 
     154                                        | (0xC0 << 8) | 0xFF
     155        response = cParent->avcExecuteTransaction(request, 1, 4)
     156         
    40157        if (response != NULL) { 
    41                 iNbDestinationPlugs= (unsigned char) ((response[1]>>24) & 0xff); 
    42                 iNbSourcePlugs= (unsigned char) ((response[1]>>16) & 0xff); 
    43         } 
    44         debugPrint (DEBUG_LEVEL_SUBUNIT,"AvDeviceSubunit: %d source plugs, %d destination plugs\n",iNbSourcePlugs,iNbDestinationPlugs); 
    45          
    46  
    47 
     158                unsigned char *buffer=(unsigned char *) response; 
     159                buffer += 4; 
     160                unsigned char nb_items=*buffer; 
     161                buffer += 1; 
     162                for (unsigned int i=0;i<nb_items;i++) { 
     163                        unsigned int nb_output_plugs=CORRECT_INTEGER_ENDIANNESS(*((unsigned int *)(buffer + 3))); 
     164                        unsigned int nb_input_plugs=CORRECT_INTEGER_ENDIANNESS(*((unsigned int *)(buffer + 1))); 
     165                        debugPrint(DEBUG_LEVEL_SUBUNIT," Music plug type 0x%02X: %d input plugs / %d output plugs\n",*buffer,nb_input_plugs,nb_output_plugs) 
     166                        buffer +=5; 
     167                } 
     168        } 
     169 
     170
     171 
    48172 
    49173AvDeviceMusicSubunit::AvDeviceMusicSubunit(AvDevice *parent, unsigned char  id) : AvDeviceSubunit(parent,0x0C,id) 
  • trunk/freebob/src/avdevicemusicsubunit.h

    r26 r27  
    3535 
    3636    void test(); 
     37    // functions to demonstrate the usage of the commands defined by the specs 
     38    // we'll see later what to do with them exactly 
     39    void printMusicPlugInfo(); 
     40    void printMusicPlugConfigurations(); 
    3741     
    3842 private: 
  • trunk/freebob/src/avdevicesubunit.h

    r26 r27  
    3737 protected: 
    3838        bool bValid;     
    39     
    40  private: 
    4139        unsigned char iNbDestinationPlugs; 
    4240        unsigned char iNbSourcePlugs; 
     
    4543    unsigned char iId; 
    4644    AvDevice *cParent; 
     45    
     46 private: 
    4747 
    4848}; 
  • trunk/freebob/src/debugmodule.h

    r26 r27  
    3333#define DEBUG_LEVEL_TRANSFERS           (1<<5) 
    3434 
    35 #define DEBUG_LEVEL  (DEBUG_LEVEL_INFO | DEBUG_LEVEL_DEVICE | DEBUG_LEVEL_SUBUNIT) 
     35#define DEBUG_LEVEL_ALL  (DEBUG_LEVEL_INFO | DEBUG_LEVEL_DEVICE | DEBUG_LEVEL_SUBUNIT | DEBUG_LEVEL_DESCRIPTOR | DEBUG_LEVEL_INFOBLOCK | DEBUG_LEVEL_TRANSFERS ) 
     36 
     37#define DEBUG_LEVEL_MODERATE (DEBUG_LEVEL_INFO | DEBUG_LEVEL_DEVICE | DEBUG_LEVEL_SUBUNIT) 
     38 
     39#define DEBUG_LEVEL DEBUG_LEVEL_MODERATE 
     40 
    3641#define DEBUG 
    3742