From patchwork Mon Jun 27 16:27:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16383 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id C9E67BD808 for ; Mon, 27 Jun 2022 16:27:45 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D73E665642; Mon, 27 Jun 2022 18:27:44 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1656347265; bh=Td3krTJJg9DQJdNUDwUHGq6oqQPqRHLo3sYlLNOUw9g=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=lmewknPpO/cGzbCO/pmH4z2+tk+iuZdD1x1EflR1zXtbfRoSctjDg8SLukQ9ZkxBI 3FYbKg1xCOJA8UT9t/oquDEjw/WtA6AxBtxeLGFFxvjINyCZsVh1TT9FdfdH/oDiFG bFqvnqXfi922FlkH2ijZ1F53tgbAnmBGMVZMJmUwgDRX8PhZX3RkT5Z/5c6tjdjx91 Xroa9oqaKpAxPLnOpY7EK/vPv1u6AyoxbHXjenzfW6xvqCsEIsnmkHmxCSi8YQyrlx KdDceKtHsqiSRSNfCuut/FY5ehsMQ2QwsZLXXCm5W7S8mqFCZmeKbfK3BmCyt/nrTh /R7YbJId67oEw== Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C074D6059B for ; Mon, 27 Jun 2022 18:27:41 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id BA89B20008; Mon, 27 Jun 2022 16:27:40 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Mon, 27 Jun 2022 18:27:19 +0200 Message-Id: <20220627162732.33160-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220627162732.33160-1-jacopo@jmondi.org> References: <20220627162732.33160-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 02/15] libcamera: control_ids: Separate the id numerical space X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jacopo Mondi via libcamera-devel From: Jacopo Mondi Reply-To: Jacopo Mondi Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Separate the internal and public control id numerical space by placing the internal controls at offset 0x1000. Signed-off-by: Jacopo Mondi Reviewed-by: Jean-Michel Hautbois --- utils/gen-controls.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/utils/gen-controls.py b/utils/gen-controls.py index 978179f63858..63e888546277 100755 --- a/utils/gen-controls.py +++ b/utils/gen-controls.py @@ -118,7 +118,7 @@ ${description} } -def generate_h(controls): +def generate_h(internal, controls): enum_template_start = string.Template('''enum ${name}Enum {''') enum_value_template = string.Template('''\t${name} = ${value},''') enum_values_template = string.Template('''extern const std::array ${name}Values;''') @@ -133,7 +133,11 @@ def generate_h(controls): name, ctrl = ctrl.popitem() id_name = snake_case(name).upper() - ids.append('\t' + id_name + ' = ' + str(id_value) + ',') + # Separate the internal and public controls id space + if internal: + ids.append('\t' + id_name + ' = ' + "0x1000 | " + str(id_value) + ',') + else: + ids.append('\t' + id_name + ' = ' + str(id_value) + ',') ctrl_type = ctrl['type'] if ctrl_type == 'string': @@ -218,7 +222,7 @@ def main(argv): if args.template.endswith('.cpp.in'): data = generate_cpp(controls) elif args.template.endswith('.h.in'): - data = generate_h(controls) + data = generate_h(args.internal, controls) else: raise RuntimeError('Unknown template type')