195 lines
4.9 KiB
C++
195 lines
4.9 KiB
C++
/*
|
|
* main.cpp
|
|
*
|
|
* Created on: 19 Mar 2018
|
|
* Author: user
|
|
*/
|
|
|
|
#include <stdint.h>
|
|
#include <string>
|
|
#include "CHal.h"
|
|
|
|
extern "C"
|
|
{
|
|
// --------------------------------------------------
|
|
// STM8 configuration
|
|
|
|
int64_t ElHalSOM_stm8Config(uint32_t p_uAddr, uint8_t *p_pyData, uint32_t p_uNumBytes)
|
|
{
|
|
return CHal::Hal()->p_core->p_swim1->stm8SwimConfig(p_uAddr, p_pyData, p_uNumBytes);
|
|
}
|
|
|
|
int64_t ElHalSOM_stm8Read(uint32_t p_uAddr, uint8_t *p_pyData, uint32_t p_uNumBytes)
|
|
{
|
|
return CHal::Hal()->p_core->p_swim1->stm8SwimRead(p_uAddr, p_pyData, p_uNumBytes);
|
|
}
|
|
|
|
int64_t ElHalSOM_stm8ProgramFlash(char* imageFile_str, bool verify)
|
|
{
|
|
return CHal::Hal()->p_core->p_swim1->stm8ProgramFlash(imageFile_str, verify);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// Waveform sequencer
|
|
|
|
int64_t ElHalSOM_loadWavSeqRam(const uint32_t head, const uint32_t* buf, const uint32_t offset, const uint32_t len)
|
|
{
|
|
return CHal::Hal()->p_core->p_printCtrl1->loadWavSeqRam(head, buf, offset, len);
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuRunWavSequence(const uint32_t head_bm, const uint32_t addresses[MAX_HEADS])
|
|
{
|
|
return CHal::Hal()->p_core->p_printCtrl1->cpuRunWavSequence(head_bm, addresses);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// HMB FPGA configuration
|
|
|
|
int64_t ElHalSOM_startHmbFpgaConfig(uint32_t phyStartAddr)
|
|
{
|
|
return CHal::Hal()->p_core->p_hmbFpgaCfg1->startHmbFpgaConfig(phyStartAddr);
|
|
}
|
|
|
|
// --------------------------------------------------
|
|
// PIO access
|
|
|
|
int64_t ElHalSOM_setHostPowers(uint32_t powersBm)
|
|
{
|
|
CHal::Hal()->p_core->p_genericPio1->setHostPowers(powersBm);
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_sendStm8TriggerRx()
|
|
{
|
|
CHal::Hal()->p_core->p_genericPio1->sendStm8TriggerRx();
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_setLeds(uint32_t ledBm)
|
|
{
|
|
CHal::Hal()->p_core->p_genericPio1->setLeds(ledBm);
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_resetDacs()
|
|
{
|
|
CHal::Hal()->p_core->p_genericPio1->resetDacs();
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuHeadAmpEnAll(bool on)
|
|
{
|
|
if (on)
|
|
CHal::Hal()->p_core->p_genericPio1->cpuSetHeadAmpEnAll();
|
|
else
|
|
CHal::Hal()->p_core->p_genericPio1->cpuClrHeadAmpEnAll();
|
|
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_getHeadiLimMainEnAll()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericPio1->getHeadiLimMainAll();
|
|
}
|
|
|
|
int64_t ElHalSOM_getHeadiLimBiasEnAll()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericPio1->getHeadiLimBiasAll();
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuHead3v3fEnAll(bool on)
|
|
{
|
|
if (on)
|
|
CHal::Hal()->p_core->p_genericPio1->cpuSetHead3v3fEnAll();
|
|
else
|
|
CHal::Hal()->p_core->p_genericPio1->cpuClrHead3v3fEnAll();
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuNI2cHeadEnAll(bool on)
|
|
{
|
|
if (on)
|
|
CHal::Hal()->p_core->p_genericPio1->cpuSetNI2cHeadEnAll();
|
|
else
|
|
CHal::Hal()->p_core->p_genericPio1->cpuClrNI2cHeadEnAll();
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuHeadNVampNPLLAll(bool on)
|
|
{
|
|
if (on)
|
|
CHal::Hal()->p_core->p_genericPio1->cpuSetheadNVampNPLLAll();
|
|
else
|
|
CHal::Hal()->p_core->p_genericPio1->cpuClrheadNVampNPLLAll();
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuSetStm8TriggerRx()
|
|
{
|
|
CHal::Hal()->p_core->p_genericPio1->cpuSetStm8TriggerRx();
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuClrStm8TriggerRx()
|
|
{
|
|
CHal::Hal()->p_core->p_genericPio1->cpuClrStm8TriggerRx();
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_cpuSetRedYellowLeds(uint32_t bm)
|
|
{
|
|
CHal::Hal()->p_core->p_genericPio1->cpuSetRedYellowLeds(bm);
|
|
return 0;
|
|
}
|
|
|
|
int64_t ElHalSOM_getHeadThermFaultAll()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericPio1->getHeadThermFaultAll();
|
|
}
|
|
|
|
int64_t ElHalSOM_getHeadI2CFaultAll()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericPio1->getHeadI2CFaultAll();
|
|
}
|
|
|
|
int64_t ElHalSOM_getSomStm8AlertTx()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericPio1->getSomStm8AlertTx();
|
|
}
|
|
|
|
int64_t ElHalSOM_getHmbStm8AlertTx()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericPio1->getHmbStm8AlertTx();
|
|
}
|
|
|
|
int64_t ElHalSOM_getPAllGood()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericPio1->getPAllGood();
|
|
}
|
|
|
|
int64_t ElHalSOM_getTimingRxp()
|
|
{
|
|
return CHal::Hal()->p_core->p_genericLvdsRx1->getTimingRxp();
|
|
}
|
|
}
|
|
|
|
#if 0
|
|
#include <boost/python.hpp>
|
|
using namespace boost::python;
|
|
|
|
struct World
|
|
{
|
|
void set(std::string msg) { this->msg = msg; }
|
|
std::string greet() { return msg; }
|
|
std::string msg;
|
|
};
|
|
|
|
BOOST_PYTHON_MODULE(Hal)
|
|
{
|
|
class_<World>("World")
|
|
.def("greet", &World::greet)
|
|
.def("set", &World::set)
|
|
;
|
|
}
|
|
#endif
|
|
|