From a29cd5297d2d66f05ea91d05175fdc9fd4b2fef3 Mon Sep 17 00:00:00 2001 From: bd Date: Fri, 21 Mar 2025 16:42:16 -0400 Subject: add 'process' function to handle boilerplate on every request --- inc/dram.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'inc/dram.h') diff --git a/inc/dram.h b/inc/dram.h index ff2c298..e6db633 100644 --- a/inc/dram.h +++ b/inc/dram.h @@ -31,6 +31,18 @@ class Dram : public Storage read_word(Accessor accessor, int address, signed int &data) override; private: + /** + * Helper for all access methods. + * Calls `request_handler` when `accessor` is allowed to complete its + * request cycle. + * @param the source making the request + * @param the address to write to + * @param the function to call when an access should be completed + */ + Response process( + Accessor accessor, + int address, + std::function request_handler); /** * Returns OK if `accessor` is allowed to complete its request this cycle. * Handles wait times, side door, and setting the current accessor this -- cgit v1.2.3