Browse Source

icarus: Clarify user_set flags with an enum

Luke Dashjr 12 years ago
parent
commit
eaaa81d300
3 changed files with 8 additions and 4 deletions
  1. 2 2
      driver-cairnsmore.c
  2. 2 2
      driver-icarus.c
  3. 4 0
      icarus-common.h

+ 2 - 2
driver-cairnsmore.c

@@ -147,9 +147,9 @@ static bool cairnsmore_init(struct thr_info *thr)
 		       CAIRNSMORE1_DEFAULT_CLOCK, CAIRNSMORE1_MINIMUM_CLOCK, CAIRNSMORE1_MAXIMUM_CLOCK
 		       CAIRNSMORE1_DEFAULT_CLOCK, CAIRNSMORE1_MINIMUM_CLOCK, CAIRNSMORE1_MAXIMUM_CLOCK
 		);
 		);
 		// The dynamic-clocking firmware connects each FPGA as its own device
 		// The dynamic-clocking firmware connects each FPGA as its own device
-		if (!(info->user_set & 1)) {
+		if (!(info->user_set & IUS_WORK_DIVISION)) {
 			info->work_division = 1;
 			info->work_division = 1;
-			if (!(info->user_set & 2))
+			if (!(info->user_set & IUS_FPGA_COUNT))
 				info->fpga_count = 1;
 				info->fpga_count = 1;
 		}
 		}
 	} else {
 	} else {

+ 2 - 2
driver-icarus.c

@@ -511,7 +511,7 @@ static void get_options(int this_option_offset, struct ICARUS_INFO *info)
 				*(colon2++) = '\0';
 				*(colon2++) = '\0';
 
 
 			if (*colon) {
 			if (*colon) {
-				info->user_set |= 1;
+				info->user_set |= IUS_WORK_DIVISION;
 				tmp = atoi(colon);
 				tmp = atoi(colon);
 				if (tmp == 1 || tmp == 2 || tmp == 4 || tmp == 8) {
 				if (tmp == 1 || tmp == 2 || tmp == 4 || tmp == 8) {
 					*work_division = tmp;
 					*work_division = tmp;
@@ -527,7 +527,7 @@ static void get_options(int this_option_offset, struct ICARUS_INFO *info)
 					*(colon++) = '\0';
 					*(colon++) = '\0';
 
 
 			  if (*colon2) {
 			  if (*colon2) {
-				info->user_set |= 2;
+				info->user_set |= IUS_FPGA_COUNT;
 				tmp = atoi(colon2);
 				tmp = atoi(colon2);
 				if (tmp > 0 && tmp <= *work_division)
 				if (tmp > 0 && tmp <= *work_division)
 					*fpga_count = tmp;
 					*fpga_count = tmp;

+ 4 - 0
icarus-common.h

@@ -61,6 +61,10 @@ enum icarus_reopen_mode {
 	IRM_TIMEOUT,
 	IRM_TIMEOUT,
 	IRM_CYCLE,
 	IRM_CYCLE,
 };
 };
+enum icarus_user_settings {
+	IUS_WORK_DIVISION = 1,
+	IUS_FPGA_COUNT    = 2,
+};
 
 
 struct ICARUS_INFO {
 struct ICARUS_INFO {
 	// time to calculate the golden_ob
 	// time to calculate the golden_ob