fix bug in blackfin read access to firmware registers

This commit is contained in:
muelle_m1 2025-05-08 15:40:13 +02:00
parent 0d5d851585
commit 9051dae787
2 changed files with 30 additions and 0 deletions

View File

@ -15,6 +15,7 @@
#include "loadPattern.h" #include "loadPattern.h"
#include <netinet/in.h> #include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> // usleep #include <unistd.h> // usleep
@ -93,6 +94,7 @@ void basictests() {
LOG(logINFOBLUE, ("********* Chip Test Board Virtual Server *********\n")); LOG(logINFOBLUE, ("********* Chip Test Board Virtual Server *********\n"));
#else #else
LOG(logINFOBLUE, ("************* Chip Test Board Server *************\n")); LOG(logINFOBLUE, ("************* Chip Test Board Server *************\n"));
enableBlackfinAMCExternalAccessExtension();
initError = defineGPIOpins(initErrorMessage); initError = defineGPIOpins(initErrorMessage);
if (initError == FAIL) { if (initError == FAIL) {
return; return;
@ -438,6 +440,33 @@ uint32_t getDetectorIP() {
return res; return res;
} }
void enableBlackfinAMCExternalAccessExtension() {
unsigned int value;
const char *file_path = "/sys/kernel/debug/blackfin/ebiu_amc/EBIU_AMBCTL1";
FILE *file = fopen(file_path, "r");
if (!file) {
LOG(logERROR, ("Failed to read EBIU_AMBCTL1\n"));
return;
}
fscanf(file, "%x", &value);
fclose(file);
// 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
value |= 0x3;
file = fopen(file_path, "w");
if (!file) {
LOG(logERROR, ("Failed to enable blackfin AMC access extension\n"));
return;
}
fprintf(file, "0x%x", value);
fclose(file);
}
/* initialization */ /* initialization */
void initControlServer() { void initControlServer() {

View File

@ -135,6 +135,7 @@ void setupDetector();
#if defined(CHIPTESTBOARDD) #if defined(CHIPTESTBOARDD)
int updateDatabytesandAllocateRAM(); int updateDatabytesandAllocateRAM();
void updateDataBytes(); void updateDataBytes();
void enableBlackfinAMCExternalAccessExtension();
#endif #endif
#if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD) #if !defined(CHIPTESTBOARDD) && !defined(XILINX_CHIPTESTBOARDD)