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

SDCard performance improvements #107

Merged
merged 2 commits into from
Nov 10, 2023

Commits on Oct 27, 2023

  1. Convert spi.c and sd.c to eZ80 assembler.

    1. Replace spi.c with spi.asm
       Maximise performance as much as possible by structuring the code so
       that:
       a) The SPI transmission is initiated as quickly as possible
       b) When transferring multiple bytes, minimising the time between
          the the first byte being sent/received and the next transmission
          being initiated.
       c) Do as much as possible whilst the SPI byte is being transmitted
       Introduces spi_read() and spi_write() functions to reduce overhead
       of transmitting multiple bytes.
    
    2. Replace sd.c with sd.asm
       Maximimise performance by:
       a) Using spi_read() and spi_write() where possible.
       b) Create static buffers for SD command sequences that are fixed
       c) Make the byte swapping of the sector address as efficient as
          possible
       d) Avoid martialing parameters off and on the stack by using non-C
          calling conventions and referencing the parameters on the
          calling function's stack
       Uses timer functions and macros instead of counted loops. This also
       makes the code to do things until a timeout occurs simpler and
       quicker. We also use compile-time convertion of milliseconds to
       number of timer counts to avoid unnecessary arithmetic.
    leighbb authored and stevesims committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    d9dab5c View commit details
    Browse the repository at this point in the history
  2. Remove unnecessarily exported functions from sd.asm

    Whilst testing, I had been exporting some of the functions that are
    part of the internal interface, remove those exports now.
    leighbb authored and stevesims committed Oct 27, 2023
    Configuration menu
    Copy the full SHA
    b9555dc View commit details
    Browse the repository at this point in the history