/[PAMELA software]/tracker/ground/source/readraw/trkalarmpkt.c
ViewVC logotype

Contents of /tracker/ground/source/readraw/trkalarmpkt.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Wed Mar 8 15:00:39 2006 UTC (18 years, 9 months ago) by pam-fi
Branch: MAIN, trk-ground
CVS Tags: R3v02, HEAD
Changes since 1.1: +0 -0 lines
File MIME type: text/plain
First CVS release of tracker ground software (R3v02) 

1
2
3 #include <stdio.h> /* include standard i/o library */
4 #include <stdlib.h> /* include standard library */
5
6
7 struct trk_ControlRegister{
8
9 unsigned int TrigMask:2;
10 unsigned int DSPMask:6;
11 unsigned int DSPBusy:6;
12
13 unsigned int FlashShutdown:1;
14 unsigned int FlashOn:1;
15 unsigned int FlashUpset:1;
16 unsigned int FlashData:1;
17
18 unsigned int InterCheck:1;
19 unsigned int FinalCheck:1;
20
21 unsigned int UnknownCmd:1;
22 unsigned int CmdDuringTrig:1;
23
24 unsigned int DSPSoft:6;
25
26 unsigned int CmdIDMA:6;
27 unsigned int TrigIDMA:6;
28
29
30 };
31
32 struct trk_Trailer{
33
34 unsigned int PNum;
35 unsigned int CmdNum;
36 unsigned int BID[7];
37 unsigned int ALARM[2];
38 unsigned int Aswr;
39
40 };
41
42 void trkalarmpkt_(char* buffer,int* length,int *error){
43
44
45 struct trk_ControlRegister CR;
46 struct trk_Trailer TR;
47
48
49 char *buff;
50
51 int i;
52
53 buff = buffer;
54
55 *error = 0;
56
57
58 CR.TrigMask = (*buff&0xc0) >> 6;
59 CR.DSPMask = (*buff&0x3f);
60 buff++;
61
62 CR.FlashShutdown = (*buff&0x80) >> 7;
63 CR.FlashOn = (*buff&0x40) >> 6;
64 CR.DSPBusy = (*buff&0x3f);
65 buff++;
66
67 CR.FlashUpset = (*buff&0x80) >> 7;
68 CR.FlashData = (*buff&0x40) >> 6;
69 CR.DSPSoft = (*buff&0x3f);
70 buff++;
71
72 CR.InterCheck = (*buff&0x80) >> 7;
73 CR.FinalCheck = (*buff&0x40) >> 6;
74 CR.CmdIDMA = (*buff&0x3f);
75 buff++;
76
77 CR.UnknownCmd = (*buff&0x80) >> 7;
78 CR.CmdDuringTrig = (*buff&0x40) >> 6;
79 CR.TrigIDMA = (*buff&0x3f);
80 buff++;
81
82
83 TR.PNum = (*buff&0xf0) >> 4;
84 TR.CmdNum = (*buff&0x0f);
85 buff++;
86
87 for(i=0 ; i<4 ; i++){
88 TR.BID[i] = (*buff&(0x03<<i*2)) >> i*2;
89 };
90 buff++;
91
92 for(i=1 ; i<4 ; i++){
93 TR.BID[3+i] = (*buff&(0x03<<i*2)) >> i*2;
94 };
95 TR.ALARM[0] = (*buff&0x02) >> 1;
96 TR.ALARM[1] = (*buff&0x01);
97 buff++;
98
99 TR.Aswr = (*buff&0xff) << 8;
100 buff++;
101
102 TR.Aswr = TR.Aswr | (*buff&0xff);
103
104
105 printf("\n\n TRK CONTROL REGISTER");
106 printf("\n ----------------------");
107 printf("\n TrigMask 0x%x",CR.TrigMask);
108 printf("\n DSPMask 0x%x",CR.DSPMask);
109 printf("\n FlashShutdown 0x%x",CR.FlashShutdown);
110 printf("\n FlashOn 0x%x",CR.FlashOn);
111 printf("\n DSPBusy 0x%x",CR.DSPBusy);
112 printf("\n FlashUpset 0x%x",CR.FlashUpset);
113 printf("\n FlashData 0x%x",CR.FlashData);
114 printf("\n DSPSoft 0x%x",CR.DSPSoft);
115 printf("\n InterCheck 0x%x",CR.InterCheck);
116 printf("\n FinalCheck 0x%x",CR.FinalCheck);
117 printf("\n CmdIDMA 0x%x",CR.CmdIDMA);
118 printf("\n UnknownCmd 0x%x",CR.UnknownCmd);
119 printf("\n CmdDuringTrig 0x%x",CR.CmdDuringTrig);
120 printf("\n TrigIDMA 0x%x",CR.TrigIDMA);
121 printf("\n ----------------------");
122 printf("\n PNum 0x%x",TR.PNum);
123 printf("\n CmdNum 0x%x",TR.CmdNum);
124 printf("\n BID 0x%x",TR.BID[0]);
125 printf("\n ALARM 0x%x",TR.ALARM[0]);
126 printf("\n Aswr 0x%x",TR.Aswr);
127 printf("\n----------------------\n\n\n");
128
129
130
131 return;
132 }

  ViewVC Help
Powered by ViewVC 1.1.23