Project

General

Profile

c453_family_mess.txt

Kyle Hazelwood, 01/15/2015 12:00 PM

 
1
c453_config_set_all
2
-> c453_family(main_mdat_table,dis)
3
? who defined the family devices? 
4

    
5
- must change to using wg_get_device to get a di list of particular table type.
6
- use group and grp_id system
7
- designate grp_id 0 for horz orbit c453s, 1 for vert. extend the list of gid when needed.
8

    
9

    
10
******************************************************************************/
11
/*+ int c453_family(int type,int *dis)
12
	get di list of a family for given table type and plane.
13
        This includes all c453 for recycler disregarding plane or specific
14
	applications.
15
	Number getting from a family is checked if wrong 0 is
16
	returned, otherwise the number of device is returned. 
17
-*/
18
/******************************************************************************/
19
extern "C" int c453_family(int type,int *dis)
20
{
21
 int			di;
22
 int			num=0,ndis=0;
23
 short			err;
24
 char			fname[9];
25
 char			date[21];
26
 char			mes[80];
27

    
28
 switch (type) {
29
    case DEFAULT_TABLE:   /* also gi table */
30
      memcpy(fname,"R:RRCORR",8); num = NUM_RR_C453;
31
      break;
32
    case MDAT_GTABLE:
33
      memcpy(fname,"R:RRCORR",8); num = NUM_RR_C453; 
34
      break;
35
    case MDAT_HTABLE:
36
      memcpy(fname,"R:RRCHI ",8); num = NUM_RR_C453; 
37
      break;
38
    case SCALE_FACTOR_TABLE:
39
      memcpy(fname,"R:RRCSF ",8); num = NUM_RR_C453; 
40
      break;
41
    case RAMP_POINTER_TABLE:
42
      memcpy(fname,"R:RRCMAP",8); num = NUM_RR_C453; 
43
      break;
44
    case SCALE_FACTOR_POINTER_TABLE:
45
      memcpy(fname,"R:RRCMAP",8); num = NUM_RR_C453; 
46
      break;
47
    case CLOCK_TABLE:
48
      memcpy(fname,"R:RRCCLK",8); num = NUM_RR_C453_CARD; 
49
      break;
50
    case MDAT_GITABLE:
51
      memcpy(fname,"R:RRCGII",8); num = NUM_RR_C453_CARD; 
52
      break;
53
    case MDAT_HITABLE:
54
      memcpy(fname,"R:RRCHII",8); num = NUM_RR_C453_CARD; 
55
      break;
56
    case MAIN_MDAT_TABLE:
57
      memcpy(fname,"R:RRCMDT",8); num = NUM_RR_C453_CARD; 
58
      break;
59
    default: break;
60
  }
61
 if (dio_device_index_c(fname, &di, 1)) goto err;
62
 if (dio_family_info(&di,&ndis,dis,&err)) goto err;
63
 if (ndis != num) goto err;
64
 return(ndis);
65
 err: clinks_to_date(clinks_now(), date);
66
 sprintf(mes,"%.20s: err getting dis in c453_family",date);
67
 return(0);
68
}
69

    
70

71
/**************************************************************************/
72
/*+ int c453_config_set_all(int which, C453_CONFIG1_DATA *con)
73
	configure all c453s using data passed. The HII and scale factors are
74
	not included because HII is not used and scale factors are different 
75
	for channels.
76
-*/
77
/**************************************************************************/
78
extern "C" int c453_config_set_all(int which, C453_CONFIG1_DATA *con)
79
{
80
 int			i,n,sts;
81
 int			ndi,dis[NUM_RR_C453];
82
 char			date[21];
83
 short			*raw;
84
 char			mes[80];
85

    
86
 raw = (short *)clib_malloc(CLK_SLOTS*NUM_RR_C453*4);
87
 if (!raw) return(util_errpost(MYERR,"Err allocate memory"));
88
 clinks_to_date(clinks_now(), date);
89
 if (which == 6 || which == 0) { 
90
    ndi = c453_family(MAIN_MDAT_TABLE,dis);
91
    if (ndi==0) goto err;
92
    if (ndi) {
93
       for (i = 0; i < ndi; i++) memcpy(&raw[i],con->mdat,2);
94
       if (c453_main_mdat_lst_rw(SET,ndi,dis,(char *)raw)) goto err;
95
       sprintf(mes,"%.20s: sent main MDAT to all locations",date);
96
       error_message_c(mes,0,GREEN,1);
97
     }
98
  }
99
 if (which == 6 || which == 1) { 
100
    for (i = 0; i < NUM_RR_C453_CARD; i++)   /* is more than enough */
101
       memcpy(&raw[CLK_SLOTS*i],con->clk,CLK_SLOTS*2);
102
    sts = rr_c453_td(SET,CLOCK_TABLE,1,1,CLK_SLOTS,raw,&n);
103
    if (sts) goto err;
104
    sprintf(mes,"%.20s: sent clocks to all locations",date);
105
    error_message_c(mes,0,GREEN,1);
106
  }
107
 if (which == 6 || which == 2) { 
108
    for (i = 0; i < NUM_RR_C453_CARD; i++) 
109
       memcpy(&raw[GII_SLOTS*i],con->gii,GII_SLOTS*2);
110
    sts = rr_c453_td(SET,MDAT_GITABLE,1,1,GII_SLOTS,raw,&n);
111
    if (sts) goto err;
112
    sprintf(mes,"%.20s: sent GII to all locations",date);
113
    error_message_c(mes,0,GREEN,1);
114
  }
115
 if (which == 6 || which == 3) { 
116
    for (i = 0; i < NUM_RR_C453_CARD; i++) 
117
       memcpy(&raw[GII_SLOTS*i],con->hii,GII_SLOTS*2);
118
    sts = rr_c453_td(SET,MDAT_HITABLE,1,1,GII_SLOTS,raw,&n);
119
    if (sts) goto err;
120
    sprintf(mes,"%.20s: sent HII to all locations",date);
121
    error_message_c(mes,0,GREEN,1);
122
  }
123
 if (which == 6 || which == 4) { 
124
    for (i = 0; i < NUM_RR_C453; i++)   
125
       memcpy(&raw[RAMP_PTR_SLOTS*i],con->rampp,RAMP_PTR_SLOTS*2);
126
     /* ramp ptr are same for both planes,c453_family includes all dev */
127
    sts = rr_c453_td(SET,RAMP_POINTER_TABLE,1,1,RAMP_PTR_SLOTS,raw,&n);
128
    if (sts) goto err;
129
    sprintf(mes,"%.20s: sent ramp pointors to all locations",date);
130
    error_message_c(mes,0,GREEN,1);
131
  }
132
 if (which == 6 || which == 5) { 
133
    copy_sfp(TRUE,(short *)con->sfp,(short *)raw);
134
    for (i = 1; i < NUM_RR_C453; i++)  
135
       memcpy(&raw[SF_PTR_SLOTS_MAX*i],raw,SF_PTR_SLOTS_MAX*2);
136
     /* sf ptr are same for both planes */
137
    sts =rr_c453_td(SET,SCALE_FACTOR_POINTER_TABLE,1,1,SF_PTR_SLOTS_MAX,
138
                 raw,&n);
139
    if (sts) goto err;
140
    sprintf(mes,"%.20s: sent s.f. pointors to all locations",date);
141
    error_message_c(mes,0,GREEN,1);
142
  }
143
 clib_free((char **)&raw);
144
 return(0);
145
 err:if (raw != NULL)clib_free((char **)&raw);
146
 sprintf(mes,"%.20s: sending config encountered an error",date);
147
 error_message_c(mes,0,RED,1);
148
 return(MYERR);
149
}
150

    
151

152
/**************************************************************************/
153
/*+ int c453_config_check(int which, C453_CONFIG1_DATA *con)
154
	compare all c453s using data passed. The HII and scale factors are
155
	not included because HII is not used and scale factors are different 
156
	for channels.
157
-*/
158
/**************************************************************************/
159
extern "C" int c453_config_check(int which, C453_CONFIG1_DATA *con)
160
{