Sfoglia il codice sorgente

Print the unchunked_ext_msg bit in get_source_cap

A new bit was added to the Source Fixed Supply PDO in PD 3.0, saying
whether the source supports unchunked extended messages.  It's not
really relevant to the PD Buddy Sink since it itself doesn't support
them, but users might want to know and it's very little work to print
it, so now it does.
Clara Hobbs 6 anni fa
parent
commit
8126c4dc4d
3 ha cambiato i file con 20 aggiunte e 6 eliminazioni
  1. 7
    1
      docs/console_config.md
  2. 2
    0
      lib/include/pd.h
  3. 11
    5
      src/shell.c

+ 7
- 1
docs/console_config.md Vedi File

@@ -1,6 +1,6 @@
1 1
 # PD Buddy Sink Serial Console Configuration Interface
2 2
 
3
-Version 1.2.0-dev.1, 2018-01-10
3
+Version 1.2.0-dev.1, 2018-01-13
4 4
 
5 5
 The PD Buddy Sink can be put into setup mode by holding the Setup button while
6 6
 plugging it into a computer.  In this mode, the device runs a configuration
@@ -448,6 +448,12 @@ bit (B26).  If this field is not present, its value shall be assumed 0.
448 448
 The `dual_role_data` field holds the value of the PDO's Dual-Role Data bit
449 449
 (B25).  If this field is not present, its value shall be assumed 0.
450 450
 
451
+#### unchunked_ext_msg
452
+
453
+The `unchunked_ext_msg` field holds the value of the PDO's Unchunked Extended
454
+Messages Supported bit (B24).  If this field is not present, its value shall be
455
+assumed 0.
456
+
451 457
 #### peak_i
452 458
 
453 459
 The `peak_i` field holds the value of the PDO's Peak Current field (B21-20), in

+ 2
- 0
lib/include/pd.h Vedi File

@@ -165,6 +165,8 @@
165 165
 #define PD_PDO_SRC_FIXED_USB_COMMS (1 << PD_PDO_SRC_FIXED_USB_COMMS_SHIFT)
166 166
 #define PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT 25
167 167
 #define PD_PDO_SRC_FIXED_DUAL_ROLE_DATA (1 << PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT)
168
+#define PD_PDO_SRC_FIXED_UNCHUNKED_EXT_MSG_SHIFT 24
169
+#define PD_PDO_SRC_FIXED_UNCHUNKED_EXT_MSG (1 << PD_PDO_SRC_FIXED_UNCHUNKED_EXT_MSG_SHIFT)
168 170
 #define PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT 20
169 171
 #define PD_PDO_SRC_FIXED_PEAK_CURRENT (0x3 << PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT)
170 172
 #define PD_PDO_SRC_FIXED_VOLTAGE_SHIFT 10

+ 11
- 5
src/shell.c Vedi File

@@ -78,25 +78,31 @@ static void print_src_fixed_pdo(BaseSequentialStream *chp, uint32_t pdo)
78 78
         chprintf(chp, "\tusb_suspend: %d\r\n", tmp);
79 79
     }
80 80
 
81
-    /* Unconstrained power */
81
+    /* Unconstrained Power */
82 82
     tmp = (pdo & PD_PDO_SRC_FIXED_UNCONSTRAINED) >> PD_PDO_SRC_FIXED_UNCONSTRAINED_SHIFT;
83 83
     if (tmp) {
84 84
         chprintf(chp, "\tunconstrained_pwr: %d\r\n", tmp);
85 85
     }
86 86
 
87
-    /* USB communications capable */
87
+    /* USB Communications Capable */
88 88
     tmp = (pdo & PD_PDO_SRC_FIXED_USB_COMMS) >> PD_PDO_SRC_FIXED_USB_COMMS_SHIFT;
89 89
     if (tmp) {
90 90
         chprintf(chp, "\tusb_comms: %d\r\n", tmp);
91 91
     }
92 92
 
93
-    /* Dual-role data */
93
+    /* Dual-Role Data */
94 94
     tmp = (pdo & PD_PDO_SRC_FIXED_DUAL_ROLE_DATA) >> PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT;
95 95
     if (tmp) {
96 96
         chprintf(chp, "\tdual_role_data: %d\r\n", tmp);
97 97
     }
98 98
 
99
-    /* Peak current */
99
+    /* Unchunked Extended Messages Supported */
100
+    tmp = (pdo & PD_PDO_SRC_FIXED_UNCHUNKED_EXT_MSG) >> PD_PDO_SRC_FIXED_UNCHUNKED_EXT_MSG_SHIFT;
101
+    if (tmp) {
102
+        chprintf(chp, "\tunchunked_ext_msg: %d\r\n", tmp);
103
+    }
104
+
105
+    /* Peak Current */
100 106
     tmp = (pdo & PD_PDO_SRC_FIXED_PEAK_CURRENT) >> PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT;
101 107
     if (tmp) {
102 108
         chprintf(chp, "\tpeak_i: %d\r\n", tmp);
@@ -106,7 +112,7 @@ static void print_src_fixed_pdo(BaseSequentialStream *chp, uint32_t pdo)
106 112
     tmp = (pdo & PD_PDO_SRC_FIXED_VOLTAGE) >> PD_PDO_SRC_FIXED_VOLTAGE_SHIFT;
107 113
     chprintf(chp, "\tv: %d.%02d V\r\n", PD_PDV_V(tmp), PD_PDV_CV(tmp));
108 114
 
109
-    /* Maximum current */
115
+    /* Maximum Current */
110 116
     tmp = (pdo & PD_PDO_SRC_FIXED_CURRENT) >> PD_PDO_SRC_FIXED_CURRENT_SHIFT;
111 117
     chprintf(chp, "\ti: %d.%02d A\r\n", PD_PDI_A(tmp), PD_PDI_CA(tmp));
112 118
 }

Loading…
Annulla
Salva