-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Medium
-
SITSW-6278
-
10.01.00
-
12.00.00
-
The current MMCSD_read & MMCSD_write function, which are designed to support reading any buffer size, are not designed for simplicity & readability.
The implementation looks like this:
- If #blocks are greater than max #blocks, split the transactions as:
- Loop for multiple transactions with max #blocks.
- Separate if condition to handle the leftover blocks (< max #blocks).
- Else, a single transaction for #blocks < max #blocks.
There are too many branches here which makes the code unnecessarily complicated & unreadable.
The implementation needs refactoring for simplicity, readability, and to show quality.
One simple implementation is to club everything into a single loop with conditionally assigning the #blocks, buf, cmd for the transaction like shown in the attached file.