18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (C) 2010-2013 Bluecherry, LLC <https://www.bluecherrydvr.com>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Original author:
68c2ecf20Sopenharmony_ci * Ben Collins <bcollins@ubuntu.com>
78c2ecf20Sopenharmony_ci *
88c2ecf20Sopenharmony_ci * Additional work by:
98c2ecf20Sopenharmony_ci * John Brooks <john.brooks@bluecherry.net>
108c2ecf20Sopenharmony_ci */
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#ifndef __SOLO6X10_OFFSETS_H
138c2ecf20Sopenharmony_ci#define __SOLO6X10_OFFSETS_H
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_ci#define SOLO_DISP_EXT_ADDR			0x00000000
168c2ecf20Sopenharmony_ci#define SOLO_DISP_EXT_SIZE			0x00480000
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ci#define SOLO_EOSD_EXT_ADDR \
198c2ecf20Sopenharmony_ci	(SOLO_DISP_EXT_ADDR + SOLO_DISP_EXT_SIZE)
208c2ecf20Sopenharmony_ci#define SOLO_EOSD_EXT_SIZE(__solo) \
218c2ecf20Sopenharmony_ci	(__solo->type == SOLO_DEV_6010 ? 0x10000 : 0x20000)
228c2ecf20Sopenharmony_ci#define SOLO_EOSD_EXT_SIZE_MAX			0x20000
238c2ecf20Sopenharmony_ci#define SOLO_EOSD_EXT_AREA(__solo) \
248c2ecf20Sopenharmony_ci	(SOLO_EOSD_EXT_SIZE(__solo) * 32)
258c2ecf20Sopenharmony_ci#define SOLO_EOSD_EXT_ADDR_CHAN(__solo, ch) \
268c2ecf20Sopenharmony_ci	(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_SIZE(__solo) * (ch))
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_ci#define SOLO_MOTION_EXT_ADDR(__solo) \
298c2ecf20Sopenharmony_ci	(SOLO_EOSD_EXT_ADDR + SOLO_EOSD_EXT_AREA(__solo))
308c2ecf20Sopenharmony_ci#define SOLO_MOTION_EXT_SIZE			0x00080000
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ci#define SOLO_G723_EXT_ADDR(__solo) \
338c2ecf20Sopenharmony_ci	(SOLO_MOTION_EXT_ADDR(__solo) + SOLO_MOTION_EXT_SIZE)
348c2ecf20Sopenharmony_ci#define SOLO_G723_EXT_SIZE			0x00010000
358c2ecf20Sopenharmony_ci
368c2ecf20Sopenharmony_ci#define SOLO_CAP_EXT_ADDR(__solo) \
378c2ecf20Sopenharmony_ci	(SOLO_G723_EXT_ADDR(__solo) + SOLO_G723_EXT_SIZE)
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci/* 18 is the maximum number of pages required for PAL@D1, the largest frame
408c2ecf20Sopenharmony_ci * possible */
418c2ecf20Sopenharmony_ci#define SOLO_CAP_PAGE_SIZE			(18 << 16)
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ci/* Always allow the encoder enough for 16 channels, even if we have less. The
448c2ecf20Sopenharmony_ci * exception is if we have card with only 32Megs of memory. */
458c2ecf20Sopenharmony_ci#define SOLO_CAP_EXT_SIZE(__solo) \
468c2ecf20Sopenharmony_ci	((((__solo->sdram_size <= (32 << 20)) ? 4 : 16) + 1)	\
478c2ecf20Sopenharmony_ci	 * SOLO_CAP_PAGE_SIZE)
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci#define SOLO_EREF_EXT_ADDR(__solo) \
508c2ecf20Sopenharmony_ci	(SOLO_CAP_EXT_ADDR(__solo) + SOLO_CAP_EXT_SIZE(__solo))
518c2ecf20Sopenharmony_ci#define SOLO_EREF_EXT_SIZE			0x00140000
528c2ecf20Sopenharmony_ci#define SOLO_EREF_EXT_AREA(__solo) \
538c2ecf20Sopenharmony_ci	(SOLO_EREF_EXT_SIZE * __solo->nr_chans * 2)
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_ci#define __SOLO_JPEG_MIN_SIZE(__solo)		(__solo->nr_chans * 0x00080000)
568c2ecf20Sopenharmony_ci
578c2ecf20Sopenharmony_ci#define SOLO_MP4E_EXT_ADDR(__solo) \
588c2ecf20Sopenharmony_ci	(SOLO_EREF_EXT_ADDR(__solo) + SOLO_EREF_EXT_AREA(__solo))
598c2ecf20Sopenharmony_ci#define SOLO_MP4E_EXT_SIZE(__solo) \
608c2ecf20Sopenharmony_ci	max((__solo->nr_chans * 0x00080000),				\
618c2ecf20Sopenharmony_ci	    min(((__solo->sdram_size - SOLO_MP4E_EXT_ADDR(__solo)) -	\
628c2ecf20Sopenharmony_ci		 __SOLO_JPEG_MIN_SIZE(__solo)), 0x00ff0000))
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#define __SOLO_JPEG_MIN_SIZE(__solo)		(__solo->nr_chans * 0x00080000)
658c2ecf20Sopenharmony_ci#define SOLO_JPEG_EXT_ADDR(__solo) \
668c2ecf20Sopenharmony_ci		(SOLO_MP4E_EXT_ADDR(__solo) + SOLO_MP4E_EXT_SIZE(__solo))
678c2ecf20Sopenharmony_ci#define SOLO_JPEG_EXT_SIZE(__solo) \
688c2ecf20Sopenharmony_ci	max(__SOLO_JPEG_MIN_SIZE(__solo),				\
698c2ecf20Sopenharmony_ci	    min((__solo->sdram_size - SOLO_JPEG_EXT_ADDR(__solo)), 0x00ff0000))
708c2ecf20Sopenharmony_ci
718c2ecf20Sopenharmony_ci#define SOLO_SDRAM_END(__solo) \
728c2ecf20Sopenharmony_ci	(SOLO_JPEG_EXT_ADDR(__solo) + SOLO_JPEG_EXT_SIZE(__solo))
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci#endif /* __SOLO6X10_OFFSETS_H */
75