Skip to content

Commit

Permalink
modules: standardize encode_params and write_params.
Browse files Browse the repository at this point in the history
The other alternative in use was encode_config and write_config.
  • Loading branch information
ericonr committed Aug 10, 2023
1 parent c7c9590 commit f362f81
Show file tree
Hide file tree
Showing 16 changed files with 28 additions and 28 deletions.
4 changes: 2 additions & 2 deletions include/modules/acq.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class Controller: public RegisterController {
struct acq_core &regs;

void get_internal_values();
void encode_config();
void write_config();
void encode_params();
void write_params();
bool acquisition_ready();

void set_devinfo_callback() override;
Expand Down
2 changes: 1 addition & 1 deletion include/modules/afc_timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Controller: public RegisterController {
struct afc_timing &regs;

void set_devinfo_callback() override;
void encode_config();
void encode_params();

public:
Controller(struct pcie_bars &);
Expand Down
2 changes: 1 addition & 1 deletion include/modules/fofb_cc.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Controller: public RegisterController {
struct fofb_cc_regs &regs;

void get_internal_values();
void encode_config();
void encode_params();

public:
Controller(struct pcie_bars &);
Expand Down
2 changes: 1 addition & 1 deletion include/modules/fofb_processing.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class Controller: public RegisterController {
struct wb_fofb_processing_regs &regs;

void set_devinfo_callback() override;
void encode_config();
void encode_params();

unsigned fixed_point_coeff, fixed_point_gains;

Expand Down
4 changes: 2 additions & 2 deletions include/modules/lamp.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class CoreV2: public RegisterDecoder {

class Controller: public RegisterController {
protected:
virtual void encode_config() = 0;
virtual void encode_params() = 0;

public:
Controller(struct pcie_bars &);
Expand All @@ -60,7 +60,7 @@ class ControllerV2: public Controller {
/* control registers */
std::unique_ptr<channel_registers_v2> channel_regs;

void encode_config() override;
void encode_params() override;

public:
ControllerV2(struct pcie_bars &);
Expand Down
2 changes: 1 addition & 1 deletion include/modules/sysid.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class Controller: public RegisterController {
struct wb_fofb_sys_id_regs &regs;

void set_devinfo_callback() override;
void encode_config();
void encode_params();

public:
Controller(struct pcie_bars &);
Expand Down
2 changes: 1 addition & 1 deletion include/modules/trigger_iface.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Controller: public RegisterController {
struct trigger_iface_regs &regs;

void get_internal_values();
void encode_config();
void encode_params();

public:
Controller(struct pcie_bars &);
Expand Down
2 changes: 1 addition & 1 deletion include/modules/trigger_mux.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class Controller: public RegisterController {
struct trigger_mux_regs &regs;

void get_internal_values();
void encode_config();
void encode_params();

public:
Controller(struct pcie_bars &);
Expand Down
8 changes: 4 additions & 4 deletions modules/acq.cc
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ void Controller::get_internal_values()
throw BadAtomWidth();
}

void Controller::encode_config()
void Controller::encode_params()
{
get_internal_values();
acq_pre_samples = pre_samples;
Expand Down Expand Up @@ -331,9 +331,9 @@ void Controller::encode_config()
regs.ddr3_end_addr = ram_end_addr - sample_size;
}

void Controller::write_config()
void Controller::write_params()
{
encode_config();
encode_params();
bar4_write_v(&bars, addr, &regs, sizeof regs);
}

Expand All @@ -343,7 +343,7 @@ acq_error Controller::start_acquisition()
throw std::logic_error("acquisition should only be started if it's not currently running");

try {
write_config();
write_params();
} catch (BadPostSamples &e) {
return acq_error::bad_post_samples;
} catch (TooManySamples &e) {
Expand Down
4 changes: 2 additions & 2 deletions modules/afc_timing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ bool Controller::set_freq(double freq, struct clock &clock)
return true;
}

void Controller::encode_config()
void Controller::encode_params()
{
insert_bit(regs.stat, event_receiver_enable, TIMING_STAT_EVREN);
insert_bit(regs.stat, reset_latches, TIMING_STAT_RST_LATCH);
Expand Down Expand Up @@ -294,7 +294,7 @@ void Controller::encode_config()

void Controller::write_params()
{
encode_config();
encode_params();

bar4_write_v(&bars, addr, &regs, sizeof regs);

Expand Down
4 changes: 2 additions & 2 deletions modules/fofb_cc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ void Controller::get_internal_values()
bar4_read_v(&bars, addr, &regs, sizeof regs);
}

void Controller::encode_config()
void Controller::encode_params()
{
get_internal_values();

Expand Down Expand Up @@ -239,7 +239,7 @@ void Controller::encode_config()

void Controller::write_params()
{
encode_config();
encode_params();

bar4_write_v(&bars, addr, &regs, sizeof regs);

Expand Down
4 changes: 2 additions & 2 deletions modules/fofb_processing.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ void Controller::set_devinfo_callback()
fixed_point_gains = extract_value<uint32_t>(regs.fixed_point_pos.accs_gains, WB_FOFB_PROCESSING_REGS_FIXED_POINT_POS_ACCS_GAINS_VAL_MASK);
}

void Controller::encode_config()
void Controller::encode_params()
{
insert_bit(regs.loop_intlk.ctl, intlk_sta_clr, WB_FOFB_PROCESSING_REGS_LOOP_INTLK_CTL_STA_CLR);
insert_bit(regs.loop_intlk.ctl, intlk_en_orb_distort, WB_FOFB_PROCESSING_REGS_LOOP_INTLK_CTL_SRC_EN_ORB_DISTORT);
Expand Down Expand Up @@ -216,7 +216,7 @@ void Controller::encode_config()

void Controller::write_params()
{
encode_config();
encode_params();

bar4_write_v(&bars, addr, &regs, sizeof regs);

Expand Down
4 changes: 2 additions & 2 deletions modules/lamp.cc
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ ControllerV2::ControllerV2(struct pcie_bars &bars):
}
ControllerV2::~ControllerV2() = default;

void ControllerV2::encode_config()
void ControllerV2::encode_params()
{
static const std::unordered_map<std::string_view, int> mode_options({
{"open-loop-dac", 0},
Expand Down Expand Up @@ -212,7 +212,7 @@ void ControllerV2::encode_config()

void ControllerV2::write_params()
{
encode_config();
encode_params();

bar4_write_v(&bars, addr + WB_RTMLAMP_OHWR_REGS_CH + channel * CHANNEL_DISTANCE, channel_regs.get(), CHANNEL_DISTANCE);

Expand Down
4 changes: 2 additions & 2 deletions modules/sysid.cc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ void Controller::set_devinfo_callback()
bar4_read_v(&bars, addr, &regs, sizeof regs);
}

void Controller::encode_config()
void Controller::encode_params()
{
if (step_duration < 1 || step_duration > 0x3FF + 1)
throw std::runtime_error("step duration is outside of valid range");
Expand Down Expand Up @@ -172,7 +172,7 @@ void Controller::encode_config()

void Controller::write_params()
{
encode_config();
encode_params();
bar4_write_v(&bars, addr, &regs, sizeof regs);
}

Expand Down
4 changes: 2 additions & 2 deletions modules/trigger_iface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void Controller::get_internal_values()
bar4_read_v(&bars, addr, &regs, sizeof regs);
}

void Controller::encode_config()
void Controller::encode_params()
{
get_internal_values();

Expand All @@ -108,7 +108,7 @@ void Controller::encode_config()

void Controller::write_params()
{
encode_config();
encode_params();

bar4_write_v(&bars, addr, &regs, sizeof regs);

Expand Down
4 changes: 2 additions & 2 deletions modules/trigger_mux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void Controller::get_internal_values()
bar4_read_v(&bars, addr, &regs, sizeof regs);
}

void Controller::encode_config()
void Controller::encode_params()
{
get_internal_values();

Expand All @@ -101,7 +101,7 @@ void Controller::encode_config()

void Controller::write_params()
{
encode_config();
encode_params();

bar4_write_v(&bars, addr, &regs, sizeof regs);
}
Expand Down

0 comments on commit f362f81

Please sign in to comment.