Changeset 5912:57ee7d410296 in roaraudio


Ignore:
Timestamp:
09/05/13 16:35:08 (6 years ago)
Author:
phi
Branch:
default
Message:

updated device type checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roard/driver_i2cdmx.c

    r5909 r5912  
    3333#define DEFAULT_DEVICE  "/dev/i2c-1" 
    3434 
    35 #define DEV_TYPE        0x00 /* FIXME */ 
    36 #define DEV_SUBTYPE     0x00 /* FIXME */ 
     35#define DEV_TYPE        0x01 /* RI2C_DEV_BRIDGE */ 
     36#define DEV_SUBTYPE     0x01 /* RI2C_SUBTYPE_BRIDGE_CONVERTER */ 
     37#define DEVSTATUS_READY 0x01 /* RI2C_STATUS0_DEVICE_READY */ 
     38#define CAPS0_DMX512    0x10 /* RI2C_CAPS0_BRIDGE_DMX512 */ 
    3739 
    3840#define MIN_ADDR        0x20 
     
    5254#define ADDR_PTYPE      (ADDR_BANK+11) 
    5355#define ADDR_PSUBTYPE   (ADDR_BANK+12) 
     56#define ADDR_CAPS0      (ADDR_BANK+13) 
    5457 
    5558#define COMMAND_DEVINFO 0x00 
     
    133136 
    134137 // test for device overall status 
    135  ret = __i2c_read(self, ADDR_IFVERSION); 
    136 // __check_response(ret, ret & 0x01, ROAR_ERROR_BADSTATE); 
     138 ret = __i2c_read(self, ADDR_DEVSTATUS); 
     139 __check_response(ret, ret & DEVSTATUS_READY, ROAR_ERROR_BADSTATE); 
    137140 
    138141 // Request device infos 
     
    146149 subtype = __i2c_read(self, ADDR_SUBTYPE); 
    147150 
    148  if ( __open_test_device_type(vendor, type, subtype) == 0 ) 
    149   return 0; 
    150  
    151  vendor  = __i2c_read(self, ADDR_PVENDOR); 
    152  type    = __i2c_read(self, ADDR_PTYPE); 
    153  subtype = __i2c_read(self, ADDR_PSUBTYPE); 
    154  
    155  return __open_test_device_type(vendor, type, subtype); 
     151 if ( __open_test_device_type(vendor, type, subtype) == -1 ) { 
     152  vendor  = __i2c_read(self, ADDR_PVENDOR); 
     153  type    = __i2c_read(self, ADDR_PTYPE); 
     154  subtype = __i2c_read(self, ADDR_PSUBTYPE); 
     155 
     156  if (  __open_test_device_type(vendor, type, subtype) == -1 ) 
     157   return -1; 
     158 } 
     159 
     160 // check for DMX512 support: 
     161 
     162 ret = __i2c_read(self, ADDR_CAPS0); 
     163 __check_response(ret, ret & CAPS0_DMX512, ROAR_ERROR_TYPEMM); 
     164 
     165 return 0; 
    156166} 
    157167 
Note: See TracChangeset for help on using the changeset viewer.