include/bcd: move bcd code to commonlib/bsd/include
Move bcd2bin() / bin2bcd() functions to commonlib/bsd/include/ Also, the license is changed from GPL to BSD. This is because it is needed from "utils" (see CL in the chain). For reference bin2bcd() & bcd2bin() are very simple functions. There are already BSD implementations, like these ones (just to name a few): https://chromium.googlesource.com/chromiumos/platform/mosys/+/refs/heads/main/include/lib/math.h#67 http://web.mit.edu/freebsd/head/sys/contrib/octeon-sdk/cvmx-cn3010-evb-hs5.c BUG=b:172210863 TEST=make (everything compiled Ok). Change-Id: If2eba82da35838799bcbcf38303de6bd53f7eb72 Signed-off-by: Ricardo Quesada <ricardoq@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/56904 Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Paul Menzel <paulepanter@mailbox.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
parent
c8f926adda
commit
954df3d6bf
10 changed files with 16 additions and 16 deletions
|
|
@ -1,18 +0,0 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
|
||||
#ifndef _BCD_H_
|
||||
#define _BCD_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
static inline uint8_t bcd2bin(uint8_t val)
|
||||
{
|
||||
return ((val >> 4) & 0xf) * 10 + (val & 0xf);
|
||||
}
|
||||
|
||||
static inline uint8_t bin2bcd(uint8_t val)
|
||||
{
|
||||
return ((val / 10) << 4) | (val % 10);
|
||||
}
|
||||
|
||||
#endif /* _BCD_H_ */
|
||||
|
|
@ -3,10 +3,10 @@
|
|||
#ifndef _CPER_H_
|
||||
#define _CPER_H_
|
||||
|
||||
#include <commonlib/bsd/bcd.h>
|
||||
#include <rtc.h>
|
||||
#include <types.h>
|
||||
#include <uuid.h>
|
||||
#include <bcd.h>
|
||||
#include <rtc.h>
|
||||
|
||||
/* This file contains some definitions and helpers for implementing structures
|
||||
* in the UEFI specification, Appendix "Common Platform Error Record". This
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue