Skip to content
This repository has been archived by the owner on Jan 31, 2022. It is now read-only.

WIP [feature] templated RPC methods migration #164

Conversation

jsturdy
Copy link
Contributor

@jsturdy jsturdy commented Dec 17, 2019

This PR holds the code of the migration to the templated methods.
It will be built up as the individual modules are merged into my fork, and will only become non WIP after all code has found its way into that fork (so review of the independent parts can still happen in bite-size chunks).

As it stands here, the changes have been applied to the core libraries as well as the utils and amc modules.

Description

Significant and breaking

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)

Motivation and Context

Necessary to bring the code base into the future.

How Has This Been Tested?

Only with the compiler so far, will envision a set of operational tests to follow before final merge.

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly (hopefully)
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Copy link

@lmoureaux lmoureaux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursory look at the first files in alphabetical order, mostly interface & documentation comments

include/amc.h Outdated
uint32_t getOHVFATMaskLocal(localArgs * la, uint32_t ohN);
/*!
* \brief Returns AMC FW version
* In the case FW version is not 1.X or 3.X, throws std::runtime_error

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/*!
 * \throws std::runtime_error if the FW version is not 1.X or 3.X
 */

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Guess this will have to be updated globally, as there are quite some places that now throw

include/amc.h Outdated
/*!
* \brief Returns AMC FW version
* In the case FW version is not 1.X or 3.X, throws std::runtime_error
* \param \c caller_name Name of method which called the FW version check FIXME necessary?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the parameter is not needed, now would be a good time to drop it or at least make it optional.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What were the use cases originally for including it?
Just to pass it to a potential LOGGER message?

*/
struct getOHVFATMask : public xhal::rpc::Method
{
uint32_t operator()(const uint32_t &ohN) const;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why constant references for parameters? I can't think of any reason to prefer them over values (for scalars; for heavier objects there is a good reason).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Support for returning std::bitset would come handy here.

*/
void getOHVFATMaskMultiLink(const RPCMsg *request, RPCMsg *response);
/*!
* \brief As \c getOHVFATMask but for all optical links specified in ohMask on the AMC

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest repeating the documentation instead of referring to another. If not, use \ref instead of \c.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think \c was an artifact, so not sure who introduced it nor what it does

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\c displays the following word in typewriter font. \ref is for a reference.

include/amc.h Show resolved Hide resolved
include/amc/blaster_ram.h Outdated Show resolved Hide resolved
include/amc/blaster_ram.h Outdated Show resolved Hide resolved
* * if the size is more, an error will be thrown
* * if the size is less, only the number of words specified will be read from the RAM (maybe)
* * if ALL is specified, the size must be the total RAM size
* - GBT_RAM_SIZE*N_GBTX*N_OH + OH_RAM_SIZE*N_OH + VFAT_RAM_SIZE*N_VFAT*N_OH

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could introduce a function to calculate this.

* GEM_AMC.CONFIG_BLASTER.STATUS.VFAT_RAM_SIZE
*/
struct readConfRAM : xhal::rpc::Method {
uint32_t operator()(BLASTERTypeT const& type, uint32_t* blob, size_t const& blob_sz);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method cannot be called remotely because of the pointer parameter. Return a std::vector? Same issue for several RPC methods after this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, this was a byproduct of partial implementation...

* \brief With its intrusive serializer
*/
template<class Message> void serialize(Message & msg) {
msg & EBLASTERType;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this compile? EBLASTERType is the enum type, shouldn't it be BLASTERType?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This particular commit probably doesn't, but the compilation is fixed in a later commit.
As I go through to fix the comments here, I'll backport that

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do ya know, it actually does compile :-D, but this still needs the update viz scoped enums

Copy link
Contributor

@mexanick mexanick left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursory approval for testing

@jsturdy
Copy link
Contributor Author

jsturdy commented Jan 23, 2020

I opened #167 to supersede this (it contains all the changes mentioned in the description of this, and is the hopeful starting point for integrated development between xhal/cmsgemos/ctp7_modules in the templated RPC framework)

@jsturdy jsturdy closed this Jan 23, 2020
@jsturdy jsturdy deleted the feature/templated-rpc-methods-migration branch February 14, 2020 15:30
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants