• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021–2022 Beijing OSWare Technology Co., Ltd
3  * This file contains confidential and proprietary information of
4  * OSWare Technology Co., Ltd
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18 
19 #include <cstdint>
20 #include <cstdio>
21 #include <cstdlib>
22 #include <fcntl.h>
23 #include <gtest/gtest.h>
24 #include <string>
25 #include <unistd.h>
26 #include "hdf_uhdf_test.h"
27 #include "hdf_io_service_if.h"
28 
29 using namespace testing::ext;
30 
31 enum SdioTestCmd {
32     SDIO_DISABLE_FUNC_01 = 0,
33     SDIO_ENABLE_FUNC_01,
34     SDIO_SET_BLOCK_SIZE_01,
35     SDIO_INCR_ADDR_READ_AND_WRITE_BYTES_01,
36     SDIO_FIXED_ADDR_READ_AND_WRITE_BYTES_01,
37     SDIO_FUNC0_READ_AND_WRITE_BYTES_01,
38     SDIO_SET_AND_GET_COMMON_INFO_01,
39 };
40 
41 class HdfLiteSdioTest : public testing::Test {
42 public:
43     static void SetUpTestCase();
44     static void TearDownTestCase();
45     void SetUp();
46     void TearDown();
47 };
48 
SetUpTestCase()49 void HdfLiteSdioTest::SetUpTestCase()
50 {
51     HdfTestOpenService();
52 }
53 
TearDownTestCase()54 void HdfLiteSdioTest::TearDownTestCase()
55 {
56     HdfTestCloseService();
57 }
58 
SetUp()59 void HdfLiteSdioTest::SetUp()
60 {
61 }
62 
TearDown()63 void HdfLiteSdioTest::TearDown()
64 {
65 }
66 
67 /**
68   * @tc.name: SdioDisableFunc001
69   * @tc.desc: SdioDisableFunc Interface test
70   * @tc.type: FUNC
71   * @tc.require: AR000F868B
72   */
73 HWTEST_F(HdfLiteSdioTest, SdioDisableFunc001, TestSize.Level1)
74 {
75     struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_DISABLE_FUNC_01, -1};
76     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
77 }
78 
79 /**
80   * @tc.name: SdioEnableFunc001
81   * @tc.desc: SdioEnableFunc Interface test
82   * @tc.type: FUNC
83   * @tc.require: AR000F868B
84   */
85 HWTEST_F(HdfLiteSdioTest, SdioEnableFunc001, TestSize.Level1)
86 {
87     struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_ENABLE_FUNC_01, -1};
88     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
89 }
90 
91 /**
92   * @tc.name: SdioSetBlockSize001
93   * @tc.desc: SdioSetBlockSize Interface test
94   * @tc.type: FUNC
95   * @tc.require: AR000F868B
96   */
97 HWTEST_F(HdfLiteSdioTest, SdioSetBlockSize001, TestSize.Level1)
98 {
99     struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_SET_BLOCK_SIZE_01, -1};
100     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
101 }
102 
103 /**
104   * @tc.name: SdioIncrAddrReadAndWriteBytes001
105   * @tc.desc: SdioReadBytes and SdioWriteBytes Interface test
106   * @tc.type: FUNC
107   * @tc.require: AR000F868B
108   */
109 HWTEST_F(HdfLiteSdioTest, SdioIncrAddrReadAndWriteBytes001, TestSize.Level1)
110 {
111     struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_INCR_ADDR_READ_AND_WRITE_BYTES_01, -1};
112     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
113 }
114 
115 /**
116   * @tc.name: SdioFixedAddrReadAndWriteBytes001
117   * @tc.desc: SdioReadBytesFromFixedAddr and SdioWriteBytesToFixedAddr Interface test
118   * @tc.type: FUNC
119   * @tc.require: AR000F868B
120   */
121 HWTEST_F(HdfLiteSdioTest, SdioFixedAddrReadAndWriteBytes001, TestSize.Level1)
122 {
123     struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_FIXED_ADDR_READ_AND_WRITE_BYTES_01, -1};
124     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
125 }
126 
127 /**
128   * @tc.name: SdioFunc0ReadAndWriteBytes001
129   * @tc.desc: SdioReadBytesFromFunc0 and SdioWriteBytesToFunc0 Interface test
130   * @tc.type: FUNC
131   * @tc.require: AR000F868B
132   */
133 HWTEST_F(HdfLiteSdioTest, SdioFunc0ReadAndWriteBytes001, TestSize.Level1)
134 {
135     struct HdfTestMsg msg = { TEST_PAL_SDIO_TYPE, SDIO_FUNC0_READ_AND_WRITE_BYTES_01, -1};
136     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
137 }
138 
139 /**
140   * @tc.name: SdioSetAndGetCommonInfo001
141   * @tc.desc: SdioGetCommonInfo and SdioSetCommonInfo Interface test
142   * @tc.type: FUNC
143   * @tc.require: AR000F868B
144   */
145 HWTEST_F(HdfLiteSdioTest, SdioSetAndGetCommonInfo001, TestSize.Level1)
146 {
147     struct HdfTestMsg msg = {TEST_PAL_SDIO_TYPE, SDIO_SET_AND_GET_COMMON_INFO_01, -1};
148     EXPECT_EQ(0, HdfTestSendMsgToService(&msg));
149 }
150