• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
21 #ifndef __SOLO6X10_OFFSETS_H
22 #define __SOLO6X10_OFFSETS_H
23 
24 #define SOLO_DISP_EXT_ADDR			0x00000000
25 #define SOLO_DISP_EXT_SIZE			0x00480000
26 
27 #define SOLO_EOSD_EXT_ADDR \
28 	(SOLO_DISP_EXT_ADDR + SOLO_DISP_EXT_SIZE)
29 #define SOLO_EOSD_EXT_SIZE(__solo) \
30 	(__solo->type == SOLO_DEV_6010 ? 0x10000 : 0x20000)
31 #define SOLO_EOSD_EXT_SIZE_MAX			0x20000
32 #define SOLO_EOSD_EXT_AREA(__solo) \
33 	(SOLO_EOSD_EXT_SIZE(__solo) * 32)
34 #define SOLO_EOSD_EXT_ADDR_CHAN(__solo, ch) \
35 	(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_SIZE(__solo) * (ch))
36 
37 #define SOLO_MOTION_EXT_ADDR(__solo) \
38 	(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo))
39 #define SOLO_MOTION_EXT_SIZE			0x00080000
40 
41 #define SOLO_G723_EXT_ADDR(__solo) \
42 	(SOLO_MOTION_EXT_ADDR(__solo) + SOLO_MOTION_EXT_SIZE)
43 #define SOLO_G723_EXT_SIZE			0x00010000
44 
45 #define SOLO_CAP_EXT_ADDR(__solo) \
46 	(SOLO_G723_EXT_ADDR(__solo) + SOLO_G723_EXT_SIZE)
47 
48 /* 18 is the maximum number of pages required for PAL@D1, the largest frame
49  * possible */
50 #define SOLO_CAP_PAGE_SIZE			(18 << 16)
51 
52 /* Always allow the encoder enough for 16 channels, even if we have less. The
53  * exception is if we have card with only 32Megs of memory. */
54 #define SOLO_CAP_EXT_SIZE(__solo) \
55 	((((__solo->sdram_size <= (32 << 20)) ? 4 : 16) + 1)	\
56 	 * SOLO_CAP_PAGE_SIZE)
57 
58 #define SOLO_EREF_EXT_ADDR(__solo) \
59 	(SOLO_CAP_EXT_ADDR(__solo) + SOLO_CAP_EXT_SIZE(__solo))
60 #define SOLO_EREF_EXT_SIZE			0x00140000
61 #define SOLO_EREF_EXT_AREA(__solo) \
62 	(SOLO_EREF_EXT_SIZE * __solo->nr_chans * 2)
63 
64 #define __SOLO_JPEG_MIN_SIZE(__solo)		(__solo->nr_chans * 0x00080000)
65 
66 #define SOLO_MP4E_EXT_ADDR(__solo) \
67 	(SOLO_EREF_EXT_ADDR(__solo) + SOLO_EREF_EXT_AREA(__solo))
68 #define SOLO_MP4E_EXT_SIZE(__solo) \
69 	max((__solo->nr_chans * 0x00080000),				\
70 	    min(((__solo->sdram_size - SOLO_MP4E_EXT_ADDR(__solo)) -	\
71 		 __SOLO_JPEG_MIN_SIZE(__solo)), 0x00ff0000))
72 
73 #define __SOLO_JPEG_MIN_SIZE(__solo)		(__solo->nr_chans * 0x00080000)
74 #define SOLO_JPEG_EXT_ADDR(__solo) \
75 		(SOLO_MP4E_EXT_ADDR(__solo) + SOLO_MP4E_EXT_SIZE(__solo))
76 #define SOLO_JPEG_EXT_SIZE(__solo) \
77 	max(__SOLO_JPEG_MIN_SIZE(__solo),				\
78 	    min((__solo->sdram_size - SOLO_JPEG_EXT_ADDR(__solo)), 0x00ff0000))
79 
80 #define SOLO_SDRAM_END(__solo) \
81 	(SOLO_JPEG_EXT_ADDR(__solo) + SOLO_JPEG_EXT_SIZE(__solo))
82 
83 #endif /* __SOLO6X10_OFFSETS_H */
84