From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=40.107.82.133; helo=nam01-sn1-obe.outbound.protection.outlook.com; envelope-from=christopher.co@microsoft.com; receiver=edk2-devel@lists.01.org Received: from NAM01-SN1-obe.outbound.protection.outlook.com (mail-eopbgr820133.outbound.protection.outlook.com [40.107.82.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3DF1321198CBB for ; Mon, 3 Dec 2018 18:06:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=o6vx04A0zAZX/Oy7gKydKeT6HGpDVSJKgncb8Ybs6Wc=; b=JcWQJNZ20RJmItchvyLVQqVEDtv/QDjQeYx60CgL2APl553CovNE1rtcU/IdK17RDWQz2PF0gfL7G7qxjuGQJ4UXE654jkvqC4XvzaOmqGiwtjHOauFko2htOYciIdOnNS2WkYwIEnGK3YCD5ZsyuzFquVDH7rjShkd1iMLnpg8= Received: from DM5PR21MB0186.namprd21.prod.outlook.com (10.173.173.137) by DM5PR21MB0796.namprd21.prod.outlook.com (10.175.112.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1425.3; Tue, 4 Dec 2018 02:06:04 +0000 Received: from DM5PR21MB0186.namprd21.prod.outlook.com ([fe80::9115:7193:d145:d0f5]) by DM5PR21MB0186.namprd21.prod.outlook.com ([fe80::9115:7193:d145:d0f5%6]) with mapi id 15.20.1425.005; Tue, 4 Dec 2018 02:06:04 +0000 From: Chris Co To: Leif Lindholm CC: "edk2-devel@lists.01.org" , Ard Biesheuvel , Michael D Kinney Thread-Topic: [PATCH edk2-platforms 14/27] Silicon/NXP: Add i.MX6 GPT and EPIT timer headers Thread-Index: AQHUUYS9Y57z1bDqZkOLCocHvrJGZ6VGeraAgCfMZOA= Date: Tue, 4 Dec 2018 02:06:04 +0000 Message-ID: References: <20180921082542.35768-1-christopher.co@microsoft.com> <20180921082542.35768-15-christopher.co@microsoft.com> <20181108181423.zpt4mivpcnd7w4cs@bivouac.eciton.net> In-Reply-To: <20181108181423.zpt4mivpcnd7w4cs@bivouac.eciton.net> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=True; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Owner=chrco@microsoft.com; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2018-12-04T02:06:02.3293460Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=General; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Application=Microsoft Azure Information Protection; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Extended_MSFT_Method=Automatic; Sensitivity=General x-originating-ip: [2001:4898:80e8:1:6928:7d3d:7cac:2222] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; DM5PR21MB0796; 6:nVOOsKkQR25NglSUN19/LLld4zYugdspaw9NwBwvZONSnI/SgK+X4RXYXj4Q21CjKVfEFOsttuo6K0eXy21c43McfM/RfjhYeCcZwITBxou8ztmmm3z7GWiD47wZXVfulN59ZEj/b0xjsQ6bFprjPcB4oonoeB2MUdIUzV7oIye9BlV/afwwcX3Unf6qJWVdmViPNokiLNzOL6Ts/PIE0z7kqSVwwZcLUbOKMCID2YGGisaiOEr7+t8Nwkr8K9kCGU1ANOokYrs28BjjNZZBVv3sjp6myz3jy/efzsujNf/9LRxfISRLnmmDwflFt4z8csd1R9WA3zI5RTtIDOwexktXiWK8TpJ0upJjBUvotnWr+cJmyiM3XOupuSjW0YZUX3AhHVEPk+BQ1Y7N3KehKfvPzxE1GZDjEjCDBskkXzyKw7bGcTynmTeD+2oisiabP7h5ZXAJOW4vElO5GgKI1Q==; 5:iqQ8+geKtIX9bBqCjU20rAYalm82IZL1ytaRRXfWelW3O51eLnf1wwrkS6tpw8kNBUV7Lwz6LZmgYw5GiQvaYYlUsj19yzIy6jxVfM/sEzHMr4/voeXkgnj6QmiJ/tjV9ddNAkVvC43/d2GJDRvbipvC+BHHVvHBo1rCbH3BO40=; 7:uwKlLCE/tmxRPLVnriiaVzqOSNOuof2w2HQoA4Ad6ALQSugEId0r/fzxpHbb2Fk+Dx+8MgYAXXVuhoXdFkjYH+RpHDSThYaWFvkdrRERoQh0hCp4YFZ1eM38HEWi9l9XeBpr96TJ89sN5hCw0xa+TQ== x-ms-exchange-antispam-srfa-diagnostics: SOS; x-ms-office365-filtering-correlation-id: 507abf9b-214f-4944-838e-08d6598d0bfb x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:DM5PR21MB0796; x-ms-traffictypediagnostic: DM5PR21MB0796: x-ms-exchange-purlcount: 2 authentication-results: spf=none (sender IP is ) smtp.mailfrom=Christopher.Co@microsoft.com; x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(8220035)(2401047)(5005006)(8121501046)(93006095)(93001095)(3231455)(999002)(944501505)(4982022)(2018427008)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(20161123562045)(201708071742011)(7699051)(76991095); SRVR:DM5PR21MB0796; BCL:0; PCL:0; RULEID:; SRVR:DM5PR21MB0796; x-forefront-prvs: 0876988AF0 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(376002)(136003)(346002)(366004)(39860400002)(396003)(13464003)(199004)(189003)(8676002)(575784001)(68736007)(86612001)(86362001)(8936002)(19627235002)(229853002)(81166006)(81156014)(97736004)(6246003)(25786009)(8990500004)(22452003)(71190400001)(316002)(46003)(71200400001)(6116002)(105586002)(11346002)(10090500001)(106356001)(476003)(446003)(54906003)(14454004)(99286004)(4744004)(2906002)(486006)(33656002)(76176011)(5660300001)(6916009)(186003)(6436002)(55016002)(256004)(53936002)(6306002)(10290500003)(53946003)(9686003)(72206003)(16799955002)(74316002)(102836004)(53546011)(6506007)(4326008)(305945005)(7696005)(478600001)(7736002)(14444005)(579004); DIR:OUT; SFP:1102; SCL:1; SRVR:DM5PR21MB0796; H:DM5PR21MB0186.namprd21.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: kNFxS+DAO42BxXivLf35ihnqsndiOCDcEfv5uVB/5rrODx+1yLpPd4AWq+RrhCWih4l1CEY2oG5m4DCDDeDu/9b3jdg+pCDl7Szb6QpfEFrmwLr58+6/vMVqjMxA0WBxqtspSfMGhd3mImmS0JJlQzBIXU/ejoXaoLACKr4PTbvjs06wJF18G1zu7/CVoKWqkVt+O3N4FHbj92v/L97hGz4NJIRDlnOcAX//LJzVKYGt+AbjkhIwKY4dsLXzZriz3TqTKWYYawcghHT1k/lgEPBar4cplxmS5nrjisxGK54TVkFsx0926mXErV//GF8WVIMQqcG1Loah09hLtmV4QKqlzY19YxP89SUQ0I+IYLk= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 507abf9b-214f-4944-838e-08d6598d0bfb X-MS-Exchange-CrossTenant-originalarrivaltime: 04 Dec 2018 02:06:04.3985 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR21MB0796 Subject: Re: [PATCH edk2-platforms 14/27] Silicon/NXP: Add i.MX6 GPT and EPIT timer headers X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Dec 2018 02:06:07 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Leif, > -----Original Message----- > From: Leif Lindholm > Sent: Thursday, November 8, 2018 10:14 AM > To: Chris Co > Cc: edk2-devel@lists.01.org; Ard Biesheuvel ; > Michael D Kinney > Subject: Re: [PATCH edk2-platforms 14/27] Silicon/NXP: Add i.MX6 GPT and > EPIT timer headers >=20 > On Fri, Sep 21, 2018 at 08:26:05AM +0000, Chris Co wrote: > > This adds the definitions for the NXP i.MX6 General Purpose Timer and > > the Enhanced Periodic Interrupt Timer modules. > > > > Contributed-under: TianoCore Contribution Agreement 1.1 > > Signed-off-by: Christopher Co > > Cc: Ard Biesheuvel > > Cc: Leif Lindholm > > Cc: Michael D Kinney > > --- > > Silicon/NXP/iMX6Pkg/Include/common_epit.h | 118 +++++++++ > > Silicon/NXP/iMX6Pkg/Include/common_gpt.h | 271 > ++++++++++++++++++++ > > 2 files changed, 389 insertions(+) > > > > diff --git a/Silicon/NXP/iMX6Pkg/Include/common_epit.h > > b/Silicon/NXP/iMX6Pkg/Include/common_epit.h > > new file mode 100644 > > index 000000000000..485d6ccbc51e > > --- /dev/null > > +++ b/Silicon/NXP/iMX6Pkg/Include/common_epit.h >=20 > Rename to CamelCase? >=20 Can do. Would you prefer the iMX prefix to be in CamelCase too? (i.e. Imx6E= pit.h) > > @@ -0,0 +1,118 @@ > > +/** @file > > +* > > +* Provides definitions for the EPIT (Enhanced Periodic Interrupt > > +Timer) > > +* module that are common to Freescale SoCs. > > +* > > +* Copyright (c) 2018 Microsoft Corporation. All rights reserved. > > +* Copyright (c) 2004-2010, Freescale Semiconductor, Inc. All Rights > Reserved. > > +* > > +* This program and the accompanying materials > > +* are licensed and made available under the terms and conditions of > > +the BSD License > > +* which accompanies this distribution. The full text of the license > > +may be found at > > +* > > +https://na01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fopen= s > > +ource.org%2Flicenses%2Fbsd- > license.php&data=3D02%7C01%7CChristopher > > > +.Co%40microsoft.com%7C5da90dbbf4b5452a4c8e08d645a605cc%7C72f988 > bf86f1 > > > +41af91ab2d7cd011db47%7C1%7C0%7C636772976703090578&sdata=3D > g3OOywqu7 > > +VDuq39F3PVs8SaXZVbA7h77F7riMUXb0lE%3D&reserved=3D0 > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > > +BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > > +* > > +**/ > > + > > +#ifndef __COMMON_EPIT_H > > +#define __COMMON_EPIT_H >=20 > COMMON is a bit too common. Can we at least stick an IMX on the front? >=20 > This is really also a problem for all of the structs and #defines below a= s well. >=20 > > + > > +typedef struct { > > + UINT32 CR; > > + UINT32 SR; > > + UINT32 LR; > > + UINT32 CMPR; > > + UINT32 CNT; > > +} CSP_EPIT_REG, *PCSP_EPIT_REG; >=20 > I'm really not a fan of typedef pointers. Please drop the *PSCP one. >=20 > > + > > +#define EPIT_CR_OFFSET 0x0000 > > +#define EPIT_SR_OFFSET 0x0004 > > +#define EPIT_LR_OFFSET 0x0008 > > +#define EPIT_CMPR_OFFSET 0x000C > > +#define EPIT_CNR_OFFSET 0x0010 > > + > > +#define EPIT_CR_EN_LSH 0 >=20 > What is LSH? >=20 > > +#define EPIT_CR_ENMOD_LSH 1 > > +#define EPIT_CR_OCIEN_LSH 2 > > +#define EPIT_CR_RLD_LSH 3 > > +#define EPIT_CR_PRESCALAR_LSH 4 > > +#define EPIT_CR_SWR_LSH 16 > > +#define EPIT_CR_IOVW_LSH 17 > > +#define EPIT_CR_DBGEN_LSH 18 > > +#define EPIT_CR_WAITEN_LSH 19 > > +#define EPIT_CR_DOZEN_LSH 20 > > +#define EPIT_CR_STOPEN_LSH 21 > > +#define EPIT_CR_OM_LSH 22 > > +#define EPIT_CR_CLKSRC_LSH 24 > > + > > +#define EPIT_SR_OCIF_LSH 0 > > +#define EPIT_LR_LOAD_LSH 0 > > +#define EPIT_CMPR_COMPARE_LSH 0 > > +#define EPIT_CNT_COUNT_LSH 0 > > + > > +#define EPIT_CR_EN_WID 1 >=20 > What is WID? >=20 LSH is the number of bits to left shift to get to the specified bitfield in= the register. WID is the length of the specified bitfield. I don't like this register access pattern at all. Will define structs of th= e registers instead... Thanks, Chris > > +#define EPIT_CR_ENMOD_WID 1 > > +#define EPIT_CR_OCIEN_WID 2 > > +#define EPIT_CR_RLD_WID 1 > > +#define EPIT_CR_PRESCALAR_WID 12 > > +#define EPIT_CR_SWR_WID 1 > > +#define EPIT_CR_IOVW_WID 1 > > +#define EPIT_CR_DBGEN_WID 1 > > +#define EPIT_CR_WAITEN_WID 1 > > +#define EPIT_CR_DOZEN_WID 1 > > +#define EPIT_CR_STOPEN_WID 1 > > +#define EPIT_CR_OM_WID 2 > > +#define EPIT_CR_CLKSRC_WID 2 > > + > > +#define EPIT_SR_OCIF_WID 1 > > +#define EPIT_LR_LOAD_WID 32 > > +#define EPIT_CMPR_COMPARE_WID 32 > > +#define EPIT_CNT_COUNT_WID 32 > > + > > +// CR > > +#define EPIT_CR_EN_DISABLE 0 > > +#define EPIT_CR_EN_ENABLE 1 > > + > > +#define EPIT_CR_ENMOD_RESUME 0 > > +#define EPIT_CR_ENMOD_LOAD 1 > > + > > +#define EPIT_CR_OCIEN_DISABLE 0 > > +#define EPIT_CR_OCIEN_ENABLE 1 > > + > > +#define EPIT_CR_RLD_ROLLOVER 0 > > +#define EPIT_CR_RLD_RELOAD 1 > > + > > +#define EPIT_CR_SWR_NORESET 0 > > +#define EPIT_CR_SWR_RESET 1 > > + > > +#define EPIT_CR_IOVW_NOOVR 0 > > +#define EPIT_CR_IOVW_OVR 1 > > + > > +#define EPIT_CR_DBGEN_INACTIVE 0 > > +#define EPIT_CR_DBGEN_ACTIVE 1 > > + > > +#define EPIT_CR_WAITEN_DISABLE 0 > > +#define EPIT_CR_WAITEN_ENABLE 1 > > + > > +#define EPIT_CR_DOZEN_DISABLE 0 > > +#define EPIT_CR_DOZEN_ENABLE 1 > > + > > +#define EPIT_CR_STOPEN_DISABLE 0 > > +#define EPIT_CR_STOPEN_ENABLE 1 > > + > > +#define EPIT_CR_OM_DICONNECT 0 > > +#define EPIT_CR_OM_TOGGLE 1 > > +#define EPIT_CR_OM_CLEAR 2 > > +#define EPIT_CR_OM_SET 3 > > + > > +#define EPIT_CR_CLKSRC_OFF 0 > > +#define EPIT_CR_CLKSRC_IPGCLK 1 > > +#define EPIT_CR_CLKSRC_HIGHFREQ 2 // High freq is sourcing from > PERCLK > > +#define EPIT_CR_CLKSRC_CKIL 3 > > + > > +// CNT > > +#define EPIT_CNT_COUNT_MAX 0xFFFFFFFF >=20 > MAX_UINT32? >=20 > > + > > +#endif // __COMMON_EPIT_H > > diff --git a/Silicon/NXP/iMX6Pkg/Include/common_gpt.h > > b/Silicon/NXP/iMX6Pkg/Include/common_gpt.h > > new file mode 100644 > > index 000000000000..7fdfc25d819f > > --- /dev/null > > +++ b/Silicon/NXP/iMX6Pkg/Include/common_gpt.h >=20 > Rename to CamelCase. >=20 > > @@ -0,0 +1,271 @@ > > +/** @file > > +* > > +* Provides definitions for the GPT (General Purpose Timer) module > > +* that are common to Freescale SoCs. > > +* > > +* Copyright (c) 2018 Microsoft Corporation. All rights reserved. > > +* Copyright (c) 2004-2010, Freescale Semiconductor, Inc. All Rights > Reserved. > > +* > > +* This program and the accompanying materials > > +* are licensed and made available under the terms and conditions of > > +the BSD License > > +* which accompanies this distribution. The full text of the license > > +may be found at > > +* > > +https://na01.safelinks.protection.outlook.com/?url=3Dhttp%3A%2F%2Fopen= s > > +ource.org%2Flicenses%2Fbsd- > license.php&data=3D02%7C01%7CChristopher > > > +.Co%40microsoft.com%7C5da90dbbf4b5452a4c8e08d645a605cc%7C72f988 > bf86f1 > > > +41af91ab2d7cd011db47%7C1%7C0%7C636772976703090578&sdata=3D > g3OOywqu7 > > +VDuq39F3PVs8SaXZVbA7h77F7riMUXb0lE%3D&reserved=3D0 > > +* > > +* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" > > +BASIS, > > +* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER > EXPRESS OR IMPLIED. > > +* > > +**/ > > + > > +#ifndef __COMMON_GPT_H > > +#define __COMMON_GPT_H >=20 > +IMX. >=20 > > + > > +typedef struct { > > + UINT32 CR; > > + UINT32 PR; > > + UINT32 SR; > > + UINT32 IR; > > + UINT32 OCR1; > > + UINT32 OCR2; > > + UINT32 OCR3; > > + UINT32 ICR1; > > + UINT32 ICR2; > > + UINT32 CNT; > > +} CSP_GPT_REGS, *PCSP_GPT_REGS; >=20 > Drop *PCSP. >=20 > > + > > +#define GPT_CR_OFFSET 0x0000 > > +#define GPT_PR_OFFSET 0x0004 > > +#define GPT_SR_OFFSET 0x0008 > > +#define GPT_IR_OFFSET 0x000C > > +#define GPT_OCR1_OFFSET 0x0010 > > +#define GPT_OCR2_OFFSET 0x0014 > > +#define GPT_OCR3_OFFSET 0x0018 > > +#define GPT_ICR1_OFFSET 0x001C > > +#define GPT_ICR2_OFFSET 0x0020 > > +#define GPT_CNT_OFFSET 0x0024 > > + > > + > > +#define GPT_CR_EN_LSH 0 >=20 > What is LSH? >=20 > > +#define GPT_CR_ENMOD_LSH 1 > > +#define GPT_CR_DBGEN_LSH 2 > > +#define GPT_CR_WAITEN_LSH 3 > > +#define GPT_CR_STOPEN_LSH 5 > > +#define GPT_CR_CLKSRC_LSH 6 > > +#define GPT_CR_FRR_LSH 9 > > +#if defined(CPU_IMX6SX) || defined(CPU_IMX6SDL) > > +#define GPT_CR_EN_24M_LSH 10 > > +#endif > > +#define GPT_CR_SWR_LSH 15 > > +#define GPT_CR_IM1_LSH 16 > > +#define GPT_CR_IM2_LSH 18 > > +#define GPT_CR_OM1_LSH 20 > > +#define GPT_CR_OM2_LSH 23 > > +#define GPT_CR_OM3_LSH 26 > > +#define GPT_CR_FO1_LSH 29 > > +#define GPT_CR_FO2_LSH 30 > > +#define GPT_CR_FO3_LSH 31 > > + > > +#define GPT_PR_PRESCALER_LSH 0 > > + > > +#define GPT_SR_OF1_LSH 0 > > +#define GPT_SR_OF2_LSH 1 > > +#define GPT_SR_OF3_LSH 2 > > +#define GPT_SR_IF1_LSH 3 > > +#define GPT_SR_IF2_LSH 4 > > +#define GPT_SR_ROV_LSH 5 > > + > > +#define GPT_IR_OF1IE_LSH 0 > > +#define GPT_IR_OF2IE_LSH 1 > > +#define GPT_IR_OF3IE_LSH 2 > > +#define GPT_IR_IF1IE_LSH 3 > > +#define GPT_IR_IF2IE_LSH 4 > > +#define GPT_IR_ROVIE_LSH 5 > > + > > +#define GPT_OCR1_COMP_LSH 0 > > +#define GPT_OCR2_COMP_LSH 0 > > +#define GPT_OCR3_COMP_LSH 0 > > +#define GPT_ICR1_CAPT_LSH 0 > > +#define GPT_ICR2_CAPT_LSH 0 > > +#define GPT_CNT_COUNT_LSH 0 > > + > > +#define GPT_CR_EN_WID 1 >=20 > What is WID? >=20 > / > Leif >=20 > > +#define GPT_CR_ENMOD_WID 1 > > +#define GPT_CR_DBGEN_WID 1 > > +#define GPT_CR_WAITEN_WID 1 > > +#define GPT_CR_STOPEN_WID 1 > > +#define GPT_CR_CLKSRC_WID 3 > > +#define GPT_CR_FRR_WID 1 > > +#if defined(CPU_IMX6SX) || defined(CPU_IMX6SDL) > > +#define GPT_CR_EN_24M_WID 1 > > +#endif > > +#define GPT_CR_SWR_WID 1 > > +#define GPT_CR_IM1_WID 2 > > +#define GPT_CR_IM2_WID 2 > > +#define GPT_CR_OM1_WID 3 > > +#define GPT_CR_OM2_WID 3 > > +#define GPT_CR_OM3_WID 3 > > +#define GPT_CR_FO1_WID 1 > > +#define GPT_CR_FO2_WID 1 > > +#define GPT_CR_FO3_WID 1 > > + > > +#define GPT_PR_PRESCALER_WID 12 > > + > > +#define GPT_SR_OF1_WID 1 > > +#define GPT_SR_OF2_WID 1 > > +#define GPT_SR_OF3_WID 1 > > +#define GPT_SR_IF1_WID 1 > > +#define GPT_SR_IF2_WID 1 > > +#define GPT_SR_ROV_WID 1 > > + > > +#define GPT_IR_OF1IE_WID 1 > > +#define GPT_IR_OF2IE_WID 1 > > +#define GPT_IR_OF3IE_WID 1 > > +#define GPT_IR_IF1IE_WID 1 > > +#define GPT_IR_IF2IE_WID 1 > > +#define GPT_IR_ROVIE_WID 1 > > + > > +#define GPT_OCR1_COMP_WID 32 > > +#define GPT_OCR2_COMP_WID 32 > > +#define GPT_OCR3_COMP_WID 32 > > +#define GPT_ICR1_CAPT_WID 32 > > +#define GPT_ICR2_CAPT_WID 32 > > +#define GPT_CNT_COUNT_WID 32 > > + > > + > > +//------------------------------------------------------------------- > > +----------- > > +// REGISTER BIT WRITE VALUES > > +//------------------------------------------------------------------- > > +----------- > > + > > +// GPTCR > > +#define GPT_CR_EN_ENABLE 1 // GPT enabled > > +#define GPT_CR_EN_DISABLE 0 // GPT disabled > > + > > +#define GPT_CR_ENMOD_RESET 1 // GPT counter reset to > > + // 0 when disabled > > +#define GPT_CR_ENMOD_RETAIN 0 // GPT counter retains > > + // value when disabled > > + > > +#define GPT_CR_DBGEN_ENABLE 1 // GPT enabled in debug mode > > +#define GPT_CR_DBGEN_DISABLE 0 // GPT disabled in debug mod= e > > + > > +#define GPT_CR_WAITEN_ENABLE 1 // GPT enabled in wait mode > > +#define GPT_CR_WAITEN_DISABLE 0 // GPT disabled in wait mode > > + > > +#define GPT_CR_STOPEN_ENABLE 1 // GPT enabled in stopdoze m= ode > > +#define GPT_CR_STOPEN_DISABLE 0 // GPT disabled in stopoze m= ode > > + > > +#if defined(CPU_IMX6DQ) || defined (CPU_IMX6DQP) > > +#define GPT_CR_CLKSRC_NOCLK 0 // No clock to GPT > > +#define GPT_CR_CLKSRC_IPGCLK 1 // ipg_clk is the clock sour= ce > > +#define GPT_CR_CLKSRC_HIGHFREQ 2 // ipg_clk_highfreq > > +#define GPT_CR_CLKSRC_EXTCLK 3 // ipp_gpt_clkin (external c= lock > > +// from pad) is the clock source > > +#define GPT_CR_CLKSRC_CLK32K 4 // ipg_clk_32k is clock sour= ce > > +#define GPT_CR_CLKSRC_CLK8M 5 // crystal oscillator divide= d by 8 is > clock source > > +#define GPT_CR_CLKSRC_CLK24M 7 // crystal oscillator (24 Mh= z) is > clock source > > +#elif defined(CPU_IMX6SDL) > > +#define GPT_CR_CLKSRC_NOCLK 0 // No clock to GPT > > +#define GPT_CR_CLKSRC_IPGCLK 1 // Peripheral Clock > > +#define GPT_CR_CLKSRC_HIGHFREQ 2 // High Frequency Reference > Clock > > +#define GPT_CR_CLKSRC_EXTCLK 3 // External Clock (CLKIN) > > +#define GPT_CR_CLKSRC_LOWFREQ 4 // Low Frequency Reference > Clock > > +#define GPT_CR_CLKSRC_CLK24M 5 // Crystal oscillator as Ref= erence > Clock > > +#elif defined(CPU_IMX6SX) > > +#define GPT_CR_CLKSRC_NOCLK 0 // No clock to GPT > > +#define GPT_CR_CLKSRC_PERIPHCLK 1 // Peripheral Clock > > +#define GPT_CR_CLKSRC_HIGHFREQ 2 // High Frequency Reference > Clock > > +#define GPT_CR_CLKSRC_EXTCLK 3 // External Clock (CLKIN) > > +#define GPT_CR_CLKSRC_LOWFREQ 4 // Low Frequency Reference > Clock > > +#define GPT_CR_CLKSRC_CLK24M 5 // Crystal oscillator as Ref= erence > Clock > > +#else > > +#error CPU Preprocessor Flag Not Defined #endif > > + > > +#define GPT_CR_FRR_FREERUN 1 // Freerun mode (counter > > + // continues after compare= ) > > +#define GPT_CR_FRR_RESTART 0 // Restart mode (counter set > > + // to zero after compare) > > +#if defined(CPU_IMX6SX) || defined(CPU_IMX6SDL) > > +#define GPT_CR_EN_24M_DISABLE 0 // 24M clock disabled > > +#define GPT_CR_EN_24M_ENABLE 1 // 24M clock enabled > > +#endif > > + > > +#define GPT_CR_SWR_RESET 1 // Self-clearing software re= set > > +#define GPT_CR_SWR_NORESET 0 // Do not activate software = reset > > + > > +#define GPT_CR_IM1_DISABLE 0 // Capture Disabled > > +#define GPT_CR_IM1_EDGE_RISE 1 // Capture on rising edge > > +#define GPT_CR_IM1_EDGE_FALL 2 // Capture on falling edge > > +#define GPT_CR_IM1_EDGE_BOTH 3 // Capture on both edges > > + > > +#define GPT_CR_IM2_DISABLE 0 // Capture Disabled > > +#define GPT_CR_IM2_EDGE_RISE 1 // Capture on rising edge > > +#define GPT_CR_IM2_EDGE_FALL 2 // Capture on falling edge > > +#define GPT_CR_IM2_EDGE_BOTH 3 // Capture on both edges > > + > > +#define GPT_CR_OM1_DISABLE 0 // Compare generates no resp= onse > > +#define GPT_CR_OM1_TOGGLE 1 // Compare toggles output pi= n > > +#define GPT_CR_OM1_CLEAR 2 // Compare clears output pin > > +#define GPT_CR_OM1_SET 3 // Compare sets output pin > > +#define GPT_CR_OM1_PULSE 4 // Compare event generates a > > + // single count duration p= ulse > > + // on output pin > > + > > +#define GPT_CR_OM2_DISABLE 0 // Compare generates no resp= onse > > +#define GPT_CR_OM2_TOGGLE 1 // Compare toggles output pi= n > > +#define GPT_CR_OM2_CLEAR 2 // Compare clears output pin > > +#define GPT_CR_OM2_SET 3 // Compare sets output pin > > +#define GPT_CR_OM2_PULSE 4 // Compare event generates a > > + // single count duration p= ulse > > + // on output pin > > + > > +#define GPT_CR_OM3_DISABLE 0 // Compare generates no resp= onse > > +#define GPT_CR_OM3_TOGGLE 1 // Compare toggles output pi= n > > +#define GPT_CR_OM3_CLEAR 2 // Compare clears output pin > > +#define GPT_CR_OM3_SET 3 // Compare sets output pin > > +#define GPT_CR_OM3_PULSE 4 // Compare event generates a > > + // single count duration p= ulse > > + // on output pin > > + > > +#define GPT_CR_FO1_FORCE 1 // Force pin action programm= ed > > + // for output compare 1 pi= n. > > + // Pin is self-negating. > > +#define GPT_CR_FO1_NOFORCE 0 // Do not force pin > > + > > +#define GPT_CR_FO2_FORCE 1 // Force pin action programm= ed > > + // for output compare 1 pi= n > > + // Pin is self-negating. > > +#define GPT_CR_FO2_NOFORCE 0 // Do not force pin > > + > > +#define GPT_CR_FO3_FORCE 1 // Force pin action programm= ed > > + // for output compare 1 pi= n > > + // Pin is self-negating. > > +#define GPT_CR_FO3_NOFORCE 0 // Do not force pin > > + > > +// GPTSR > > +#define GPT_SR_OF1_STATUS_CLEAR 1 // Output compare 1 status > clear > > +#define GPT_SR_OF2_STATUS_CLEAR 1 // Output compare 2 status > clear > > +#define GPT_SR_OF3_STATUS_CLEAR 1 // Output compare 3 status > clear > > +#define GPT_SR_IF1_STATUS_CLEAR 1 // Input capture 1 status cl= ear > > +#define GPT_SR_IF2_STATUS_CLEAR 1 // Input capture 2 status cl= ear > > +#define GPT_SR_ROV_STATUS_CLEAR 1 // Rollover status clear > > + > > +// GPTIR > > +#define GPT_IR_OF1IE_INT_ENABLE 1 // Output compare 1 int enab= led > > +#define GPT_IR_OF1IE_INT_DISABLE 0 // Output compare 1 int disa= bled > > + > > +#define GPT_IR_OF2IE_INT_ENABLE 1 // Output compare 2 int enab= led > > +#define GPT_IR_OF2IE_INT_DISABLE 0 // Output compare 2 int disa= bled > > + > > +#define GPT_IR_OF3IE_INT_ENABLE 1 // Output compare 3 int enab= led > > +#define GPT_IR_OF3IE_INT_DISABLE 0 // Output compare 3 int disa= bled > > + > > +#define GPT_IR_IF1IE_INT_ENABLE 1 // Input capture 1 int enabl= ed > > +#define GPT_IR_IF1IE_INT_DISABLE 0 // Input capture 1 int disab= led > > + > > +#define GPT_IR_IF2IE_INT_ENABLE 1 // Input capture 2 int enabl= ed > > +#define GPT_IR_IF2IE_INT_DISABLE 0 // Input capture 2 int disab= led > > + > > +#define GPT_IR_ROVIE_INT_ENABLE 1 // Rollover int enabled > > +#define GPT_IR_ROVIE_INT_DISABLE 0 // Rollover int disabled > > + > > +#endif // __COMMON_GPT_H > > -- > > 2.16.2.gvfs.1.33.gf5370f1 > >