inline void libsoc_spi_debug (const char *func, spi * spi, char *format, ...) { #ifdef DEBUG if (libsoc_get_debug ()) { va_list args; fprintf (stderr, "libsoc-spi-debug: "); va_start (args, format); vfprintf (stderr, format, args); va_end (args); if (spi == NULL) { fprintf (stderr, " (NULL, %s)", func); } else { fprintf (stderr, " (spidev%d.%d, %s)", spi->spi_dev, spi->chip_select, func); } fprintf (stderr, "\n"); } #endif }
inline void libsoc_gpio_debug (const char *func, int gpio, char *format, ...) { #ifdef DEBUG if (libsoc_get_debug ()) { va_list args; fprintf (stderr, "libsoc-gpio-debug: "); va_start (args, format); vfprintf (stderr, format, args); va_end (args); if (gpio >= 0) { fprintf (stderr, " (%d, %s)", gpio, func); } else { fprintf (stderr, " (NULL, %s)", func); } fprintf (stderr, "\n"); } #endif }
void libsoc_i2c_debug (const char *func, i2c * i2c, char *format, ...) { #ifdef DEBUG if (libsoc_get_debug ()) { va_list args; fprintf (stderr, "libsoc-i2c-debug: "); va_start (args, format); vfprintf (stderr, format, args); va_end (args); if (i2c == NULL) { fprintf (stderr, " (NULL, %s)", func); } else { fprintf (stderr, " (i2c-%d, %d, %s)", i2c->bus, i2c->address, func); } fprintf (stderr, "\n"); } #endif }