Changeset 31 for trunk

Show
Ignore:
Timestamp:
11/28/04 14:11:36 (19 years ago)
Author:
wagi
Message:

emacs has complained about the whitespaces, so there we go: whitespace-cleanup.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/freebob/src/avaudioinfoblock.h

    r22 r31  
    1818 * MA 02111-1307 USA. 
    1919 */ 
    20   
     20 
    2121#include <string.h> 
    2222#include <errno.h> 
     
    4242protected: 
    4343        AvNameInfoBlock *cNameInfoBlock; 
    44 private:        
    45          
     44private: 
     45 
    4646}; 
    4747 
  • trunk/freebob/src/avaudiosyncinfoblock.h

    r22 r31  
    1818 * MA 02111-1307 USA. 
    1919 */ 
    20   
     20 
    2121 
    2222#include <string.h> 
     
    4141protected: 
    4242 
    43 private:        
    44          
     43private: 
     44 
    4545}; 
    4646 
  • trunk/freebob/src/avdescriptor.h

    r25 r31  
    2828    AvDescriptor(AvDevice *parent, quadlet_t target, unsigned int type); 
    2929    virtual ~AvDescriptor(); 
    30      
     30 
    3131    void Load(); 
    3232    bool isLoaded(); 
     
    4242    bool canWrite(); 
    4343    bool isValid(); 
    44      
     44 
    4545 protected: 
    4646    AvDevice *cParent; 
  • trunk/freebob/src/avdevice.cpp

    r27 r31  
    11/* avdevice.cpp 
    22 * Copyright (C) 2004 by Daniel Wagner, Pieter Palmers 
    3  *                        
    43 * 
    54 * This file is part of FreeBob. 
     
    3433 
    3534        // check to see if a device is really present? 
    36          
     35 
    3736        // probably initialisation would be better done here 
     37 
     38        // Port and node id are not distinct.  The node id 
     39        // can change after a bus reset, therefore the 
     40        // device id has to be taken for identifiction. 
    3841} 
    3942 
     
    4346 
    4447        m_handle = raw1394_new_handle(); 
    45         if ( !m_handle ) { 
    46             if ( !errno ) { 
    47                 debugPrint(DEBUG_LEVEL_DEVICE,  "libraw1394 not compatible.\n" ); 
    48             } else { 
    49                 perror ("Could not get 1394 handle"); 
    50                 debugPrint(DEBUG_LEVEL_DEVICE, "Is ieee1394 and raw1394 driver loaded?\n"); 
    51             } 
    52             return eFBRC_Creating1394HandleFailed; 
    53        
    54          
     48       if ( !m_handle ) { 
     49           if ( !errno ) { 
     50               debugPrint(DEBUG_LEVEL_DEVICE,  "libraw1394 not compatible.\n" ); 
     51           } else { 
     52               perror ("Could not get 1394 handle"); 
     53               debugPrint(DEBUG_LEVEL_DEVICE, "Is ieee1394 and raw1394 driver loaded?\n"); 
     54           } 
     55           return eFBRC_Creating1394HandleFailed; 
     56       
     57 
    5558        raw1394_set_userdata( m_handle, this ); 
    56          
     59 
    5760        if ( raw1394_set_port( m_handle,  m_iPort ) < 0 ) { 
    58             perror( "Could not set port" ); 
    59             return eFBRC_Setting1394PortFailed; 
    60        
     61           perror( "Could not set port" ); 
     62           return eFBRC_Setting1394PortFailed; 
     63       
    6164   } 
    62     
     65 
    6366   // enumerate the subunits present in this device, create an AvDeviceSubunit for them, and add this object to the cSubUnits vector 
    6467        unsigned char table_entry; 
    6568        unsigned char subunit_maxid; 
    6669        unsigned char subunit_type; 
    67         quadlet_t table_entries; // buffer these table entries, because the memory content pointed to by  
     70        quadlet_t table_entries; // buffer these table entries, because the memory content pointed to by 
    6871                                 // the response pointer can change due to other libraw operations on this handle 
    69          
     72 
    7073        quadlet_t request[6]; 
    7174        quadlet_t *response; 
    7275        AvDeviceSubunit *tmpAvDeviceSubunit=NULL; 
    73          
     76 
    7477        // check the number of I/O plugs 
    75          
     78 
    7679        request[0] = AVC1394_CTYPE_STATUS | AVC1394_SUBUNIT_TYPE_UNIT | AVC1394_SUBUNIT_ID_IGNORE 
    7780                                        | AVC1394_COMMAND_PLUG_INFO | 0x00; 
     
    9295                iNbAsyncSourcePlugs= (unsigned char) ((response[1]>>16) & 0xff); 
    9396        } 
    94          
     97 
    9598        debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: %d Isochronous source plugs, %d Isochronous destination plugs\n",iNbIsoSourcePlugs,iNbIsoDestinationPlugs); 
    9699        debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: %d External source plugs, %d External destination plugs\n",iNbExtSourcePlugs,iNbExtDestinationPlugs); 
    97100        debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: %d Asynchronous source plugs, %d Asynchronous destination plugs\n",iNbAsyncSourcePlugs,iNbAsyncDestinationPlugs); 
    98          
     101 
    99102        // create the subunits 
    100103        for (unsigned int i=0;i<8;i++) { // cycle through the 8 pages (max 32 subunits; 4 subunits/page) 
     
    103106                request[1] = 0xFFFFFFFF; 
    104107                response = avcExecuteTransaction(request, 6, 2); 
    105                  
     108 
    106109                table_entries=response[1]; 
    107                  
     110 
    108111                if (response != NULL) { 
    109112                        // this way of processing the table entries assumes that the subunit type is not "extended" 
    110                                  
     113 
    111114                        // stop processing when a "not implemented" is received (according to spec) 
    112115                        if((response[0]&0xFF000000) == AVC1394_RESPONSE_NOT_IMPLEMENTED) break; 
    113                          
     116 
    114117                        // warning: don't do unsigned int j! comparison >= 0 is always true for uint 
    115118                        for (int j=3;j>=0;j--) { // cycle through the 8 pages (max 32 subunits; 4 subunits/page) 
     
    118121                                subunit_type=(table_entry >> 3) & 0x1F; 
    119122                                //debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: Page %d, item %d: Table entry=0x%02X, subunit_maxid=0x%02X, subunit_type=0x%02X\n",i,j,table_entry,subunit_maxid,subunit_type); 
    120                                  
     123 
    121124                                // according to spec we could stop processing 
    122125                                // at the first 0xFF entry, but doing it this way 
     
    124127                                if (table_entry != 0xFF) { 
    125128                                        for (unsigned char subunit_id=0;subunit_id<subunit_maxid+1;subunit_id++) { 
    126                                                  
     129 
    127130                                                // only two types of specific subunits are supported: audio and music 
    128131                                                switch (subunit_type) { 
     
    139142                                                                } 
    140143                                                        break; 
    141                                                          
     144 
    142145                                                        default: // generic 
    143146                                                                tmpAvDeviceSubunit=new AvDeviceSubunit(this,subunit_type,subunit_id); 
    144147                                                        break; 
    145                                                 }  
    146                                                  
     148                                                } 
     149 
    147150                                                if(tmpAvDeviceSubunit && tmpAvDeviceSubunit->isValid()) { 
    148151                                                        cSubUnits.push_back(tmpAvDeviceSubunit); 
    149                                                          
    150                                                          
     152 
     153 
    151154                                                } else { 
    152155                                                        if (tmpAvDeviceSubunit) { 
    153                                                                 debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: Unsupported AvDeviceSubunit encountered. Page %d, item %d: Table entry=0x%02X, subunit_maxid=0x%02X, subunit_type=0x%02X, subunit_id=%0x02X\n",i,j,table_entry,subunit_maxid,subunit_id); 
    154          
     156                                                                debugPrint (DEBUG_LEVEL_DEVICE,"AvDevice: Unsupported AvDeviceSubunit encountered. Page %d, item %d: Table entry=0x%02X, subunit_maxid=0x%02X, subunit_type=0x%02X, subunit_id=%0x02X\n",i,j,table_entry,subunit_maxid,subunit_type,subunit_id); 
     157 
    155158                                                                delete tmpAvDeviceSubunit; 
    156159                                                        } else { 
     
    163166                } 
    164167        } 
    165     
     168 
    166169   m_bInitialised = true; 
    167170   return eFBRC_Success; 
    168          
     171 
    169172} 
    170173 
     
    182185 
    183186    if ( m_handle ) { 
    184         raw1394_destroy_handle( m_handle ); 
    185         m_handle = 0; 
     187       raw1394_destroy_handle( m_handle ); 
     188       m_handle = 0; 
    186189    } 
    187190} 
     
    209212                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); 
    210213                debugPrint (DEBUG_LEVEL_TRANSFERS,"\n"); 
    211         }       
     214        } 
    212215        if (response != NULL) { 
    213216                /* response is in order of receiving, i.e. msb first */ 
     
    237240                                debugPrint (DEBUG_LEVEL_TRANSFERS,"Changed              "); 
    238241                        break; 
    239                         case AVC1394_RESPONSE_INTERIM:          
     242                        case AVC1394_RESPONSE_INTERIM: 
    240243                                debugPrint (DEBUG_LEVEL_TRANSFERS,"Interim              "); 
    241244                        break; 
  • trunk/freebob/src/avdevice.h

    r26 r31  
    11/* avdevice.h 
    22 * Copyright (C) 2004 by Daniel Wagner, Pieter Palmers 
    3  *                        
     3 * 
    44 * 
    55 * This file is part of FreeBob. 
     
    3535    AvDevice(int node,int port); 
    3636    virtual ~AvDevice(); 
    37      
     37 
    3838    quadlet_t * avcExecuteTransaction(quadlet_t *request, unsigned int request_len, unsigned int response_len); 
    39      
     39 
    4040    FBReturnCodes AvDevice::Initialize(); 
    41      
     41 
    4242    bool AvDevice::isInitialised(); 
    43      
     43 
    4444 private: 
    45       int iNodeId; 
     45      int iNodeId; 
    4646        raw1394handle_t m_handle; 
    47         int m_iPort; 
     47       int m_iPort; 
    4848        bool m_bInitialised; 
    4949        vector<AvDeviceSubunit *> cSubUnits; 
    50          
    51       unsigned char iNbAsyncDestinationPlugs; 
    52       unsigned char iNbAsyncSourcePlugs; 
    53       unsigned char iNbIsoDestinationPlugs; 
    54       unsigned char iNbIsoSourcePlugs; 
    55       unsigned char iNbExtDestinationPlugs; 
    56       unsigned char iNbExtSourcePlugs; 
    57          
     50 
     51      unsigned char iNbAsyncDestinationPlugs; 
     52      unsigned char iNbAsyncSourcePlugs; 
     53      unsigned char iNbIsoDestinationPlugs; 
     54      unsigned char iNbIsoSourcePlugs; 
     55      unsigned char iNbExtDestinationPlugs; 
     56      unsigned char iNbExtSourcePlugs; 
     57 
    5858}; 
    5959 
  • trunk/freebob/src/avdeviceaudiosubunit.h

    r26 r31  
    3131    virtual ~AvDeviceAudioSubunit(); 
    3232 
    33     
     33 
    3434 private: 
    3535 
  • trunk/freebob/src/avdevicemusicsubunit.h

    r27 r31  
    3535 
    3636    void test(); 
     37 
    3738    // functions to demonstrate the usage of the commands defined by the specs 
    3839    // we'll see later what to do with them exactly 
     
    4243 private: 
    4344        AvMusicStatusDescriptor         *cStatusDescriptor; 
    44         AvMusicIdentifierDescriptor   *cIdentifierDescriptor; 
     45        AvMusicIdentifierDescriptor   *cIdentifierDescriptor; 
    4546}; 
    4647 
  • trunk/freebob/src/avdevicesubunit.cpp

    r26 r31  
    3636        quadlet_t request[6]; 
    3737        quadlet_t *response; 
    38          
     38 
    3939        cParent=parent; 
    4040        iTarget=target; 
     
    4242        iNbDestinationPlugs=0; 
    4343        iNbSourcePlugs=0; 
    44          
     44 
    4545        debugPrint (DEBUG_LEVEL_SUBUNIT,"AvDeviceSubunit target=%02X id=%02X created\n",target,id); 
    46          
     46 
    4747        if (!cParent) { 
    4848                debugPrint (DEBUG_LEVEL_SUBUNIT,"AvDeviceSubunit: parent == NULL!\n"); 
     
    5050                return; 
    5151        } 
    52          
     52 
    5353        bValid=true; 
    54          
     54 
    5555        // check the number of I/O plugs 
    56          
     56 
    5757        request[0] = AVC1394_CTYPE_STATUS | ((iTarget & 0x1F) << 19) | ((iId & 0x07) << 16) 
    5858                                        | AVC1394_COMMAND_PLUG_INFO | 0x00; 
     
    6464        } 
    6565        debugPrint (DEBUG_LEVEL_SUBUNIT,"AvDeviceSubunit: %d source plugs, %d destination plugs\n",iNbSourcePlugs,iNbDestinationPlugs); 
    66          
    67          
     66 
     67 
    6868} 
    6969 
     
    8585        return iNbSourcePlugs; 
    8686} 
    87  
  • trunk/freebob/src/avmusicidentifierdescriptor.h

    r26 r31  
    1818 * MA 02111-1307 USA. 
    1919 */ 
    20   
     20 
    2121#include "avdevice.h" 
    2222#include "avdescriptor.h" 
     
    3535    AvMusicIdentifierDescriptor(AvDevice *parent, unsigned char id); 
    3636    ~AvMusicIdentifierDescriptor(); 
    37      
     37 
    3838    void printCapabilities(); 
    3939 
    4040 protected: 
    41          
     41 
    4242 private: 
    4343 
  • trunk/freebob/src/ieee1394service.h

    r21 r31  
    2828 
    2929/* XXX: add those to avc1394.h */ 
    30 #define AVC1394_SUBUNIT_TYPE_AUDIO (1 <<19)  
    31 #define AVC1394_SUBUNIT_TYPE_PRINTER (2 <<19)  
    32 #define AVC1394_SUBUNIT_TYPE_CA (6 <<19)  
    33 #define AVC1394_SUBUNIT_TYPE_PANEL (9 <<19)  
    34 #define AVC1394_SUBUNIT_TYPE_BULLETIN_BOARD (0xA <<19)  
    35 #define AVC1394_SUBUNIT_TYPE_CAMERA_STORAGE (0xB <<19)  
    36 #define AVC1394_SUBUNIT_TYPE_MUSIC (0xC <<19)  
     30#define AVC1394_SUBUNIT_TYPE_AUDIO (1 <<19) 
     31#define AVC1394_SUBUNIT_TYPE_PRINTER (2 <<19) 
     32#define AVC1394_SUBUNIT_TYPE_CA (6 <<19) 
     33#define AVC1394_SUBUNIT_TYPE_PANEL (9 <<19) 
     34#define AVC1394_SUBUNIT_TYPE_BULLETIN_BOARD (0xA <<19) 
     35#define AVC1394_SUBUNIT_TYPE_CAMERA_STORAGE (0xB <<19) 
     36#define AVC1394_SUBUNIT_TYPE_MUSIC (0xC <<19) 
    3737 
    3838#define AVC1394_SUBUNIT_MUSIC_CAPABILITY_GENERAL     (1<<0) 
     
    5353class Ieee1394Service { 
    5454 public: 
    55     Ieee1394Service(); 
    56     ~Ieee1394Service(); 
    57  
    5855    FBReturnCodes initialize(); 
    59     void shutdown();  
     56    void shutdown(); 
    6057 
    6158    static Ieee1394Service* instance(); 
     
    6562 
    6663 protected: 
    67     static int resetHandler( raw1394handle_t handle,  
     64    static int resetHandler( raw1394handle_t handle, 
    6865                             unsigned int iGeneration ); 
    6966    void setGenerationCount( unsigned int iGeneration ); 
     
    7673    void printRomDirectory( int iNodeId,  rom1394_directory* pRomDir ); 
    7774 private: 
     75    Ieee1394Service(); 
     76    ~Ieee1394Service(); 
     77 
    7878    static Ieee1394Service* m_pInstance; 
    7979    raw1394handle_t m_handle;