py/mphal.h contains declarations for generic mp_hal_XXX functions, such as stdio and delay/ticks, which ports should provide definitions for. A port will also provide mphalport.h with further HAL declarations.
The reason to have our owm ubinascii module is so that later we can add crc32 support using the hardware engine.