vboot_audio_private.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
  2. * Use of this source code is governed by a BSD-style license that can be
  3. * found in the LICENSE file.
  4. *
  5. * Private declarations for vboot_audio.c. Defined here for easier testing.
  6. */
  7. #ifndef VBOOT_REFERENCE_VBOOT_AUDIO_PRIVATE_H_
  8. #define VBOOT_REFERENCE_VBOOT_AUDIO_PRIVATE_H_
  9. #include "vboot_api.h"
  10. #include "vboot_audio.h"
  11. typedef struct VbDevMusicNote {
  12. uint16_t msec;
  13. uint16_t frequency;
  14. } __attribute__((packed)) VbDevMusicNote;
  15. typedef struct VbDevMusic {
  16. uint8_t sig[4]; /* "$SND" */
  17. uint32_t checksum; /* crc32 over count & all notes */
  18. uint32_t count; /* number of notes */
  19. VbDevMusicNote notes[1]; /* gcc allows [0], MSVC doesn't */
  20. /* more VbDevMusicNotes follow immediately */
  21. } __attribute__((packed)) VbDevMusic;
  22. struct VbAudioContext {
  23. /* note tracking */
  24. VbDevMusicNote *music_notes;
  25. uint32_t note_count;
  26. uint32_t next_note;
  27. /* implementation flags */
  28. int background_beep;
  29. int free_notes_when_done;
  30. /* sound tracking */
  31. uint16_t current_frequency;
  32. uint64_t play_until;
  33. uint64_t last_time;
  34. };
  35. #ifdef FOR_TEST
  36. #define CUSTOM_MUSIC
  37. #endif
  38. #ifdef CUSTOM_MUSIC
  39. void *VbExGetMusicPtr(void);
  40. uint32_t VbExMaxMusicSize(void);
  41. #define CUSTOM_MUSIC_NOTES VbExGetMusicPtr()
  42. #define CUSTOM_MUSIC_MAXSIZE VbExMaxMusicSize()
  43. #else
  44. #define CUSTOM_MUSIC_NOTES 0
  45. #define CUSTOM_MUSIC_MAXSIZE 0
  46. #endif
  47. #endif /* VBOOT_REFERENCE_VBOOT_AUDIO_PRIVATE_H_ */