solo6x10-offsets.h 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. * Copyright (C) 2010-2013 Bluecherry, LLC <http://www.bluecherrydvr.com>
  3. *
  4. * Original author:
  5. * Ben Collins <bcollins@ubuntu.com>
  6. *
  7. * Additional work by:
  8. * John Brooks <john.brooks@bluecherry.net>
  9. *
  10. * This program is free software; you can redistribute it and/or modify
  11. * it under the terms of the GNU General Public License as published by
  12. * the Free Software Foundation; either version 2 of the License, or
  13. * (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU General Public License for more details.
  19. */
  20. #ifndef __SOLO6X10_OFFSETS_H
  21. #define __SOLO6X10_OFFSETS_H
  22. #define SOLO_DISP_EXT_ADDR 0x00000000
  23. #define SOLO_DISP_EXT_SIZE 0x00480000
  24. #define SOLO_EOSD_EXT_ADDR \
  25. (SOLO_DISP_EXT_ADDR + SOLO_DISP_EXT_SIZE)
  26. #define SOLO_EOSD_EXT_SIZE(__solo) \
  27. (__solo->type == SOLO_DEV_6010 ? 0x10000 : 0x20000)
  28. #define SOLO_EOSD_EXT_SIZE_MAX 0x20000
  29. #define SOLO_EOSD_EXT_AREA(__solo) \
  30. (SOLO_EOSD_EXT_SIZE(__solo) * 32)
  31. #define SOLO_EOSD_EXT_ADDR_CHAN(__solo, ch) \
  32. (SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_SIZE(__solo) * (ch))
  33. #define SOLO_MOTION_EXT_ADDR(__solo) \
  34. (SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo))
  35. #define SOLO_MOTION_EXT_SIZE 0x00080000
  36. #define SOLO_G723_EXT_ADDR(__solo) \
  37. (SOLO_MOTION_EXT_ADDR(__solo) + SOLO_MOTION_EXT_SIZE)
  38. #define SOLO_G723_EXT_SIZE 0x00010000
  39. #define SOLO_CAP_EXT_ADDR(__solo) \
  40. (SOLO_G723_EXT_ADDR(__solo) + SOLO_G723_EXT_SIZE)
  41. /* 18 is the maximum number of pages required for PAL@D1, the largest frame
  42. * possible */
  43. #define SOLO_CAP_PAGE_SIZE (18 << 16)
  44. /* Always allow the encoder enough for 16 channels, even if we have less. The
  45. * exception is if we have card with only 32Megs of memory. */
  46. #define SOLO_CAP_EXT_SIZE(__solo) \
  47. ((((__solo->sdram_size <= (32 << 20)) ? 4 : 16) + 1) \
  48. * SOLO_CAP_PAGE_SIZE)
  49. #define SOLO_EREF_EXT_ADDR(__solo) \
  50. (SOLO_CAP_EXT_ADDR(__solo) + SOLO_CAP_EXT_SIZE(__solo))
  51. #define SOLO_EREF_EXT_SIZE 0x00140000
  52. #define SOLO_EREF_EXT_AREA(__solo) \
  53. (SOLO_EREF_EXT_SIZE * __solo->nr_chans * 2)
  54. #define __SOLO_JPEG_MIN_SIZE(__solo) (__solo->nr_chans * 0x00080000)
  55. #define SOLO_MP4E_EXT_ADDR(__solo) \
  56. (SOLO_EREF_EXT_ADDR(__solo) + SOLO_EREF_EXT_AREA(__solo))
  57. #define SOLO_MP4E_EXT_SIZE(__solo) \
  58. max((__solo->nr_chans * 0x00080000), \
  59. min(((__solo->sdram_size - SOLO_MP4E_EXT_ADDR(__solo)) - \
  60. __SOLO_JPEG_MIN_SIZE(__solo)), 0x00ff0000))
  61. #define __SOLO_JPEG_MIN_SIZE(__solo) (__solo->nr_chans * 0x00080000)
  62. #define SOLO_JPEG_EXT_ADDR(__solo) \
  63. (SOLO_MP4E_EXT_ADDR(__solo) + SOLO_MP4E_EXT_SIZE(__solo))
  64. #define SOLO_JPEG_EXT_SIZE(__solo) \
  65. max(__SOLO_JPEG_MIN_SIZE(__solo), \
  66. min((__solo->sdram_size - SOLO_JPEG_EXT_ADDR(__solo)), 0x00ff0000))
  67. #define SOLO_SDRAM_END(__solo) \
  68. (SOLO_JPEG_EXT_ADDR(__solo) + SOLO_JPEG_EXT_SIZE(__solo))
  69. #endif /* __SOLO6X10_OFFSETS_H */