console_assertions.h 1.0 KB

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #ifndef CONSOLE_ASSERTIONS_H
  7. #define CONSOLE_ASSERTIONS_H
  8. #include <lib/cassert.h>
  9. /*
  10. * This file contains some separate assertions about console_t, moved here to
  11. * keep them out of the way. Should only be included from <console.h>.
  12. */
  13. CASSERT(CONSOLE_T_NEXT == __builtin_offsetof(console_t, next),
  14. assert_console_t_next_offset_mismatch);
  15. CASSERT(CONSOLE_T_FLAGS == __builtin_offsetof(console_t, flags),
  16. assert_console_t_flags_offset_mismatch);
  17. CASSERT(CONSOLE_T_PUTC == __builtin_offsetof(console_t, putc),
  18. assert_console_t_putc_offset_mismatch);
  19. #if ENABLE_CONSOLE_GETC
  20. CASSERT(CONSOLE_T_GETC == __builtin_offsetof(console_t, getc),
  21. assert_console_t_getc_offset_mismatch);
  22. #endif
  23. CASSERT(CONSOLE_T_FLUSH == __builtin_offsetof(console_t, flush),
  24. assert_console_t_flush_offset_mismatch);
  25. CASSERT(CONSOLE_T_DRVDATA == sizeof(console_t),
  26. assert_console_t_drvdata_offset_mismatch);
  27. #endif /* CONSOLE_ASSERTIONS_H */