Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: refactor and expand StUartProgrammer #202

Merged
merged 24 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
913040f
Create StUartBootloaderCommandHandler
EkelmansPh Oct 22, 2023
20a387a
Rename ReceiveRegularBufferAction to ReceiveBufferAction
EkelmansPh Oct 22, 2023
7e4b5ee
StUartBootloaderCommandHandler some refactoring
EkelmansPh Oct 23, 2023
50fb73e
Update services/st_util/CMakeLists.txt
EkelmansPh Oct 23, 2023
4a30ce7
Update services/st_util/StUartBootloaderCommandHandler.cpp
EkelmansPh Oct 23, 2023
8feaa2f
Apply suggestions from code review
EkelmansPh Oct 23, 2023
e3a0295
Resolve PR comments.
EkelmansPh Oct 26, 2023
839ca37
Resolve PR comments.
EkelmansPh Oct 26, 2023
8443f88
Resolve PR comments
EkelmansPh Oct 26, 2023
db0da1a
Process PR comments
EkelmansPh Oct 30, 2023
df79387
add ack to end of special command
EkelmansPh Oct 30, 2023
8c094e7
Process review comments
EkelmansPh Oct 30, 2023
02cca4d
Add ReceivePredefinedBuffer Action
EkelmansPh Oct 30, 2023
8c85307
Process PR comments
EkelmansPh Oct 30, 2023
9175336
Process PR comments
EkelmansPh Oct 30, 2023
656de07
Update services/st_util/test/TestStUartBootloaderCommandHandler.cpp
EkelmansPh Oct 30, 2023
9b22912
Merge branch 'main' into feature/st_uart_bootloader_communicator
EkelmansPh Oct 30, 2023
958d71c
Process PR comments
EkelmansPh Oct 30, 2023
a7a7049
Merge branch 'main' into feature/st_uart_bootloader_communicator
EkelmansPh Nov 2, 2023
0776682
chore: rename to StBootloaderCommandHandlerUart
EkelmansPh Nov 6, 2023
c3a1f9e
chore: StBootloaderCommandHandlerUartTest ExpectReceiveData -> Receiv…
EkelmansPh Nov 6, 2023
5cf21a8
test: StBootloaderCommandHandlerUart extend test coverage
EkelmansPh Nov 6, 2023
2adfc35
Merge branch 'main' into feature/st_uart_bootloader_communicator
EkelmansPh Nov 6, 2023
882be34
chore: StBootloaderCommandHandler -> StBootloaderCommunicator
EkelmansPh Nov 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions services/st_util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,16 @@ target_sources(services.st_util PRIVATE
FlashOnStUartProgrammer.hpp
StUartProgrammer.cpp
StUartProgrammer.hpp
StBootloaderCommandHandler.hpp
StUartBootloaderCommandHandler.cpp
StUartBootloaderCommandHandler.hpp
)

target_link_libraries(services.st_util PUBLIC
hal.interfaces
services.util
)

if (EMIL_BUILD_TESTS)
add_subdirectory(test)
endif()
37 changes: 37 additions & 0 deletions services/st_util/StBootloaderCommandHandler.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#ifndef SERVICES_ST_UTIL_ST_BOOTLOADER_COMMAND_HANDLER_HPP
#define SERVICES_ST_UTIL_ST_BOOTLOADER_COMMAND_HANDLER_HPP

#include "infra/util//Function.hpp"

namespace services
{
class StBootloaderCommandHandler
{
protected:
StBootloaderCommandHandler() = default;
StBootloaderCommandHandler(const StBootloaderCommandHandler& other) = delete;
StBootloaderCommandHandler& operator=(const StBootloaderCommandHandler& other) = delete;
~StBootloaderCommandHandler() = default;

public:
virtual void GetCommand(infra::ByteRange& commands, const infra::Function<void(uint8_t major, uint8_t minor)>& onDone) = 0;
virtual void GetVersion(const infra::Function<void(uint8_t major, uint8_t minor)>& onDone) = 0;
virtual void GetId(const infra::Function<void(uint16_t id)>& onDone) = 0;
virtual void ReadMemory(uint32_t address, uint8_t size, infra::ByteRange& data, const infra::Function<void()>& onDone) = 0;
virtual void Go(uint32_t address, const infra::Function<void()>& onDone) = 0;
virtual void WriteMemory(uint32_t address, infra::ConstByteRange data, const infra::Function<void()>& onDone) = 0;
virtual void Erase(uint8_t subcommand, const infra::Function<void()>& onDone) = 0;
virtual void Erase(uint8_t nPages, infra::ConstByteRange pages, const infra::Function<void()>& onDone) = 0;
virtual void ExtendedErase(uint16_t subcommand, const infra::Function<void()>& onDone) = 0;
virtual void ExtendedErase(uint8_t nPages, infra::ConstByteRange pages, const infra::Function<void()>& onDone) = 0;
virtual void Special(uint16_t subcommand, infra::ConstByteRange txData, infra::ByteRange& rxData, infra::ByteRange& rxStatus, const infra::Function<void()>& onDone) = 0;
virtual void ExtendedSpecial(uint16_t subcommand, infra::ConstByteRange txData1, infra::ConstByteRange txData2, infra::ByteRange& rxData, const infra::Function<void()>& onDone) = 0;
virtual void WriteProtect(infra::ConstByteRange sectors, const infra::Function<void()>& onDone) = 0;
virtual void WriteUnprotect(const infra::Function<void()>& onDone) = 0;
virtual void ReadoutProtect(const infra::Function<void()>& onDone) = 0;
virtual void ReadoutUnprotect(const infra::Function<void()>& onDone) = 0;
virtual void GetChecksum(uint32_t address, uint32_t memAreaSize, uint32_t crcPolinomial, uint32_t crcInitialization, const infra::Function<void(uint32_t crc, uint8_t checksum)>& onDone) = 0;
};
}

#endif
Loading
Loading