From patchwork Tue Jun 21 15:03:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 16300 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 87F9DBE173 for ; Tue, 21 Jun 2022 15:03:50 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id DE0B565632; Tue, 21 Jun 2022 17:03:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1655823830; bh=UvxTsubqWRotqxl+cjyqObqjTaPXbtT+WfVYLYjWIjg=; 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=PAlnz+rN8mX7a2aU7PweDAB+lvnrsVXIEGm66WYDzRCcwQit7Z8xMZzjYDwcW44rK RiPxN0hu+FwqZvue8OLmq97n5Cw5puJV12FeGEwqj3kJqjGMmofTcgx8aGVKzwWyYP yGxtdiod1QNhueRkgMSH9f89Do7uQQ//P71OLSozgMGCkOVuhmFuRa/TF1d1ZBzMVm qFb1Ihlsnk0YW2Ei68tRbY/6PLKU1jCWI/GJ98+/sM9vytxiiTD0jxnjdSbJX3T5W0 nzG1mX3sGV3uFmSNtXqh+pC/l6FnpmBBHgsb574WjnC2TPGWbspChooKfDfAgyqePq f2hj5MaMNa64g== Received: from relay9-d.mail.gandi.net (relay9-d.mail.gandi.net [217.70.183.199]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 5F66C65632 for ; Tue, 21 Jun 2022 17:03:46 +0200 (CEST) Received: (Authenticated sender: jacopo@jmondi.org) by mail.gandi.net (Postfix) with ESMTPSA id A5E6AFF80C; Tue, 21 Jun 2022 15:03:45 +0000 (UTC) To: libcamera-devel@lists.libcamera.org Date: Tue, 21 Jun 2022 17:03:36 +0200 Message-Id: <20220621150337.47839-3-jacopo@jmondi.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220621150337.47839-1-jacopo@jmondi.org> References: <20220621150337.47839-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 2/3] 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')