Reading SdFat's backend for interacting with SD cards...
There's a layer of abstraction for describing how which pins the SD card is plugged into & factories for turning those datastructures into block devices.
Behind that is (among other thinsg I'll describe tomorrow) are abstractions around LibSPI with microcontroller-specific micro-optimizations. Hence there's multiple variants of this wrapper for the different targets. LibSPI is a cross-platform hardware-accelerated API for SPI comms.
1/2