functions for the communication between SOLID slow control modules and Cprograms

Dependents:   sscm SPItest sscm

Revision:
0:2afae79ea9ca
Child:
1:288db0531b1f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sscm_comm.h	Tue Sep 23 19:21:20 2014 +0000
@@ -0,0 +1,50 @@
+#ifndef SSCM_COMM_H
+#define SSCM_COMM_H
+
+
+#define SSCM_COMM_LIB_HDR_VERSION "1.00"
+
+
+#define MAXCMDLLENGTH 256
+namespace sscm_comm {
+//public :    
+
+enum ssc_dev{ ADC=1, DAC=2, TEMP=3};
+typedef  unsigned char u8;
+typedef  unsigned int u32;
+typedef struct {
+        u8 module; // 1 char 0 --F
+        u8 con;    // 1 char 0--2
+        ssc_dev dev; // 2 char 01--03
+        char cmd[4]; // 3 char 
+        u8 ch; // 2 char 00 -- FF  or register nr 
+        u32 datain; // 2 char 0000 -- FFFF
+        u32 dataout;// 2 char 00 -- FF
+    } ssc_cmd;
+
+const char  CMDSTART= '$';
+const char  CMDSTOP= '#';
+const char SEP=  ';';
+
+// decode the string sent to the uP to the original cmd structure , for the moment the input string is cleared 
+// param input :  input string at least char [30]
+// param ssc_cmd  the cmd structure to be filled 
+int  decode_cmd(char* input, ssc_cmd * sc);
+
+
+// param output the string to be sent to the SSCM 
+// param sc the cmd to be sent to the SSCM 
+void encode_cmd ( char *output , ssc_cmd *sc);
+    
+// to get info of the module nr , connector serial number for a given plane 
+// param  plane  plane nr for which the cmd coordinates has to be known
+// param modulenr  the module nr  ( first nr in the cmd structure 
+// param connr  connector number ( 1 or 2) 
+// param serailnr  the serial nr of the board ( can be used for verification) .
+
+void getmodulecordinate(u8 plane, u8& modulenr, u8& connr ,u8& serialnr );
+
+
+
+
+#endif