mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-05-22 04:10:41 +02:00
Merge pull request #1207 from slsdetectorgroup/fix_blackfin_read_access
ctb: fix bug in blackfin read access to firmware registers
This commit is contained in:
commit
1d0eeea7ee
Binary file not shown.
@ -15,6 +15,7 @@
|
||||
#include "loadPattern.h"
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h> // usleep
|
||||
@ -93,6 +94,10 @@ void basictests() {
|
||||
LOG(logINFOBLUE, ("********* Chip Test Board Virtual Server *********\n"));
|
||||
#else
|
||||
LOG(logINFOBLUE, ("************* Chip Test Board Server *************\n"));
|
||||
initError = enableBlackfinAMCExternalAccessExtension(initErrorMessage);
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
}
|
||||
initError = defineGPIOpins(initErrorMessage);
|
||||
if (initError == FAIL) {
|
||||
return;
|
||||
@ -438,6 +443,32 @@ uint32_t getDetectorIP() {
|
||||
return res;
|
||||
}
|
||||
|
||||
int enableBlackfinAMCExternalAccessExtension(char *mess) {
|
||||
unsigned int value;
|
||||
const char *file_path = BFIN_AMC_ACCESS_EXTENSION_FNAME;
|
||||
FILE *file = fopen(file_path, "r");
|
||||
if (!file) {
|
||||
strcpy(mess, "Failed to enable blackfin AMC access extension. Could "
|
||||
"not read EBIU_AMBCTL1\n");
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
fscanf(file, "%x", &value);
|
||||
fclose(file);
|
||||
|
||||
value |= BFIN_AMC_ACCESS_EXTENSION_ENA_VAL;
|
||||
file = fopen(file_path, "w");
|
||||
if (!file) {
|
||||
strcpy(mess, "Failed to enable blackfin AMC access extension. Could "
|
||||
"not write EBIU_AMBCTL1\n");
|
||||
LOG(logERROR, (mess));
|
||||
return FAIL;
|
||||
}
|
||||
fprintf(file, "0x%x", value);
|
||||
fclose(file);
|
||||
return OK;
|
||||
}
|
||||
|
||||
/* initialization */
|
||||
|
||||
void initControlServer() {
|
||||
|
@ -5,6 +5,23 @@
|
||||
#include <inttypes.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/** enable support for ARDY signal on interface to FPGA
|
||||
* needed to properly translate avalon_mm_waitrequest in the CTB firmware
|
||||
* https://www.analog.com/media/en/dsp-documentation/processor-manuals/bf537_hwr_Rev3.2.pdf
|
||||
* page 274
|
||||
* */
|
||||
#define BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_OFST (0)
|
||||
#define BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_MSK \
|
||||
(1 << BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_OFST)
|
||||
#define BFIN_EBIU_AMBCTL1_B2_ARDY_POL_OFST (1)
|
||||
#define BFIN_EBIU_AMBCTL1_B2_ARDY_POL_MSK \
|
||||
(1 << BFIN_EBIU_AMBCTL1_B2_ARDY_POL_OFST)
|
||||
|
||||
#define BFIN_AMC_ACCESS_EXTENSION_ENA_VAL \
|
||||
(BFIN_EBIU_AMBCTL1_B2_ARDY_ENA_MSK | BFIN_EBIU_AMBCTL1_B2_ARDY_POL_MSK)
|
||||
#define BFIN_AMC_ACCESS_EXTENSION_FNAME \
|
||||
"/sys/kernel/debug/blackfin/ebiu_amc/EBIU_AMBCTL1"
|
||||
|
||||
/** I2C defines */
|
||||
#define I2C_CLOCK_MHZ (131.25)
|
||||
|
||||
|
@ -113,6 +113,10 @@ void setModuleId(int modid);
|
||||
u_int64_t getDetectorMAC();
|
||||
u_int32_t getDetectorIP();
|
||||
|
||||
#if defined(CHIPTESTBOARDD)
|
||||
int enableBlackfinAMCExternalAccessExtension(char *mess);
|
||||
#endif
|
||||
|
||||
// initialization
|
||||
void initControlServer();
|
||||
void initStopServer();
|
||||
|
@ -168,7 +168,7 @@ class DataProcessor : private virtual slsDetectorDefs, public ThreadObject {
|
||||
uint32_t streamingTimerInMs;
|
||||
uint32_t streamingStartFnum;
|
||||
uint32_t currentFreqCount{0};
|
||||
struct timespec timerbegin{};
|
||||
struct timespec timerbegin {};
|
||||
bool framePadding;
|
||||
std::atomic<bool> startedFlag{false};
|
||||
std::atomic<uint64_t> firstIndex{0};
|
||||
|
@ -63,8 +63,8 @@ class GeneralData {
|
||||
slsDetectorDefs::frameDiscardPolicy frameDiscardMode{
|
||||
slsDetectorDefs::NO_DISCARD};
|
||||
|
||||
GeneralData() {};
|
||||
virtual ~GeneralData() {};
|
||||
GeneralData(){};
|
||||
virtual ~GeneralData(){};
|
||||
|
||||
// Returns the pixel depth in byte, 4 bits being 0.5 byte
|
||||
float GetPixelDepth() { return float(dynamicRange) / 8; }
|
||||
|
@ -47,8 +47,8 @@ class GeneralDataTest : public GeneralData {
|
||||
// dummy DataProcessor class for testing
|
||||
class DataProcessorTest : public DataProcessor {
|
||||
public:
|
||||
DataProcessorTest() : DataProcessor(0) {};
|
||||
~DataProcessorTest() {};
|
||||
DataProcessorTest() : DataProcessor(0){};
|
||||
~DataProcessorTest(){};
|
||||
void ArrangeDbitData(size_t &size, char *data) {
|
||||
DataProcessor::ArrangeDbitData(size, data);
|
||||
}
|
||||
|
@ -3,10 +3,10 @@
|
||||
/** API versions */
|
||||
#define APILIB "developer 0x241122"
|
||||
#define APIRECEIVER "developer 0x241122"
|
||||
#define APICTB "developer 0x250310"
|
||||
#define APIGOTTHARD2 "developer 0x250310"
|
||||
#define APIMOENCH "developer 0x250310"
|
||||
#define APIEIGER "developer 0x250310"
|
||||
#define APIXILINXCTB "developer 0x250311"
|
||||
#define APIJUNGFRAU "developer 0x250318"
|
||||
#define APIMYTHEN3 "developer 0x250409"
|
||||
#define APICTB "developer 0x250519"
|
||||
|
Loading…
x
Reference in New Issue
Block a user