Hello hacke,
first of all, it would be good if you can describe your question / your project / your problem a little bit more detailed in order to give you some helpful hints.
Concerning the interface to the underlying hardware, let me refer to the following articles:
Integrating with the device
Device class and device driver
Additionally, within all STM32 Build Environments your will find the example DeviceIntegration which demonstrates the interaction with the underlying hardware.
I hope this helps...
Best regards,
Manfred.