| 1 |
4 |
sergeykhbr |
/**
|
| 2 |
|
|
* @file
|
| 3 |
|
|
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved.
|
| 4 |
|
|
* @author Sergey Khabarov - sergeykhbr@gmail.com
|
| 5 |
|
|
* @brief Fast Search Engnine (FSE) black-box model.
|
| 6 |
|
|
*/
|
| 7 |
|
|
|
| 8 |
|
|
#include "api_core.h"
|
| 9 |
|
|
#include "fsev2.h"
|
| 10 |
|
|
|
| 11 |
|
|
namespace debugger {
|
| 12 |
|
|
|
| 13 |
|
|
static const uint32_t FSE2_CONTROL_ENA = (1 << 31); // 0=disable; 1=enable
|
| 14 |
|
|
static const uint32_t FSE2_CONTROL_ADC = (1 << 30); // 0=bin offset; 1=sign/magn
|
| 15 |
|
|
static const uint32_t FSE2_STATE_NXT_DOPLER = (1 << 21);
|
| 16 |
|
|
static const uint32_t FSE2_STATE_PROCESSING = (1 << 20);
|
| 17 |
|
|
static const uint32_t FSE2_STATE_SELCHAN = (1 << 19);
|
| 18 |
|
|
static const uint32_t FSE2_STATE_WRITING = (1 << 18);
|
| 19 |
|
|
static const uint32_t FSE2_STATE_WAIT_MS = (1 << 17);
|
| 20 |
|
|
static const uint32_t FSE2_STATE_IDLE = (1 << 16);
|
| 21 |
|
|
|
| 22 |
|
|
FseV2::FseV2(const char *name) : IService(name) {
|
| 23 |
|
|
registerInterface(static_cast<IMemoryOperation *>(this));
|
| 24 |
|
|
|
| 25 |
|
|
memset(®s_, 0, sizeof(regs_));
|
| 26 |
|
|
regs_.hw_id = (16 << 16) | 5; // 16 msec accum, 5=id
|
| 27 |
|
|
for (int i = 0; i < FSE2_CHAN_MAX; i++) {
|
| 28 |
|
|
regs_.chan[i].dopler = 1000 << 4;
|
| 29 |
|
|
regs_.chan[i].noise = 1872 << 12;
|
| 30 |
|
|
regs_.chan[i].ind = 100 + i;
|
| 31 |
|
|
}
|
| 32 |
|
|
// Check float comparision with threshold (=2.1*noise):
|
| 33 |
|
|
regs_.chan[14].max = static_cast<uint32_t>(1872.0 * 2.11);
|
| 34 |
|
|
regs_.chan[15].max = static_cast<uint32_t>(1872.0 * 2.09);
|
| 35 |
|
|
}
|
| 36 |
|
|
|
| 37 |
|
|
ETransStatus FseV2::b_transport(Axi4TransactionType *trans) {
|
| 38 |
|
|
uint64_t mask = (length_.to_uint64() - 1);
|
| 39 |
|
|
uint64_t off = ((trans->addr - getBaseAddress()) & mask);
|
| 40 |
|
|
trans->response = MemResp_Valid;
|
| 41 |
|
|
if (trans->action == MemAction_Write) {
|
| 42 |
|
|
memcpy(&reinterpret_cast<uint8_t *>(®s_)[off], trans->wpayload.b8,
|
| 43 |
|
|
trans->xsize);
|
| 44 |
|
|
} else {
|
| 45 |
|
|
memcpy(trans->rpayload.b8, &reinterpret_cast<uint8_t *>(®s_)[off],
|
| 46 |
|
|
trans->xsize);
|
| 47 |
|
|
}
|
| 48 |
|
|
return TRANS_OK;
|
| 49 |
|
|
}
|
| 50 |
|
|
|
| 51 |
|
|
} // namespace debugger
|