2 ## This file is part of the libsigrokdecode project.
4 ## Copyright (C) 2018 Elias Oenal <sigrok@eliasoenal.com>
5 ## All rights reserved.
7 ## Redistribution and use in source and binary forms, with or without
8 ## modification, are permitted provided that the following conditions are met:
10 ## 1. Redistributions of source code must retain the above copyright notice,
11 ## this list of conditions and the following disclaimer.
12 ## 2. Redistributions in binary form must reproduce the above copyright notice,
13 ## this list of conditions and the following disclaimer in the documentation
14 ## and/or other materials provided with the distribution.
16 ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 ## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 ## IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 ## ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20 ## LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 ## CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 ## SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 ## INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 ## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 ## ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 ## POSSIBILITY OF SUCH DAMAGE.
29 import sigrokdecode as srd
32 0x00: 'Unknown or unspecified',
34 0x02: 'Module/connector soldered to motherboard',
52 class Decoder(srd.Decoder):
56 longname = '100 Gigabit C form-factor pluggable'
57 desc = '100 Gigabit C form-factor pluggable (CFP) protocol.'
62 ('cfp-register', 'Register'),
63 ('cfp-decode', 'Decode'),
66 ('cfp-register', 'Register', (0,)),
67 ('cfp-decode', 'Decode', (1,)),
74 self.out_ann = self.register(srd.OUTPUT_ANN)
76 def decode(self, ss, es, data):
77 for (clause45, clause45_address, is_read, portad, devad, register) in data:
79 if clause45_address >= 0x8000 and clause45_address <= 0x807F:
80 self.put(ss, es, self.out_ann, [0, ['CFP NVR 1: Basic ID registers', 'NVR1']])
81 if clause45_address == 0x8000:
82 self.put(ss, es, self.out_ann, [1, ['Module identifier: %s' % MODULE_ID.get(register, 'Reserved')]])
83 elif clause45_address >= 0x8080 and clause45_address <= 0x80FF:
84 self.put(ss, es, self.out_ann, [0, ['CFP NVR 2: Extended ID registers', 'NVR2']])
85 elif clause45_address >= 0x8100 and clause45_address <= 0x817F:
86 self.put(ss, es, self.out_ann, [0, ['CFP NVR 3: Network lane specific registers', 'NVR3']])
87 elif clause45_address >= 0x8180 and clause45_address <= 0x81FF:
88 self.put(ss, es, self.out_ann, [0, ['CFP NVR 4', 'NVR4']])
89 elif clause45_address >= 0x8400 and clause45_address <= 0x847F:
90 self.put(ss, es, self.out_ann, [0, ['Vendor NVR 1: Vendor data registers', 'V-NVR1']])
91 elif clause45_address >= 0x8480 and clause45_address <= 0x84FF:
92 self.put(ss, es, self.out_ann, [0, ['Vendor NVR 2: Vendor data registers', 'V-NVR2']])
93 elif clause45_address >= 0x8800 and clause45_address <= 0x887F:
94 self.put(ss, es, self.out_ann, [0, ['User NVR 1: User data registers', 'U-NVR1']])
95 elif clause45_address >= 0x8880 and clause45_address <= 0x88FF:
96 self.put(ss, es, self.out_ann, [0, ['User NVR 2: User data registers', 'U-NVR2']])
97 elif clause45_address >= 0xA000 and clause45_address <= 0xA07F:
98 self.put(ss, es, self.out_ann, [0, ['CFP Module VR 1: CFP Module level control and DDM registers', 'Mod-VR1']])
99 elif clause45_address >= 0xA080 and clause45_address <= 0xA0FF:
100 self.put(ss, es, self.out_ann, [0, ['MLG VR 1: MLG Management Interface registers', 'MLG-VR1']])