From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=2a00:1450:400c:c0c::234; helo=mail-wr0-x234.google.com; envelope-from=leif.lindholm@linaro.org; receiver=edk2-devel@lists.01.org Received: from mail-wr0-x234.google.com (mail-wr0-x234.google.com [IPv6:2a00:1450:400c:c0c::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 47F1421E080E9 for ; Thu, 19 Apr 2018 06:47:18 -0700 (PDT) Received: by mail-wr0-x234.google.com with SMTP id q13-v6so14263064wre.3 for ; Thu, 19 Apr 2018 06:47:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=/abAIl5xpL9xQbzm6Iq0Imo8kTd1H8Du+PWj3a3+3ec=; b=IhVqt1+KYbgXkeNLCaF7FKNH9DXKwfjOmpGmrFy3epWZ3MS/s3RAocoLTA3ljkGa4D yZXeT2JRuibUgVPRATVMaX3EOEJWF21CbYzcLvlg27vTZZ/fq6ncuI2G34oHM0tM/61H SzV9zaS/t4+GwKeCq6nDmsVy8KOP4AxdB9aBk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=/abAIl5xpL9xQbzm6Iq0Imo8kTd1H8Du+PWj3a3+3ec=; b=M6HUtSWPjTxIZuZymusV2RJMIc48O+C8yHz0TOxwHAbXBjR97ESeHd/qLlaYzC7DDT fgaJVUaQV5g+r7E4qiXZL785fEq8Z1V9PE5ghXDlzCS1Mx1tRpvn9AE0Rs5TjOT7xws8 jD033pfpUVfq11O3bG/tPpMHrGedzf/LdE5o/0u+FMf/a6pQznKAkepCuVcyVzVOaCtg CQfTJDse6svdTGZ94aaFqhn0ijU55Atu64/+ilDDCf6ad6gU7QiqDUrvXak1SPduVTx8 XtII4XyEs1r2PW5TQ0Wj1SoUSYDiw2lOBfRih9NvX641uloKJhbyThlYDoP6Uop+9WjR PT+g== X-Gm-Message-State: ALQs6tA+u6joB9htnYnhu0r5o94EukTel8EHG2c3VL5ODpTIipzs4vhD E1DWMkV3HKo8uLnoOi8m69nlGQ== X-Google-Smtp-Source: AIpwx48Vo9x/FIyDjng/yP+UPAKShVKuLtDfTFEEM76LgqAmVBIX28yO49Ju6fP5PlBkB8OMaVUTLg== X-Received: by 10.28.15.78 with SMTP id 75mr4560995wmp.16.1524145636214; Thu, 19 Apr 2018 06:47:16 -0700 (PDT) Received: from bivouac.eciton.net (bivouac.eciton.net. [2a00:1098:0:86:1000:23:0:2]) by smtp.gmail.com with ESMTPSA id b105-v6sm6554026wrd.64.2018.04.19.06.47.14 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Apr 2018 06:47:14 -0700 (PDT) Date: Thu, 19 Apr 2018 14:47:13 +0100 From: Leif Lindholm To: Meenakshi Aggarwal Cc: "ard.biesheuvel@linaro.org" , "edk2-devel@lists.01.org" , Udit Kumar , Varun Sethi , Vabhav Sharma Message-ID: <20180419134713.75awm3muksmko57t@bivouac.eciton.net> References: <1518771035-6733-1-git-send-email-meenakshi.aggarwal@nxp.com> <1518771035-6733-20-git-send-email-meenakshi.aggarwal@nxp.com> <20180419101156.6biaqkoduoczfjgp@bivouac.eciton.net> MIME-Version: 1.0 In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Subject: Re: [PATCH edk2-platforms 19/39] Silicon/NXP:Add support for PCF2129 Real Time Clock Library X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 19 Apr 2018 13:47:18 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Thu, Apr 19, 2018 at 12:33:50PM +0000, Meenakshi Aggarwal wrote: > > > +EFI_STATUS > > > +EFIAPI > > > +LibSetTime ( > > > + IN EFI_TIME *Time > > > + ) > > > +{ > > > + UINT8 Buffer[8]; > > > + UINT8 Index; > > > + EFI_STATUS Status; > > > + RTC_I2C_REQUEST Req; > > > + UINT8 RtcRegAddr; > > > + > > > + Index = 0; > > > + Status = EFI_SUCCESS; > > > + RtcRegAddr = PCF2129_CTRL1_REG_ADDR; > > > + > > > + if (mI2cMaster == NULL) { > > > + return EFI_DEVICE_ERROR; > > > + } > > > + > > > + // start register address > > > + Buffer[Index++] = PCF2129_SEC_REG_ADDR; > > > + > > > + // hours, minutes and seconds > > > + Buffer[Index++] = DecimalToBcd8 (Time->Second); > > > + Buffer[Index++] = DecimalToBcd8 (Time->Minute); > > > + Buffer[Index++] = DecimalToBcd8 (Time->Hour); > > > + Buffer[Index++] = DecimalToBcd8 (Time->Day); > > > + Buffer[Index++] = EfiTimeToWday (Time) & 0x07; > > > > Why mask at the call site? > > > In GetTime function, data is been read from RTC device so we need to > mask the unnecessary bits > [as described in RTC registers] while > In SetTime, we are receiving the appropriate buffer so no need to > mask the data. But EfiTimeToWday returns an integer in the range 0-6: return (EpochDays + 4) % 7; Anding the result of that with 0x7 has no effect. / Leif