1 /*
2 * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3 *
4 * HDF is dual licensed: you can use it either under the terms of
5 * the GPL, or the BSD license, at your option.
6 * See the LICENSE file in the root of this repository for complete details.
7 */
8
9 #include <cstdint>
10 #include <cstdio>
11 #include <cstdlib>
12 #include <fcntl.h>
13 #include <gtest/gtest.h>
14 #include <string>
15 #include <unistd.h>
16 #include "emmc_if.h"
17 #include "hdf_io_service_if.h"
18 #include "hdf_uhdf_test.h"
19
20 using namespace testing::ext;
21
22 enum EmmcTestCmd {
23 EMMC_GET_CID_01 = 0,
24 };
25
26 class HdfLiteEmmcTest : public testing::Test {
27 public:
28 static void SetUpTestCase();
29 static void TearDownTestCase();
30 void SetUp();
31 void TearDown();
32 };
33
SetUpTestCase()34 void HdfLiteEmmcTest::SetUpTestCase()
35 {
36 HdfTestOpenService();
37 }
38
TearDownTestCase()39 void HdfLiteEmmcTest::TearDownTestCase()
40 {
41 HdfTestCloseService();
42 }
43
SetUp()44 void HdfLiteEmmcTest::SetUp()
45 {
46 }
47
TearDown()48 void HdfLiteEmmcTest::TearDown()
49 {
50 }
51
TestUserEmmcGetCid(void)52 static void TestUserEmmcGetCid(void)
53 {
54 uint8_t cid[EMMC_CID_LEN] = {0};
55 uint32_t i;
56
57 EmmcGetHuid(cid, EMMC_CID_LEN);
58 for (i = 0; i < EMMC_CID_LEN; i++) {
59 printf("user interface get cid[%u] = 0x%x\n", i, cid[i]);
60 }
61 }
62
63 /**
64 * @tc.name: EmmcGetCid001
65 * @tc.desc: test EmmcGetCid/EmmcGetHuid interface in kernel and user status.
66 * @tc.type: FUNC
67 * @tc.require: AR000F5LSD AR000F5LV3
68 */
69 HWTEST_F(HdfLiteEmmcTest, EmmcGetCid001, TestSize.Level1)
70 {
71 struct HdfTestMsg msg = {TEST_PAL_EMMC_TYPE, EMMC_GET_CID_01, -1};
72 EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
73 TestUserEmmcGetCid();
74 }
75