mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 03:40:04 +02:00
Merge branch 'developer' of github.com:slsdetectorgroup/slsDetectorPackage into developer
This commit is contained in:
commit
07455bb11e
Binary file not shown.
@ -1537,7 +1537,7 @@ int configureMAC(){
|
|||||||
// start addr
|
// start addr
|
||||||
uint32_t addr = RXR_ENDPOINT_START_REG;
|
uint32_t addr = RXR_ENDPOINT_START_REG;
|
||||||
// get struct memory
|
// get struct memory
|
||||||
udp_header *udp = (udp_header*) (Blackfin_getBaseAddress() + addr * 2);
|
udp_header *udp = (udp_header*) (Blackfin_getBaseAddress() + addr / 2);
|
||||||
memset(udp, 0, sizeof(udp_header));
|
memset(udp, 0, sizeof(udp_header));
|
||||||
|
|
||||||
// mac addresses
|
// mac addresses
|
||||||
|
Binary file not shown.
@ -1326,7 +1326,7 @@ int configureMAC() {
|
|||||||
FILE_LOG(logDEBUG1, ("\tWrite back released. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
FILE_LOG(logDEBUG1, ("\tWrite back released. MultiPurpose reg: 0x%x\n", bus_r(addr)));
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("\tConfiguring MAC CONF\n"));
|
FILE_LOG(logDEBUG1, ("\tConfiguring MAC CONF\n"));
|
||||||
mac_conf *mac_conf_regs = (mac_conf*)(Blackfin_getBaseAddress() + ENET_CONF_REG * 2); // direct write
|
mac_conf *mac_conf_regs = (mac_conf*)(Blackfin_getBaseAddress() + ENET_CONF_REG / 2); // direct write
|
||||||
mac_conf_regs->mac.mac_dest_mac1 = ((destmac >> (8 * 5)) & 0xFF);
|
mac_conf_regs->mac.mac_dest_mac1 = ((destmac >> (8 * 5)) & 0xFF);
|
||||||
mac_conf_regs->mac.mac_dest_mac2 = ((destmac >> (8 * 4)) & 0xFF);
|
mac_conf_regs->mac.mac_dest_mac2 = ((destmac >> (8 * 4)) & 0xFF);
|
||||||
mac_conf_regs->mac.mac_dest_mac3 = ((destmac >> (8 * 3)) & 0xFF);
|
mac_conf_regs->mac.mac_dest_mac3 = ((destmac >> (8 * 3)) & 0xFF);
|
||||||
@ -1364,7 +1364,7 @@ int configureMAC() {
|
|||||||
mac_conf_regs->udp.udp_chksum = 0x0000;
|
mac_conf_regs->udp.udp_chksum = 0x0000;
|
||||||
|
|
||||||
FILE_LOG(logDEBUG1, ("\tConfiguring TSE\n"));
|
FILE_LOG(logDEBUG1, ("\tConfiguring TSE\n"));
|
||||||
tse_conf *tse_conf_regs = (tse_conf*)(Blackfin_getBaseAddress() + TSE_CONF_REG * 2); // direct write
|
tse_conf *tse_conf_regs = (tse_conf*)(Blackfin_getBaseAddress() + TSE_CONF_REG / 2); // direct write
|
||||||
tse_conf_regs->rev = 0xA00;
|
tse_conf_regs->rev = 0xA00;
|
||||||
tse_conf_regs->scratch = 0xCCCCCCCC;
|
tse_conf_regs->scratch = 0xCCCCCCCC;
|
||||||
tse_conf_regs->command_config = 0xB;
|
tse_conf_regs->command_config = 0xB;
|
||||||
|
Binary file not shown.
@ -994,7 +994,7 @@ void setupHeader(int iRxEntry, enum interfaceType type, uint32_t destip, uint64_
|
|||||||
// calculate rxr endpoint offset
|
// calculate rxr endpoint offset
|
||||||
addr += (iRxEntry * RXR_ENDPOINT_OFST);
|
addr += (iRxEntry * RXR_ENDPOINT_OFST);
|
||||||
// get struct memory
|
// get struct memory
|
||||||
udp_header *udp = (udp_header*) (Blackfin_getBaseAddress() + addr * 2);
|
udp_header *udp = (udp_header*) (Blackfin_getBaseAddress() + addr / 2);
|
||||||
memset(udp, 0, sizeof(udp_header));
|
memset(udp, 0, sizeof(udp_header));
|
||||||
|
|
||||||
// mac addresses
|
// mac addresses
|
||||||
|
@ -98,7 +98,7 @@ u_int32_t writeRegister16(u_int32_t offset, u_int32_t data);
|
|||||||
/**
|
/**
|
||||||
* Get base address for memory copy
|
* Get base address for memory copy
|
||||||
*/
|
*/
|
||||||
uint64_t Blackfin_getBaseAddress();
|
uint32_t* Blackfin_getBaseAddress();
|
||||||
/**
|
/**
|
||||||
* Map FPGA
|
* Map FPGA
|
||||||
*/
|
*/
|
||||||
|
@ -8,32 +8,32 @@
|
|||||||
#include <sys/mman.h> // mmap
|
#include <sys/mman.h> // mmap
|
||||||
|
|
||||||
/* global variables */
|
/* global variables */
|
||||||
u_int64_t CSP0BASE = 0;
|
u_int32_t* csp0base = 0;
|
||||||
#define CSP0 0x20200000
|
#define CSP0 0x20200000
|
||||||
#define MEM_SIZE 0x100000
|
#define MEM_SIZE 0x100000
|
||||||
|
|
||||||
|
|
||||||
void bus_w16(u_int32_t offset, u_int16_t data) {
|
void bus_w16(u_int32_t offset, u_int16_t data) {
|
||||||
volatile u_int16_t *ptr1;
|
volatile u_int16_t *ptr1;
|
||||||
ptr1=(u_int16_t*)(CSP0BASE+offset*2);
|
ptr1=(u_int16_t*)(csp0base + offset / 2);
|
||||||
*ptr1=data;
|
*ptr1=data;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int16_t bus_r16(u_int32_t offset){
|
u_int16_t bus_r16(u_int32_t offset){
|
||||||
volatile u_int16_t *ptr1;
|
volatile u_int16_t *ptr1;
|
||||||
ptr1=(u_int16_t*)(CSP0BASE+offset*2);
|
ptr1=(u_int16_t*)(csp0base + offset / 2);
|
||||||
return *ptr1;
|
return *ptr1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void bus_w(u_int32_t offset, u_int32_t data) {
|
void bus_w(u_int32_t offset, u_int32_t data) {
|
||||||
volatile u_int32_t *ptr1;
|
volatile u_int32_t *ptr1;
|
||||||
ptr1=(u_int32_t*)(CSP0BASE+offset*2);
|
ptr1=(u_int32_t*)(csp0base + offset / 2);
|
||||||
*ptr1=data;
|
*ptr1=data;
|
||||||
}
|
}
|
||||||
|
|
||||||
u_int32_t bus_r(u_int32_t offset) {
|
u_int32_t bus_r(u_int32_t offset) {
|
||||||
volatile u_int32_t *ptr1;
|
volatile u_int32_t *ptr1;
|
||||||
ptr1=(u_int32_t*)(CSP0BASE+offset*2);
|
ptr1=(u_int32_t*)(csp0base + offset / 2);
|
||||||
return *ptr1;
|
return *ptr1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -93,11 +93,11 @@ u_int32_t writeRegister16(u_int32_t offset, u_int32_t data) {
|
|||||||
|
|
||||||
int mapCSP0(void) {
|
int mapCSP0(void) {
|
||||||
// if not mapped
|
// if not mapped
|
||||||
if (CSP0BASE == 0) {
|
if (csp0base == 0) {
|
||||||
FILE_LOG(logINFO, ("Mapping memory\n"));
|
FILE_LOG(logINFO, ("Mapping memory\n"));
|
||||||
#ifdef VIRTUAL
|
#ifdef VIRTUAL
|
||||||
CSP0BASE = malloc(MEM_SIZE);
|
csp0base = malloc(MEM_SIZE);
|
||||||
if (CSP0BASE == NULL) {
|
if (csp0base == NULL) {
|
||||||
FILE_LOG(logERROR, ("Could not allocate virtual memory.\n"));
|
FILE_LOG(logERROR, ("Could not allocate virtual memory.\n"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@ -110,15 +110,14 @@ int mapCSP0(void) {
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
FILE_LOG(logDEBUG1, ("/dev/mem opened\n"));
|
FILE_LOG(logDEBUG1, ("/dev/mem opened\n"));
|
||||||
CSP0BASE = mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
|
csp0base = mmap(0, MEM_SIZE, PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED, fd, CSP0);
|
||||||
if (CSP0BASE == MAP_FAILED) {
|
if (csp0base == MAP_FAILED) {
|
||||||
FILE_LOG(logERROR, ("Can't map memmory area\n"));
|
FILE_LOG(logERROR, ("Can't map memmory area\n"));
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
FILE_LOG(logINFO, ("CSPOBASE mapped from 0x%llx to 0x%llx\n",
|
FILE_LOG(logINFO, ("csp0base mapped from %p to %p\n",
|
||||||
(long long unsigned int)CSP0BASE,
|
csp0base, (csp0base + MEM_SIZE)));
|
||||||
(long long unsigned int)(CSP0BASE+MEM_SIZE)));
|
|
||||||
FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
FILE_LOG(logINFO, ("Status Register: %08x\n", bus_r(STATUS_REG)));
|
||||||
}else
|
}else
|
||||||
FILE_LOG(logINFO, ("Memory already mapped before\n"));
|
FILE_LOG(logINFO, ("Memory already mapped before\n"));
|
||||||
@ -126,6 +125,6 @@ int mapCSP0(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint64_t Blackfin_getBaseAddress() {
|
uint32_t* Blackfin_getBaseAddress() {
|
||||||
return CSP0BASE;
|
return csp0base;
|
||||||
}
|
}
|
@ -5,8 +5,8 @@
|
|||||||
#define APIGUI 0x190723
|
#define APIGUI 0x190723
|
||||||
#define APIMOENCH 0x190820
|
#define APIMOENCH 0x190820
|
||||||
#define APIEIGER 0x191111
|
#define APIEIGER 0x191111
|
||||||
|
#define APIGOTTHARD2 0x191127
|
||||||
|
#define APIMYTHEN3 0x191127
|
||||||
#define APICTB 0x191127
|
#define APICTB 0x191127
|
||||||
#define APIGOTTHARD 0x191127
|
#define APIGOTTHARD 0x191127
|
||||||
#define APIGOTTHARD2 0x191127
|
|
||||||
#define APIJUNGFRAU 0x191127
|
#define APIJUNGFRAU 0x191127
|
||||||
#define APIMYTHEN3 0x191127
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user