drv_modem_log_buf.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* Copyright (C) 2018 RDA Technologies Limited and/or its affiliates("RDA").
  2. * All rights reserved.
  3. *
  4. * This software is supplied "AS IS" without any warranties.
  5. * RDA assumes no responsibility or liability for the use of the software,
  6. * conveys no license or title under any patent, copyright, or mask work
  7. * right to the product. RDA reserves the right to make changes in the
  8. * software without notification. RDA also make no representation or
  9. * warranty that such application will be suitable for the specified use
  10. * without further testing or modification.
  11. */
  12. #ifndef _DRV_MODEM_LOG_BUF_H_
  13. #define _DRV_MODEM_LOG_BUF_H_
  14. #include "osi_compiler.h"
  15. OSI_EXTERN_C_BEGIN
  16. /**
  17. * \brief dummy struct for modem log buf
  18. *
  19. * Usually, this is embedded in another data struct. The dummy struct is
  20. * just a placeholder. Don't access members inside.
  21. *
  22. * There should be only one owner for each modem log buf, and then thread
  23. * safe isn't considered in this module. If needed, caller should take
  24. * care of thread safe.
  25. */
  26. typedef struct
  27. {
  28. //! @cond Doxygen_Suppress
  29. void *dummy1;
  30. bool dummy2;
  31. //! @endcond
  32. } drvModemLogBuf_t;
  33. /**
  34. * \brief initialize cp log buffer data structure
  35. *
  36. * It will only search the shared memory, and won't check the content in
  37. * shared memory. It may be called before CP initialization.
  38. *
  39. * \param d modem log buf instance, must be valid
  40. * \return
  41. * - true on success
  42. * - false on fail, no shared memory for cp log
  43. */
  44. bool drvModemLogBufInitCp(drvModemLogBuf_t *d);
  45. /**
  46. * \brief initialize zsp log buffer data structure
  47. *
  48. * \param d modem log buf instance, must be valid
  49. * \return
  50. * - true on success
  51. * - false on fail, no shared memory for zsp log
  52. */
  53. bool drvModemLogBufInitZsp(drvModemLogBuf_t *d);
  54. /**
  55. * \brief initialize mos log buffer data structure
  56. *
  57. * \param d modem log buf instance, must be valid
  58. * \return
  59. * - true on success
  60. * - false on fail, no shared memory for mos log
  61. */
  62. bool drvModemLogBufInitMos(drvModemLogBuf_t *d);
  63. /**
  64. * \brief get linear buffer of modem log buf
  65. *
  66. * Typically, modem log buf is a cyclic buffer. \p is_tail will return
  67. * true when the linear buffer is at the tail, and log data has already
  68. * wrapped. In this case, the returned linear buffer won't be changed
  69. * in the following calls. In case there are size control (avoid to
  70. * process small data) in caller, this case should be handled specially.
  71. *
  72. * When modem log buf is invalid, the returned linear buffer size will
  73. * be 0, the same as buffer empty.
  74. *
  75. * The returned linear buffer pointer will be 4 bytes aligned, and size
  76. * is 4 bytes aligned.
  77. *
  78. * \param d modem log buf instance, must be valid
  79. * \param is_tail return true is the linear buffer is at the tail, and
  80. * log data has been wrapped.
  81. * \return
  82. * - true on success
  83. * - false on fail, no shared memory for mos log
  84. */
  85. osiBuffer_t drvModemLogLinearBuf(drvModemLogBuf_t *d, bool *is_tail);
  86. /**
  87. * \brief update reader pointer of modem log buffer
  88. *
  89. * \p size should be 4 bytes aligned.
  90. *
  91. * \param d modem log buf instance, must be valid
  92. * \param size bytes to be advanced
  93. */
  94. void drvModemLogBufAdvance(drvModemLogBuf_t *d, unsigned size);
  95. OSI_EXTERN_C_END
  96. #endif