dwl_linux.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*------------------------------------------------------------------------------
  2. -- --
  3. -- This software is confidential and proprietary and may be used --
  4. -- only as expressly authorized by a licensing agreement from --
  5. -- --
  6. -- Hantro Products Oy. --
  7. -- --
  8. -- (C) COPYRIGHT 2006 HANTRO PRODUCTS OY --
  9. -- ALL RIGHTS RESERVED --
  10. -- --
  11. -- The entire notice above must be reproduced --
  12. -- on all copies and should not be removed. --
  13. -- --
  14. --------------------------------------------------------------------------------
  15. --
  16. -- Description : dwl common part header file
  17. --
  18. ------------------------------------------------------------------------------
  19. --
  20. -- Version control information, please leave untouched.
  21. --
  22. -- $RCSfile: dwl_linux.h,v $
  23. -- $Revision: 1.8 $
  24. -- $Date: 2008/11/28 12:32:33 $
  25. --
  26. ------------------------------------------------------------------------------*/
  27. #include "basetype.h"
  28. #include "dwl.h"
  29. #include "memalloc.h"
  30. #include "dwl_linux_lock.h"
  31. #include <sys/types.h>
  32. #include <sys/stat.h>
  33. #include <sys/mman.h>
  34. #include <sys/ioctl.h>
  35. #include <sys/timeb.h>
  36. #include <assert.h>
  37. #include <stdio.h>
  38. #include <stdlib.h>
  39. #include <string.h>
  40. #ifdef USE_EFENCE
  41. #include "efence.h"
  42. #endif
  43. //#define _DWL_DEBUG
  44. #ifdef _DWL_DEBUG
  45. #define DWL_DEBUG(fmt, args...) printf(__FILE__ ":%d: " fmt, __LINE__ , ## args)
  46. #else
  47. #define DWL_DEBUG(fmt, args...) /* not debugging: nothing */
  48. #endif
  49. #ifdef INTERNAL_TEST
  50. #define REG_DUMP_FILE "swreg.trc"
  51. #endif
  52. #ifndef HX170DEC_IO_BASE
  53. #define HX170DEC_IO_BASE 0xC0000000U
  54. #endif
  55. #define HX170PP_REG_START 0xF0
  56. #define HX170DEC_REG_START 0x4
  57. #define HX170PP_SYNTH_CFG 100
  58. #define HX170DEC_SYNTH_CFG 50
  59. #define HX170DEC_SYNTH_CFG_2 54
  60. #define HX170PP_FUSE_CFG 99
  61. #define HX170DEC_FUSE_CFG 57
  62. #define DWL_DECODER_INT ((DWLReadReg(dec_dwl, HX170DEC_REG_START) >> 12) & 0xFFU)
  63. #define DWL_PP_INT ((DWLReadReg(dec_dwl, HX170PP_REG_START) >> 12) & 0xFFU)
  64. #define DEC_IRQ_ABORT (1 << 11)
  65. #define DEC_IRQ_RDY (1 << 12)
  66. #define DEC_IRQ_BUS (1 << 13)
  67. #define DEC_IRQ_BUFFER (1 << 14)
  68. #define DEC_IRQ_ASO (1 << 15)
  69. #define DEC_IRQ_ERROR (1 << 16)
  70. #define DEC_IRQ_SLICE (1 << 17)
  71. #define DEC_IRQ_TIMEOUT (1 << 18)
  72. #define PP_IRQ_RDY (1 << 12)
  73. #define PP_IRQ_BUS (1 << 13)
  74. #define DWL_STREAM_ERROR_BIT 0x010000 /* 16th bit */
  75. #define DWL_HW_TIMEOUT_BIT 0x040000 /* 18th bit */
  76. #define DWL_HW_ENABLE_BIT 0x000001 /* 0th bit */
  77. #define DWL_HW_PIC_RDY_BIT 0x001000 /* 12th bit */
  78. #ifdef _DWL_HW_PERFORMANCE
  79. /* signal that decoder/pp is enabled */
  80. void DwlDecoderEnable(void);
  81. void DwlPpEnable(void);
  82. #endif
  83. /* Function prototypes */
  84. /* wrapper information */
  85. typedef struct hX170dwl
  86. {
  87. u32 clientType;
  88. int fd; /* decoder device file */
  89. int fd_mem; /* /dev/mem for mapping */
  90. int fd_memalloc; /* linear memory allocator */
  91. u32 numCores;
  92. volatile u32 *pRegBase; /* IO mem base */
  93. u32 regSize; /* IO mem size */
  94. u32 freeLinMem; /* Start address of free linear memory */
  95. u32 freeRefFrmMem; /* Start address of free reference frame memory */
  96. int semid;
  97. int sigio_needed;
  98. #ifdef INTERNAL_TEST
  99. FILE *regDump;
  100. #endif
  101. u32 bPPReserved;
  102. } hX170dwl_t;
  103. i32 DWLWaitPpHwReady(const void *instance, u32 timeout);
  104. i32 DWLWaitDecHwReady(const void *instance, u32 timeout);
  105. u32 *DWLMapRegisters(int mem_dev, unsigned int base,
  106. unsigned int regSize, u32 write);
  107. void DWLUnmapRegisters(const void *io, unsigned int regSize);
  108. void DWLSoftResetAsic(void);