Trivial style changes to mg proto parser
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156
diff --git a/driver-spondoolies.h b/driver-spondoolies.h
index cfb6539..0fead0a 100644
--- a/driver-spondoolies.h
+++ b/driver-spondoolies.h
@@ -1,4 +1,5 @@
/*
+ * Copyright 2014 Con Kolivas <kernel@kolivas.org>
* Copyright 2014 Zvi Shteingart - Spondoolies-tech.com
*
* This program is free software; you can redistribute it and/or modify it
@@ -27,6 +28,7 @@ typedef enum spond_work_state {
#define MAX_JOBS_IN_MINERGATE MINERGATE_TOTAL_QUEUE // 1.5 sec worth of jobs
#define MAX_NROLES 50
+
typedef struct {
struct work *cgminer_work;
SPONDWORK_STATE state;
@@ -39,7 +41,7 @@ typedef struct {
struct spond_adapter {
pthread_mutex_t lock;
ADAPTER_STATE adapter_state;
- void* cgpu;
+ void *cgpu;
// Statistics
int wins;
diff --git a/mg_proto_parser.c b/mg_proto_parser.c
index bdfbc39..d791d64 100644
--- a/mg_proto_parser.c
+++ b/mg_proto_parser.c
@@ -1,4 +1,5 @@
/*
+ * Copyright 2014 Con Kolivas <kernel@kolivas.org>
* Copyright 2014 Zvi (Zvisha) Shteingart - Spondoolies-tech.com
*
* This program is free software; you can redistribute it and/or modify it
@@ -18,12 +19,8 @@
#include "assert.h"
//#include "spond_debug.h"
-
-
-
-minergate_req_packet *allocate_minergate_packet_req(
- uint8_t requester_id,
- uint8_t request_id) {
+minergate_req_packet *allocate_minergate_packet_req(uint8_t requester_id, uint8_t request_id)
+{
minergate_req_packet *p = (minergate_req_packet*)malloc(sizeof(minergate_req_packet));
p->requester_id = requester_id;
p->req_count = 0;
@@ -34,11 +31,8 @@ minergate_req_packet *allocate_minergate_packet_req(
return p;
}
-
-minergate_rsp_packet *allocate_minergate_packet_rsp(
- uint8_t requester_id,
- uint8_t request_id) {
-
+minergate_rsp_packet *allocate_minergate_packet_rsp(uint8_t requester_id, uint8_t request_id)
+{
minergate_rsp_packet *p = (minergate_rsp_packet*)malloc(sizeof(minergate_rsp_packet));
p->requester_id = requester_id;
p->rsp_count = 0;
@@ -48,6 +42,3 @@ minergate_rsp_packet *allocate_minergate_packet_rsp(
p->gh_div_10_rate = 0;
return p;
}
-
-
-
diff --git a/mg_proto_parser.h b/mg_proto_parser.h
index 42f3af4..a11c1f6 100644
--- a/mg_proto_parser.h
+++ b/mg_proto_parser.h
@@ -1,4 +1,5 @@
/*
+ * Copyright 2014 Con Kolivas <kernel@kolivas.org>
* Copyright 2014 Zvi (Zvisha) Shteingart - Spondoolies-tech.com
*
* This program is free software; you can redistribute it and/or modify it
@@ -28,12 +29,9 @@
#define passert assert
#endif
-
-
#define MINERGATE_PROTOCOL_VERSION 5
#define MINERGATE_SOCKET_FILE "/tmp/connection_pipe"
-
typedef enum {
//MINERGATE_DATA_ID_CONNECT = 1,
MINERGATE_DATA_ID_DO_JOB_REQ = 2,
@@ -41,32 +39,30 @@ typedef enum {
} MINERGATE_DATA_ID;
-
typedef struct {
uint32_t work_id_in_sw;
uint32_t difficulty;
uint32_t timestamp;
uint32_t mrkle_root;
uint32_t midstate[8];
- uint8_t leading_zeroes;
- uint8_t ntime_limit;
- uint8_t ntime_offset;
- uint8_t resr1;
+ uint8_t leading_zeroes;
+ uint8_t ntime_limit;
+ uint8_t ntime_offset;
+ uint8_t resr1;
} minergate_do_job_req;
#define MAX_REQUESTS 100
#define MAX_RESPONDS 300
#define MINERGATE_TOTAL_QUEUE 300
-
typedef struct {
uint32_t work_id_in_sw;
uint32_t mrkle_root; // to validate
uint32_t winner_nonce;
- uint8_t ntime_offset;
- uint8_t res; // 0 = done, 1 = overflow, 2 = dropped bist
- uint8_t resrv1;
- uint8_t resrv2;
+ uint8_t ntime_offset;
+ uint8_t res; // 0 = done, 1 = overflow, 2 = dropped bist
+ uint8_t resrv1;
+ uint8_t resrv2;
} minergate_do_job_rsp;
@@ -90,16 +86,7 @@ typedef struct {
minergate_do_job_rsp rsp[MAX_RESPONDS]; // array of responce
} minergate_rsp_packet;
-
-minergate_req_packet *allocate_minergate_packet_req(
- uint8_t requester_id,
- uint8_t request_id) ;
-
-
-
-minergate_rsp_packet *allocate_minergate_packet_rsp(
- uint8_t requester_id,
- uint8_t request_id);
-
+minergate_req_packet *allocate_minergate_packet_req(uint8_t requester_id, uint8_t request_id);
+minergate_rsp_packet *allocate_minergate_packet_rsp(uint8_t requester_id, uint8_t request_id);
#endif