Browse Source

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 years ago
parent
commit
8126c4dc4d
3 changed files with 20 additions and 6 deletions
  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 View File

1
 # PD Buddy Sink Serial Console Configuration Interface
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
 The PD Buddy Sink can be put into setup mode by holding the Setup button while
5
 The PD Buddy Sink can be put into setup mode by holding the Setup button while
6
 plugging it into a computer.  In this mode, the device runs a configuration
6
 plugging it into a computer.  In this mode, the device runs a configuration
448
 The `dual_role_data` field holds the value of the PDO's Dual-Role Data bit
448
 The `dual_role_data` field holds the value of the PDO's Dual-Role Data bit
449
 (B25).  If this field is not present, its value shall be assumed 0.
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
 #### peak_i
457
 #### peak_i
452
 
458
 
453
 The `peak_i` field holds the value of the PDO's Peak Current field (B21-20), in
459
 The `peak_i` field holds the value of the PDO's Peak Current field (B21-20), in

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

165
 #define PD_PDO_SRC_FIXED_USB_COMMS (1 << PD_PDO_SRC_FIXED_USB_COMMS_SHIFT)
165
 #define PD_PDO_SRC_FIXED_USB_COMMS (1 << PD_PDO_SRC_FIXED_USB_COMMS_SHIFT)
166
 #define PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT 25
166
 #define PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT 25
167
 #define PD_PDO_SRC_FIXED_DUAL_ROLE_DATA (1 << PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT)
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
 #define PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT 20
170
 #define PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT 20
169
 #define PD_PDO_SRC_FIXED_PEAK_CURRENT (0x3 << PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT)
171
 #define PD_PDO_SRC_FIXED_PEAK_CURRENT (0x3 << PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT)
170
 #define PD_PDO_SRC_FIXED_VOLTAGE_SHIFT 10
172
 #define PD_PDO_SRC_FIXED_VOLTAGE_SHIFT 10

+ 11
- 5
src/shell.c View File

78
         chprintf(chp, "\tusb_suspend: %d\r\n", tmp);
78
         chprintf(chp, "\tusb_suspend: %d\r\n", tmp);
79
     }
79
     }
80
 
80
 
81
-    /* Unconstrained power */
81
+    /* Unconstrained Power */
82
     tmp = (pdo & PD_PDO_SRC_FIXED_UNCONSTRAINED) >> PD_PDO_SRC_FIXED_UNCONSTRAINED_SHIFT;
82
     tmp = (pdo & PD_PDO_SRC_FIXED_UNCONSTRAINED) >> PD_PDO_SRC_FIXED_UNCONSTRAINED_SHIFT;
83
     if (tmp) {
83
     if (tmp) {
84
         chprintf(chp, "\tunconstrained_pwr: %d\r\n", tmp);
84
         chprintf(chp, "\tunconstrained_pwr: %d\r\n", tmp);
85
     }
85
     }
86
 
86
 
87
-    /* USB communications capable */
87
+    /* USB Communications Capable */
88
     tmp = (pdo & PD_PDO_SRC_FIXED_USB_COMMS) >> PD_PDO_SRC_FIXED_USB_COMMS_SHIFT;
88
     tmp = (pdo & PD_PDO_SRC_FIXED_USB_COMMS) >> PD_PDO_SRC_FIXED_USB_COMMS_SHIFT;
89
     if (tmp) {
89
     if (tmp) {
90
         chprintf(chp, "\tusb_comms: %d\r\n", tmp);
90
         chprintf(chp, "\tusb_comms: %d\r\n", tmp);
91
     }
91
     }
92
 
92
 
93
-    /* Dual-role data */
93
+    /* Dual-Role Data */
94
     tmp = (pdo & PD_PDO_SRC_FIXED_DUAL_ROLE_DATA) >> PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT;
94
     tmp = (pdo & PD_PDO_SRC_FIXED_DUAL_ROLE_DATA) >> PD_PDO_SRC_FIXED_DUAL_ROLE_DATA_SHIFT;
95
     if (tmp) {
95
     if (tmp) {
96
         chprintf(chp, "\tdual_role_data: %d\r\n", tmp);
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
     tmp = (pdo & PD_PDO_SRC_FIXED_PEAK_CURRENT) >> PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT;
106
     tmp = (pdo & PD_PDO_SRC_FIXED_PEAK_CURRENT) >> PD_PDO_SRC_FIXED_PEAK_CURRENT_SHIFT;
101
     if (tmp) {
107
     if (tmp) {
102
         chprintf(chp, "\tpeak_i: %d\r\n", tmp);
108
         chprintf(chp, "\tpeak_i: %d\r\n", tmp);
106
     tmp = (pdo & PD_PDO_SRC_FIXED_VOLTAGE) >> PD_PDO_SRC_FIXED_VOLTAGE_SHIFT;
112
     tmp = (pdo & PD_PDO_SRC_FIXED_VOLTAGE) >> PD_PDO_SRC_FIXED_VOLTAGE_SHIFT;
107
     chprintf(chp, "\tv: %d.%02d V\r\n", PD_PDV_V(tmp), PD_PDV_CV(tmp));
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
     tmp = (pdo & PD_PDO_SRC_FIXED_CURRENT) >> PD_PDO_SRC_FIXED_CURRENT_SHIFT;
116
     tmp = (pdo & PD_PDO_SRC_FIXED_CURRENT) >> PD_PDO_SRC_FIXED_CURRENT_SHIFT;
111
     chprintf(chp, "\ti: %d.%02d A\r\n", PD_PDI_A(tmp), PD_PDI_CA(tmp));
117
     chprintf(chp, "\ti: %d.%02d A\r\n", PD_PDI_A(tmp), PD_PDI_CA(tmp));
112
 }
118
 }

Loading…
Cancel
Save