syntax = "proto3";

package sysmon;
import public "datatypes.proto";

service SysMonService {
    rpc GetTemperature (TempSelect) returns (sdr.datatypes.Float) {}
    rpc GetVoltage (VoltSelect) returns (sdr.datatypes.Float) {}
}

// enum IDs corresponding to sysfs numbers
message TempSelect {
    enum TempID {
        ps_rpu = 0;         // Channel Number 7
        ps_apu = 1;      	// Channel Number 8
        pl = 2;             // Channel Number 20
    }
    TempSelect.TempID select = 1;
}

message VoltSelect {
    enum VoltID {
        // Main channels
        main_pll = 0;       // Channel Number 0
        main_batt = 1;      // Channel Number 1
        main_int = 2;       // Channel Number 2
        main_ram = 3;       // Channel Number 3
        main_pl_aux = 4;    // Channel Number 4
        main_ddr_pll = 5;   // Channel Number 5
        main_int_ddr = 6;   // Channel Number 6

        // PS channels
        ps_int_lpd = 7;     // Channel Number 9
        ps_int_fpd = 8;     // Channel Number 10
        ps_aux = 9;         // Channel Number 11
        ps_addr = 10;       // Channel Number 12
        ps_io_3 = 11;       // Channel Number 13
        ps_io_0 = 12;       // Channel Number 14
        ps_io_1 = 13;       // Channel Number 15
        ps_io_2 = 14;       // Channel Number 16
        ps_trav_cc = 15;    // Channel Number 17
        ps_trav_tt = 16;    // Channel Number 18
        ps_adc = 17;        // Channel Number 19
        
        // PL channels (cutoff after 10 including temp)
        pl_int = 18;        // Channel Number 21
        pl_aux = 19;        // Channel Number 22
        pl_adc_p = 20;      // Channel Number 23
        pl_adc_n = 21;      // Channel Number 24
        pl_ram = 22;        // Channel Number 25
        pl_int_lpd = 23;    // Channel Number 26
        pl_int_fpd = 24;    // Channel Number 27
        pl_aux_sup = 25;    // Channel Number 28
        pl_adc = 26;        // Channel Number 29
    }
    VoltSelect.VoltID select = 1;
}

/*
(from https://github.com/Xilinx/linux-xlnx/blob/release-2020.2.2_k26/Documentation/devicetree/bindings/iio/adc/xilinx-ams.txt)

AMS Channels Details: 

Sysmon Block	|Channel|						Details									|Measurement
				 Number																	 Type
---------------------------------------------------------------------------------------------------------
AMS CTRL		|0		|System PLLs voltage measurement, VCC_PSPLL.					|Voltage
				|1		|Battery voltage measurement, VCC_PSBATT.						|Voltage
				|2		|PL Internal voltage measurement, VCCINT.						|Voltage
				|3		|Block RAM voltage measurement, VCCBRAM.						|Voltage
				|4		|PL Aux voltage measurement, VCCAUX.							|Voltage
				|5		|Voltage measurement for six DDR I/O PLLs, VCC_PSDDR_PLL.		|Voltage
				|6		|VCC_PSINTFP_DDR voltage measurement.							|Voltage
---------------------------------------------------------------------------------------------------------
PS Sysmon		|7		|LPD temperature measurement.									|Temperature
				|8		|FPD Temperature Measurment (REMOTE).							|Temperature
				|9		|VCC PS LPD voltage measurement (supply1).						|Voltage
				|10		|VCC PS FPD voltage measurement (supply2).						|Voltage
				|11		|PS Aux voltage reference (supply3).							|Voltage
				|12		|DDR I/O VCC voltage measurement.								|Voltage
				|13		|PS IO Bank 503 voltage measurement (supply5).					|Voltage
				|14		|PS IO Bank 500 voltage measurement (supply6).					|Voltage
				|15		|VCCO_PSIO1 voltage measurement.								|Voltage
				|16		|VCCO_PSIO2 voltage measurement.								|Voltage
				|17		|VCC_PS_GTR voltage measurement (VPS_MGTRAVCC).					|Voltage
				|18		|VTT_PS_GTR voltage measurement (VPS_MGTRAVTT).					|Voltage
				|19		|VCC_PSADC voltage measurement.									|Voltage
---------------------------------------------------------------------------------------------------------
PL Sysmon		|20		|PL Temperature measurement.									|Temperature
				|21		|PL Internal Voltage Voltage measurement, VCCINT.				|Voltage
				|22		|PL Auxiliary Voltage measurement, VCCAUX.						|Voltage
				|23		|ADC Reference P+ Voltage measurement.							|Voltage
				|24		|ADC Reference N- Voltage measurement.							|Voltage
				|25		|PL Block RAM Voltage measurement, VCCBRAM.						|Voltage
				|26		|LPD Internal Voltage measurement, VCC_PSINTLP (supply4).		|Voltage
				|27		|FPD Internal Voltage measurement, VCC_PSINTFP (supply5).		|Voltage
				|28		|PS Auxiliary Voltage measurement (supply6).					|Voltage
				|29		|PL VCCADC Voltage measurement (vccams).						|Voltage
				|30		|Differencial analog input signal Voltage measurment.			|Voltage
				|31		|VUser0 Voltage measurement (supply7).							|Voltage
				|32		|VUser1 Voltage measurement (supply8).							|Voltage
				|33		|VUser2 Voltage measurement (supply9).							|Voltage
				|34		|VUser3 Voltage measurement (supply10).							|Voltage
				|35		|Auxiliary ch 0 Voltage measurement (VAux0).					|Voltage
				|36		|Auxiliary ch 1 Voltage measurement (VAux1).					|Voltage
				|37		|Auxiliary ch 2 Voltage measurement (VAux2).					|Voltage
				|38		|Auxiliary ch 3 Voltage measurement (VAux3).					|Voltage
				|39		|Auxiliary ch 4 Voltage measurement (VAux4).					|Voltage
				|40		|Auxiliary ch 5 Voltage measurement (VAux5).					|Voltage
				|41		|Auxiliary ch 6 Voltage measurement (VAux6).					|Voltage
				|42		|Auxiliary ch 7 Voltage measurement (VAux7).					|Voltage
				|43		|Auxiliary ch 8 Voltage measurement (VAux8).					|Voltage
				|44		|Auxiliary ch 9 Voltage measurement (VAux9).					|Voltage
				|45		|Auxiliary ch 10 Voltage measurement (VAux10).					|Voltage
				|46		|Auxiliary ch 11 Voltage measurement (VAux11).					|Voltage
				|47		|Auxiliary ch 12 Voltage measurement (VAux12).					|Voltage
				|48		|Auxiliary ch 13 Voltage measurement (VAux13).					|Voltage
				|49		|Auxiliary ch 14 Voltage measurement (VAux14).					|Voltage
				|50		|Auxiliary ch 15 Voltage measurement (VAux15).					|Voltage
---------------------------------------------------------------------------------------------------------
*/