66
77// #include "otsdaq-mu2e/FEInterfaces/ROCPolarFireCoreInterface.h"
88
9- uint8_t * MZB_Encode_CMD_Command_raw (MZB_OSCMDCODE_t cmdCode , float * params )
10- {
9+ uint8_t * MZB_Encode_CMD_Command_raw (MZB_OSCMDCODE_t cmdCode , float * params ) {
1110 int i ;
1211
1312 // Create structure and fill only to ease the checksum calculation
1413
1514#ifdef GNU_COMP
16- static struct __attribute__((__packed__ )) ems
17- {
15+ static struct __attribute__((__packed__ )) ems {
1816#else
19- __packed __align (4 ) struct ems
20- {
17+ __packed __align (4 ) struct ems {
2118#endif
2219 short dummy ;
2320 short adr ;
2421
2522#ifdef GNU_COMP
26- struct __attribute__((__packed__ ))
27- {
23+ struct __attribute__((__packed__ )) {
2824#else
29- __packed struct
30- {
25+ __packed struct {
3126#endif
3227 unsigned short functionReq_tag ; // 'CD'
3328 unsigned short functionReq ;
@@ -60,8 +55,7 @@ uint8_t* MZB_Encode_CMD_Command_raw(MZB_OSCMDCODE_t cmdCode, float* params)
6055 em .cmdReq .functionReq = cmdCode | 0x8000 ;
6156
6257 // 9 parameters (float)
63- for (i = 0 ; i < CT_MAXP ; i ++ )
64- {
58+ for (i = 0 ; i < CT_MAXP ; i ++ ) {
6559 em .cmdReq .P [i ] = params [i ];
6660 }
6761
@@ -70,13 +64,10 @@ uint8_t* MZB_Encode_CMD_Command_raw(MZB_OSCMDCODE_t cmdCode, float* params)
7064
7165 // Print for debug
7266 int debug = 0 ;
73- if (debug )
74- {
67+ if (debug ) {
7568 uint8_t * p = (uint8_t * )& em .adr ;
76- for (size_t i = 0 ; i < (sizeof (em ) - offsetof(struct ems , adr )); i += 8 )
77- {
78- for (int j = 0 ; j < 8 ; j ++ )
79- {
69+ for (size_t i = 0 ; i < (sizeof (em ) - offsetof(struct ems , adr )); i += 8 ) {
70+ for (int j = 0 ; j < 8 ; j ++ ) {
8071 printf ("%02 x ", * p ++ );
8172 }
8273 printf ("\n ");
@@ -86,17 +77,15 @@ uint8_t* MZB_Encode_CMD_Command_raw(MZB_OSCMDCODE_t cmdCode, float* params)
8677 return (uint8_t * )& em .adr ;
8778}
8879
89- unsigned ees_chksum (void * ptr , int len )
90- {
80+ unsigned ees_chksum (void * ptr , int len ) {
9181 unsigned * src = (unsigned * )ptr ;
9282 unsigned sum ;
9383 unsigned tmp ;
9484
9585 for (sum = 0 ; len >= 4 ; len -= 4 )
9686 sum += * src ++ ;
9787
98- if (len )
99- {
88+ if (len ) {
10089 tmp = 0 ;
10190 memcpy (& tmp , src , len );
10291 sum += tmp ;
@@ -105,12 +94,9 @@ unsigned ees_chksum(void* ptr, int len)
10594 return sum ;
10695}
10796
108- MZB_OSCMDCODE_t mz_string_to_enum (const char * str )
109- {
110- for (size_t i = 0 ; i < sizeof (code_map ) / sizeof (code_map [0 ]); i ++ )
111- {
112- if (code_map [i ].str == str )
113- {
97+ MZB_OSCMDCODE_t mz_string_to_enum (const char * str ) {
98+ for (size_t i = 0 ; i < sizeof (code_map ) / sizeof (code_map [0 ]); i ++ ) {
99+ if (code_map [i ].str == str ) {
114100 return code_map [i ].code ;
115101 }
116102 }
0 commit comments