Files
MicrochipFor32/Doc/latex/bsp___s_d_8cpp_source.tex

378 lines
79 KiB
TeX
Raw Normal View History

2022-11-23 23:59:23 +08:00
\hypertarget{bsp___s_d_8cpp_source}{}\doxysection{bsp\+\_\+\+SD.\+cpp}
\label{bsp___s_d_8cpp_source}\index{D:/gitt/MicrochipFor32/bsp\_Device/bsp\_SD.cpp@{D:/gitt/MicrochipFor32/bsp\_Device/bsp\_SD.cpp}}
\mbox{\hyperlink{bsp___s_d_8cpp}{浏览该文件的文档.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00001}00001 \textcolor{comment}{/*-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00002}00002 \textcolor{comment}{ \#}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00003}00003 \textcolor{comment}{ \# Copyright (c) 2022 Yuankang Liang(XerolySkinner)}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00004}00004 \textcolor{comment}{ \#}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00005}00005 \textcolor{comment}{ \# 本软件按原样提供,无任何明示或暗示}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00006}00006 \textcolor{comment}{ \# 在任何情况下,作者都不承担任何损害赔偿责任}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00007}00007 \textcolor{comment}{ \#}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00008}00008 \textcolor{comment}{ \# 使用的许可声明:}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00009}00009 \textcolor{comment}{ \# 1. 不得歪曲本软件的来源,你不能声称你编写了原始软件.}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00010}00010 \textcolor{comment}{ \# 2. 免费授予以任何目的,前提是版权声明出现在所有副本中.}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00011}00011 \textcolor{comment}{ \# 并且版权声明和许可声明同时出现.}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00012}00012 \textcolor{comment}{ \# 3. 你有使用,复制,修改,分发,和销售本软件的许可.}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00013}00013 \textcolor{comment}{ \# 4. 如果你在产品中使用,产品文档中的声明是赞赏的但不是必须的.}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00014}00014 \textcolor{comment}{ \# 5. 本通知不得从任何来源删除或更改.}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00015}00015 \textcolor{comment}{ \#}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00016}00016 \textcolor{comment}{ \# Yuankang Liang(XerolySkinner)}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00017}00017 \textcolor{comment}{ \# E-\/mail:zabbcccbbaz@163.com}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00018}00018 \textcolor{comment}{ \# QQ:2715099320}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00019}00019 \textcolor{comment}{ \# Mobile Phone:13005636215}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00020}00020 \textcolor{comment}{ \#}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00021}00021 \textcolor{comment}{ \# All rights reserved.}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00022}00022 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00023}00023 }
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00034}00034 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{bsp___s_d_8h}{bsp\_SD.h}}"{}}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00036}00036 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00037}00037 \textcolor{comment}{// 程序}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00038}00038 \textcolor{comment}{// }}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00043}\mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{00043}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{bsp\_SD::SD\_CS}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} p)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00044}00044 HAL\_GPIO\_WritePin(\mbox{\hyperlink{classbsp___s_d_ad7788d2e62152a2fb1a6b307fa902180}{GPIOx\_CS}}, \mbox{\hyperlink{classbsp___s_d_a4525b5c0f62e39af1c9adb9a9c22239f}{GPIO\_Pin\_CS}}, p == 0 ? GPIO\_PIN\_SET: GPIO\_PIN\_RESET);\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00045}00045 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00053}\mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{00053}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{bsp\_SD::SD\_sendcmd}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} cmd, \mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} arg, \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} crc)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00054}00054 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00055}00055 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} retry;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00056}00056 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(0);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00057}00057 \_\_nop();}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00058}00058 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(1);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00059}00059 \textcolor{keywordflow}{do} retry = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(\mbox{\hyperlink{classbsp___s_d_a6c68fa82294f18968a92719931cff5fa}{DFF}});\textcolor{keywordflow}{while}(retry != 0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00060}00060 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(cmd | 0x40);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00061}00061 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(arg >> 24);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00062}00062 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(arg >> 16);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00063}00063 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(arg >> 8);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00064}00064 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(arg);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00065}00065 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(crc);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00066}00066 \textcolor{keywordflow}{if} (cmd == \mbox{\hyperlink{bsp___s_d_8h_a8d6283c9b060afbaa0e6d1ff7e5ea7b8}{CMD12}}) \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(\mbox{\hyperlink{classbsp___s_d_a6c68fa82294f18968a92719931cff5fa}{DFF}});}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00067}00067 \textcolor{keywordflow}{do} r1 = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF);\textcolor{keywordflow}{while}(r1 \& 0X80);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00068}00068 \textcolor{keywordflow}{return} r1;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00069}00069 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00074}\mbox{\hyperlink{classbsp___s_d_a1e0a3f09367627bcafc8efaaeb90b066}{00074}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a1e0a3f09367627bcafc8efaaeb90b066}{bsp\_SD::SD\_init}}(\textcolor{keywordtype}{void})\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00075}00075 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00076}00076 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} buff[6] = \{0\};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00077}00077 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} retry;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00078}00078 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} i;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00079}00079 \textcolor{comment}{// MX\_SPI3\_Init();}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00080}00080 \mbox{\hyperlink{classbsp___s_d_a5ed95b95b141ee21d83ca70c1b06a31a}{SPI\_setspeed}}(SPI\_BAUDRATEPRESCALER\_256);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00081}00081 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(0);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00082}00082 \textcolor{keywordflow}{for} (retry = 0; retry < 10; retry++) \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(\mbox{\hyperlink{classbsp___s_d_a6c68fa82294f18968a92719931cff5fa}{DFF}});}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00083}00083 \textcolor{comment}{// SD卡进入IDLE状态}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00084}00084 \textcolor{keywordflow}{do} r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a938c1466755f12fb04ac0d1b775584d1}{CMD0}}, 0, 0x95);\textcolor{keywordflow}{while}(r1 != 0x01);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00085}00085 \textcolor{comment}{// 查看SD卡的类型}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00086}00086 \mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} = 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00087}00087 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_ac75b3e0ad1fb013ea946fb49bbe65668}{CMD8}}, 0x1AA, 0x87);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00088}00088 \textcolor{keywordflow}{if} (r1 == 0x01) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00089}00089 \textcolor{keywordflow}{for} (i = 0; i < 4; i++) buff[i] = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(\mbox{\hyperlink{classbsp___s_d_a6c68fa82294f18968a92719931cff5fa}{DFF}}); \textcolor{comment}{//Get trailing return value of R7 resp}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00090}00090 \textcolor{keywordflow}{if} (buff[2] == 0X01 \&\& buff[3] == 0XAA) \{ \textcolor{comment}{//卡是否支持2.7\string~3.6V}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00091}00091 retry = 0XFFFE;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00092}00092 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00093}00093 \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a78289a7a85ffcfddd626694105dc0780}{CMD55}}, 0, 0X01); \textcolor{comment}{//发送CMD55}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00094}00094 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a3ca1450d0ac55d2705aab03537bf2865}{CMD41}}, 0x40000000, 0X01); \textcolor{comment}{//发送CMD41}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00095}00095 \}\textcolor{keywordflow}{while}(r1 \&\& retry-\/-\/);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00096}00096 \textcolor{keywordflow}{if} (retry \&\& \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_aa7a26b2cf17e1ff5967820a1fa41a7aa}{CMD58}}, 0, 0X01) == 0) \{ \textcolor{comment}{//鉴别SD2.0卡版本开始}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00097}00097 \textcolor{keywordflow}{for} (i = 0; i < 4; i++) buff[i] = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0XFF); \textcolor{comment}{//得到OCR值}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00098}00098 \textcolor{keywordflow}{if} (buff[0] \&0x40) \mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} = \mbox{\hyperlink{bsp___s_d_8h_ae52e14c1b95e5162f4fe492d9b1b0fec}{V2HC}};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00099}00099 \textcolor{keywordflow}{else} \mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} = \mbox{\hyperlink{bsp___s_d_8h_a9173468f90b474471bfff59f8487cbc1}{V2}};\}\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00100}00100 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00101}00101 \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a78289a7a85ffcfddd626694105dc0780}{CMD55}}, 0, 0X01); \textcolor{comment}{//发送CMD55}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00102}00102 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a3ca1450d0ac55d2705aab03537bf2865}{CMD41}}, 0, 0X01); \textcolor{comment}{//发送CMD41}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00103}00103 \textcolor{keywordflow}{if} (r1 <= 1) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00104}00104 \mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} = \mbox{\hyperlink{bsp___s_d_8h_ae21a9518b4dd62d2baeab430c89a657a}{V1}};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00105}00105 retry = 0XFFFE;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00106}00106 \textcolor{keywordflow}{do} \{ \textcolor{comment}{//等待退出IDLE模式}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00107}00107 \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a78289a7a85ffcfddd626694105dc0780}{CMD55}}, 0, 0X01); \textcolor{comment}{//发送CMD55}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00108}00108 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a3ca1450d0ac55d2705aab03537bf2865}{CMD41}}, 0, 0X01); \textcolor{comment}{//发送CMD41}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00109}00109 \}\textcolor{keywordflow}{while}(r1 \&\& retry-\/-\/);\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00110}00110 \textcolor{keywordflow}{else} \{ \textcolor{comment}{//MMC卡不支持CMD55+CMD41识别}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00111}00111 \mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} = \mbox{\hyperlink{bsp___s_d_8h_ab5a7d5477e55758bde614bda3250a93c}{MMC}}; \textcolor{comment}{//MMC V3}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00112}00112 retry = 0XFFFE;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00113}00113 \textcolor{keywordflow}{do} r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_aca9979f299fa78c1128d778084478673}{CMD1}}, 0, 0X01);\textcolor{keywordflow}{while}(r1 \&\& retry-\/-\/);\} \textcolor{comment}{//等待退出IDLE模式}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00114}00114 \textcolor{keywordflow}{if} (retry == 0 || \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_aaeab261b94f2031ba41a1d4d857c3541}{CMD16}}, 512, 0X01) != 0) \mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} = \mbox{\hyperlink{bsp___s_d_8h_a735563036dced0b7d6cc98f97ea4978b}{ERR}};\} \textcolor{comment}{//错误的卡}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00115}00115 \}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00116}00116 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(0);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00117}00117 \mbox{\hyperlink{classbsp___s_d_a5ed95b95b141ee21d83ca70c1b06a31a}{SPI\_setspeed}}(SPI\_BAUDRATEPRESCALER\_2);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00118}00118 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}}) \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00119}00119 \textcolor{keywordflow}{else} \textcolor{keywordflow}{return} 1;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00120}00120 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00127}\mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{00127}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{bsp\_SD::SD\_ReceiveData}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} * data, \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} len)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00128}00128 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00129}00129 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(1);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00130}00130 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00131}00131 r1 = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00132}00132 \_\_nop();}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00133}00133 \}\textcolor{keywordflow}{while}(r1 != 0xFE);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00134}00134 \textcolor{keywordflow}{while} (len-\/-\/) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00135}00135 *data = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00136}00136 data++;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00137}00137 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00138}00138 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00139}00139 \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00140}00140 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00147}\mbox{\hyperlink{classbsp___s_d_a2df843979bb4c764422a37b255c184ea}{00147}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a2df843979bb4c764422a37b255c184ea}{bsp\_SD::SD\_SendBlock}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} * buf, \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} cmd)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00148}00148 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} t;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00149}00149 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00150}00150 \textcolor{keywordflow}{do} r1 = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF);\textcolor{keywordflow}{while}(r1 != 0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00151}00151 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(cmd);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00152}00152 \textcolor{keywordflow}{if} (cmd != 0XFD) \{ \textcolor{comment}{//不是结束指令}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00153}00153 \textcolor{keywordflow}{for} (t = 0; t < 512; t++) \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(buf[t]); \textcolor{comment}{//提高速度,减少函数传参时间}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00154}00154 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF); \textcolor{comment}{//忽略crc}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00155}00155 \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00156}00156 t = \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{spi\_readwrite}}(0xFF); \textcolor{comment}{//接收响应}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00157}00157 \textcolor{keywordflow}{if} ((t \& 0x1F) != 0x05) \textcolor{keywordflow}{return} 2;\} \textcolor{comment}{//响应错误}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00158}00158 \textcolor{keywordflow}{return} 0;\} \textcolor{comment}{//写入成功}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00159}00159 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00164}\mbox{\hyperlink{classbsp___s_d_a25bc03ff69d0c3c9a73153c71c84a8b0}{00164}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a25bc03ff69d0c3c9a73153c71c84a8b0}{bsp\_SD::SD\_GETCID}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} * cid\_data)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00165}00165 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00166}00166 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_ae7b800ed8e7bd52e6f570a5ce72b8104}{CMD10}}, 0, 0x01); \textcolor{comment}{//读取CID寄存器}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00167}00167 \textcolor{keywordflow}{if} (r1 == 0x00) r1 = \mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{SD\_ReceiveData}}(cid\_data, 16);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00168}00168 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(0);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00169}00169 \textcolor{keywordflow}{if} (r1) \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00170}00170 \textcolor{keywordflow}{else} \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00171}00171 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00176}\mbox{\hyperlink{classbsp___s_d_ad0426f6a4b550e60a926c95724d81665}{00176}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_ad0426f6a4b550e60a926c95724d81665}{bsp\_SD::SD\_GETCSD}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} * csd\_data)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00177}00177 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00178}00178 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a1fac6a251d7e7dc204d21639bf521459}{CMD9}}, 0, 0x01); \textcolor{comment}{//发CMD9命令读CSD寄存器}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00179}00179 \textcolor{keywordflow}{if} (r1 == 0) r1 = \mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{SD\_ReceiveData}}(csd\_data, 16); \textcolor{comment}{//接收16个字节的数据 }}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00180}00180 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(0); \textcolor{comment}{//取消片选}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00181}00181 \textcolor{keywordflow}{if} (r1) \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00182}00182 \textcolor{keywordflow}{else} \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00183}00183 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00188}\mbox{\hyperlink{classbsp___s_d_a600cc886dc5da6d34f75d0bf226c1b92}{00188}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} \mbox{\hyperlink{classbsp___s_d_a600cc886dc5da6d34f75d0bf226c1b92}{bsp\_SD::SD\_GetSectorCount}}(\textcolor{keywordtype}{void})\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00189}00189 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} csd[16];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00190}00190 \mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} Capacity;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00191}00191 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} n;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00192}00192 \mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}} csize;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00193}00193 \textcolor{comment}{//取CSD信息如果期间出错返回0}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00194}00194 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_ad0426f6a4b550e60a926c95724d81665}{SD\_GETCSD}}(csd) != 0) \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00195}00195 \textcolor{comment}{//如果为SDHC卡按照下面方式计算}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00196}00196 \textcolor{keywordflow}{if} ((csd[0] \&0xC0) == 0x40) \{ \textcolor{comment}{//V2.00的卡}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00197}00197 csize = csd[9] + ((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}}) csd[8] << 8) + 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00198}00198 Capacity = (\mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}})}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00199}00199 csize << 10;\} \textcolor{comment}{//得到扇区数}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00200}00200 \textcolor{keywordflow}{else} \{ \textcolor{comment}{//V1.XX的卡}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00201}00201 n = (csd[5] \&15) + ((csd[10] \&128) >> 7) + ((csd[9] \&3) << 1) + 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00202}00202 csize = (csd[8] >> 6) + ((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}}) csd[7] << 2) + ((\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}}) (csd[6] \&3) << 10) + 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00203}00203 Capacity = (\mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}})}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00204}00204 csize << (n -\/ 9);\} \textcolor{comment}{//得到扇区数}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00205}00205 \textcolor{keywordflow}{return} Capacity;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00206}00206 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00207}\mbox{\hyperlink{classbsp___s_d_aaf2d27cc9275f3ffa71556124f143d12}{00207}} \textcolor{keywordtype}{int} \mbox{\hyperlink{classbsp___s_d_aaf2d27cc9275f3ffa71556124f143d12}{bsp\_SD::MSD0\_GetCardInfo}}(\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o}{PMSD\_CARDINFO}} \mbox{\hyperlink{bsp___s_d_8h_a2c85a6a257358283b46ba829ae0c2dba}{SD0\_CardInfo}})\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00208}00208 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00209}00209 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} CSD\_Tab[16];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00210}00210 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} CID\_Tab[16];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00211}00211 \textcolor{comment}{/* Send CMD9, Read CSD */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00212}00212 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a1fac6a251d7e7dc204d21639bf521459}{CMD9}}, 0, 0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00213}00213 \textcolor{keywordflow}{if} (r1 != 0x00) \textcolor{keywordflow}{return} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00214}00214 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{SD\_ReceiveData}}(CSD\_Tab, 16)) \textcolor{keywordflow}{return} 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00215}00215 \textcolor{comment}{/* Send CMD10, Read CID */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00216}00216 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_ae7b800ed8e7bd52e6f570a5ce72b8104}{CMD10}}, 0, 0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00217}00217 \textcolor{keywordflow}{if} (r1 != 0x00) \textcolor{keywordflow}{return} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00218}00218 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{SD\_ReceiveData}}(CID\_Tab, 16)) \textcolor{keywordflow}{return} 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00219}00219 \textcolor{comment}{/* Byte 0 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00220}00220 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a53c6d82426462a5f31a0e07bc2014d97}{CSDStruct}} = (CSD\_Tab[0] \&0xC0) >> 6;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00221}00221 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a8709246fbcaa2984e8752e5d028a25e1}{SysSpecVersion}} = (CSD\_Tab[0] \&0x3C) >> 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00222}00222 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a43d9f48b7a10b9b16700cc4df7f944c0}{Reserved1}} = CSD\_Tab[0] \&0x03;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00223}00223 \textcolor{comment}{/* Byte 1 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00224}00224 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ac80ef2c5f8eedf6e361b9d48da66d98d}{TAAC}} = CSD\_Tab[1];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00225}00225 \textcolor{comment}{/* Byte 2 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00226}00226 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ae9fdc21394cb38fc96de03821b5b1f5b}{NSAC}} = CSD\_Tab[2];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00227}00227 \textcolor{comment}{/* Byte 3 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00228}00228 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ae4fe7f59ec2c0fec2d5c5edc912de487}{MaxBusClkFrec}} = CSD\_Tab[3];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00229}00229 \textcolor{comment}{/* Byte 4 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00230}00230 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a235ebfcf7116a28eb8f7e2348b46c279}{CardComdClasses}} = CSD\_Tab[4] << 4;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00231}00231 \textcolor{comment}{/* Byte 5 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00232}00232 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a235ebfcf7116a28eb8f7e2348b46c279}{CardComdClasses}} |= (CSD\_Tab[5] \&0xF0) >> 4;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00233}00233 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a0d503ea30e3553e3dbf1d259c1835bca}{RdBlockLen}} = CSD\_Tab[5] \&0x0F;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00234}00234 \textcolor{comment}{/* Byte 6 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00235}00235 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a7e302d0f797f25a53205bf683fcb9315}{PartBlockRead}} = (CSD\_Tab[6] \&0x80) >> 7;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00236}00236 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_aaf61be1914d24eeef107b78d57f96f66}{WrBlockMisalign}} = (CSD\_Tab[6] \&0x40) >> 6;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00237}00237 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ad4c2ce16da22ad02424466d1b42d04b0}{RdBlockMisalign}} = (CSD\_Tab[6] \&0x20) >> 5;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00238}00238 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a6010a523c29470b3fca2a179608bb165}{DSRImpl}} = (CSD\_Tab[6] \&0x10) >> 4;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00239}00239 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_af46b7c72145239d75dcf08e97a8015cb}{Reserved2}} = 0; \textcolor{comment}{/* Reserved */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00240}00240 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ab2341b019f101f621817ab7f13f85321}{DeviceSize}} = (CSD\_Tab[6] \&0x03) << 10;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00241}00241 \textcolor{comment}{/* Byte 7 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00242}00242 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ab2341b019f101f621817ab7f13f85321}{DeviceSize}} |= (CSD\_Tab[7]) << 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00243}00243 \textcolor{comment}{/* Byte 8 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00244}00244 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ab2341b019f101f621817ab7f13f85321}{DeviceSize}} |= (CSD\_Tab[8] \&0xC0) >> 6;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00245}00245 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a5f028ae76ae390e7efc7581863f86fa4}{MaxRdCurrentVDDMin}} = (CSD\_Tab[8] \&0x38) >> 3;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00246}00246 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a81dee06837a4a641a428af5271ce7881}{MaxRdCurrentVDDMax}} = (CSD\_Tab[8] \&0x07);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00247}00247 \textcolor{comment}{/* Byte 9 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00248}00248 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a4312d08d19360f8cda0fdcefea8c58a8}{MaxWrCurrentVDDMin}} = (CSD\_Tab[9] \&0xE0) >> 5;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00249}00249 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a5a4157c022770f5f2a22da59f1287ec1}{MaxWrCurrentVDDMax}} = (CSD\_Tab[9] \&0x1C) >> 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00250}00250 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a021add43b09781e1c4feb5a911bab718}{DeviceSizeMul}} = (CSD\_Tab[9] \&0x03) << 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00251}00251 \textcolor{comment}{/* Byte 10 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00252}00252 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a021add43b09781e1c4feb5a911bab718}{DeviceSizeMul}} |= (CSD\_Tab[10] \&0x80) >> 7;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00253}00253 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a3217bd2b49b77943bcb3e5a6f5f0e419}{EraseGrSize}} = (CSD\_Tab[10] \&0x7C) >> 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00254}00254 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a6d4b83a1a42edb0e08f674fa6e611d28}{EraseGrMul}} = (CSD\_Tab[10] \&0x03) << 3;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00255}00255 \textcolor{comment}{/* Byte 11 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00256}00256 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a6d4b83a1a42edb0e08f674fa6e611d28}{EraseGrMul}} |= (CSD\_Tab[11] \&0xE0) >> 5;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00257}00257 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_aa21f77c612167167e40003b6d3784689}{WrProtectGrSize}} = (CSD\_Tab[11] \&0x1F);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00258}00258 \textcolor{comment}{/* Byte 12 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00259}00259 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a0d11fc6f8c1e51d1b63887603eee8915}{WrProtectGrEnable}} = (CSD\_Tab[12] \&0x80) >> 7;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00260}00260 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a1ee9e5144b15487f92f6d9ce59835428}{ManDeflECC}} = (CSD\_Tab[12] \&0x60) >> 5;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00261}00261 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a3ededd192a17234569a584cbd72b12ae}{WrSpeedFact}} = (CSD\_Tab[12] \&0x1C) >> 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00262}00262 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a0dcba500cb60f6ce8d95864ae2eaa307}{MaxWrBlockLen}} = (CSD\_Tab[12] \&0x03) << 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00263}00263 \textcolor{comment}{/* Byte 13 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00264}00264 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a0dcba500cb60f6ce8d95864ae2eaa307}{MaxWrBlockLen}} |= (CSD\_Tab[13] \&0xc0) >> 6;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00265}00265 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a3c32bff0de0b6cba1f9bd3205159e6e4}{WriteBlockPaPartial}} = (CSD\_Tab[13] \&0x20) >> 5;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00266}00266 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a83b44a54e8cefcfffdfb5a744d0bf3d5}{Reserved3}} = 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00267}00267 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_aaadb152d2dce1323e589580ef0099fec}{ContentProtectAppli}} = (CSD\_Tab[13] \&0x01);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00268}00268 \textcolor{comment}{/* Byte 14 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00269}00269 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a08f8247c46de7ef2b0677886470d7792}{FileFormatGrouop}} = (CSD\_Tab[14] \&0x80) >> 7;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00270}00270 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a17f58dd1f98e6e6376efe142f352cb59}{CopyFlag}} = (CSD\_Tab[14] \&0x40) >> 6;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00271}00271 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a150bf25ff42008d58320a6b7e531c9ab}{PermWrProtect}} = (CSD\_Tab[14] \&0x20) >> 5;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00272}00272 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a3f2c48bb307e7779173e3563bbd5038f}{TempWrProtect}} = (CSD\_Tab[14] \&0x10) >> 4;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00273}00273 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ac3510e157155d4b9d9f67591b1cb0c8e}{FileFormat}} = (CSD\_Tab[14] \&0x0C) >> 2;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00274}00274 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a1e153d660ffe4bbafa596d4b0b8c2906}{ECC}} = (CSD\_Tab[14] \&0x03);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00275}00275 \textcolor{comment}{/* Byte 15 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00276}00276 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a81e9f99cdd87dd2e0305b3b191aa5226}{CSD\_CRC}} = (CSD\_Tab[15] \&0xFE) >> 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00277}00277 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_a36b124f6ffc0716dc0dc93c407b975d1}{Reserved4}} = 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00278}00278 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a8f29efd96df6abb8cd6353787eebca04}{CardType}} == \mbox{\hyperlink{bsp___s_d_8h_ae52e14c1b95e5162f4fe492d9b1b0fec}{V2HC}}) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00279}00279 \textcolor{comment}{/* Byte 7 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00280}00280 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ab2341b019f101f621817ab7f13f85321}{DeviceSize}} = (\mbox{\hyperlink{varint_8h_ace9d960e74685e2cd84b36132dbbf8aa}{u16}}) (CSD\_Tab[8]) * 256;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00281}00281 \textcolor{comment}{/* Byte 8 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00282}00282 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ab2341b019f101f621817ab7f13f85321}{DeviceSize}} += CSD\_Tab[9];\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00283}00283 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a4e5da8ba91229ac3ccb2d3f11f1ab4bf}{Capacity}} = \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_a9893f18007a0897aa45869e703f4cc2a}{CSD}}.\mbox{\hyperlink{struct_m_s_d___c_s_d_ab2341b019f101f621817ab7f13f85321}{DeviceSize}} * \mbox{\hyperlink{bsp___s_d_8h_a5bda0c70032a9b8625ae5a3c55d21c38}{MSD\_BLOCKSIZE}} * 1024;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00284}00284 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_aadaf986217b3c403be1cc4a2fd2fd148}{BlockSize}} = \mbox{\hyperlink{bsp___s_d_8h_a5bda0c70032a9b8625ae5a3c55d21c38}{MSD\_BLOCKSIZE}};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00285}00285 \textcolor{comment}{/* Byte 0 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00286}00286 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a5ae9ad5d65182a34e20b87fa2752010e}{ManufacturerID}} = CID\_Tab[0];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00287}00287 \textcolor{comment}{/* Byte 1 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00288}00288 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_acd04644e46f7ceca82bbe9bdc80f1d53}{OEM\_AppliID}} = CID\_Tab[1] << 8;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00289}00289 \textcolor{comment}{/* Byte 2 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00290}00290 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_acd04644e46f7ceca82bbe9bdc80f1d53}{OEM\_AppliID}} |= CID\_Tab[2];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00291}00291 \textcolor{comment}{/* Byte 3 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00292}00292 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_ab7e359a09fecf1fa2d1b18e708dcc292}{ProdName1}} = CID\_Tab[3] << 24;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00293}00293 \textcolor{comment}{/* Byte 4 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00294}00294 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_ab7e359a09fecf1fa2d1b18e708dcc292}{ProdName1}} |= CID\_Tab[4] << 16;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00295}00295 \textcolor{comment}{/* Byte 5 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00296}00296 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_ab7e359a09fecf1fa2d1b18e708dcc292}{ProdName1}} |= CID\_Tab[5] << 8;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00297}00297 \textcolor{comment}{/* Byte 6 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00298}00298 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_ab7e359a09fecf1fa2d1b18e708dcc292}{ProdName1}} |= CID\_Tab[6];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00299}00299 \textcolor{comment}{/* Byte 7 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00300}00300 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_ad0d7606f38a0140075647fb3f66614ea}{ProdName2}} = CID\_Tab[7];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00301}00301 \textcolor{comment}{/* Byte 8 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00302}00302 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_acd9fbacd30fdff0eef7d885ad4ec438b}{ProdRev}} = CID\_Tab[8];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00303}00303 \textcolor{comment}{/* Byte 9 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00304}00304 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a0c5c88d258f73f17a496f3b92d9cfd5c}{ProdSN}} = CID\_Tab[9] << 24;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00305}00305 \textcolor{comment}{/* Byte 10 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00306}00306 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a0c5c88d258f73f17a496f3b92d9cfd5c}{ProdSN}} |= CID\_Tab[10] << 16;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00307}00307 \textcolor{comment}{/* Byte 11 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00308}00308 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a0c5c88d258f73f17a496f3b92d9cfd5c}{ProdSN}} |= CID\_Tab[11] << 8;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00309}00309 \textcolor{comment}{/* Byte 12 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00310}00310 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a0c5c88d258f73f17a496f3b92d9cfd5c}{ProdSN}} |= CID\_Tab[12];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00311}00311 \textcolor{comment}{/* Byte 13 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00312}00312 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a1be2e4d82c95f2d158ce5f5157a7fd5b}{Reserved1}} |= (CID\_Tab[13] \&0xF0) >> 4;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00313}00313 \textcolor{comment}{/* Byte 14 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00314}00314 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a55015d75002e50ff4f23cd19c9b5c90a}{ManufactDate}} = (CID\_Tab[13] \&0x0F) << 8;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00315}00315 \textcolor{comment}{/* Byte 15 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00316}00316 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a55015d75002e50ff4f23cd19c9b5c90a}{ManufactDate}} |= CID\_Tab[14];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00317}00317 \textcolor{comment}{/* Byte 16 */}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00318}00318 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_a61fe89c386eb7bf7b8e2ba44545168de}{CID\_CRC}} = (CID\_Tab[15] \&0xFE) >> 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00319}00319 \mbox{\hyperlink{classbsp___s_d_aab1487286ac43dc9110e65b52c850de4}{SD0\_CardInfo}}-\/>\mbox{\hyperlink{struct_m_s_d___c_a_r_d_i_n_f_o_ab267c45d70fa28f9ff17829fa8753509}{CID}}.\mbox{\hyperlink{struct_m_s_d___c_i_d_aac8e73e305ea1ff29ae195a6c0a63e05}{Reserved2}} = 1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00320}00320 \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00321}00321 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00329}\mbox{\hyperlink{classbsp___s_d_af203b65e00206d38ef14640f7b7242b6}{00329}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_af203b65e00206d38ef14640f7b7242b6}{bsp\_SD::SD\_WriteDisk}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} * buf, \mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} sector, \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} cnt)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00330}00330 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00331}00331 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} != \mbox{\hyperlink{bsp___s_d_8h_ae52e14c1b95e5162f4fe492d9b1b0fec}{V2HC}}) sector *= 512; \textcolor{comment}{//转换为字节地址}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00332}00332 \textcolor{keywordflow}{if} (cnt == 1)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00333}00333 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a252300302c6f7960df547a7f5c25be85}{CMD24}}, sector, 0X01); \textcolor{comment}{//读命令}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00334}00334 \textcolor{keywordflow}{if} (r1 == 0) \textcolor{comment}{//指令发送成功}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00335}00335 r1 = \mbox{\hyperlink{classbsp___s_d_a2df843979bb4c764422a37b255c184ea}{SD\_SendBlock}}(buf, 0xFE);\} \textcolor{comment}{//写512个字节}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00336}00336 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00337}00337 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} != \mbox{\hyperlink{bsp___s_d_8h_ab5a7d5477e55758bde614bda3250a93c}{MMC}}) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00338}00338 \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a78289a7a85ffcfddd626694105dc0780}{CMD55}}, 0, 0X01);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00339}00339 \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a14506e981f38b6177bc36f72c2ca18b1}{CMD23}}, cnt, 0X01);\} \textcolor{comment}{//发送指令}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00340}00340 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_aee2c673fba987178f4642531fdeefe9e}{CMD25}}, sector, 0X01); \textcolor{comment}{//连续读命令}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00341}00341 \textcolor{keywordflow}{if} (r1 == 0) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00342}00342 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00343}00343 r1 = \mbox{\hyperlink{classbsp___s_d_a2df843979bb4c764422a37b255c184ea}{SD\_SendBlock}}(buf, 0xFC); \textcolor{comment}{//接收512个字节}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00344}00344 buf += 512;\}\textcolor{keywordflow}{while}(-\/-\/cnt \&\& r1 == 0);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00345}00345 r1 = \mbox{\hyperlink{classbsp___s_d_a2df843979bb4c764422a37b255c184ea}{SD\_SendBlock}}(0, 0xFD);\}\} \textcolor{comment}{//接收512个字节}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00346}00346 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(0); \textcolor{comment}{//取消片选}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00347}00347 \textcolor{keywordflow}{return} r1;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00348}00348 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00356}\mbox{\hyperlink{classbsp___s_d_a96f32b50ec777acc0dd819150cd28937}{00356}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a96f32b50ec777acc0dd819150cd28937}{bsp\_SD::SD\_ReadDisk}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} * buf, \mbox{\hyperlink{varint_8h_afaa62991928fb9fb18ff0db62a040aba}{u32}} sector, \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} cnt)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00357}00357 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} r1;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00358}00358 \textcolor{keywordflow}{if} (\mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{SD\_TYPE}} != \mbox{\hyperlink{bsp___s_d_8h_ae52e14c1b95e5162f4fe492d9b1b0fec}{V2HC}}) sector <<= 9; \textcolor{comment}{//转换为字节地址}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00359}00359 \textcolor{keywordflow}{if} (cnt == 1) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00360}00360 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a6bbfe7dc16a19b7f40efcf554b5666ad}{CMD17}}, sector, 0X01); \textcolor{comment}{//读命令}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00361}00361 \textcolor{keywordflow}{if} (r1 == 0) \textcolor{comment}{//指令发送成功}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00362}00362 r1 = \mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{SD\_ReceiveData}}(buf, 512);\} \textcolor{comment}{//接收512个字节}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00363}00363 \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00364}00364 r1 = \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a3d32c27a6be061b865ba539127278f14}{CMD18}}, sector, 0X01); \textcolor{comment}{//连续读命令}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00365}00365 \textcolor{keywordflow}{do} \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00366}00366 r1 = \mbox{\hyperlink{classbsp___s_d_a242ec4ccd88203b6691cf4ae1e77fdfe}{SD\_ReceiveData}}(buf, 512); \textcolor{comment}{//接收512个字节 }}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00367}00367 buf += 512;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00368}00368 \textcolor{keywordflow}{while}(-\/-\/cnt \&\& r1 == 0);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00369}00369 \mbox{\hyperlink{classbsp___s_d_ab799d7d8ebaf4c304bf62722ba10ba37}{SD\_sendcmd}}(\mbox{\hyperlink{bsp___s_d_8h_a8d6283c9b060afbaa0e6d1ff7e5ea7b8}{CMD12}}, 0, 0X01);\} \textcolor{comment}{//发送停止命令}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00370}00370 \mbox{\hyperlink{classbsp___s_d_a3250f411819ed57543b0326d13faddc6}{SD\_CS}}(0); \textcolor{comment}{//取消片选}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00371}00371 \textcolor{keywordflow}{return} r1;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00372}00372 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00373}\mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{00373}} \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a36d1110bcbe2404ddd5796dc078ce1f5}{bsp\_SD::spi\_readwrite}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} Txdata)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00374}00374 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} Rxdata;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00375}00375 HAL\_SPI\_TransmitReceive(\mbox{\hyperlink{classbsp___s_d_a227c7eb7a28e89d6adfda085a4217992}{hspi}}, \&Txdata, \&Rxdata, 1, 0xFF);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00376}00376 \textcolor{keywordflow}{return} Rxdata;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00377}00377 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00383}\mbox{\hyperlink{classbsp___s_d_a5ed95b95b141ee21d83ca70c1b06a31a}{00383}} \textcolor{comment}{}\textcolor{keywordtype}{void} \mbox{\hyperlink{classbsp___s_d_a5ed95b95b141ee21d83ca70c1b06a31a}{bsp\_SD::SPI\_setspeed}}(\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} speed)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00384}00384 \mbox{\hyperlink{classbsp___s_d_a227c7eb7a28e89d6adfda085a4217992}{hspi}}-\/>Init.BaudRatePrescaler = speed;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00385}00385 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00393}\mbox{\hyperlink{classbsp___s_d_a164f0bb03133464f2da485f362a52718}{00393}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a164f0bb03133464f2da485f362a52718}{bsp\_SD::offsetWrite}}(\mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} offset,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}* dat,\mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} datlen) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00394}00394 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} sectorBuff[512] = \{ 0 \};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00395}00395 \mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} sectorBuffptr = 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00396}00396 }
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00397}00397 \mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} sectorSour = offset / 512; \textcolor{comment}{// 起始扇}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00398}00398 \mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} sectorSourlen = offset \% 512; \textcolor{comment}{// 起始扇内位}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00399}00399 }
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00400}00400 \textcolor{comment}{// 填入数据}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00401}00401 \mbox{\hyperlink{classbsp___s_d_a96f32b50ec777acc0dd819150cd28937}{SD\_ReadDisk}}(sectorBuff,sectorSour,1);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00402}00402 sectorBuffptr = sectorSourlen;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00403}00403 \textcolor{keywordflow}{for} (\mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} i = 0; i < datlen; i++) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00404}00404 \textcolor{comment}{// 写入数据}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00405}00405 sectorBuff[sectorBuffptr] = dat[i];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00406}00406 sectorBuffptr++;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00407}00407 \textcolor{comment}{// 扇区回写}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00408}00408 \textcolor{keywordflow}{if} (sectorBuffptr == 512 || i == datlen -\/ 1) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00409}00409 \mbox{\hyperlink{classbsp___s_d_af203b65e00206d38ef14640f7b7242b6}{SD\_WriteDisk}}(sectorBuff,sectorSour,1);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00410}00410 sectorBuffptr = 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00411}00411 sectorSour++;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00412}00412 \textcolor{keywordflow}{if} (i != datlen -\/ 1)\mbox{\hyperlink{classbsp___s_d_a96f32b50ec777acc0dd819150cd28937}{SD\_ReadDisk}}(sectorBuff,sectorSour,1);\}\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00413}00413 \textcolor{keywordflow}{return} 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00414}00414 \}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00415}00415 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00423}\mbox{\hyperlink{classbsp___s_d_a1c78e6f5a72f3bdec600a52331dd4d20}{00423}} \textcolor{comment}{}\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} \mbox{\hyperlink{classbsp___s_d_a1c78e6f5a72f3bdec600a52331dd4d20}{bsp\_SD::offsetRead}}(\mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} offset,\mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}}* dat,\mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} datlen) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00424}00424 \mbox{\hyperlink{varint_8h_a92c50087ca0e64fa93fc59402c55f8ca}{u8}} sectorBuff[512] = \{ 0 \};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00425}00425 \mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} sectorBuffptr = 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00426}00426 }
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00427}00427 \mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} sectorSour = offset / 512; \textcolor{comment}{// 起始扇}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00428}00428 \mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} sectorSourlen = offset \% 512; \textcolor{comment}{// 起始扇内位}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00429}00429 }
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00430}00430 \textcolor{comment}{// 填入数据}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00431}00431 \mbox{\hyperlink{classbsp___s_d_a96f32b50ec777acc0dd819150cd28937}{SD\_ReadDisk}}(sectorBuff,sectorSour,1);}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00432}00432 sectorBuffptr = sectorSourlen;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00433}00433 \textcolor{keywordflow}{for} (\mbox{\hyperlink{varint_8h_a3f7e2bcbb0b4c338f3c4f6c937cd4234}{u64}} i = 0; i < datlen; i++) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00434}00434 \textcolor{comment}{// 写入数据}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00435}00435 dat[i]=sectorBuff[sectorBuffptr];}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00436}00436 sectorBuffptr++;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00437}00437 \textcolor{comment}{// 扇区回写}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00438}00438 \textcolor{keywordflow}{if} (sectorBuffptr == 512 || i == datlen -\/ 1) \{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00439}00439 sectorBuffptr = 0;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00440}00440 sectorSour++;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00441}00441 \textcolor{keywordflow}{if} (i != datlen -\/ 1)\mbox{\hyperlink{classbsp___s_d_a96f32b50ec777acc0dd819150cd28937}{SD\_ReadDisk}}(sectorBuff,sectorSour,1);\}\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00442}00442 \textcolor{keywordflow}{return} 0;\}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00444}00444 \textcolor{comment}{//-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/-\/}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00445}00445 \textcolor{comment}{// 构造函数}}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00446}00446 \textcolor{comment}{// }}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00447}\mbox{\hyperlink{classbsp___s_d_a9f5ace0a335acc31271c9d131cd6d306}{00447}} \mbox{\hyperlink{classbsp___s_d_a9f5ace0a335acc31271c9d131cd6d306}{bsp\_SD::bsp\_SD}}(}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00448}00448 SPI\_HandleTypeDef *hspi,}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00449}00449 GPIO\_TypeDef *GPIOx\_CS,}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00450}00450 uint16\_t GPIO\_Pin\_CS)\{}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00451}00451 \mbox{\hyperlink{classbsp___s_d_a227c7eb7a28e89d6adfda085a4217992}{bsp\_SD::hspi}}=\mbox{\hyperlink{classbsp___s_d_a227c7eb7a28e89d6adfda085a4217992}{hspi}};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00452}00452 \mbox{\hyperlink{classbsp___s_d_ad7788d2e62152a2fb1a6b307fa902180}{bsp\_SD::GPIOx\_CS}}=\mbox{\hyperlink{classbsp___s_d_ad7788d2e62152a2fb1a6b307fa902180}{GPIOx\_CS}};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00453}00453 \mbox{\hyperlink{classbsp___s_d_a4525b5c0f62e39af1c9adb9a9c22239f}{bsp\_SD::GPIO\_Pin\_CS}}=\mbox{\hyperlink{classbsp___s_d_a4525b5c0f62e39af1c9adb9a9c22239f}{GPIO\_Pin\_CS}};}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00454}00454 \mbox{\hyperlink{classbsp___s_d_a6c68fa82294f18968a92719931cff5fa}{bsp\_SD::DFF}}=0xFF;}
\DoxyCodeLine{\Hypertarget{bsp___s_d_8cpp_source_l00455}00455 \mbox{\hyperlink{classbsp___s_d_a2350601b90ad75bd434094a9c31475c4}{bsp\_SD::SD\_TYPE}}=0x00;\}}
\end{DoxyCode}