Changeset 1444 for trunk


Ignore:
Timestamp:
09/17/11 21:53:11 (8 months ago)
Author:
stefanct
Message:

ichspi: improve prettyprint_opcodes

add headers for the columns and some decoding into human readable format.

Signed-off-by: Stefan Tauner <stefan.tauner@…>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ichspi.c

    r1443 r1444  
    295295static void prettyprint_opcodes(OPCODES *ops) 
    296296{ 
    297         if(ops == NULL) 
     297        OPCODE oc; 
     298        const char *t; 
     299        const char *a; 
     300        uint8_t i; 
     301        static const char *const spi_type[4] = { 
     302                "read  w/o addr", 
     303                "write w/o addr", 
     304                "read  w/  addr", 
     305                "write w/  addr" 
     306        }; 
     307        static const char *const atomic_type[3] = { 
     308                "none", 
     309                " 0  ", 
     310                " 1  " 
     311        }; 
     312 
     313        if (ops == NULL) 
    298314                return; 
    299315 
    300         msg_pdbg("preop0=0x%02x, preop1=0x%02x\n", ops->preop[0], 
    301                  ops->preop[1]); 
    302  
    303         OPCODE oc; 
    304         uint8_t i; 
     316        msg_pdbg2("        OP        Type      Pre-OP\n"); 
    305317        for (i = 0; i < 8; i++) { 
    306318                oc = ops->opcode[i]; 
    307                 msg_pdbg("op[%d]=0x%02x, %d, %d\n", 
    308                          i, 
    309                          oc.opcode, 
    310                          oc.spi_type, 
    311                          oc.atomic); 
    312         } 
     319                t = (oc.spi_type > 3) ? "invalid" : spi_type[oc.spi_type]; 
     320                a = (oc.atomic > 2) ? "invalid" : atomic_type[oc.atomic]; 
     321                msg_pdbg2("op[%d]: 0x%02x, %s, %s\n", i, oc.opcode, t, a); 
     322        } 
     323        msg_pdbg2("Pre-OP 0: 0x%02x, Pre-OP 1: 0x%02x\n", ops->preop[0], 
     324                 ops->preop[1]); 
    313325} 
    314326 
     
    673685                msg_pdbg("done\n"); 
    674686                prettyprint_opcodes(curopcodes); 
    675                 msg_pdbg("\n"); 
    676687                return 0; 
    677688        } 
Note: See TracChangeset for help on using the changeset viewer.