Lines Matching full:card

17 static struct sd_card card;  variable
26 * Verify that SD stack can initialize an MMC card
27 * This test must run first, to ensure the card is initialized.
35 ret = sd_init(sdhc_dev, &card); in ZTEST()
37 zassert_equal(ret, 0, "Card initialization failed"); in ZTEST()
45 ret = mmc_ioctl(&card, DISK_IOCTL_GET_SECTOR_COUNT, &sector_count); in ZTEST()
47 TC_PRINT("SD card reports sector count of %d\n", sector_count); in ZTEST()
49 ret = mmc_ioctl(&card, DISK_IOCTL_GET_SECTOR_SIZE, &sector_size); in ZTEST()
51 TC_PRINT("SD card reports sector size of %d\n", sector_size); in ZTEST()
54 /* Verify that SD stack can read from an SD card */
60 /* Try simple reads from start of SD card */ in ZTEST()
62 ret = mmc_read_blocks(&card, buf, block_addr, 1); in ZTEST()
63 zassert_equal(ret, 0, "Single block card read failed"); in ZTEST()
65 ret = mmc_read_blocks(&card, buf, block_addr, SECTOR_COUNT / 2); in ZTEST()
66 zassert_equal(ret, 0, "Multiple block card read failed"); in ZTEST()
71 ret = mmc_read_blocks(&card, buf, block_addr, SECTOR_COUNT); in ZTEST()
76 ret = mmc_read_blocks(&card, buf, block_addr, 1); in ZTEST()
80 ret = mmc_read_blocks(&card, buf, block_addr, 2); in ZTEST()
81 zassert_equal(ret, 0, "Read from end of card failed"); in ZTEST()
85 ret = mmc_read_blocks(&card, buf + MMC_UNALIGN_OFFSET, block_addr, SECTOR_COUNT - 1); in ZTEST()
89 /* Verify that SD stack can write to an SD card */
95 /* Try simple writes from start of SD card */ in ZTEST()
97 ret = mmc_write_blocks(&card, buf, block_addr, 1); in ZTEST()
98 zassert_equal(ret, 0, "Single block card write failed"); in ZTEST()
100 ret = mmc_write_blocks(&card, buf, block_addr, SECTOR_COUNT / 2); in ZTEST()
101 zassert_equal(ret, 0, "Multiple block card write failed"); in ZTEST()
106 ret = mmc_write_blocks(&card, buf, block_addr, SECTOR_COUNT); in ZTEST()
111 ret = mmc_write_blocks(&card, buf, block_addr, 1); in ZTEST()
115 ret = mmc_write_blocks(&card, buf, block_addr, 2); in ZTEST()
116 zassert_equal(ret, 0, "Write to end of card failed"); in ZTEST()
120 ret = mmc_write_blocks(&card, buf + MMC_UNALIGN_OFFSET, block_addr, SECTOR_COUNT - 1); in ZTEST()
133 ret = mmc_write_blocks(&card, buf, block_addr, SECTOR_COUNT / 2); in ZTEST()
134 zassert_equal(ret, 0, "Write to card failed"); in ZTEST()
136 ret = mmc_read_blocks(&card, buf, block_addr, SECTOR_COUNT / 2); in ZTEST()
137 zassert_equal(ret, 0, "Read from card failed"); in ZTEST()
145 ret = mmc_write_blocks(&card, buf, block_addr, SECTOR_COUNT); in ZTEST()
146 zassert_equal(ret, 0, "Write to card failed"); in ZTEST()
149 ret = mmc_read_blocks(&card, buf, block_addr, SECTOR_COUNT); in ZTEST()
150 zassert_equal(ret, 0, "Read from card failed"); in ZTEST()
156 ret = mmc_write_blocks(&card, buf + MMC_UNALIGN_OFFSET, block_addr, in ZTEST()
158 zassert_equal(ret, 0, "Write to card failed"); in ZTEST()
161 ret = mmc_read_blocks(&card, check_buf + MMC_UNALIGN_OFFSET, block_addr, in ZTEST()
163 zassert_equal(ret, 0, "Read from card failed"); in ZTEST()
170 /* Simply dump the card configuration. */
173 switch (card.card_voltage) { in ZTEST()
175 TC_PRINT("Card voltage: 1.2V\n"); in ZTEST()
178 TC_PRINT("Card voltage: 1.8V\n"); in ZTEST()
181 TC_PRINT("Card voltage: 3.0V\n"); in ZTEST()
184 TC_PRINT("Card voltage: 3.3V\n"); in ZTEST()
187 zassert_unreachable("Card voltage is not known value"); in ZTEST()
189 zassert_equal(card.status, CARD_INITIALIZED, "Card status is not OK"); in ZTEST()
190 switch (card.card_speed) { in ZTEST()
192 TC_PRINT("Card timing: Legacy MMC\n"); in ZTEST()
195 TC_PRINT("Card timing: High Speed MMC\n"); in ZTEST()
198 TC_PRINT("Card timing: MMC HS200\n"); in ZTEST()
201 TC_PRINT("Card timing: MMC HS400\n"); in ZTEST()
204 zassert_unreachable("Card timing is not known value"); in ZTEST()
206 switch (card.type) { in ZTEST()
208 TC_PRINT("Card type: SDIO\n"); in ZTEST()
211 TC_PRINT("Card type: SDMMC\n"); in ZTEST()
214 TC_PRINT("Card type: combo card\n"); in ZTEST()
217 TC_PRINT("Card type: MMC\n"); in ZTEST()
220 zassert_unreachable("Card type is not known value"); in ZTEST()