diff options
author | Armelle Laine <armellel@google.com> | 2021-04-27 15:37:00 +0000 |
---|---|---|
committer | Armelle Laine <armellel@google.com> | 2021-04-27 16:58:24 +0000 |
commit | cff3f064dff607c7381249964c31db44f72a9e3a (patch) | |
tree | 979ec4c0a8e1658fb19ac6cf6392521886f3df6c | |
parent | 1507b0dcb765ec597c4b2be244167b5dc458d048 (diff) | |
download | nxp-cff3f064dff607c7381249964c31db44f72a9e3a.tar.gz |
[app][hwcrypto] Uplift hwcrypto sample to use trusty_log.
Bug: 186526869
Change-Id: I8825eea74981258fd9bf79e48f53b40787c687b2
-rw-r--r-- | app/hwcrypto/caam.c | 3 | ||||
-rw-r--r-- | app/hwcrypto/hwkey_srv.c | 5 | ||||
-rw-r--r-- | app/hwcrypto/hwkey_srv_provider.c | 5 | ||||
-rw-r--r-- | app/hwcrypto/hwrng_srv.c | 5 | ||||
-rw-r--r-- | app/hwcrypto/hwrng_srv_provider.c | 3 | ||||
-rw-r--r-- | app/hwcrypto/main.c | 7 | ||||
-rw-r--r-- | app/hwcrypto/rules.mk | 3 | ||||
-rw-r--r-- | app/hwcrypto/tlog.h | 49 |
8 files changed, 11 insertions, 69 deletions
diff --git a/app/hwcrypto/caam.c b/app/hwcrypto/caam.c index 3b1920e..0d6f908 100644 --- a/app/hwcrypto/caam.c +++ b/app/hwcrypto/caam.c @@ -43,9 +43,8 @@ #include "caam.h" #include "fsl_caam_internal.h" -#define TLOG_LVL TLOG_LVL_DEFAULT #define TLOG_TAG "caam_drv" -#include "tlog.h" +#include <trusty_log.h> struct caam_job_rings { uint32_t in[1]; /* single entry input ring */ diff --git a/app/hwcrypto/hwkey_srv.c b/app/hwcrypto/hwkey_srv.c index 5ee6f60..cfe8a8e 100644 --- a/app/hwcrypto/hwkey_srv.c +++ b/app/hwcrypto/hwkey_srv.c @@ -29,9 +29,8 @@ #include "common.h" #include "hwkey_srv_priv.h" -#define TLOG_LVL TLOG_LVL_DEFAULT #define TLOG_TAG "hwkey_srv" -#include "tlog.h" +#include <trusty_log.h> #define HWKEY_MAX_PAYLOAD_SIZE 2048 @@ -328,7 +327,7 @@ int hwkey_start_service(void) { int rc; handle_t port; - TLOGI("Start HWKEY service\n"); + TLOGD("Start HWKEY service\n"); /* Initialize service */ rc = port_create(HWKEY_PORT, 1, diff --git a/app/hwcrypto/hwkey_srv_provider.c b/app/hwcrypto/hwkey_srv_provider.c index 8a01468..0f1b2a5 100644 --- a/app/hwcrypto/hwkey_srv_provider.c +++ b/app/hwcrypto/hwkey_srv_provider.c @@ -35,9 +35,8 @@ #include "hwkey_keyslots.h" #include "hwkey_srv_priv.h" -#define TLOG_LVL TLOG_LVL_DEFAULT #define TLOG_TAG "hwkey_caam" -#include "tlog.h" +#include <trusty_log.h> static const uint8_t skeymod[16] __attribute__((aligned(16))) = { 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, @@ -156,7 +155,7 @@ static void unpack_kbox(void) { void hwkey_init_srv_provider(void) { int rc; - TLOGI("Init HWKEY service provider\n"); + TLOGD("Init HWKEY service provider\n"); unpack_kbox(); diff --git a/app/hwcrypto/hwrng_srv.c b/app/hwcrypto/hwrng_srv.c index 28d2334..708cf8e 100644 --- a/app/hwcrypto/hwrng_srv.c +++ b/app/hwcrypto/hwrng_srv.c @@ -29,9 +29,8 @@ #include "common.h" #include "hwrng_srv_priv.h" -#define TLOG_LVL TLOG_LVL_DEFAULT #define TLOG_TAG "hwrng_srv" -#include "tlog.h" +#include <trusty_log.h> #define HWRNG_SRV_NAME HWRNG_PORT #define MAX_HWRNG_MSG_SIZE 4096 @@ -255,7 +254,7 @@ static void hwrng_port_handler(const uevent_t* ev, void* priv) { int hwrng_start_service(void) { int rc; - TLOGI("Start HWRNG service\n"); + TLOGD("Start HWRNG service\n"); /* create HWRNG port */ rc = port_create(HWRNG_SRV_NAME, 1, MAX_HWRNG_MSG_SIZE, diff --git a/app/hwcrypto/hwrng_srv_provider.c b/app/hwcrypto/hwrng_srv_provider.c index 2cb81ac..0b2d848 100644 --- a/app/hwcrypto/hwrng_srv_provider.c +++ b/app/hwcrypto/hwrng_srv_provider.c @@ -25,9 +25,8 @@ #include "common.h" #include "hwrng_srv_priv.h" -#define TLOG_LVL TLOG_LVL_DEFAULT #define TLOG_TAG "hwrng_caam" -#include "tlog.h" +#include <trusty_log.h> void hwrng_dev_get_rng_data(uint8_t* buf, size_t buf_len) { uint32_t res = caam_hwrng(buf, buf_len); diff --git a/app/hwcrypto/main.c b/app/hwcrypto/main.c index 7d91f1d..1ca3b6c 100644 --- a/app/hwcrypto/main.c +++ b/app/hwcrypto/main.c @@ -28,9 +28,8 @@ #include "hwkey_srv_priv.h" #include "hwrng_srv_priv.h" -#define TLOG_LVL TLOG_LVL_DEFAULT #define TLOG_TAG "hwcrypto" -#include "tlog.h" +#include <trusty_log.h> /* * Hexdump content of memory region @@ -221,7 +220,7 @@ int main(void) { int rc; uevent_t event; - TLOGI("Initializing\n"); + TLOGD("Initializing\n"); rc = init_caam_env(); if (rc != 0) { @@ -233,7 +232,7 @@ int main(void) { hwrng_init_srv_provider(); hwkey_init_srv_provider(); - TLOGI("enter main event loop\n"); + TLOGD("enter main event loop\n"); /* enter main event loop */ while (true) { diff --git a/app/hwcrypto/rules.mk b/app/hwcrypto/rules.mk index fe738f2..2b52a41 100644 --- a/app/hwcrypto/rules.mk +++ b/app/hwcrypto/rules.mk @@ -34,9 +34,6 @@ MODULE_SRCS := \ $(LOCAL_DIR)/hwrng_srv_provider.c \ $(LOCAL_DIR)/caam.c \ -MODULE_DEFINES := \ - TLOG_LVL_DEFAULT=2 \ - MODULE_INCLUDES := \ $(LOCAL_DIR)/../../platform/imx/soc/$(PLATFORM_SOC)/include diff --git a/app/hwcrypto/tlog.h b/app/hwcrypto/tlog.h deleted file mode 100644 index 2445f1c..0000000 --- a/app/hwcrypto/tlog.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2017 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#include <stdio.h> - -#define TLOG_LVL_NONE 0 -#define TLOG_LVL_ERROR 1 -#define TLOG_LVL_INFO 2 -#define TLOG_LVL_DEBUG 3 - -#ifndef TLOG_LVL -#define TLOG_LVL TLOG_LVL_DEFAULT -#endif - -#if TLOG_LVL >= TLOG_LVL_DEBUG -#define TLOGD(fmt, ...) \ - fprintf(stderr, "%s: %d: " fmt, TLOG_TAG, __LINE__, ##__VA_ARGS__) -#else -#define TLOGD(fmt, ...) -#endif - -#if TLOG_LVL >= TLOG_LVL_INFO -#define TLOGI(fmt, ...) \ - fprintf(stderr, "%s: %d: " fmt, TLOG_TAG, __LINE__, ##__VA_ARGS__) -#else -#define TLOGI(fmt, ...) -#endif - -#if TLOG_LVL >= TLOG_LVL_ERROR -#define TLOGE(fmt, ...) \ - fprintf(stderr, "%s: %d: " fmt, TLOG_TAG, __LINE__, ##__VA_ARGS__) -#else -#define TLOGE(fmt, ...) -#endif |