Here it is. A slightly modified algorithm.h file:
Thanks. Now I'm interested in:
int to_baikal_algorithm(algorithm_type_t type);
In a different file:
#ifdef USE_BAIKAL
int to_baikal_algorithm(algorithm_type_t type)
{
switch (type) {
case ALGO_X11:
return 1;
case ALGO_X13:
return 2;
case ALGO_X14:
return 3;
case ALGO_X15:
return 4;
case ALGO_QUARK:
return 5;
case ALGO_QUBIT:
return 6;
default:
return 0;
break;
}
}
#endif
Looks like this is a pretty old version of the source as that list doesn't contain Skein or MGroestl, as the x10 is known to have. This looks like the same list of algorithms that Baikal's older Mini Miner and Giant A900 Dash Miner had so it may not have any new code at all for the x10/B/N (in this deleted version). Maybe it's just as easy as adding a few cases in there for the missing ones and using guess-and-check to get the right values.
Did those earlier generations use pi's also? I've never messed with them.
Here's a couple snippets from another version that do contain Skein and Myriad Groestl:
...
static bool baikal_send_work(struct cgpu_info *baikal, int miner_id)
{
struct baikal_info *info = baikal->device_data;
struct miner_info *miner = &info->miners[miner_id];
struct thr_info *thr = mining_thr[miner->thr_id];
struct work *work;
uint32_t target;
baikal_msg msg;
uint8_t algo;
uint32_t * mdata,*wdata;
/* Do not send */
if (miner->overheated == true) {
return (true);
}
mutex_lock(baikal->mutex);
if (info->works[info->work_idx] == NULL) {
work = get_work(thr, miner->thr_id);
info->works[info->work_idx] = work;
#if 0 /* TODO : Performance Check */
if (thr->work_restart) {
free_work(info->works[info->work_idx]);
info->works[info->work_idx] = NULL;
applog(LOG_ERR, "work restart\n");
mutex_unlock(baikal->mutex);
return true;
}
#endif
}
if (work->pool->algorithm.type != thr->cgpu->algorithm.type) {
thr->cgpu->algorithm.type = work->pool->algorithm.type;
}
work->device_diff = MAX(miner->working_diff, work->work_difficulty);
//work->device_diff = MIN(miner->working_diff, work->work_difficulty);
set_target(work->device_target, work->device_diff, work->pool->algorithm.diff_multiplier2, work->thr_id);
memset(msg.data, 0x0, 512);
msg.data[0] = to_baikal_algorithm(thr->cgpu->algorithm.type);
msg.data[1] = miner_id;
memcpy(&msg.data[2], &work->device_target[24], 8);
if (*((uint32_t *)&msg.data[6]) != 0x0) { // TripleS
memset(&msg.data[2], 0xFF, 4);
}
switch (baikal->algorithm.type) {
case ALGO_BLAKECOIN: // blake256r8
if (work->pool->algorithm.calc_midstate) { // use midstate
msg.data[0] += 1;
memcpy(&msg.data[10], work->midstate, 32);
memcpy(&msg.data[42], &work->data[64], 16);
be32enc_vect((uint32_t *)&msg.data[42], (const uint32_t *)&msg.data[42], 4);
*((uint32_t *)&msg.data[58]) = 0x00000080;
*((uint32_t *)&msg.data[94]) = 0x01000000;
*((uint32_t *)&msg.data[102]) = 0x80020000;
msg.len = 106;
}
else {
memcpy(&msg.data[10], work->data, 80);
be32enc_vect((uint32_t *)&msg.data[10], (const uint32_t *)&msg.data[10], 20);
msg.len = 90;
}
break;
case ALGO_DECRED: // blake256r14
if (work->pool->algorithm.calc_midstate) { // use midstate
msg.data[0] += 1;
memcpy(&msg.data[10], work->midstate, 32);
memcpy(&msg.data[42], &work->data[128], 52);
*((uint32_t *)&msg.data[94]) = 0x01000080UL;
*((uint32_t *)&msg.data[98]) = 0x00000000UL;
*((uint32_t *)&msg.data[102]) = 0xa0050000UL;
msg.len = 106;
}
else {
memcpy(&msg.data[10], work->data, 180);
msg.len = 190;
}
break;
case ALGO_SIA: // blake2b
memcpy(&msg.data[10], work->data, 80);
be32enc_vect((uint32_t *)&msg.data[10], (const uint32_t *)&msg.data[10], 20);
msg.len = 90;
break;
case ALGO_LBRY: // lbry-all
memcpy(&msg.data[10], work->data, 112);
be32enc_vect((uint32_t *)&msg.data[10], (const uint32_t *)&msg.data[10], 27);
msg.len = 122;
break;
case ALGO_PASCAL: // lbry-sha
memcpy(&msg.data[10], work->data, 200);
msg.len = 210;
break;
case ALGO_X11:
case ALGO_X11GOST:
case ALGO_SKEINCOIN:
case ALGO_MYRIAD_GROESTL:
case ALGO_QUARK:
case ALGO_QUBIT:
case ALGO_GROESTL:
case ALGO_SKEIN2:
case ALGO_NIST:
case ALGO_CRYPTONIGHT:
case ALGO_CRYPTONIGHT_LITE:
case ALGO_BLAKE:
case ALGO_VANILLA:
case ALGO_VELTOR:
default:
memcpy(&msg.data[10], work->data, 80);
msg.len = 90;
break;
}
msg.miner_id = miner_id;
msg.cmd = BAIKAL_SEND_WORK;
msg.param = info->work_idx;
msg.dest = 0;
//mutex_lock(baikal->mutex);
if (baikal_sendmsg(baikal, &msg) < 0) {
applog(LOG_ERR, "baikal_send_work : sendmsg error[%d]", miner_id);
mutex_unlock(baikal->mutex);
return (false);
}
if (baikal_readmsg(baikal, &msg, 7) < 0) {
applog(LOG_ERR, "baikal_send_work : readmsg error[%d]", miner_id);
mutex_unlock(baikal->mutex);
return (false);
}
/* update clock */
miner->clock = msg.param << 1;
info->work_idx++;
if (info->work_idx >= BAIKAL_WORK_FIFO) {
info->work_idx = 0;
}
if (info->works[info->work_idx] != NULL) {
free_work(info->works[info->work_idx]);
info->works[info->work_idx] = NULL;
}
cgtimer_time(&miner->start_time);
mutex_unlock(baikal->mutex);
return (true);
}
...
...
static int64_t baikal_hash_done(struct cgpu_info *baikal, struct miner_info *miner, int elpased)
{
int64_t hash_done = 0;
switch(baikal->algorithm.type) {
case ALGO_CRYPTONIGHT:
hash_done = miner->clock * miner->asic_count * elapsed / 1776;
break;
case ALGO_CRYPTONIGHT_LITE:
hash_done = miner->clock * miner->asic_count * elapsed / 888;
break;
case ALGO_X11:
case ALGO_QUARK:
case ALGO_QUBIT:
case ALGO_NIST:
case ALGO_SKEINCOIN:
case ALGO_SKEIN2:
case ALGO_MYRIAD_GROESTL:
case ALGO_GROESTL:
hash_done = miner->clock * miner->asic_count * elapsed * 128;
break;
case ALGO_X11GOST:
case ALGO_VELTOR:
hash_done = miner->clock * miner->asic_count * elapsed * 18;
break;
case ALGO_BLAKECOIN
case ALGO_DECRED
case ALGO_VANILLA
case ALGO_BLAKE
hash_done = miner->clock * miner->asic_count * elapsed * 2048;
break;
case ALGO_SIA
hash_done = miner->clock * miner->asic_count * elapsed * 1024;
break;
case ALGO_LBRY
case ALGO_PASCAL
hash_done = miner->clock * miner->asic_count * elapsed * 512;
break;
}
return hash_done;
}
...