\hypertarget{mmc__da_8c_source}{}\doxysection{mmc\+\_\+da.\+c}
\label{mmc__da_8c_source}\index{cam/mmc/mmc\_da.c@{cam/mmc/mmc\_da.c}}
\mbox{\hyperlink{mmc__da_8c}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00001}00001 \textcolor{comment}{/*-\/}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00002}00002 \textcolor{comment}{ * SPDX-\/License-\/Identifier: BSD-\/2-\/Clause-\/FreeBSD}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00003}00003 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00004}00004 \textcolor{comment}{ * Copyright (c) 2006 Bernd Walter <tisco@FreeBSD.org> All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00005}00005 \textcolor{comment}{ * Copyright (c) 2009 Alexander Motin <mav@FreeBSD.org> All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00006}00006 \textcolor{comment}{ * Copyright (c) 2015-\/2017 Ilya Bakulin <kibab@FreeBSD.org> All rights reserved.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00007}00007 \textcolor{comment}{ * Copyright (c) 2006 M. Warner Losh <imp@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00008}00008 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00009}00009 \textcolor{comment}{ * Redistribution and use in source and binary forms, with or without}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00010}00010 \textcolor{comment}{ * modification, are permitted provided that the following conditions}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00011}00011 \textcolor{comment}{ * are met:}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00012}00012 \textcolor{comment}{ * 1. Redistributions of source code must retain the above copyright}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00013}00013 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer,}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00014}00014 \textcolor{comment}{ *    without modification, immediately at the beginning of the file.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00015}00015 \textcolor{comment}{ * 2. Redistributions in binary form must reproduce the above copyright}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00016}00016 \textcolor{comment}{ *    notice, this list of conditions and the following disclaimer in the}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00017}00017 \textcolor{comment}{ *    documentation and/or other materials provided with the distribution.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00018}00018 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00019}00019 \textcolor{comment}{ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00020}00020 \textcolor{comment}{ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00021}00021 \textcolor{comment}{ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00022}00022 \textcolor{comment}{ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00023}00023 \textcolor{comment}{ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00024}00024 \textcolor{comment}{ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00025}00025 \textcolor{comment}{ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00026}00026 \textcolor{comment}{ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00027}00027 \textcolor{comment}{ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00028}00028 \textcolor{comment}{ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00029}00029 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00030}00030 \textcolor{comment}{ * Some code derived from the sys/dev/mmc and sys/cam/ata}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00031}00031 \textcolor{comment}{ * Thanks to Warner Losh <imp@FreeBSD.org>, Alexander Motin <mav@FreeBSD.org>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00032}00032 \textcolor{comment}{ * Bernd Walter <tisco@FreeBSD.org>, and other authors.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00033}00033 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00034}00034 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00035}00035 \textcolor{preprocessor}{\#include <sys/cdefs.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00036}\mbox{\hyperlink{mmc__da_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{00036}} \mbox{\hyperlink{mmc__da_8c_a8c3ef283470a68cd30afe9b8a72cb60f}{\_\_FBSDID}}(\textcolor{stringliteral}{"{}\$FreeBSD\$"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00037}00037 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00038}00038 \textcolor{comment}{//\#include "{}opt\_sdda.h"{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00039}00039 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00040}00040 \textcolor{preprocessor}{\#include <sys/param.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00041}00041 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00042}00042 \textcolor{preprocessor}{\#ifdef \_KERNEL}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00043}00043 \textcolor{preprocessor}{\#include <sys/systm.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00044}00044 \textcolor{preprocessor}{\#include <sys/kernel.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00045}00045 \textcolor{preprocessor}{\#include <sys/bio.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00046}00046 \textcolor{preprocessor}{\#include <sys/sysctl.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00047}00047 \textcolor{preprocessor}{\#include <sys/endian.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00048}00048 \textcolor{preprocessor}{\#include <sys/taskqueue.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00049}00049 \textcolor{preprocessor}{\#include <sys/lock.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00050}00050 \textcolor{preprocessor}{\#include <sys/mutex.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00051}00051 \textcolor{preprocessor}{\#include <sys/conf.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00052}00052 \textcolor{preprocessor}{\#include <sys/devicestat.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00053}00053 \textcolor{preprocessor}{\#include <sys/eventhandler.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00054}00054 \textcolor{preprocessor}{\#include <sys/malloc.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00055}00055 \textcolor{preprocessor}{\#include <sys/cons.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00056}00056 \textcolor{preprocessor}{\#include <sys/proc.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00057}00057 \textcolor{preprocessor}{\#include <sys/reboot.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00058}00058 \textcolor{preprocessor}{\#include <geom/geom\_disk.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00059}00059 \textcolor{preprocessor}{\#include <machine/\_inttypes.h>}  \textcolor{comment}{/* for PRIu64 */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00060}00060 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* \_KERNEL */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00061}00061 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00062}00062 \textcolor{preprocessor}{\#ifndef \_KERNEL}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00063}00063 \textcolor{preprocessor}{\#include <stdio.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00064}00064 \textcolor{preprocessor}{\#include <string.h>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00065}00065 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* \_KERNEL */}\textcolor{preprocessor}{}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00066}00066 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00067}00067 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam_8h}{cam/cam.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00068}00068 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__ccb_8h}{cam/cam\_ccb.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00069}00069 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__queue_8h}{cam/cam\_queue.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00070}00070 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__periph_8h}{cam/cam\_periph.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00071}00071 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__sim_8h}{cam/cam\_sim.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00072}00072 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__xpt_8h}{cam/cam\_xpt.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00073}00073 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__xpt__sim_8h}{cam/cam\_xpt\_sim.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00074}00074 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__xpt__periph_8h}{cam/cam\_xpt\_periph.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00075}00075 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__xpt__internal_8h}{cam/cam\_xpt\_internal.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00076}00076 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{cam__debug_8h}{cam/cam\_debug.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00077}00077 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00078}00078 \textcolor{preprocessor}{\#include <\mbox{\hyperlink{mmc__all_8h}{cam/mmc/mmc\_all.h}}>}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00079}00079 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00080}00080 \textcolor{preprocessor}{\#ifdef \_KERNEL}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00082}\mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366}{00082}} \textcolor{keyword}{typedef} \textcolor{keyword}{enum} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00083}\mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366aeea473b1bd444e47149765f0d5f99adf}{00083}}         \mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366aeea473b1bd444e47149765f0d5f99adf}{SDDA\_FLAG\_OPEN}}            = 0x0002,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00084}00084         \mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366a7dc731f2dede334017f50803f7811f7d}{SDDA\_FLAG\_DIRTY}}          = 0x0004}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00085}\mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366a7dc731f2dede334017f50803f7811f7d}{00085}} \} \mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366}{sdda\_flags}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00086}00086 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00087}\mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3}{00087}} \textcolor{keyword}{typedef} \textcolor{keyword}{enum} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00088}\mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3afe754e010ae14fe5f4d6dcf7f19d5f7f}{00088}}         \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3afe754e010ae14fe5f4d6dcf7f19d5f7f}{SDDA\_STATE\_INIT}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00089}\mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3aafa457ab8184a2908690752e4ac67674}{00089}}         \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3aafa457ab8184a2908690752e4ac67674}{SDDA\_STATE\_INVALID}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00090}\mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a65267511ec89d2d6d8f0a712bdacde73}{00090}}         \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a65267511ec89d2d6d8f0a712bdacde73}{SDDA\_STATE\_NORMAL}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00091}\mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a643865b7906e6e4df23ca7f687d62776}{00091}}         \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a643865b7906e6e4df23ca7f687d62776}{SDDA\_STATE\_PART\_SWITCH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00092}00092 \} \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3}{sdda\_state}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00093}00093 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00094}\mbox{\hyperlink{mmc__da_8c_aa269737b9a401b8f1647612e0fd0824d}{00094}} \textcolor{preprocessor}{\#define SDDA\_FMT\_BOOT           "{}sdda\%dboot"{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00095}\mbox{\hyperlink{mmc__da_8c_a44db5cbd665d3c32f476ce160c3afb8a}{00095}} \textcolor{preprocessor}{\#define SDDA\_FMT\_GP             "{}sdda\%dgp"{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00096}\mbox{\hyperlink{mmc__da_8c_a55f26af384a86289d0dace66c95cb80f}{00096}} \textcolor{preprocessor}{\#define SDDA\_FMT\_RPMB           "{}sdda\%drpmb"{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00097}\mbox{\hyperlink{mmc__da_8c_ae65c004aa79c5411d622377a47bbf964}{00097}} \textcolor{preprocessor}{\#define SDDA\_LABEL\_ENH          "{}enh"{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00098}00098 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00099}\mbox{\hyperlink{mmc__da_8c_ae04967bf0ccf960537014f93601f45e7}{00099}} \textcolor{preprocessor}{\#define SDDA\_PART\_NAMELEN       (16 + 1)}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00100}00100 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00101}00101 \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00102}00102 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00103}\mbox{\hyperlink{structsdda__part}{00103}} \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00104}\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{00104}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}} *\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00105}\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{00105}}         \textcolor{keyword}{struct }bio\_queue\_head \mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00106}\mbox{\hyperlink{structsdda__part_ac921cbc4e4ce091842c37b1ec267180e}{00106}}         \mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366}{sdda\_flags}} \mbox{\hyperlink{structsdda__part_ac921cbc4e4ce091842c37b1ec267180e}{flags}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00107}\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{00107}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00108}\mbox{\hyperlink{structsdda__part_ae319d756b3bf72ce9d239c4d2e887a68}{00108}}         u\_int \mbox{\hyperlink{structsdda__part_ae319d756b3bf72ce9d239c4d2e887a68}{cnt}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00109}\mbox{\hyperlink{structsdda__part_aab504c5f3a9bc3c4d8f7037e46a1f4e2}{00109}}         u\_int \mbox{\hyperlink{structsdda__part_aab504c5f3a9bc3c4d8f7037e46a1f4e2}{type}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00110}\mbox{\hyperlink{structsdda__part_a7a567cfda5b6505b65283807b71bfb08}{00110}}         \textcolor{keywordtype}{bool} \mbox{\hyperlink{structsdda__part_a7a567cfda5b6505b65283807b71bfb08}{ro}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00111}\mbox{\hyperlink{structsdda__part_aaece6e5bc2f0057802633b0e7e7b342f}{00111}}         \textcolor{keywordtype}{char} \mbox{\hyperlink{structsdda__part_aaece6e5bc2f0057802633b0e7e7b342f}{name}}[\mbox{\hyperlink{mmc__da_8c_ae04967bf0ccf960537014f93601f45e7}{SDDA\_PART\_NAMELEN}}];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00112}00112 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00113}00113 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00114}\mbox{\hyperlink{structsdda__softc}{00114}} \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00115}\mbox{\hyperlink{structsdda__softc_a429f510a9324edb5996b58f1ae25bfb7}{00115}}         \textcolor{keywordtype}{int}      \mbox{\hyperlink{structsdda__softc_a429f510a9324edb5996b58f1ae25bfb7}{outstanding\_cmds}};      \textcolor{comment}{/* Number of active commands */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00116}\mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{00116}}         \textcolor{keywordtype}{int}      \mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{refcount}};              \textcolor{comment}{/* Active xpt\_action() calls */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00117}\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{00117}}         \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3}{sdda\_state}} \mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00118}\mbox{\hyperlink{structsdda__softc_aed77974991ef815afe3b249db5a25561}{00118}}         \textcolor{keyword}{struct }mmc\_data *\mbox{\hyperlink{structsdda__softc_aed77974991ef815afe3b249db5a25561}{mmcdata}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00119}\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{00119}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00120}00120 \textcolor{comment}{//      sdda\_quirks quirks;}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00121}\mbox{\hyperlink{structsdda__softc_a807f5b3d75010bba973cd337cf61a764}{00121}}         \textcolor{keyword}{struct }task \mbox{\hyperlink{structsdda__softc_a807f5b3d75010bba973cd337cf61a764}{start\_init\_task}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00122}\mbox{\hyperlink{structsdda__softc_ac5bf34a161068a7bafec8fd15468904a}{00122}}         uint32\_t \mbox{\hyperlink{structsdda__softc_ac5bf34a161068a7bafec8fd15468904a}{raw\_csd}}[4];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00123}\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{00123}}         uint8\_t \mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[512]; \textcolor{comment}{/* MMC only? */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00124}\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{00124}}         \textcolor{keyword}{struct }mmc\_csd \mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00125}\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{00125}}         \textcolor{keyword}{struct }mmc\_cid \mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00126}\mbox{\hyperlink{structsdda__softc_ac42292207c96df0922b33765bf1e78bf}{00126}}         \textcolor{keyword}{struct }mmc\_scr \mbox{\hyperlink{structsdda__softc_ac42292207c96df0922b33765bf1e78bf}{scr}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00127}00127         \textcolor{comment}{/* Calculated from CSD */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00128}\mbox{\hyperlink{structsdda__softc_a33c93c45b410fc3c6b7768c98102dd8a}{00128}}         uint64\_t \mbox{\hyperlink{structsdda__softc_a33c93c45b410fc3c6b7768c98102dd8a}{sector\_count}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00129}\mbox{\hyperlink{structsdda__softc_a76e3a40aa21032b790c4ea11613062c1}{00129}}         uint64\_t \mbox{\hyperlink{structsdda__softc_a76e3a40aa21032b790c4ea11613062c1}{mediasize}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00130}00130 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00131}00131         \textcolor{comment}{/* Calculated from CID */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00132}\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{00132}}         \textcolor{keywordtype}{char} \mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}}[64];\textcolor{comment}{/* Formatted CID info (serial, MFG, etc) */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00133}\mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{00133}}         \textcolor{keywordtype}{char} \mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{card\_sn\_string}}[16];\textcolor{comment}{/* Formatted serial \# for disk-\/>d\_ident */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00134}00134         \textcolor{comment}{/* Determined from CSD + is highspeed card*/}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00135}\mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{00135}}         uint32\_t \mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{card\_f\_max}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00136}00136 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00137}00137         \textcolor{comment}{/* Generic switch timeout */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00138}\mbox{\hyperlink{structsdda__softc_aa4ff982ccca7ceef6e22bfaa821dff2b}{00138}}         uint32\_t \mbox{\hyperlink{structsdda__softc_aa4ff982ccca7ceef6e22bfaa821dff2b}{cmd6\_time}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00139}\mbox{\hyperlink{structsdda__softc_af72469f1bb8db55cd418c09fa0c460d6}{00139}}         uint32\_t \mbox{\hyperlink{structsdda__softc_af72469f1bb8db55cd418c09fa0c460d6}{timings}};        \textcolor{comment}{/* Mask of bus timings supported */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00140}\mbox{\hyperlink{structsdda__softc_a443c0fc9689ddc77386096fd4da2b4ab}{00140}}         uint32\_t \mbox{\hyperlink{structsdda__softc_a443c0fc9689ddc77386096fd4da2b4ab}{vccq\_120}};      \textcolor{comment}{/* Mask of bus timings at VCCQ of 1.2 V */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00141}\mbox{\hyperlink{structsdda__softc_a2a258f28c193e33deab783361af57d5b}{00141}}         uint32\_t \mbox{\hyperlink{structsdda__softc_a2a258f28c193e33deab783361af57d5b}{vccq\_180}};      \textcolor{comment}{/* Mask of bus timings at VCCQ of 1.8 V */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00142}00142         \textcolor{comment}{/* MMC partitions support */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00143}\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{00143}}         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[MMC\_PART\_MAX];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00144}\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{00144}}         uint8\_t \mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}};     \textcolor{comment}{/* Partition currently switched to */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00145}\mbox{\hyperlink{structsdda__softc_af6bbe2e4b0e8583a3a64167004bd7031}{00145}}         uint8\_t \mbox{\hyperlink{structsdda__softc_af6bbe2e4b0e8583a3a64167004bd7031}{part\_requested}}; \textcolor{comment}{/* What partition we're currently switching to */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00146}\mbox{\hyperlink{structsdda__softc_aa60874e87a5277db0918b1eeb6cd4844}{00146}}         uint32\_t \mbox{\hyperlink{structsdda__softc_aa60874e87a5277db0918b1eeb6cd4844}{part\_time}};    \textcolor{comment}{/* Partition switch timeout [us] */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00147}\mbox{\hyperlink{structsdda__softc_ac427673f1398183d25b0f03c6a81d918}{00147}}         off\_t \mbox{\hyperlink{structsdda__softc_ac427673f1398183d25b0f03c6a81d918}{enh\_base}};         \textcolor{comment}{/* Enhanced user data area slice base ... */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00148}\mbox{\hyperlink{structsdda__softc_a591a23e40a23eabd5618949711ee4d3b}{00148}}         off\_t \mbox{\hyperlink{structsdda__softc_a591a23e40a23eabd5618949711ee4d3b}{enh\_size}};         \textcolor{comment}{/* ... and size [bytes] */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00149}\mbox{\hyperlink{structsdda__softc_a4de3ebca86c13fb8c633b8d3be2015d7}{00149}}         \textcolor{keywordtype}{int} \mbox{\hyperlink{structsdda__softc_a4de3ebca86c13fb8c633b8d3be2015d7}{log\_count}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00150}\mbox{\hyperlink{structsdda__softc_ac6db29cf5a579e276721d6810290837a}{00150}}         \textcolor{keyword}{struct }timeval \mbox{\hyperlink{structsdda__softc_ac6db29cf5a579e276721d6810290837a}{log\_time}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00151}00151 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00152}00152 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00153}\mbox{\hyperlink{mmc__da_8c_a2cf6ea95b6de930473bfda0d43506943}{00153}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{char} *\mbox{\hyperlink{mmc__da_8c_a2cf6ea95b6de930473bfda0d43506943}{mmc\_errmsg}}[] =}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00154}00154 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00155}00155         \textcolor{stringliteral}{"{}None"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00156}00156         \textcolor{stringliteral}{"{}Timeout"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00157}00157         \textcolor{stringliteral}{"{}Bad CRC"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00158}00158         \textcolor{stringliteral}{"{}Fifo"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00159}00159         \textcolor{stringliteral}{"{}Failed"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00160}00160         \textcolor{stringliteral}{"{}Invalid"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00161}00161         \textcolor{stringliteral}{"{}NO MEMORY"{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00162}00162 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00163}00163 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00164}\mbox{\hyperlink{mmc__da_8c_aa8cbccb0f9744ba58c6df5ddc2e8b35a}{00164}} \textcolor{preprocessor}{\#define ccb\_bp          ppriv\_ptr1}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00165}00165 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00166}\mbox{\hyperlink{mmc__da_8c_a7ef57618aff8b2a42229ba2e342e7d24}{00166}} \textcolor{keyword}{static}  disk\_strategy\_t \mbox{\hyperlink{mmc__da_8c_a7ef57618aff8b2a42229ba2e342e7d24}{sddastrategy}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00167}\mbox{\hyperlink{mmc__da_8c_a17f0fde6552e61d09ae1b57da22cac83}{00167}} \textcolor{keyword}{static}  dumper\_t        \mbox{\hyperlink{mmc__da_8c_a17f0fde6552e61d09ae1b57da22cac83}{sddadump}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00168}\mbox{\hyperlink{mmc__da_8c_ac1fbeda4ad8b3b6279f2aa2a2240f762}{00168}} \textcolor{keyword}{static}  \mbox{\hyperlink{cam__periph_8h_ae8635482322b2513ab2f662535250ac0}{periph\_init\_t}}      \mbox{\hyperlink{mmc__da_8c_ac1fbeda4ad8b3b6279f2aa2a2240f762}{sddainit}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00169}00169 \textcolor{keyword}{static}  \textcolor{keywordtype}{void}            \mbox{\hyperlink{mmc__da_8c_aa8afafa82880a055578509ca212bc2e9}{sddaasync}}(\textcolor{keywordtype}{void} *callback\_arg, u\_int32\_t code,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00170}00170                                 \textcolor{keyword}{struct} \mbox{\hyperlink{structcam__path}{cam\_path}} *path, \textcolor{keywordtype}{void} *arg);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00171}\mbox{\hyperlink{mmc__da_8c_a03aa32183fe57fc3962d753c65fe02bc}{00171}} \textcolor{keyword}{static}  \mbox{\hyperlink{cam__periph_8h_a0134746116b0c19d248d1342a16aab04}{periph\_ctor\_t}}      \mbox{\hyperlink{mmc__da_8c_a03aa32183fe57fc3962d753c65fe02bc}{sddaregister}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00172}\mbox{\hyperlink{mmc__da_8c_aee996c8ae5d270cd8531dfde2661815b}{00172}} \textcolor{keyword}{static}  \mbox{\hyperlink{cam__periph_8h_a8d863e438ef46ba796fbf3e77340b3e3}{periph\_dtor\_t}}      \mbox{\hyperlink{mmc__da_8c_aee996c8ae5d270cd8531dfde2661815b}{sddacleanup}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00173}\mbox{\hyperlink{mmc__da_8c_abc7bb4d36fce8f60b034ea6291f82ef3}{00173}} \textcolor{keyword}{static}  \mbox{\hyperlink{cam__periph_8h_ab04cb4cf3fd8f8a44ce312952af7cb7f}{periph\_start\_t}}    \mbox{\hyperlink{mmc__da_8c_abc7bb4d36fce8f60b034ea6291f82ef3}{sddastart}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00174}\mbox{\hyperlink{mmc__da_8c_a29b87fc744eb3db89b2a0cd5959ee0ef}{00174}} \textcolor{keyword}{static}  \mbox{\hyperlink{cam__periph_8h_a14602bb3ac9272ea2209d63f1e618fca}{periph\_oninv\_t}}    \mbox{\hyperlink{mmc__da_8c_a29b87fc744eb3db89b2a0cd5959ee0ef}{sddaoninvalidate}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00175}00175 \textcolor{keyword}{static}  \textcolor{keywordtype}{void}            \mbox{\hyperlink{mmc__da_8c_ac7f7185f8c44f482261d8f94cba8993f}{sddadone}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00176}00176                                \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *done\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00177}00177 \textcolor{keyword}{static}  \textcolor{keywordtype}{int}             \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}(\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}}, u\_int32\_t \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316}{cam\_flags}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00178}00178                                 u\_int32\_t sense\_flags);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00179}00179 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00180}00180 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00181}00181 \textcolor{keyword}{static} uint16\_t \mbox{\hyperlink{mmc__da_8c_af2e6bbe164550dee70250880c23b06d3}{get\_rca}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00182}00182 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mmc__da_8c_a3f18f2f7a714d1598a4685c21ed6d01c}{sdda\_start\_init}}(\textcolor{keywordtype}{void} *context, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00183}00183 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mmc__da_8c_a8932a2cc5a68eff1b7da2ce0d1301588}{sdda\_start\_init\_task}}(\textcolor{keywordtype}{void} *context, \textcolor{keywordtype}{int} pending);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00184}00184 \textcolor{keyword}{static} \textcolor{keywordtype}{void} \mbox{\hyperlink{mmc__da_8c_a4de14e34fa35caf3c2b67a4d2dc6562a}{sdda\_process\_mmc\_partitions}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00185}00185 \textcolor{keyword}{static} uint32\_t \mbox{\hyperlink{mmc__da_8c_a8bfa149ef851763cee2f41e0d63854f3}{sdda\_get\_host\_caps}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00186}00186 \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mmc__da_8c_a62ace3a21edbd3521ad75a4009c5b422}{mmc\_select\_card}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}}, uint32\_t rca);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00187}\mbox{\hyperlink{mmc__da_8c_a1680d0fdb2e480b983f44bd31e6f1949}{00187}} \textcolor{keyword}{static} \textcolor{keyword}{inline} uint32\_t \mbox{\hyperlink{mmc__da_8c_a1680d0fdb2e480b983f44bd31e6f1949}{mmc\_get\_sector\_size}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph) \{\textcolor{keywordflow}{return} MMC\_SECTOR\_SIZE;\}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00188}00188 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00189}\mbox{\hyperlink{mmc__da_8c_a3fe471a5b23aabc253cc808ebfd44412}{00189}} \textcolor{keyword}{static} \mbox{\hyperlink{mmc__da_8c_a3fe471a5b23aabc253cc808ebfd44412}{SYSCTL\_NODE}}(\_kern\_cam, OID\_AUTO, sdda, CTLFLAG\_RD | CTLFLAG\_MPSAFE, 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00190}00190     \textcolor{stringliteral}{"{}CAM Direct Access Disk driver"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00191}00191 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00192}\mbox{\hyperlink{mmc__da_8c_a00f29e2433cced208cbe3eb6c6068304}{00192}} \textcolor{keyword}{static} \textcolor{keywordtype}{int} \mbox{\hyperlink{mmc__da_8c_a00f29e2433cced208cbe3eb6c6068304}{sdda\_mmcsd\_compat}} = 1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00193}\mbox{\hyperlink{mmc__da_8c_aab9d0e40ebfaf163c39937c06fc4f32a}{00193}} \mbox{\hyperlink{mmc__da_8c_aab9d0e40ebfaf163c39937c06fc4f32a}{SYSCTL\_INT}}(\_kern\_cam\_sdda, OID\_AUTO, mmcsd\_compat, CTLFLAG\_RDTUN,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00194}00194     \&\mbox{\hyperlink{mmc__da_8c_a00f29e2433cced208cbe3eb6c6068304}{sdda\_mmcsd\_compat}}, 1, \textcolor{stringliteral}{"{}Enable creation of mmcsd aliases."{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00195}00195 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00196}00196 \textcolor{comment}{/* TODO: actually issue GET\_TRAN\_SETTINGS to get R/O status */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00197}\mbox{\hyperlink{mmc__da_8c_a1dc4d0cab4b0bac94689eecbd21e813c}{00197}} \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{bool} \mbox{\hyperlink{mmc__da_8c_a1dc4d0cab4b0bac94689eecbd21e813c}{sdda\_get\_read\_only}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *start\_ccb)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00198}00198 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00199}00199 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00200}00200         \textcolor{keywordflow}{return} (\textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00201}00201 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00202}00202 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00203}00203 \textcolor{keyword}{static} uint32\_t \mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00204}00204 \textcolor{keyword}{static} uint64\_t \mbox{\hyperlink{mmc__da_8c_a1bfcf14f4533a7a7485f6dc9caefa8e2}{mmc\_get\_media\_size}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00205}00205 \textcolor{keyword}{static} uint32\_t \mbox{\hyperlink{mmc__da_8c_af98a4c78a4018d532ecfb17dd66321d6}{mmc\_get\_cmd6\_timeout}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00206}00206 \textcolor{keyword}{static} \textcolor{keywordtype}{bool} \mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, u\_int type,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00207}00207     \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name, u\_int cnt, off\_t media\_size, \textcolor{keywordtype}{bool} ro);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00208}00208 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00209}\mbox{\hyperlink{mmc__da_8c_af23cddfbb888967675f964ad7be4d1da}{00209}} \textcolor{keyword}{static} \textcolor{keyword}{struct }\mbox{\hyperlink{structperiph__driver}{periph\_driver}} \mbox{\hyperlink{mmc__da_8c_af23cddfbb888967675f964ad7be4d1da}{sddadriver}} =}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00210}00210 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00211}00211         \mbox{\hyperlink{mmc__da_8c_ac1fbeda4ad8b3b6279f2aa2a2240f762}{sddainit}}, \textcolor{stringliteral}{"{}sdda"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00212}00212         TAILQ\_HEAD\_INITIALIZER(\mbox{\hyperlink{mmc__da_8c_af23cddfbb888967675f964ad7be4d1da}{sddadriver}}.units), \textcolor{comment}{/* generation */} 0}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00213}00213 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00214}00214 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00215}\mbox{\hyperlink{mmc__da_8c_ad9d84a4678aa9840c2940061f2604d7f}{00215}} \mbox{\hyperlink{mmc__da_8c_ad9d84a4678aa9840c2940061f2604d7f}{PERIPHDRIVER\_DECLARE}}(sdda, \mbox{\hyperlink{mmc__da_8c_af23cddfbb888967675f964ad7be4d1da}{sddadriver}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00216}00216 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00217}\mbox{\hyperlink{mmc__da_8c_a556b66ec2bb8f0763792b084acf16100}{00217}} \textcolor{keyword}{static} \mbox{\hyperlink{mmc__da_8c_a556b66ec2bb8f0763792b084acf16100}{MALLOC\_DEFINE}}(M\_SDDA, \textcolor{stringliteral}{"{}sd\_da"{}}, \textcolor{stringliteral}{"{}sd\_da buffers"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00218}00218 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00219}\mbox{\hyperlink{mmc__da_8c_a8498db25f8f725bf55dfe03879218464}{00219}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{int} \mbox{\hyperlink{mmc__da_8c_a8498db25f8f725bf55dfe03879218464}{exp}}[8] = \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00220}00220         1, 10, 100, 1000, 10000, 100000, 1000000, 10000000}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00221}00221 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00222}00222 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00223}\mbox{\hyperlink{mmc__da_8c_a63f5380221e351db0292755f489e8dc7}{00223}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{int} \mbox{\hyperlink{mmc__da_8c_a63f5380221e351db0292755f489e8dc7}{mant}}[16] = \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00224}00224         0, 10, 12, 13, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 70, 80}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00225}00225 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00226}00226 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00227}\mbox{\hyperlink{mmc__da_8c_ab9934a76e4b23155132432653a8fef19}{00227}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{int} \mbox{\hyperlink{mmc__da_8c_ab9934a76e4b23155132432653a8fef19}{cur\_min}}[8] = \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00228}00228         500, 1000, 5000, 10000, 25000, 35000, 60000, 100000}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00229}00229 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00230}00230 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00231}\mbox{\hyperlink{mmc__da_8c_aa3354946e23df65c5d7d90e04f4b291e}{00231}} \textcolor{keyword}{static} \textcolor{keyword}{const} \textcolor{keywordtype}{int} \mbox{\hyperlink{mmc__da_8c_aa3354946e23df65c5d7d90e04f4b291e}{cur\_max}}[8] = \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00232}00232         1000, 5000, 10000, 25000, 35000, 45000, 800000, 200000}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00233}00233 \};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00234}00234 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00235}00235 \textcolor{keyword}{static} uint16\_t}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00236}\mbox{\hyperlink{mmc__da_8c_af2e6bbe164550dee70250880c23b06d3}{00236}} \mbox{\hyperlink{mmc__da_8c_af2e6bbe164550dee70250880c23b06d3}{get\_rca}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00237}00237         \textcolor{keywordflow}{return} periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}}.\mbox{\hyperlink{structmmc__params_aa63066700cf88f02aad30e378f386a23}{card\_rca}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00238}00238 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00239}00239 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00240}00240 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00241}00241 \textcolor{comment}{ * Figure out if CCB execution resulted in error.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00242}00242 \textcolor{comment}{ * Look at both CAM-\/level errors and on MMC protocol errors.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00243}00243 \textcolor{comment}{ *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00244}00244 \textcolor{comment}{ * Return value is always MMC error.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00245}00245 \textcolor{comment}{*/}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00246}00246 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00247}\mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{00247}} \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00248}00248 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00249}00249         KASSERT(\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} == \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca7c4cd1252b7b90f1c1aaf01cb6240fd8}{XPT\_MMC\_IO}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00250}00250             (\textcolor{stringliteral}{"{}ccb \%p: cannot handle non-\/XPT\_MMC\_IO errors, got func\_code=\%d"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00251}00251                 \mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00252}00252 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00253}00253         \textcolor{comment}{/* CAM-\/level error should always correspond to MMC-\/level error */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00254}00254         \textcolor{keywordflow}{if} (((\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_abcec535dec8d07473cd2af995bf25d88}{status}} \& \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a82f0d57eda0654067dc2db0c2a218caa}{CAM\_STATUS\_MASK}}) == \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}}) \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00255}00255           (\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.error != MMC\_ERR\_NONE))}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00256}00256                 panic(\textcolor{stringliteral}{"{}CCB status is OK but MMC error != MMC\_ERR\_NONE"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00257}00257 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00258}00258         \textcolor{keywordflow}{if} (\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.error != MMC\_ERR\_NONE) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00259}00259                 \mbox{\hyperlink{cam__xpt_8c_a1de517aa78d2b98ed9ff46a85f31d54e}{xpt\_print\_path}}(\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a47763149d044e13fcc06abfb3ddc941f}{path}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00260}00260                 printf(\textcolor{stringliteral}{"{}CMD\%d failed, err \%d (\%s)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00261}00261                   \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.opcode,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00262}00262                   \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.error,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00263}00263                   \mbox{\hyperlink{mmc__da_8c_a2cf6ea95b6de930473bfda0d43506943}{mmc\_errmsg}}[\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.error]);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00264}00264         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00265}00265         \textcolor{keywordflow}{return} (\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.error);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00266}00266 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00267}00267 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00268}00268 \textcolor{keyword}{static} uint32\_t}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00269}\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{00269}} \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(uint32\_t *bits, \textcolor{keywordtype}{int} bit\_len, \textcolor{keywordtype}{int} start, \textcolor{keywordtype}{int} size)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00270}00270 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00271}00271         \textcolor{keyword}{const} \textcolor{keywordtype}{int} i = (bit\_len / 32) -\/ (start / 32) -\/ 1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00272}00272         \textcolor{keyword}{const} \textcolor{keywordtype}{int} shift = start \& 31;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00273}00273         uint32\_t retval = bits[i] >> shift;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00274}00274         \textcolor{keywordflow}{if} (size + shift > 32)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00275}00275                 retval |= bits[i -\/ 1] << (32 -\/ shift);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00276}00276         \textcolor{keywordflow}{return} (retval \& ((1llu << size) -\/ 1));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00277}00277 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00278}00278 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00279}00279 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00280}\mbox{\hyperlink{mmc__da_8c_a4ad50ed316b31d8776bbc68ccfc68d1a}{00280}} \mbox{\hyperlink{mmc__da_8c_a4ad50ed316b31d8776bbc68ccfc68d1a}{mmc\_decode\_csd\_sd}}(uint32\_t *raw\_csd, \textcolor{keyword}{struct} mmc\_csd *csd)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00281}00281 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00282}00282         \textcolor{keywordtype}{int} v;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00283}00283         \textcolor{keywordtype}{int} m;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00284}00284         \textcolor{keywordtype}{int} e;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00285}00285 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00286}00286         memset(csd, 0, \textcolor{keyword}{sizeof}(*csd));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00287}00287         csd-\/>csd\_structure = v = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 126, 2);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00288}00288 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00289}00289         \textcolor{comment}{/* Common members between 1.0 and 2.0 */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00290}00290         m = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 115, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00291}00291         e = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 112, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00292}00292         csd-\/>tacc = (\mbox{\hyperlink{mmc__da_8c_a8498db25f8f725bf55dfe03879218464}{exp}}[e] * \mbox{\hyperlink{mmc__da_8c_a63f5380221e351db0292755f489e8dc7}{mant}}[m] + 9) / 10;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00293}00293         csd-\/>nsac = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 104, 8) * 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00294}00294         m = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 99, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00295}00295         e = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 96, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00296}00296         csd-\/>tran\_speed = \mbox{\hyperlink{mmc__da_8c_a8498db25f8f725bf55dfe03879218464}{exp}}[e] * 10000 * \mbox{\hyperlink{mmc__da_8c_a63f5380221e351db0292755f489e8dc7}{mant}}[m];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00297}00297         csd-\/>ccc = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 84, 12);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00298}00298         csd-\/>read\_bl\_len = 1 << \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 80, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00299}00299         csd-\/>read\_bl\_partial = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 79, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00300}00300         csd-\/>write\_blk\_misalign = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 78, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00301}00301         csd-\/>read\_blk\_misalign = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 77, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00302}00302         csd-\/>dsr\_imp = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 76, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00303}00303         csd-\/>erase\_blk\_en = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 46, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00304}00304         csd-\/>erase\_sector = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 39, 7) + 1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00305}00305         csd-\/>wp\_grp\_size = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 32, 7);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00306}00306         csd-\/>wp\_grp\_enable = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 31, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00307}00307         csd-\/>r2w\_factor = 1 << \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 26, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00308}00308         csd-\/>write\_bl\_len = 1 << \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 22, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00309}00309         csd-\/>write\_bl\_partial = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 21, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00310}00310 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00311}00311         \textcolor{keywordflow}{if} (v == 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00312}00312                 csd-\/>vdd\_r\_curr\_min = \mbox{\hyperlink{mmc__da_8c_ab9934a76e4b23155132432653a8fef19}{cur\_min}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 59, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00313}00313                 csd-\/>vdd\_r\_curr\_max = \mbox{\hyperlink{mmc__da_8c_aa3354946e23df65c5d7d90e04f4b291e}{cur\_max}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 56, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00314}00314                 csd-\/>vdd\_w\_curr\_min = \mbox{\hyperlink{mmc__da_8c_ab9934a76e4b23155132432653a8fef19}{cur\_min}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 53, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00315}00315                 csd-\/>vdd\_w\_curr\_max = \mbox{\hyperlink{mmc__da_8c_aa3354946e23df65c5d7d90e04f4b291e}{cur\_max}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 50, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00316}00316                 m = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 62, 12);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00317}00317                 e = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 47, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00318}00318                 csd-\/>capacity = ((1 + m) << (e + 2)) * csd-\/>read\_bl\_len;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00319}00319         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (v == 1) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00320}00320                 csd-\/>capacity = ((uint64\_t)\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 48, 22) + 1) *}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00321}00321                     512 * 1024;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00322}00322         \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00323}00323                 panic(\textcolor{stringliteral}{"{}unknown SD CSD version"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00324}00324 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00325}00325 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00326}00326 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00327}\mbox{\hyperlink{mmc__da_8c_af2458dfa9a8f9fe937a6a3af8897c51e}{00327}} \mbox{\hyperlink{mmc__da_8c_af2458dfa9a8f9fe937a6a3af8897c51e}{mmc\_decode\_csd\_mmc}}(uint32\_t *raw\_csd, \textcolor{keyword}{struct} mmc\_csd *csd)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00328}00328 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00329}00329         \textcolor{keywordtype}{int} m;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00330}00330         \textcolor{keywordtype}{int} e;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00331}00331 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00332}00332         memset(csd, 0, \textcolor{keyword}{sizeof}(*csd));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00333}00333         csd-\/>csd\_structure = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 126, 2);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00334}00334         csd-\/>spec\_vers = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 122, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00335}00335         m = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 115, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00336}00336         e = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 112, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00337}00337         csd-\/>tacc = \mbox{\hyperlink{mmc__da_8c_a8498db25f8f725bf55dfe03879218464}{exp}}[e] * \mbox{\hyperlink{mmc__da_8c_a63f5380221e351db0292755f489e8dc7}{mant}}[m] + 9 / 10;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00338}00338         csd-\/>nsac = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 104, 8) * 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00339}00339         m = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 99, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00340}00340         e = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 96, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00341}00341         csd-\/>tran\_speed = \mbox{\hyperlink{mmc__da_8c_a8498db25f8f725bf55dfe03879218464}{exp}}[e] * 10000 * \mbox{\hyperlink{mmc__da_8c_a63f5380221e351db0292755f489e8dc7}{mant}}[m];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00342}00342         csd-\/>ccc = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 84, 12);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00343}00343         csd-\/>read\_bl\_len = 1 << \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 80, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00344}00344         csd-\/>read\_bl\_partial = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 79, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00345}00345         csd-\/>write\_blk\_misalign = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 78, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00346}00346         csd-\/>read\_blk\_misalign = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 77, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00347}00347         csd-\/>dsr\_imp = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 76, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00348}00348         csd-\/>vdd\_r\_curr\_min = \mbox{\hyperlink{mmc__da_8c_ab9934a76e4b23155132432653a8fef19}{cur\_min}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 59, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00349}00349         csd-\/>vdd\_r\_curr\_max = \mbox{\hyperlink{mmc__da_8c_aa3354946e23df65c5d7d90e04f4b291e}{cur\_max}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 56, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00350}00350         csd-\/>vdd\_w\_curr\_min = \mbox{\hyperlink{mmc__da_8c_ab9934a76e4b23155132432653a8fef19}{cur\_min}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 53, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00351}00351         csd-\/>vdd\_w\_curr\_max = \mbox{\hyperlink{mmc__da_8c_aa3354946e23df65c5d7d90e04f4b291e}{cur\_max}}[\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 50, 3)];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00352}00352         m = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 62, 12);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00353}00353         e = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 47, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00354}00354         csd-\/>capacity = ((1 + m) << (e + 2)) * csd-\/>read\_bl\_len;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00355}00355         csd-\/>erase\_blk\_en = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00356}00356         csd-\/>erase\_sector = (\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 42, 5) + 1) *}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00357}00357             (\mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 37, 5) + 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00358}00358         csd-\/>wp\_grp\_size = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 32, 5);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00359}00359         csd-\/>wp\_grp\_enable = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 31, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00360}00360         csd-\/>r2w\_factor = 1 << \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 26, 3);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00361}00361         csd-\/>write\_bl\_len = 1 << \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 22, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00362}00362         csd-\/>write\_bl\_partial = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_csd, 128, 21, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00363}00363 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00364}00364 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00365}00365 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00366}\mbox{\hyperlink{mmc__da_8c_a0ef7cafa6c691ae73bdd230f9e744943}{00366}} \mbox{\hyperlink{mmc__da_8c_a0ef7cafa6c691ae73bdd230f9e744943}{mmc\_decode\_cid\_sd}}(uint32\_t *raw\_cid, \textcolor{keyword}{struct} mmc\_cid *cid)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00367}00367 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00368}00368         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00369}00369 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00370}00370         \textcolor{comment}{/* There's no version info, so we take it on faith */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00371}00371         memset(cid, 0, \textcolor{keyword}{sizeof}(*cid));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00372}00372         cid-\/>mid = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 120, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00373}00373         cid-\/>oid = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 104, 16);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00374}00374         \textcolor{keywordflow}{for} (i = 0; i < 5; i++)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00375}00375                 cid-\/>pnm[i] = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 96 -\/ i * 8, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00376}00376         cid-\/>pnm[5] = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00377}00377         cid-\/>prv = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 56, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00378}00378         cid-\/>psn = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 24, 32);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00379}00379         cid-\/>mdt\_year = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 12, 8) + 2000;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00380}00380         cid-\/>mdt\_month = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 8, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00381}00381 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00382}00382 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00383}00383 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00384}\mbox{\hyperlink{mmc__da_8c_a9ac903f67a8e7221134f3dc4608aee10}{00384}} \mbox{\hyperlink{mmc__da_8c_a9ac903f67a8e7221134f3dc4608aee10}{mmc\_decode\_cid\_mmc}}(uint32\_t *raw\_cid, \textcolor{keyword}{struct} mmc\_cid *cid)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00385}00385 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00386}00386         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00387}00387 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00388}00388         \textcolor{comment}{/* There's no version info, so we take it on faith */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00389}00389         memset(cid, 0, \textcolor{keyword}{sizeof}(*cid));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00390}00390         cid-\/>mid = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 120, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00391}00391         cid-\/>oid = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 104, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00392}00392         \textcolor{keywordflow}{for} (i = 0; i < 6; i++)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00393}00393                 cid-\/>pnm[i] = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 96 -\/ i * 8, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00394}00394         cid-\/>pnm[6] = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00395}00395         cid-\/>prv = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 48, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00396}00396         cid-\/>psn = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 16, 32);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00397}00397         cid-\/>mdt\_month = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 12, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00398}00398         cid-\/>mdt\_year = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_cid, 128, 8, 4) + 1997;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00399}00399 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00400}00400 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00401}00401 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00402}\mbox{\hyperlink{mmc__da_8c_aa49508bff9f58d575f1b4d9bbc720209}{00402}} \mbox{\hyperlink{mmc__da_8c_aa49508bff9f58d575f1b4d9bbc720209}{mmc\_format\_card\_id\_string}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *sc, \textcolor{keyword}{struct} \mbox{\hyperlink{structmmc__params}{mmc\_params}} *mmcp)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00403}00403 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00404}00404         \textcolor{keywordtype}{char} oidstr[8];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00405}00405         uint8\_t c1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00406}00406         uint8\_t c2;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00407}00407 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00408}00408         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00409}00409 \textcolor{comment}{         * Format a card ID string for use by the mmcsd driver, it's what}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00410}00410 \textcolor{comment}{         * appears between the <> in the following:}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00411}00411 \textcolor{comment}{         * mmcsd0: 968MB <SD SD01G 8.0 SN 2686905 Mfg 08/2008 by 3 TN> at mmc0}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00412}00412 \textcolor{comment}{         * 22.5MHz/4bit/128-\/block}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00413}00413 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00414}00414 \textcolor{comment}{         * Also format just the card serial number, which the mmcsd driver will}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00415}00415 \textcolor{comment}{         * use as the disk-\/>d\_ident string.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00416}00416 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00417}00417 \textcolor{comment}{         * The card\_id\_string in mmc\_ivars is currently allocated as 64 bytes,}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00418}00418 \textcolor{comment}{         * and our max formatted length is currently 55 bytes if every field}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00419}00419 \textcolor{comment}{         * contains the largest value.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00420}00420 \textcolor{comment}{         *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00421}00421 \textcolor{comment}{         * Sometimes the oid is two printable ascii chars; when it's not,}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00422}00422 \textcolor{comment}{         * format it as 0xnnnn instead.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00423}00423 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00424}00424         c1 = (sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.oid >> 8) \& 0x0ff;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00425}00425         c2 = sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.oid \& 0x0ff;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00426}00426         \textcolor{keywordflow}{if} (c1 > 0x1f \&\& c1 < 0x7f \&\& c2 > 0x1f \&\& c2 < 0x7f)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00427}00427                 snprintf(oidstr, \textcolor{keyword}{sizeof}(oidstr), \textcolor{stringliteral}{"{}\%c\%c"{}}, c1, c2);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00428}00428         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00429}00429                 snprintf(oidstr, \textcolor{keyword}{sizeof}(oidstr), \textcolor{stringliteral}{"{}0x\%04x"{}}, sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.oid);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00430}00430         snprintf(sc-\/>\mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{card\_sn\_string}}, \textcolor{keyword}{sizeof}(sc-\/>\mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{card\_sn\_string}}),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00431}00431             \textcolor{stringliteral}{"{}\%08X"{}}, sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.psn);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00432}00432         snprintf(sc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}}, \textcolor{keyword}{sizeof}(sc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}}),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00433}00433                  \textcolor{stringliteral}{"{}\%s\%s \%s \%d.\%d SN \%08X MFG \%02d/\%04d by \%d \%s"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00434}00434                  mmcp-\/>\mbox{\hyperlink{structmmc__params_a9bf3e2fb1615fd94083eb8639fb2ae43}{card\_features}} \& \mbox{\hyperlink{mmc_8h_ae502d8099a7956959b6bf93bac0009ad}{CARD\_FEATURE\_MMC}} ? \textcolor{stringliteral}{"{}MMC"{}} : \textcolor{stringliteral}{"{}SD"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00435}00435                  mmcp-\/>\mbox{\hyperlink{structmmc__params_a9bf3e2fb1615fd94083eb8639fb2ae43}{card\_features}} \& \mbox{\hyperlink{mmc_8h_a31af3df3316f3816ab8b744fb7dc4444}{CARD\_FEATURE\_SDHC}} ? \textcolor{stringliteral}{"{}HC"{}} : \textcolor{stringliteral}{"{}"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00436}00436                  sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.pnm, sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.prv >> 4, sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.prv \& 0x0f,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00437}00437                  sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.psn, sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.mdt\_month, sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.mdt\_year,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00438}00438                  sc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}}.mid, oidstr);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00439}00439 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00440}00440 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00441}00441 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00442}\mbox{\hyperlink{mmc__da_8c_a404d229edf232e03e26f1d7ce2156f9a}{00442}} \mbox{\hyperlink{mmc__da_8c_a404d229edf232e03e26f1d7ce2156f9a}{sddaopen}}(\textcolor{keyword}{struct} disk *dp)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00443}00443 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00444}00444         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00445}00445         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00446}00446         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00447}00447         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00448}00448 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00449}00449         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *)dp-\/>d\_drv1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00450}00450         softc = part-\/>\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00451}00451         periph = softc-\/>\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00452}00452         if (\mbox{\hyperlink{cam__periph_8c_a5b3dbda06d83cc62f5ba1be9622efa4b}{cam\_periph\_acquire}}(periph) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00453}00453                 \textcolor{keywordflow}{return}(ENXIO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00454}00454         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00455}00455 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00456}00456         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00457}00457         \textcolor{keywordflow}{if} ((error = \mbox{\hyperlink{cam__periph_8c_a9590854e2c9bfe6a5ba541b1a211d494}{cam\_periph\_hold}}(periph, PRIBIO|PCATCH)) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00458}00458                 \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00459}00459                 \mbox{\hyperlink{cam__periph_8c_a7b495eee22da0818e6aec8aa176843b7}{cam\_periph\_release}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00460}00460                 \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00461}00461         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00462}00462 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00463}00463         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddaopen\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00464}00464 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00465}00465         part-\/>\mbox{\hyperlink{structsdda__part_ac921cbc4e4ce091842c37b1ec267180e}{flags}} |= \mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366aeea473b1bd444e47149765f0d5f99adf}{SDDA\_FLAG\_OPEN}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00466}00466 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00467}00467         \mbox{\hyperlink{cam__periph_8c_a87d933ebed78bbf0c6fce590bb487a8d}{cam\_periph\_unhold}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00468}00468         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00469}00469         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00470}00470 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00471}00471 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00472}00472 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00473}\mbox{\hyperlink{mmc__da_8c_a070c1034125292713ff2f3405985f715}{00473}} \mbox{\hyperlink{mmc__da_8c_a070c1034125292713ff2f3405985f715}{sddaclose}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}} *dp)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00474}00474 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00475}00475         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00476}00476         \textcolor{keyword}{struct  }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00477}00477         \textcolor{keyword}{struct  }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00478}00478 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00479}00479         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *)dp-\/>d\_drv1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00480}00480         softc = part-\/>\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00481}00481         periph = softc-\/>\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00482}00482         part-\/>\mbox{\hyperlink{structsdda__part_ac921cbc4e4ce091842c37b1ec267180e}{flags}} \&= \string~\mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366aeea473b1bd444e47149765f0d5f99adf}{SDDA\_FLAG\_OPEN}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00483}00483 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00484}00484         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00485}00485 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00486}00486         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddaclose\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00487}00487 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00488}00488         \textcolor{keywordflow}{while} (softc-\/>\mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{refcount}} != 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00489}00489                 \mbox{\hyperlink{cam__periph_8h_aca65f2f8c7cf5847b27c39ec84e232d7}{cam\_periph\_sleep}}(periph, \&softc-\/>\mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{refcount}}, PRIBIO, \textcolor{stringliteral}{"{}sddaclose"{}}, 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00490}00490         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00491}00491         \mbox{\hyperlink{cam__periph_8c_a7b495eee22da0818e6aec8aa176843b7}{cam\_periph\_release}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00492}00492         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00493}00493 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00494}00494 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00495}00495 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00496}\mbox{\hyperlink{mmc__da_8c_a7cbf7ae706a3de5b0bda8b461bd41d73}{00496}} \mbox{\hyperlink{mmc__da_8c_a7cbf7ae706a3de5b0bda8b461bd41d73}{sddaschedule}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00497}00497 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00498}00498         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00499}00499         \textcolor{keyword}{struct} \mbox{\hyperlink{structsdda__part}{sdda\_part}} *\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00500}00500         \textcolor{keyword}{struct} bio *bp;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00501}00501         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00502}00502 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00503}00503         \textcolor{comment}{/* Check if we have more work to do. */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00504}00504         \textcolor{comment}{/* Find partition that has outstanding commands. Prefer current partition. */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00505}00505         bp = bioq\_first(\&softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}}]-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00506}00506         \textcolor{keywordflow}{if} (bp == NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00507}00507                 \textcolor{keywordflow}{for} (i = 0; i < MMC\_PART\_MAX; i++) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00508}00508                         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[i]) != NULL \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00509}00509                             (bp = bioq\_first(\&softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[i]-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}})) != NULL)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00510}00510                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00511}00511                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00512}00512         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00513}00513         \textcolor{keywordflow}{if} (bp != NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00514}00514                 \mbox{\hyperlink{cam__xpt_8c_a26e646d0732b4acab4667d28f24d026e}{xpt\_schedule}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{cam_8h_a29369d4bf711763f232c214158987e20}{CAM\_PRIORITY\_NORMAL}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00515}00515         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00516}00516 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00517}00517 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00518}00518 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00519}00519 \textcolor{comment}{ * Actually translate the requested transfer into one the physical driver}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00520}00520 \textcolor{comment}{ * can understand.  The transfer is described by a buf and will include}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00521}00521 \textcolor{comment}{ * only one physical transfer.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00522}00522 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00523}00523 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00524}\mbox{\hyperlink{mmc__da_8c_a0d9c1954172a8b45c7b44b4c9739e2eb}{00524}} \mbox{\hyperlink{mmc__da_8c_a7ef57618aff8b2a42229ba2e342e7d24}{sddastrategy}}(\textcolor{keyword}{struct} bio *bp)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00525}00525 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00526}00526         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00527}00527         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00528}00528         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00529}00529 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00530}00530         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *)bp-\/>bio\_disk-\/>d\_drv1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00531}00531         softc = part-\/>\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00532}00532         periph = softc-\/>\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00533}00533 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00534}00534         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00535}00535 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00536}00536         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddastrategy(\%p)\(\backslash\)n"{}}, bp));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00537}00537 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00538}00538         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00539}00539 \textcolor{comment}{         * If the device has been made invalid, error out}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00540}00540 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00541}00541         \textcolor{keywordflow}{if} ((periph-\/>\mbox{\hyperlink{structcam__periph_adc175e8331b0d9559b02277232bc8c5a}{flags}} \& \mbox{\hyperlink{cam__periph_8h_a102702353fe3915d10c6d66bf5b643a7}{CAM\_PERIPH\_INVALID}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00542}00542                 \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00543}00543                 biofinish(bp, NULL, ENXIO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00544}00544                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00545}00545         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00546}00546 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00547}00547         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00548}00548 \textcolor{comment}{         * Place it in the queue of disk activities for this disk}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00549}00549 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00550}00550         bioq\_disksort(\&part-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}}, bp);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00551}00551 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00552}00552         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00553}00553 \textcolor{comment}{         * Schedule ourselves for performing the work.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00554}00554 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00555}00555         \mbox{\hyperlink{mmc__da_8c_a7cbf7ae706a3de5b0bda8b461bd41d73}{sddaschedule}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00556}00556         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00557}00557 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00558}00558         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00559}00559 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00560}00560 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00561}00561 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00562}00562 \mbox{\hyperlink{mmc__da_8c_ac1fbeda4ad8b3b6279f2aa2a2240f762}{sddainit}}(\textcolor{keywordtype}{void})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00563}00563 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00564}00564         \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3}{cam\_status}} status;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00565}00565 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00566}00566         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00567}00567 \textcolor{comment}{         * Install a global async callback.  This callback will}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00568}00568 \textcolor{comment}{         * receive async callbacks like "{}new device found"{}.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00569}00569 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00570}00570         status = \mbox{\hyperlink{cam__xpt_8c_a8307586c12fb4774768a25a1fa4e6388}{xpt\_register\_async}}(\mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0a04183843e65dd16d378d105270a6debd}{AC\_FOUND\_DEVICE}}, \mbox{\hyperlink{mmc__da_8c_aa8afafa82880a055578509ca212bc2e9}{sddaasync}}, NULL, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00571}00571 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00572}00572         \textcolor{keywordflow}{if} (status != \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00573}00573                 printf(\textcolor{stringliteral}{"{}sdda: Failed to attach master async callback "{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00574}00574                        \textcolor{stringliteral}{"{}due to status 0x\%x!\(\backslash\)n"{}}, status);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00575}00575         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00576}00576 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00577}00577 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00578}00578 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00579}00579 \textcolor{comment}{ * Callback from GEOM, called when it has finished cleaning up its}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00580}00580 \textcolor{comment}{ * resources.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00581}00581 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00582}00582 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00583}\mbox{\hyperlink{mmc__da_8c_a38188db7344833167308937a2195a837}{00583}} \mbox{\hyperlink{mmc__da_8c_a38188db7344833167308937a2195a837}{sddadiskgonecb}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}} *dp)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00584}00584 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00585}00585         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00586}00586         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00587}00587 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00588}00588         part = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *)dp-\/>d\_drv1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00589}00589         periph = part-\/>\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}}-\/>\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00590}00590         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddadiskgonecb\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00591}00591 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00592}00592         \mbox{\hyperlink{cam__periph_8c_a7b495eee22da0818e6aec8aa176843b7}{cam\_periph\_release}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00593}00593 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00594}00594 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00595}00595 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00596}\mbox{\hyperlink{mmc__da_8c_abf6e5f09a61384db0bc1dd1cb74b9257}{00596}} \mbox{\hyperlink{mmc__da_8c_a29b87fc744eb3db89b2a0cd5959ee0ef}{sddaoninvalidate}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00597}00597 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00598}00598         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00599}00599         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00600}00600 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00601}00601         softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00602}00602 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00603}00603         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddaoninvalidate\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00604}00604 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00605}00605         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00606}00606 \textcolor{comment}{         * De-\/register any async callbacks.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00607}00607 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00608}00608         \mbox{\hyperlink{cam__xpt_8c_a8307586c12fb4774768a25a1fa4e6388}{xpt\_register\_async}}(0, \mbox{\hyperlink{mmc__da_8c_aa8afafa82880a055578509ca212bc2e9}{sddaasync}}, \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00609}00609 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00610}00610         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00611}00611 \textcolor{comment}{         * Return all queued I/O with ENXIO.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00612}00612 \textcolor{comment}{         * XXX Handle any transactions queued to the card}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00613}00613 \textcolor{comment}{         *     with XPT\_ABORT\_CCB.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00614}00614 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00615}00615         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}bioq\_flush start\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00616}00616         \textcolor{keywordflow}{for} (\textcolor{keywordtype}{int} i = 0; i < MMC\_PART\_MAX; i++) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00617}00617                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[i]) != NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00618}00618                         bioq\_flush(\&\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}}, NULL, ENXIO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00619}00619                         disk\_gone(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00620}00620                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00621}00621         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00622}00622         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}bioq\_flush end\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00623}00623 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00624}00624 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00625}00625 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00626}\mbox{\hyperlink{mmc__da_8c_af6d237d2de3a2a1584486cd77d6c2f47}{00626}} \mbox{\hyperlink{mmc__da_8c_aee996c8ae5d270cd8531dfde2661815b}{sddacleanup}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00627}00627 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00628}00628         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00629}00629         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00630}00630         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00631}00631 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00632}00632         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddacleanup\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00633}00633         softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00634}00634 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00635}00635         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00636}00636 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00637}00637         \textcolor{keywordflow}{for} (i = 0; i < MMC\_PART\_MAX; i++) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00638}00638                 \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[i]) != NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00639}00639                         disk\_destroy(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00640}00640                         free(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00641}00641                         softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[i] = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00642}00642                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00643}00643         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00644}00644         free(softc, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00645}00645         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00646}00646 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00647}00647 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00648}00648 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00649}\mbox{\hyperlink{mmc__da_8c_aa8afafa82880a055578509ca212bc2e9}{00649}} \mbox{\hyperlink{mmc__da_8c_aa8afafa82880a055578509ca212bc2e9}{sddaasync}}(\textcolor{keywordtype}{void} *callback\_arg, u\_int32\_t code,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00650}00650         \textcolor{keyword}{struct} \mbox{\hyperlink{structcam__path}{cam\_path}} *path, \textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00651}00651 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00652}00652         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__getdev}{ccb\_getdev}} cgd;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00653}00653         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00654}00654 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00655}00655         periph = (\textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *)callback\_arg;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00656}00656         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddaasync(code=\%d)\(\backslash\)n"{}}, code));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00657}00657         \textcolor{keywordflow}{switch} (code) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00658}00658         \textcolor{keywordflow}{case} \mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0a04183843e65dd16d378d105270a6debd}{AC\_FOUND\_DEVICE}}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00659}00659         \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00660}00660                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}=> AC\_FOUND\_DEVICE\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00661}00661                 \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__getdev}{ccb\_getdev}} *cgd;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00662}00662                 \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3}{cam\_status}} status;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00663}00663 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00664}00664                 cgd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structccb__getdev}{ccb\_getdev}} *)arg;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00665}00665                 \textcolor{keywordflow}{if} (cgd == NULL)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00666}00666                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00667}00667 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00668}00668                 \textcolor{keywordflow}{if} (cgd-\/>\mbox{\hyperlink{structccb__getdev_a019f53feca9e4c09b563eef64e19c1fd}{protocol}} != \mbox{\hyperlink{cam__ccb_8h_a283e001579038402a95e23bef57107e8a982a0b7e7a81cd9adcbcab95e3698b4b}{PROTO\_MMCSD}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00669}00669                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00670}00670 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00671}00671                 \textcolor{keywordflow}{if} (!(path-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}}.\mbox{\hyperlink{structmmc__params_a9bf3e2fb1615fd94083eb8639fb2ae43}{card\_features}} \& \mbox{\hyperlink{mmc_8h_a6ca3cddf29f29482728a3e1be1604435}{CARD\_FEATURE\_MEMORY}})) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00672}00672                         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}No memory on the card!\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00673}00673                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00674}00674                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00675}00675 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00676}00676                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00677}00677 \textcolor{comment}{                 * Allocate a peripheral instance for}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00678}00678 \textcolor{comment}{                 * this device and start the probe}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00679}00679 \textcolor{comment}{                 * process.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00680}00680 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00681}00681                 status = \mbox{\hyperlink{cam__periph_8c_ad5e57f86a941e5a4021b0b026851e445}{cam\_periph\_alloc}}(\mbox{\hyperlink{mmc__da_8c_a03aa32183fe57fc3962d753c65fe02bc}{sddaregister}}, \mbox{\hyperlink{mmc__da_8c_a29b87fc744eb3db89b2a0cd5959ee0ef}{sddaoninvalidate}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00682}00682                                           \mbox{\hyperlink{mmc__da_8c_aee996c8ae5d270cd8531dfde2661815b}{sddacleanup}}, \mbox{\hyperlink{mmc__da_8c_abc7bb4d36fce8f60b034ea6291f82ef3}{sddastart}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00683}00683                                           \textcolor{stringliteral}{"{}sdda"{}}, \mbox{\hyperlink{cam__periph_8h_ae648b142a75d7546562342a7b7961e6cada5282ff3d485d68259bc309db51476b}{CAM\_PERIPH\_BIO}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00684}00684                                           path, \mbox{\hyperlink{mmc__da_8c_aa8afafa82880a055578509ca212bc2e9}{sddaasync}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00685}00685                                           \mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0a04183843e65dd16d378d105270a6debd}{AC\_FOUND\_DEVICE}}, cgd);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00686}00686 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00687}00687                 \textcolor{keywordflow}{if} (status != \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00688}00688                  \&\& status != \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a167c9bce81d6e65c16734d3e0d59fe24}{CAM\_REQ\_INPROG}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00689}00689                         printf(\textcolor{stringliteral}{"{}sddaasync: Unable to attach to new device "{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00690}00690                                 \textcolor{stringliteral}{"{}due to status 0x\%x\(\backslash\)n"{}}, status);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00691}00691                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00692}00692         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00693}00693         \textcolor{keywordflow}{case} \mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0a761c3deb864c8b47c8123ee11a113df6}{AC\_GETDEV\_CHANGED}}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00694}00694         \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00695}00695                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}=> AC\_GETDEV\_CHANGED\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00696}00696                 memset(\&cgd, 0, \textcolor{keyword}{sizeof}(cgd));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00697}00697                 \mbox{\hyperlink{cam__xpt_8c_a64b1b7434225c072f2d9379fe39e359c}{xpt\_setup\_ccb}}(\&cgd.\mbox{\hyperlink{structccb__getdev_a5d14cdc58f775661b78dccb59121e90e}{ccb\_h}}, periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam_8h_a29369d4bf711763f232c214158987e20}{CAM\_PRIORITY\_NORMAL}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00698}00698                 cgd.\mbox{\hyperlink{structccb__getdev_a5d14cdc58f775661b78dccb59121e90e}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055cae076749d68954cdfbd24a6060976168f}{XPT\_GDEV\_TYPE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00699}00699                 \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}((\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *)\&cgd);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00700}00700                 \mbox{\hyperlink{cam__periph_8c_a75ca97e267b2b0a98d4c146ec1967bdc}{cam\_periph\_async}}(periph, code, path, arg);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00701}00701                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00702}00702         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00703}00703         \textcolor{keywordflow}{case} \mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0a036a366f13e05e75d85915311d7acaf4}{AC\_ADVINFO\_CHANGED}}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00704}00704         \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00705}00705                 uintptr\_t buftype;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00706}00706                 \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00707}00707 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00708}00708                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}=> AC\_ADVINFO\_CHANGED\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00709}00709                 buftype = (uintptr\_t)arg;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00710}00710                 \textcolor{keywordflow}{if} (buftype == \mbox{\hyperlink{cam__ccb_8h_ac101e60833e21699afff0ae410e4f31e}{CDAI\_TYPE\_PHYS\_PATH}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00711}00711                         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00712}00712                         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00713}00713 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00714}00714                         softc = periph-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00715}00715                         \textcolor{keywordflow}{for} (i = 0; i < MMC\_PART\_MAX; i++) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00716}00716                                 \textcolor{keywordflow}{if} ((part = softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[i]) != NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00717}00717                                         disk\_attr\_changed(part-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}, \textcolor{stringliteral}{"{}GEOM::physpath"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00718}00718                                             M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00719}00719                                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00720}00720                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00721}00721                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00722}00722                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00723}00723         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00724}00724         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00725}00725                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}=> default?!\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00726}00726                 \mbox{\hyperlink{cam__periph_8c_a75ca97e267b2b0a98d4c146ec1967bdc}{cam\_periph\_async}}(periph, code, path, arg);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00727}00727                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00728}00728         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00729}00729 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00730}00730 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00731}00731 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00732}\mbox{\hyperlink{mmc__da_8c_a27b3d9b0bd88da7e2628357427376dad}{00732}} \mbox{\hyperlink{mmc__da_8c_a27b3d9b0bd88da7e2628357427376dad}{sddagetattr}}(\textcolor{keyword}{struct} bio *bp)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00733}00733 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00734}00734         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00735}00735         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00736}00736         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00737}00737         \textcolor{keywordtype}{int} ret;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00738}00738 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00739}00739         part = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *)bp-\/>bio\_disk-\/>d\_drv1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00740}00740         softc = part-\/>\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00741}00741         periph = softc-\/>\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00742}00742         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00743}00743         ret = \mbox{\hyperlink{cam__xpt_8c_a2b24f6c02556c877219f3e3b631d48f1}{xpt\_getattr}}(bp-\/>bio\_data, bp-\/>bio\_length, bp-\/>bio\_attribute,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00744}00744             periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00745}00745         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00746}00746         \textcolor{keywordflow}{if} (ret == 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00747}00747                 bp-\/>bio\_completed = bp-\/>bio\_length;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00748}00748         \textcolor{keywordflow}{return} (ret);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00749}00749 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00750}00750 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00751}00751 \textcolor{keyword}{static} \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3}{cam\_status}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00752}\mbox{\hyperlink{mmc__da_8c_a115eabf9884d46f98febb467e6e801c2}{00752}} \mbox{\hyperlink{mmc__da_8c_a03aa32183fe57fc3962d753c65fe02bc}{sddaregister}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keywordtype}{void} *arg)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00753}00753 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00754}00754         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00755}00755         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__getdev}{ccb\_getdev}} *cgd;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00756}00756 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00757}00757         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddaregister\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00758}00758         cgd = (\textcolor{keyword}{struct }\mbox{\hyperlink{structccb__getdev}{ccb\_getdev}} *)arg;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00759}00759         \textcolor{keywordflow}{if} (cgd == NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00760}00760                 printf(\textcolor{stringliteral}{"{}sddaregister: no getdev CCB, can't register device\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00761}00761                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a7c519e8cfabb5fd17f4d518c82c17692}{CAM\_REQ\_CMP\_ERR}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00762}00762         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00763}00763 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00764}00764         softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)malloc(\textcolor{keyword}{sizeof}(*softc), M\_DEVBUF,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00765}00765             M\_NOWAIT|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00766}00766         \textcolor{keywordflow}{if} (softc == NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00767}00767                 printf(\textcolor{stringliteral}{"{}sddaregister: Unable to probe new device. "{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00768}00768                     \textcolor{stringliteral}{"{}Unable to allocate softc\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00769}00769                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a7c519e8cfabb5fd17f4d518c82c17692}{CAM\_REQ\_CMP\_ERR}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00770}00770         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00771}00771 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00772}00772         softc-\/>\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}} = \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3afe754e010ae14fe5f4d6dcf7f19d5f7f}{SDDA\_STATE\_INIT}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00773}00773         softc-\/>\mbox{\hyperlink{structsdda__softc_aed77974991ef815afe3b249db5a25561}{mmcdata}} =}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00774}00774                 (\textcolor{keyword}{struct }mmc\_data *)malloc(\textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} mmc\_data), M\_DEVBUF, M\_NOWAIT|M\_ZERO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00775}00775         \textcolor{keywordflow}{if} (softc-\/>\mbox{\hyperlink{structsdda__softc_aed77974991ef815afe3b249db5a25561}{mmcdata}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00776}00776                 printf(\textcolor{stringliteral}{"{}sddaregister: Unable to probe new device. "{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00777}00777                     \textcolor{stringliteral}{"{}Unable to allocate mmcdata\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00778}00778                 free(softc, M\_DEVBUF);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00779}00779                 \textcolor{keywordflow}{return} (\mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a7c519e8cfabb5fd17f4d518c82c17692}{CAM\_REQ\_CMP\_ERR}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00780}00780         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00781}00781         periph-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}} = softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00782}00782         softc-\/>\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}} = periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00783}00783 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00784}00784         \mbox{\hyperlink{cam__xpt_8c_a26e646d0732b4acab4667d28f24d026e}{xpt\_schedule}}(periph, \mbox{\hyperlink{cam_8h_a987088dd2ae7bcf2ccb0fd12eabcc08f}{CAM\_PRIORITY\_XPT}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00785}00785         TASK\_INIT(\&softc-\/>\mbox{\hyperlink{structsdda__softc_a807f5b3d75010bba973cd337cf61a764}{start\_init\_task}}, 0, \mbox{\hyperlink{mmc__da_8c_a8932a2cc5a68eff1b7da2ce0d1301588}{sdda\_start\_init\_task}}, periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00786}00786         taskqueue\_enqueue(taskqueue\_thread, \&softc-\/>\mbox{\hyperlink{structsdda__softc_a807f5b3d75010bba973cd337cf61a764}{start\_init\_task}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00787}00787 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00788}00788         \textcolor{keywordflow}{return} (\mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00789}00789 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00790}00790 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00791}00791 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00792}\mbox{\hyperlink{mmc__da_8c_ae363149c29eb51b0329ede8d883d8c1f}{00792}} \mbox{\hyperlink{mmc__da_8c_ae363149c29eb51b0329ede8d883d8c1f}{mmc\_exec\_app\_cmd}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00793}00793         \textcolor{keyword}{struct} mmc\_command *cmd) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00794}00794         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00795}00795 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00796}00796         \textcolor{comment}{/* Send APP\_CMD first */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00797}00797         memset(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} mmc\_command));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00798}00798         memset(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_a0783c59c8cd04dd221403249d15dfac2}{stop}}, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} mmc\_command));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00799}00799         \mbox{\hyperlink{cam__ccb_8h_a7531e1d0a45f7468057d52c9f1cc8c93}{cam\_fill\_mmcio}}(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00800}00800                        \textcolor{comment}{/*retries*/} 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00801}00801                        \textcolor{comment}{/*cbfcnp*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00802}00802                        \textcolor{comment}{/*flags*/} \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00803}00803                        \textcolor{comment}{/*mmc\_opcode*/} MMC\_APP\_CMD,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00804}00804                        \textcolor{comment}{/*mmc\_arg*/} \mbox{\hyperlink{mmc__da_8c_af2e6bbe164550dee70250880c23b06d3}{get\_rca}}(periph) << 16,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00805}00805                        \textcolor{comment}{/*mmc\_flags*/} MMC\_RSP\_R1 | MMC\_CMD\_AC,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00806}00806                        \textcolor{comment}{/*mmc\_data*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00807}00807                        \textcolor{comment}{/*timeout*/} 0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00808}00808 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00809}00809         \mbox{\hyperlink{cam__periph_8c_a9eb7c5c2381f6769e4ecf63233bfff6f}{cam\_periph\_runccb}}(\mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}, \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316a4f77fb0891285d1329e080a5013ef8ed}{CAM\_FLAG\_NONE}}, \textcolor{comment}{/*sense\_flags*/}0, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00810}00810         err = \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00811}00811         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00812}00812                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00813}00813         \textcolor{keywordflow}{if} (!(\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.resp[0] \& R1\_APP\_CMD))}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00814}00814                 \textcolor{keywordflow}{return} (EIO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00815}00815 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00816}00816         \textcolor{comment}{/* Now exec actual command */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00817}00817         \textcolor{keywordtype}{int} flags = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00818}00818         \textcolor{keywordflow}{if} (cmd-\/>data != NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00819}00819                 \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data = cmd-\/>data;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00820}00820                 \textcolor{keywordflow}{if} (cmd-\/>data-\/>flags \& MMC\_DATA\_READ)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00821}00821                         flags |= \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a00dc62a475e9a013d8a7f90fcf08f3af}{CAM\_DIR\_IN}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00822}00822                 \textcolor{keywordflow}{if} (cmd-\/>data-\/>flags \& MMC\_DATA\_WRITE)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00823}00823                         flags |= \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676adf60a86f59d84768dceb1af379c0dc3a}{CAM\_DIR\_OUT}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00824}00824         \} \textcolor{keywordflow}{else} flags = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00825}00825 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00826}00826         \mbox{\hyperlink{cam__ccb_8h_a7531e1d0a45f7468057d52c9f1cc8c93}{cam\_fill\_mmcio}}(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00827}00827                        \textcolor{comment}{/*retries*/} 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00828}00828                        \textcolor{comment}{/*cbfcnp*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00829}00829                        \textcolor{comment}{/*flags*/} flags,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00830}00830                        \textcolor{comment}{/*mmc\_opcode*/} cmd-\/>opcode,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00831}00831                        \textcolor{comment}{/*mmc\_arg*/} cmd-\/>arg,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00832}00832                        \textcolor{comment}{/*mmc\_flags*/} cmd-\/>flags,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00833}00833                        \textcolor{comment}{/*mmc\_data*/} cmd-\/>data,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00834}00834                        \textcolor{comment}{/*timeout*/} 0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00835}00835 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00836}00836         \mbox{\hyperlink{cam__periph_8c_a9eb7c5c2381f6769e4ecf63233bfff6f}{cam\_periph\_runccb}}(\mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}, \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316a4f77fb0891285d1329e080a5013ef8ed}{CAM\_FLAG\_NONE}}, \textcolor{comment}{/*sense\_flags*/}0, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00837}00837         err = \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00838}00838         \textcolor{keywordflow}{if} (err != 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00839}00839                 \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00840}00840         memcpy(cmd-\/>resp, \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.resp, \textcolor{keyword}{sizeof}(cmd-\/>resp));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00841}00841         cmd-\/>error = \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}}.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.error;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00842}00842 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00843}00843         \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00844}00844 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00845}00845 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00846}00846 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00847}\mbox{\hyperlink{mmc__da_8c_a37e193887f4339fcfb53e9ca808d92e6}{00847}} \mbox{\hyperlink{mmc__da_8c_a37e193887f4339fcfb53e9ca808d92e6}{mmc\_app\_get\_scr}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}}, uint32\_t *rawscr) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00848}00848         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00849}00849         \textcolor{keyword}{struct }mmc\_command cmd;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00850}00850         \textcolor{keyword}{struct }mmc\_data d;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00851}00851 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00852}00852         memset(\&cmd, 0, \textcolor{keyword}{sizeof}(cmd));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00853}00853         memset(\&d, 0, \textcolor{keyword}{sizeof}(d));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00854}00854 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00855}00855         memset(rawscr, 0, 8);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00856}00856         cmd.opcode = ACMD\_SEND\_SCR;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00857}00857         cmd.flags = MMC\_RSP\_R1 | MMC\_CMD\_ADTC;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00858}00858         cmd.arg = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00859}00859 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00860}00860         d.data = rawscr;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00861}00861         d.len = 8;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00862}00862         d.flags = MMC\_DATA\_READ;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00863}00863         cmd.data = \&d;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00864}00864 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00865}00865         err = \mbox{\hyperlink{mmc__da_8c_ae363149c29eb51b0329ede8d883d8c1f}{mmc\_exec\_app\_cmd}}(periph, \mbox{\hyperlink{unionccb}{ccb}}, \&cmd);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00866}00866         rawscr[0] = be32toh(rawscr[0]);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00867}00867         rawscr[1] = be32toh(rawscr[1]);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00868}00868         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00869}00869 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00870}00870 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00871}00871 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00872}\mbox{\hyperlink{mmc__da_8c_a37f96cfcae8cc75381449caff403006e}{00872}} \mbox{\hyperlink{mmc__da_8c_a37f96cfcae8cc75381449caff403006e}{mmc\_send\_ext\_csd}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00873}00873                  uint8\_t *rawextcsd, \textcolor{keywordtype}{size\_t} buf\_len) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00874}00874         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00875}00875         \textcolor{keyword}{struct }mmc\_data d;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00876}00876 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00877}00877         KASSERT(buf\_len == 512, (\textcolor{stringliteral}{"{}Buffer for ext csd must be 512 bytes"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00878}00878         memset(\&d, 0, \textcolor{keyword}{sizeof}(d));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00879}00879         d.data = rawextcsd;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00880}00880         d.len = buf\_len;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00881}00881         d.flags = MMC\_DATA\_READ;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00882}00882         memset(d.data, 0, d.len);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00883}00883 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00884}00884         \mbox{\hyperlink{cam__ccb_8h_a7531e1d0a45f7468057d52c9f1cc8c93}{cam\_fill\_mmcio}}(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00885}00885                        \textcolor{comment}{/*retries*/} 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00886}00886                        \textcolor{comment}{/*cbfcnp*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00887}00887                        \textcolor{comment}{/*flags*/} \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a00dc62a475e9a013d8a7f90fcf08f3af}{CAM\_DIR\_IN}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00888}00888                        \textcolor{comment}{/*mmc\_opcode*/} MMC\_SEND\_EXT\_CSD,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00889}00889                        \textcolor{comment}{/*mmc\_arg*/} 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00890}00890                        \textcolor{comment}{/*mmc\_flags*/} MMC\_RSP\_R1 | MMC\_CMD\_ADTC,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00891}00891                        \textcolor{comment}{/*mmc\_data*/} \&d,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00892}00892                        \textcolor{comment}{/*timeout*/} 0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00893}00893 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00894}00894         \mbox{\hyperlink{cam__periph_8c_a9eb7c5c2381f6769e4ecf63233bfff6f}{cam\_periph\_runccb}}(\mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}, \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316a4f77fb0891285d1329e080a5013ef8ed}{CAM\_FLAG\_NONE}}, \textcolor{comment}{/*sense\_flags*/}0, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00895}00895         err = \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00896}00896         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00897}00897 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00898}00898 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00899}00899 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00900}\mbox{\hyperlink{mmc__da_8c_aac9236e348e0be8d058cebc87a0cb25f}{00900}} \mbox{\hyperlink{mmc__da_8c_aac9236e348e0be8d058cebc87a0cb25f}{mmc\_app\_decode\_scr}}(uint32\_t *raw\_scr, \textcolor{keyword}{struct} mmc\_scr *scr)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00901}00901 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00902}00902         \textcolor{keywordtype}{unsigned} \textcolor{keywordtype}{int} scr\_struct;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00903}00903 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00904}00904         memset(scr, 0, \textcolor{keyword}{sizeof}(*scr));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00905}00905 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00906}00906         scr\_struct = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_scr, 64, 60, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00907}00907         \textcolor{keywordflow}{if} (scr\_struct != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00908}00908                 printf(\textcolor{stringliteral}{"{}Unrecognised SCR structure version \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00909}00909                     scr\_struct);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00910}00910                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00911}00911         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00912}00912         scr-\/>sda\_vsn = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_scr, 64, 56, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00913}00913         scr-\/>bus\_widths = \mbox{\hyperlink{mmc__da_8c_aca29dd2d496b79253ef0d529d55797ab}{mmc\_get\_bits}}(raw\_scr, 64, 48, 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00914}00914 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00915}00915 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00916}00916 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00917}\mbox{\hyperlink{mmc__da_8c_a6225fe80bc50d97d8ec2dcbedd9a0da3}{00917}} \mbox{\hyperlink{mmc__da_8c_a6225fe80bc50d97d8ec2dcbedd9a0da3}{mmc\_switch\_fill\_mmcio}}(\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00918}00918     uint8\_t set, uint8\_t index, uint8\_t value, u\_int timeout)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00919}00919 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00920}00920         \textcolor{keywordtype}{int} arg = (MMC\_SWITCH\_FUNC\_WR << 24) |}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00921}00921             (index << 16) |}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00922}00922             (value << 8) |}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00923}00923             set;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00924}00924 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00925}00925         \mbox{\hyperlink{cam__ccb_8h_a7531e1d0a45f7468057d52c9f1cc8c93}{cam\_fill\_mmcio}}(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00926}00926                        \textcolor{comment}{/*retries*/} 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00927}00927                        \textcolor{comment}{/*cbfcnp*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00928}00928                        \textcolor{comment}{/*flags*/} \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00929}00929                        \textcolor{comment}{/*mmc\_opcode*/} MMC\_SWITCH\_FUNC,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00930}00930                        \textcolor{comment}{/*mmc\_arg*/} arg,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00931}00931                        \textcolor{comment}{/*mmc\_flags*/} MMC\_RSP\_R1B | MMC\_CMD\_AC,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00932}00932                        \textcolor{comment}{/*mmc\_data*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00933}00933                        \textcolor{comment}{/*timeout*/} timeout);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00934}00934 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00935}00935 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00936}00936 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00937}\mbox{\hyperlink{mmc__da_8c_a62ace3a21edbd3521ad75a4009c5b422}{00937}} \mbox{\hyperlink{mmc__da_8c_a62ace3a21edbd3521ad75a4009c5b422}{mmc\_select\_card}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}}, uint32\_t rca)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00938}00938 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00939}00939         \textcolor{keywordtype}{int} flags, err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00940}00940 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00941}00941         flags = (rca ? MMC\_RSP\_R1B : MMC\_RSP\_NONE) | MMC\_CMD\_AC;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00942}00942         \mbox{\hyperlink{cam__ccb_8h_a7531e1d0a45f7468057d52c9f1cc8c93}{cam\_fill\_mmcio}}(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00943}00943                        \textcolor{comment}{/*retries*/} 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00944}00944                        \textcolor{comment}{/*cbfcnp*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00945}00945                        \textcolor{comment}{/*flags*/} \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a00dc62a475e9a013d8a7f90fcf08f3af}{CAM\_DIR\_IN}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00946}00946                        \textcolor{comment}{/*mmc\_opcode*/} MMC\_SELECT\_CARD,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00947}00947                        \textcolor{comment}{/*mmc\_arg*/} rca << 16,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00948}00948                        \textcolor{comment}{/*mmc\_flags*/} flags,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00949}00949                        \textcolor{comment}{/*mmc\_data*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00950}00950                        \textcolor{comment}{/*timeout*/} 0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00951}00951 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00952}00952         \mbox{\hyperlink{cam__periph_8c_a9eb7c5c2381f6769e4ecf63233bfff6f}{cam\_periph\_runccb}}(\mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}, \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316a4f77fb0891285d1329e080a5013ef8ed}{CAM\_FLAG\_NONE}}, \textcolor{comment}{/*sense\_flags*/}0, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00953}00953         err = \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00954}00954         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00955}00955 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00956}00956 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00957}00957 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00958}\mbox{\hyperlink{mmc__da_8c_a06325c7a363bbeba94d73e5a5ed4541a}{00958}} \mbox{\hyperlink{mmc__da_8c_a06325c7a363bbeba94d73e5a5ed4541a}{mmc\_switch}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00959}00959     uint8\_t set, uint8\_t index, uint8\_t value, u\_int timeout)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00960}00960 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00961}00961         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00962}00962 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00963}00963         \mbox{\hyperlink{mmc__da_8c_a6225fe80bc50d97d8ec2dcbedd9a0da3}{mmc\_switch\_fill\_mmcio}}(\mbox{\hyperlink{unionccb}{ccb}}, set, index, value, timeout);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00964}00964         \mbox{\hyperlink{cam__periph_8c_a9eb7c5c2381f6769e4ecf63233bfff6f}{cam\_periph\_runccb}}(\mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}, \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316a4f77fb0891285d1329e080a5013ef8ed}{CAM\_FLAG\_NONE}}, \textcolor{comment}{/*sense\_flags*/}0, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00965}00965         err = \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00966}00966         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00967}00967 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00968}00968 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00969}00969 \textcolor{keyword}{static} uint32\_t}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00970}\mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{00970}} \mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00971}00971         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00972}00972 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00973}00973         return (softc-\/>\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}}.spec\_vers);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00974}00974 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00975}00975 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00976}00976 \textcolor{keyword}{static} uint64\_t}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00977}\mbox{\hyperlink{mmc__da_8c_a1bfcf14f4533a7a7485f6dc9caefa8e2}{00977}} \mbox{\hyperlink{mmc__da_8c_a1bfcf14f4533a7a7485f6dc9caefa8e2}{mmc\_get\_media\_size}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00978}00978         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00979}00979 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00980}00980         return (softc-\/>\mbox{\hyperlink{structsdda__softc_a76e3a40aa21032b790c4ea11613062c1}{mediasize}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00981}00981 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00982}00982 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00983}00983 \textcolor{keyword}{static} uint32\_t}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00984}\mbox{\hyperlink{mmc__da_8c_af98a4c78a4018d532ecfb17dd66321d6}{00984}} \mbox{\hyperlink{mmc__da_8c_af98a4c78a4018d532ecfb17dd66321d6}{mmc\_get\_cmd6\_timeout}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00985}00985 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00986}00986         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00987}00987 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00988}00988         if (\mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) >= 6)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00989}00989                 \textcolor{keywordflow}{return} (softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_GEN\_CMD6\_TIME] * 10);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00990}00990         \textcolor{keywordflow}{return} (500 * 1000);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00991}00991 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00992}00992 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00993}00993 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00994}\mbox{\hyperlink{mmc__da_8c_a2ba2ba63f47266f0e8ce7cc5e1a3059d}{00994}} \mbox{\hyperlink{mmc__da_8c_a2ba2ba63f47266f0e8ce7cc5e1a3059d}{mmc\_sd\_switch}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00995}00995               uint8\_t mode, uint8\_t grp, uint8\_t value,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00996}00996               uint8\_t *res) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00997}00997         \textcolor{keyword}{struct }mmc\_data mmc\_d;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00998}00998         uint32\_t arg;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l00999}00999         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01000}01000 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01001}01001         memset(res, 0, 64);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01002}01002         memset(\&mmc\_d, 0, \textcolor{keyword}{sizeof}(mmc\_d));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01003}01003         mmc\_d.len = 64;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01004}01004         mmc\_d.data = res;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01005}01005         mmc\_d.flags = MMC\_DATA\_READ;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01006}01006 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01007}01007         arg = mode << 31;                       \textcolor{comment}{/* 0 -\/ check, 1 -\/ set */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01008}01008         arg |= 0x00FFFFFF;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01009}01009         arg \&= \string~(0xF << (grp * 4));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01010}01010         arg |= value << (grp * 4);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01011}01011 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01012}01012         \mbox{\hyperlink{cam__ccb_8h_a7531e1d0a45f7468057d52c9f1cc8c93}{cam\_fill\_mmcio}}(\&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01013}01013                        \textcolor{comment}{/*retries*/} 0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01014}01014                        \textcolor{comment}{/*cbfcnp*/} NULL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01015}01015                        \textcolor{comment}{/*flags*/} \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a00dc62a475e9a013d8a7f90fcf08f3af}{CAM\_DIR\_IN}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01016}01016                        \textcolor{comment}{/*mmc\_opcode*/} SD\_SWITCH\_FUNC,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01017}01017                        \textcolor{comment}{/*mmc\_arg*/} arg,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01018}01018                        \textcolor{comment}{/*mmc\_flags*/} MMC\_RSP\_R1 | MMC\_CMD\_ADTC,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01019}01019                        \textcolor{comment}{/*mmc\_data*/} \&mmc\_d,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01020}01020                        \textcolor{comment}{/*timeout*/} 0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01021}01021 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01022}01022         \mbox{\hyperlink{cam__periph_8c_a9eb7c5c2381f6769e4ecf63233bfff6f}{cam\_periph\_runccb}}(\mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}, \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316a4f77fb0891285d1329e080a5013ef8ed}{CAM\_FLAG\_NONE}}, \textcolor{comment}{/*sense\_flags*/}0, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01023}01023         err = \mbox{\hyperlink{mmc__da_8c_a7ca769c4893f54cfa4f6ae8cd90802b1}{mmc\_handle\_reply}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01024}01024         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01025}01025 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01026}01026 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01027}01027 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01028}\mbox{\hyperlink{mmc__da_8c_a1d1855d018d4233f814999244229e2a1}{01028}} \mbox{\hyperlink{mmc__da_8c_a1d1855d018d4233f814999244229e2a1}{mmc\_set\_timing}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01029}01029                \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01030}01030                \textcolor{keyword}{enum} mmc\_bus\_timing timing)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01031}01031 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01032}01032         u\_char switch\_res[64];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01033}01033         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01034}01034         uint8\_t value;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01035}01035         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01036}01036         \textcolor{keyword}{struct} \mbox{\hyperlink{structmmc__params}{mmc\_params}} *mmcp = \&\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01037}01037 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01038}01038         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a47763149d044e13fcc06abfb3ddc941f}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01039}01039                   (\textcolor{stringliteral}{"{}mmc\_set\_timing(timing=\%d)"{}}, timing));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01040}01040         \textcolor{keywordflow}{switch} (timing) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01041}01041         \textcolor{keywordflow}{case} bus\_timing\_normal:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01042}01042                 value = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01043}01043                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01044}01044         \textcolor{keywordflow}{case} bus\_timing\_hs:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01045}01045                 value = 1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01046}01046                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01047}01047         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01048}01048                 \textcolor{keywordflow}{return} (MMC\_ERR\_INVALID);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01049}01049         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01050}01050         \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_ae502d8099a7956959b6bf93bac0009ad}{CARD\_FEATURE\_MMC}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01051}01051                 err = \mbox{\hyperlink{mmc__da_8c_a06325c7a363bbeba94d73e5a5ed4541a}{mmc\_switch}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{unionccb}{ccb}}, EXT\_CSD\_CMD\_SET\_NORMAL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01052}01052                     EXT\_CSD\_HS\_TIMING, value, softc-\/>\mbox{\hyperlink{structsdda__softc_aa4ff982ccca7ceef6e22bfaa821dff2b}{cmd6\_time}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01053}01053         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01054}01054                 err = \mbox{\hyperlink{mmc__da_8c_a2ba2ba63f47266f0e8ce7cc5e1a3059d}{mmc\_sd\_switch}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{unionccb}{ccb}}, SD\_SWITCH\_MODE\_SET, SD\_SWITCH\_GROUP1, value, switch\_res);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01055}01055         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01056}01056 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01057}01057         \textcolor{comment}{/* Set high-\/speed timing on the host */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01058}01058         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__trans__settings__mmc}{ccb\_trans\_settings\_mmc}} *\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01059}01059         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}} = \&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a49ca2523da352ce13d213ca3881a126b}{cts}}.\mbox{\hyperlink{structccb__trans__settings_aeb168f5bdb4329b47397670aae9bd2f9}{proto\_specific}}.\mbox{\hyperlink{structccb__trans__settings_ad24f59699726f62e474172bff48e575e}{mmc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01060}01060         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca809010667fe314b6a4af69f3fef6bc9f}{XPT\_SET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01061}01061         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01062}01062         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01063}01063         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01064}01064         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01065}01065         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a1f09353b8c0689d571387f33c9fb2b4d}{ios}}.timing = timing;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01066}01066         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ac6b59dc2e231369e2cf0812ca6208fad}{ios\_valid}} = \mbox{\hyperlink{cam__ccb_8h_ab1f9741c9fb5c919c2c7811a8089f935}{MMC\_BT}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01067}01067         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01068}01068 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01069}01069         \textcolor{keywordflow}{return} (err);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01070}01070 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01071}01071 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01072}01072 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01073}\mbox{\hyperlink{mmc__da_8c_a8932a2cc5a68eff1b7da2ce0d1301588}{01073}} \mbox{\hyperlink{mmc__da_8c_a8932a2cc5a68eff1b7da2ce0d1301588}{sdda\_start\_init\_task}}(\textcolor{keywordtype}{void} *context, \textcolor{keywordtype}{int} pending) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01074}01074         \textcolor{keyword}{union }\mbox{\hyperlink{unionccb}{ccb}} *new\_ccb;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01075}01075         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01076}01076 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01077}01077         periph = (\textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *)context;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01078}01078         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sdda\_start\_init\_task\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01079}01079         new\_ccb = \mbox{\hyperlink{cam__xpt_8c_a17fe920aa9698f9b81b06f08d0140fb2}{xpt\_alloc\_ccb}}();}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01080}01080         \mbox{\hyperlink{cam__xpt_8c_a64b1b7434225c072f2d9379fe39e359c}{xpt\_setup\_ccb}}(\&new\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}, periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01081}01081                       \mbox{\hyperlink{cam_8h_a4ea5a74a977c69b243128395749ac8e8}{CAM\_PRIORITY\_NONE}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01082}01082 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01083}01083         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01084}01084         \mbox{\hyperlink{cam__periph_8c_a9590854e2c9bfe6a5ba541b1a211d494}{cam\_periph\_hold}}(periph, PRIBIO|PCATCH);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01085}01085         \mbox{\hyperlink{mmc__da_8c_a3f18f2f7a714d1598a4685c21ed6d01c}{sdda\_start\_init}}(context, new\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01086}01086         \mbox{\hyperlink{cam__periph_8c_a87d933ebed78bbf0c6fce590bb487a8d}{cam\_periph\_unhold}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01087}01087         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01088}01088         \mbox{\hyperlink{cam__xpt_8c_af1e7540fc366b5cad2e58f29d1de0f60}{xpt\_free\_ccb}}(new\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01089}01089 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01090}01090 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01091}01091 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01092}\mbox{\hyperlink{mmc__da_8c_a50d8e77934bbc576f94e44e875c3c27c}{01092}} \mbox{\hyperlink{mmc__da_8c_a50d8e77934bbc576f94e44e875c3c27c}{sdda\_set\_bus\_width}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}}, \textcolor{keywordtype}{int} width) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01093}01093         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01094}01094         \textcolor{keyword}{struct} \mbox{\hyperlink{structmmc__params}{mmc\_params}} *mmcp = \&\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01095}01095         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01096}01096 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01097}01097         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sdda\_set\_bus\_width\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01098}01098 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01099}01099         \textcolor{comment}{/* First set for the card, then for the host */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01100}01100         \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_ae502d8099a7956959b6bf93bac0009ad}{CARD\_FEATURE\_MMC}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01101}01101                 uint8\_t value;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01102}01102                 \textcolor{keywordflow}{switch} (width) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01103}01103                 \textcolor{keywordflow}{case} bus\_width\_1:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01104}01104                         value = EXT\_CSD\_BUS\_WIDTH\_1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01105}01105                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01106}01106                 \textcolor{keywordflow}{case} bus\_width\_4:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01107}01107                         value = EXT\_CSD\_BUS\_WIDTH\_4;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01108}01108                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01109}01109                 \textcolor{keywordflow}{case} bus\_width\_8:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01110}01110                         value = EXT\_CSD\_BUS\_WIDTH\_8;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01111}01111                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01112}01112                 \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01113}01113                         panic(\textcolor{stringliteral}{"{}Invalid bus width \%d"{}}, width);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01114}01114                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01115}01115                 err = \mbox{\hyperlink{mmc__da_8c_a06325c7a363bbeba94d73e5a5ed4541a}{mmc\_switch}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{unionccb}{ccb}}, EXT\_CSD\_CMD\_SET\_NORMAL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01116}01116                     EXT\_CSD\_BUS\_WIDTH, value, softc-\/>\mbox{\hyperlink{structsdda__softc_aa4ff982ccca7ceef6e22bfaa821dff2b}{cmd6\_time}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01117}01117         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01118}01118                 \textcolor{comment}{/* For SD cards we send ACMD6 with the required bus width in arg */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01119}01119                 \textcolor{keyword}{struct }mmc\_command cmd;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01120}01120                 memset(\&cmd, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} mmc\_command));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01121}01121                 cmd.opcode = ACMD\_SET\_BUS\_WIDTH;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01122}01122                 cmd.arg = width;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01123}01123                 cmd.flags = MMC\_RSP\_R1 | MMC\_CMD\_AC;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01124}01124                 err = \mbox{\hyperlink{mmc__da_8c_ae363149c29eb51b0329ede8d883d8c1f}{mmc\_exec\_app\_cmd}}(periph, \mbox{\hyperlink{unionccb}{ccb}}, \&cmd);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01125}01125         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01126}01126 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01127}01127         \textcolor{keywordflow}{if} (err != MMC\_ERR\_NONE) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01128}01128                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Error \%d when setting bus width on the card\(\backslash\)n"{}}, err));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01129}01129                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01130}01130         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01131}01131         \textcolor{comment}{/* Now card is done, set the host to the same width */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01132}01132         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__trans__settings__mmc}{ccb\_trans\_settings\_mmc}} *\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01133}01133         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}} = \&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a49ca2523da352ce13d213ca3881a126b}{cts}}.\mbox{\hyperlink{structccb__trans__settings_aeb168f5bdb4329b47397670aae9bd2f9}{proto\_specific}}.\mbox{\hyperlink{structccb__trans__settings_ad24f59699726f62e474172bff48e575e}{mmc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01134}01134         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca809010667fe314b6a4af69f3fef6bc9f}{XPT\_SET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01135}01135         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01136}01136         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01137}01137         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01138}01138         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01139}01139         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a1f09353b8c0689d571387f33c9fb2b4d}{ios}}.bus\_width = width;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01140}01140         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ac6b59dc2e231369e2cf0812ca6208fad}{ios\_valid}} = \mbox{\hyperlink{cam__ccb_8h_aa38ad23eac296a3477d576993b1953aa}{MMC\_BW}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01141}01141         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01142}01142 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01143}01143 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01144}01144 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keyword}{const} \textcolor{keywordtype}{char}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01145}\mbox{\hyperlink{mmc__da_8c_a85aba65193d4c80120dd378fae6c425d}{01145}} *\mbox{\hyperlink{mmc__da_8c_a85aba65193d4c80120dd378fae6c425d}{part\_type}}(u\_int type)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01146}01146 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01147}01147 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01148}01148         \textcolor{keywordflow}{switch} (type) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01149}01149         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_RPMB:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01150}01150                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}RPMB"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01151}01151         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_DEFAULT:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01152}01152                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}default"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01153}01153         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_BOOT0:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01154}01154                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}boot0"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01155}01155         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_BOOT1:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01156}01156                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}boot1"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01157}01157         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_GP0:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01158}01158         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_GP1:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01159}01159         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_GP2:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01160}01160         \textcolor{keywordflow}{case} EXT\_CSD\_PART\_CONFIG\_ACC\_GP3:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01161}01161                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}general purpose"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01162}01162         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01163}01163                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}(unknown type)"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01164}01164         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01165}01165 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01166}01166 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01167}01167 \textcolor{keyword}{static} \textcolor{keyword}{inline} \textcolor{keyword}{const} \textcolor{keywordtype}{char}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01168}\mbox{\hyperlink{mmc__da_8c_aacb0f0c9abaa1d920ea0dda8a530b21c}{01168}} *\mbox{\hyperlink{mmc__da_8c_aacb0f0c9abaa1d920ea0dda8a530b21c}{bus\_width\_str}}(\textcolor{keyword}{enum} mmc\_bus\_width w)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01169}01169 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01170}01170 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01171}01171         \textcolor{keywordflow}{switch} (w) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01172}01172         \textcolor{keywordflow}{case} bus\_width\_1:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01173}01173                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}1-\/bit"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01174}01174         \textcolor{keywordflow}{case} bus\_width\_4:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01175}01175                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}4-\/bit"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01176}01176         \textcolor{keywordflow}{case} bus\_width\_8:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01177}01177                 \textcolor{keywordflow}{return} (\textcolor{stringliteral}{"{}8-\/bit"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01178}01178         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01179}01179                 \_\_assert\_unreachable();}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01180}01180         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01181}01181 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01182}01182 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01183}01183 \textcolor{keyword}{static} uint32\_t}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01184}\mbox{\hyperlink{mmc__da_8c_a8bfa149ef851763cee2f41e0d63854f3}{01184}} \mbox{\hyperlink{mmc__da_8c_a8bfa149ef851763cee2f41e0d63854f3}{sdda\_get\_host\_caps}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01185}01185 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01186}01186         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__trans__settings__mmc}{ccb\_trans\_settings\_mmc}} *\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01187}01187 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01188}01188         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}} = \&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a49ca2523da352ce13d213ca3881a126b}{cts}}.\mbox{\hyperlink{structccb__trans__settings_aeb168f5bdb4329b47397670aae9bd2f9}{proto\_specific}}.\mbox{\hyperlink{structccb__trans__settings_ad24f59699726f62e474172bff48e575e}{mmc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01189}01189 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01190}01190         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca4031c8b4cb9702134c45aee99474c0e7}{XPT\_GET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01191}01191         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01192}01192         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01193}01193         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01194}01194         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01195}01195         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01196}01196 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01197}01197         \textcolor{keywordflow}{if} (\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_abcec535dec8d07473cd2af995bf25d88}{status}} != \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01198}01198                 panic(\textcolor{stringliteral}{"{}Cannot get host caps"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01199}01199         \textcolor{keywordflow}{return} (\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a9496cd8f2246438e52cf20e3c1118fc3}{host\_caps}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01200}01200 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01201}01201 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01202}01202 \textcolor{keyword}{static} uint32\_t}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01203}\mbox{\hyperlink{mmc__da_8c_ad763939d38b49332bb6cccfafa1cec5b}{01203}} \mbox{\hyperlink{mmc__da_8c_ad763939d38b49332bb6cccfafa1cec5b}{sdda\_get\_max\_data}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01204}01204 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01205}01205         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__trans__settings__mmc}{ccb\_trans\_settings\_mmc}} *\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01206}01206 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01207}01207         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}} = \&\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_a49ca2523da352ce13d213ca3881a126b}{cts}}.\mbox{\hyperlink{structccb__trans__settings_aeb168f5bdb4329b47397670aae9bd2f9}{proto\_specific}}.\mbox{\hyperlink{structccb__trans__settings_ad24f59699726f62e474172bff48e575e}{mmc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01208}01208         memset(\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} \mbox{\hyperlink{structccb__trans__settings__mmc}{ccb\_trans\_settings\_mmc}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01209}01209 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01210}01210         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca4031c8b4cb9702134c45aee99474c0e7}{XPT\_GET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01211}01211         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01212}01212         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01213}01213         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01214}01214         \mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01215}01215         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(\mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01216}01216 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01217}01217         \textcolor{keywordflow}{if} (\mbox{\hyperlink{unionccb}{ccb}}-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_abcec535dec8d07473cd2af995bf25d88}{status}} != \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01218}01218                 panic(\textcolor{stringliteral}{"{}Cannot get host max data"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01219}01219         KASSERT(\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ab544c235cdfe6914513d8d9825dda3ab}{host\_max\_data}} != 0, (\textcolor{stringliteral}{"{}host\_max\_data == 0?!"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01220}01220         \textcolor{keywordflow}{return} (\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ab544c235cdfe6914513d8d9825dda3ab}{host\_max\_data}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01221}01221 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01222}01222 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01223}01223 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01224}\mbox{\hyperlink{mmc__da_8c_a3f18f2f7a714d1598a4685c21ed6d01c}{01224}} \mbox{\hyperlink{mmc__da_8c_a3f18f2f7a714d1598a4685c21ed6d01c}{sdda\_start\_init}}(\textcolor{keywordtype}{void} *context, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *start\_ccb)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01225}01225 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01226}01226         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph = (\textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *)context;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01227}01227         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__trans__settings__mmc}{ccb\_trans\_settings\_mmc}} *\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01228}01228         uint32\_t \mbox{\hyperlink{structccb__trans__settings__mmc_a9496cd8f2246438e52cf20e3c1118fc3}{host\_caps}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01229}01229         uint32\_t sec\_count;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01230}01230         \textcolor{keywordtype}{int} err;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01231}01231         \textcolor{keywordtype}{int} \mbox{\hyperlink{structccb__trans__settings__mmc_a85ab4bc3cc6532ad7ff86e50ba0b28b8}{host\_f\_max}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01232}01232         uint8\_t card\_type;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01233}01233 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01234}01234         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sdda\_start\_init\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01235}01235         \textcolor{comment}{/* periph was held for us when this task was enqueued */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01236}01236         \textcolor{keywordflow}{if} ((periph-\/>\mbox{\hyperlink{structcam__periph_adc175e8331b0d9559b02277232bc8c5a}{flags}} \& \mbox{\hyperlink{cam__periph_8h_a102702353fe3915d10c6d66bf5b643a7}{CAM\_PERIPH\_INVALID}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01237}01237                 \mbox{\hyperlink{cam__periph_8c_a7b495eee22da0818e6aec8aa176843b7}{cam\_periph\_release}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01238}01238                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01239}01239         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01240}01240 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01241}01241         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01242}01242         \textcolor{keyword}{struct} \mbox{\hyperlink{structmmc__params}{mmc\_params}} *mmcp = \&\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01243}01243         \textcolor{keyword}{struct} \mbox{\hyperlink{structcam__ed}{cam\_ed}} *device = \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01244}01244 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01245}01245         if (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_ae502d8099a7956959b6bf93bac0009ad}{CARD\_FEATURE\_MMC}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01246}01246                 \mbox{\hyperlink{mmc__da_8c_af2458dfa9a8f9fe937a6a3af8897c51e}{mmc\_decode\_csd\_mmc}}(mmcp-\/>card\_csd, \&softc-\/>\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01247}01247                 \mbox{\hyperlink{mmc__da_8c_a9ac903f67a8e7221134f3dc4608aee10}{mmc\_decode\_cid\_mmc}}(mmcp-\/>card\_cid, \&softc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01248}01248                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) >= 4) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01249}01249                         err = \mbox{\hyperlink{mmc__da_8c_a37f96cfcae8cc75381449caff403006e}{mmc\_send\_ext\_csd}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01250}01250                                                (uint8\_t *)\&softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01251}01251                                                \textcolor{keyword}{sizeof}(softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01252}01252                         \textcolor{keywordflow}{if} (err != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01253}01253                                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01254}01254                                     (\textcolor{stringliteral}{"{}Cannot read EXT\_CSD, err \%d"{}}, err));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01255}01255                                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01256}01256                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01257}01257                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01258}01258         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01259}01259                 \mbox{\hyperlink{mmc__da_8c_a4ad50ed316b31d8776bbc68ccfc68d1a}{mmc\_decode\_csd\_sd}}(mmcp-\/>card\_csd, \&softc-\/>\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01260}01260                 \mbox{\hyperlink{mmc__da_8c_a0ef7cafa6c691ae73bdd230f9e744943}{mmc\_decode\_cid\_sd}}(mmcp-\/>card\_cid, \&softc-\/>\mbox{\hyperlink{structsdda__softc_a4091c5fbff015dd62c97a23a5e7350fa}{cid}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01261}01261         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01262}01262 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01263}01263         softc-\/>\mbox{\hyperlink{structsdda__softc_a33c93c45b410fc3c6b7768c98102dd8a}{sector\_count}} = softc-\/>\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}}.capacity / MMC\_SECTOR\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01264}01264         softc-\/>\mbox{\hyperlink{structsdda__softc_a76e3a40aa21032b790c4ea11613062c1}{mediasize}} = softc-\/>\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}}.capacity;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01265}01265         softc-\/>\mbox{\hyperlink{structsdda__softc_aa4ff982ccca7ceef6e22bfaa821dff2b}{cmd6\_time}} = \mbox{\hyperlink{mmc__da_8c_af98a4c78a4018d532ecfb17dd66321d6}{mmc\_get\_cmd6\_timeout}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01266}01266 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01267}01267         \textcolor{comment}{/* MMC >= 4.x have EXT\_CSD that has its own opinion about capacity */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01268}01268         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) >= 4) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01269}01269                 sec\_count = softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_SEC\_CNT] +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01270}01270                     (softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_SEC\_CNT + 1] << 8) +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01271}01271                     (softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_SEC\_CNT + 2] << 16) +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01272}01272                     (softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_SEC\_CNT + 3] << 24);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01273}01273                 \textcolor{keywordflow}{if} (sec\_count != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01274}01274                         softc-\/>\mbox{\hyperlink{structsdda__softc_a33c93c45b410fc3c6b7768c98102dd8a}{sector\_count}} = sec\_count;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01275}01275                         softc-\/>\mbox{\hyperlink{structsdda__softc_a76e3a40aa21032b790c4ea11613062c1}{mediasize}} = softc-\/>\mbox{\hyperlink{structsdda__softc_a33c93c45b410fc3c6b7768c98102dd8a}{sector\_count}} * MMC\_SECTOR\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01276}01276                         \textcolor{comment}{/* FIXME: there should be a better name for this option...*/}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01277}01277                         mmcp-\/>card\_features |= \mbox{\hyperlink{mmc_8h_a31af3df3316f3816ab8b744fb7dc4444}{CARD\_FEATURE\_SDHC}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01278}01278                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01279}01279         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01280}01280         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01281}01281             (\textcolor{stringliteral}{"{}Capacity: \%"{}}PRIu64\textcolor{stringliteral}{"{}, sectors: \%"{}}PRIu64\textcolor{stringliteral}{"{}\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01282}01282                 softc-\/>\mbox{\hyperlink{structsdda__softc_a76e3a40aa21032b790c4ea11613062c1}{mediasize}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01283}01283                 softc-\/>\mbox{\hyperlink{structsdda__softc_a33c93c45b410fc3c6b7768c98102dd8a}{sector\_count}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01284}01284         \mbox{\hyperlink{mmc__da_8c_aa49508bff9f58d575f1b4d9bbc720209}{mmc\_format\_card\_id\_string}}(softc, mmcp);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01285}01285 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01286}01286         \textcolor{comment}{/* Update info for CAM */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01287}01287         device-\/>serial\_num\_len = strlen(softc-\/>\mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{card\_sn\_string}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01288}01288         device-\/>serial\_num = (u\_int8\_t *)malloc((device-\/>serial\_num\_len + 1),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01289}01289             M\_CAMXPT, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01290}01290         strlcpy(device-\/>serial\_num, softc-\/>\mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{card\_sn\_string}}, device-\/>serial\_num\_len + 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01291}01291 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01292}01292         device-\/>device\_id\_len = strlen(softc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01293}01293         device-\/>device\_id = (u\_int8\_t *)malloc((device-\/>device\_id\_len + 1),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01294}01294             M\_CAMXPT, M\_NOWAIT);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01295}01295         strlcpy(device-\/>device\_id, softc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}}, device-\/>device\_id\_len + 1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01296}01296 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01297}01297         strlcpy(mmcp-\/>model, softc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}}, \textcolor{keyword}{sizeof}(mmcp-\/>model));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01298}01298 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01299}01299         \textcolor{comment}{/* Set the clock frequency that the card can handle */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01300}01300         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}} = \&start\_ccb-\/>\mbox{\hyperlink{unionccb_a49ca2523da352ce13d213ca3881a126b}{cts}}.\mbox{\hyperlink{structccb__trans__settings_aeb168f5bdb4329b47397670aae9bd2f9}{proto\_specific}}.\mbox{\hyperlink{structccb__trans__settings_ad24f59699726f62e474172bff48e575e}{mmc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01301}01301 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01302}01302         \textcolor{comment}{/* First, get the host's max freq */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01303}01303         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca4031c8b4cb9702134c45aee99474c0e7}{XPT\_GET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01304}01304         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01305}01305         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01306}01306         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01307}01307         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01308}01308         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01309}01309 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01310}01310         \textcolor{keywordflow}{if} (start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_abcec535dec8d07473cd2af995bf25d88}{status}} != \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01311}01311                 panic(\textcolor{stringliteral}{"{}Cannot get max host freq"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01312}01312         host\_f\_max = \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a85ab4bc3cc6532ad7ff86e50ba0b28b8}{host\_f\_max}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01313}01313         host\_caps = \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a9496cd8f2246438e52cf20e3c1118fc3}{host\_caps}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01314}01314         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a1f09353b8c0689d571387f33c9fb2b4d}{ios}}.bus\_width != bus\_width\_1)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01315}01315                 panic(\textcolor{stringliteral}{"{}Bus width in ios is not 1-\/bit"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01316}01316 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01317}01317         \textcolor{comment}{/* Now check if the card supports High-\/speed */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01318}01318         softc-\/>\mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{card\_f\_max}} = softc-\/>\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}}.tran\_speed;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01319}01319 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01320}01320         \textcolor{keywordflow}{if} (host\_caps \& \mbox{\hyperlink{cam__ccb_8h_a5ae7c1ae1bc42b34b1623527ac89fd82}{MMC\_CAP\_HSPEED}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01321}01321                 \textcolor{comment}{/* Find out if the card supports High speed timing */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01322}01322                 \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_a98053f314b3afb0f7c08b949346e8eb6}{CARD\_FEATURE\_SD20}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01323}01323                         \textcolor{comment}{/* Get and decode SCR */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01324}01324                         uint32\_t rawscr[2];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01325}01325                         uint8\_t res[64];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01326}01326                         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mmc__da_8c_a37e193887f4339fcfb53e9ca808d92e6}{mmc\_app\_get\_scr}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb, rawscr)) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01327}01327                                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Cannot get SCR\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01328}01328                                 \textcolor{keywordflow}{goto} finish\_hs\_tests;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01329}01329                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01330}01330                         \mbox{\hyperlink{mmc__da_8c_aac9236e348e0be8d058cebc87a0cb25f}{mmc\_app\_decode\_scr}}(rawscr, \&softc-\/>\mbox{\hyperlink{structsdda__softc_ac42292207c96df0922b33765bf1e78bf}{scr}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01331}01331 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01332}01332                         \textcolor{keywordflow}{if} ((softc-\/>\mbox{\hyperlink{structsdda__softc_ac42292207c96df0922b33765bf1e78bf}{scr}}.sda\_vsn >= 1) \&\& (softc-\/>\mbox{\hyperlink{structsdda__softc_a2096181e937ee1b5c8cabade5272a329}{csd}}.ccc \& (1<<10))) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01333}01333                                 \mbox{\hyperlink{mmc__da_8c_a2ba2ba63f47266f0e8ce7cc5e1a3059d}{mmc\_sd\_switch}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb, SD\_SWITCH\_MODE\_CHECK,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01334}01334                                               SD\_SWITCH\_GROUP1, SD\_SWITCH\_NOCHANGE, res);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01335}01335                                 \textcolor{keywordflow}{if} (res[13] \& 2) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01336}01336                                         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Card supports HS\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01337}01337                                         softc-\/>\mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{card\_f\_max}} = SD\_HS\_MAX;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01338}01338                                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01339}01339 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01340}01340                                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01341}01341 \textcolor{comment}{                                 * We deselect then reselect the card here.  Some cards}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01342}01342 \textcolor{comment}{                                 * become unselected and timeout with the above two}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01343}01343 \textcolor{comment}{                                 * commands, although the state tables / diagrams in the}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01344}01344 \textcolor{comment}{                                 * standard suggest they go back to the transfer state.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01345}01345 \textcolor{comment}{                                 * Other cards don't become deselected, and if we}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01346}01346 \textcolor{comment}{                                 * attempt to blindly re-\/select them, we get timeout}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01347}01347 \textcolor{comment}{                                 * errors from some controllers.  So we deselect then}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01348}01348 \textcolor{comment}{                                 * reselect to handle all situations.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01349}01349 \textcolor{comment}{                                 */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01350}01350                                 \mbox{\hyperlink{mmc__da_8c_a62ace3a21edbd3521ad75a4009c5b422}{mmc\_select\_card}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb, 0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01351}01351                                 \mbox{\hyperlink{mmc__da_8c_a62ace3a21edbd3521ad75a4009c5b422}{mmc\_select\_card}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb, \mbox{\hyperlink{mmc__da_8c_af2e6bbe164550dee70250880c23b06d3}{get\_rca}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01352}01352                         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01353}01353                                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Not trying the switch\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01354}01354                                 \textcolor{keywordflow}{goto} finish\_hs\_tests;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01355}01355                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01356}01356                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01357}01357 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01358}01358                 \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_ae502d8099a7956959b6bf93bac0009ad}{CARD\_FEATURE\_MMC}} \&\& \mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) >= 4) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01359}01359                         card\_type = softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_CARD\_TYPE];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01360}01360                         \textcolor{keywordflow}{if} (card\_type \& EXT\_CSD\_CARD\_TYPE\_HS\_52)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01361}01361                                 softc-\/>\mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{card\_f\_max}} = MMC\_TYPE\_HS\_52\_MAX;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01362}01362                         \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (card\_type \& EXT\_CSD\_CARD\_TYPE\_HS\_26)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01363}01363                                 softc-\/>\mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{card\_f\_max}} = MMC\_TYPE\_HS\_26\_MAX;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01364}01364                         \textcolor{keywordflow}{if} ((card\_type \& EXT\_CSD\_CARD\_TYPE\_DDR\_52\_1\_2V) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01365}01365                             (host\_caps \& \mbox{\hyperlink{cam__ccb_8h_a7525a120cfa8001f01fe37eecfdc7718}{MMC\_CAP\_SIGNALING\_120}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01366}01366                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_af72469f1bb8db55cd418c09fa0c460d6}{timings}}, bus\_timing\_mmc\_ddr52);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01367}01367                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_a443c0fc9689ddc77386096fd4da2b4ab}{vccq\_120}}, bus\_timing\_mmc\_ddr52);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01368}01368                                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Card supports DDR52 at 1.2V\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01369}01369                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01370}01370                         \textcolor{keywordflow}{if} ((card\_type \& EXT\_CSD\_CARD\_TYPE\_DDR\_52\_1\_8V) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01371}01371                             (host\_caps \& \mbox{\hyperlink{cam__ccb_8h_a85a2f435922dce3d5076ff418a0d82ee}{MMC\_CAP\_SIGNALING\_180}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01372}01372                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_af72469f1bb8db55cd418c09fa0c460d6}{timings}}, bus\_timing\_mmc\_ddr52);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01373}01373                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_a2a258f28c193e33deab783361af57d5b}{vccq\_180}}, bus\_timing\_mmc\_ddr52);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01374}01374                                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Card supports DDR52 at 1.8V\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01375}01375                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01376}01376                         \textcolor{keywordflow}{if} ((card\_type \& EXT\_CSD\_CARD\_TYPE\_HS200\_1\_2V) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01377}01377                             (host\_caps \& \mbox{\hyperlink{cam__ccb_8h_a7525a120cfa8001f01fe37eecfdc7718}{MMC\_CAP\_SIGNALING\_120}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01378}01378                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_af72469f1bb8db55cd418c09fa0c460d6}{timings}}, bus\_timing\_mmc\_hs200);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01379}01379                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_a443c0fc9689ddc77386096fd4da2b4ab}{vccq\_120}}, bus\_timing\_mmc\_hs200);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01380}01380                                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Card supports HS200 at 1.2V\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01381}01381                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01382}01382                         \textcolor{keywordflow}{if} ((card\_type \& EXT\_CSD\_CARD\_TYPE\_HS200\_1\_8V) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01383}01383                             (host\_caps \& \mbox{\hyperlink{cam__ccb_8h_a85a2f435922dce3d5076ff418a0d82ee}{MMC\_CAP\_SIGNALING\_180}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01384}01384                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_af72469f1bb8db55cd418c09fa0c460d6}{timings}}, bus\_timing\_mmc\_hs200);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01385}01385                                 setbit(\&softc-\/>\mbox{\hyperlink{structsdda__softc_a2a258f28c193e33deab783361af57d5b}{vccq\_180}}, bus\_timing\_mmc\_hs200);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01386}01386                                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Card supports HS200 at 1.8V\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01387}01387                         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01388}01388                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01389}01389         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01390}01390         \textcolor{keywordtype}{int} f\_max;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01391}01391 finish\_hs\_tests:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01392}01392         f\_max = min(host\_f\_max, softc-\/>\mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{card\_f\_max}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01393}01393         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}}, (\textcolor{stringliteral}{"{}Set SD freq to \%d MHz (min out of host f=\%d MHz and card f=\%d MHz)\(\backslash\)n"{}}, f\_max  / 1000000, host\_f\_max / 1000000, softc-\/>\mbox{\hyperlink{structsdda__softc_a3748e68de2cf29aeebd297918a6c3902}{card\_f\_max}} / 1000000));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01394}01394 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01395}01395         \textcolor{comment}{/* Enable high-\/speed timing on the card */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01396}01396         \textcolor{keywordflow}{if} (f\_max > 25000000) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01397}01397                 err = \mbox{\hyperlink{mmc__da_8c_a1d1855d018d4233f814999244229e2a1}{mmc\_set\_timing}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb, bus\_timing\_hs);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01398}01398                 \textcolor{keywordflow}{if} (err != MMC\_ERR\_NONE) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01399}01399                         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}Cannot switch card to high-\/speed mode"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01400}01400                         f\_max = 25000000;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01401}01401                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01402}01402         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01403}01403         \textcolor{comment}{/* If possible, set lower-\/level signaling */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01404}01404         \textcolor{keyword}{enum} mmc\_bus\_timing timing;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01405}01405         \textcolor{comment}{/* FIXME: MMCCAM supports max. bus\_timing\_mmc\_ddr52 at the moment. */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01406}01406         \textcolor{keywordflow}{for} (timing = bus\_timing\_mmc\_ddr52; timing > bus\_timing\_normal; timing-\/-\/) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01407}01407                 \textcolor{keywordflow}{if} (isset(\&softc-\/>\mbox{\hyperlink{structsdda__softc_a443c0fc9689ddc77386096fd4da2b4ab}{vccq\_120}}, timing)) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01408}01408                         \textcolor{comment}{/* Set VCCQ = 1.2V */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01409}01409                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca809010667fe314b6a4af69f3fef6bc9f}{XPT\_SET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01410}01410                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01411}01411                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01412}01412                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01413}01413                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01414}01414                         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a1f09353b8c0689d571387f33c9fb2b4d}{ios}}.vccq = \mbox{\hyperlink{structsdda__softc_a443c0fc9689ddc77386096fd4da2b4ab}{vccq\_120}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01415}01415                         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ac6b59dc2e231369e2cf0812ca6208fad}{ios\_valid}} = \mbox{\hyperlink{cam__ccb_8h_a56cd197f703b8d6a785f01c7f1146a3d}{MMC\_VCCQ}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01416}01416                         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01417}01417                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01418}01418                 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (isset(\&softc-\/>\mbox{\hyperlink{structsdda__softc_a2a258f28c193e33deab783361af57d5b}{vccq\_180}}, timing)) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01419}01419                         \textcolor{comment}{/* Set VCCQ = 1.8V */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01420}01420                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca809010667fe314b6a4af69f3fef6bc9f}{XPT\_SET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01421}01421                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01422}01422                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01423}01423                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01424}01424                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01425}01425                         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a1f09353b8c0689d571387f33c9fb2b4d}{ios}}.vccq = \mbox{\hyperlink{structsdda__softc_a2a258f28c193e33deab783361af57d5b}{vccq\_180}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01426}01426                         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ac6b59dc2e231369e2cf0812ca6208fad}{ios\_valid}} = \mbox{\hyperlink{cam__ccb_8h_a56cd197f703b8d6a785f01c7f1146a3d}{MMC\_VCCQ}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01427}01427                         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01428}01428                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01429}01429                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01430}01430                         \textcolor{comment}{/* Set VCCQ = 3.3V */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01431}01431                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca809010667fe314b6a4af69f3fef6bc9f}{XPT\_SET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01432}01432                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01433}01433                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01434}01434                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01435}01435                         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01436}01436                         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a1f09353b8c0689d571387f33c9fb2b4d}{ios}}.vccq = vccq\_330;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01437}01437                         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ac6b59dc2e231369e2cf0812ca6208fad}{ios\_valid}} = \mbox{\hyperlink{cam__ccb_8h_a56cd197f703b8d6a785f01c7f1146a3d}{MMC\_VCCQ}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01438}01438                         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01439}01439                         \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01440}01440                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01441}01441         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01442}01442 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01443}01443         \textcolor{comment}{/* Set frequency on the controller */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01444}01444         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca809010667fe314b6a4af69f3fef6bc9f}{XPT\_SET\_TRAN\_SETTINGS}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01445}01445         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a17c5461f834828a5af4980b5ac3a375d}{CAM\_DIR\_NONE}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01446}01446         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01447}01447         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 100;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01448}01448         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = NULL;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01449}01449         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_a1f09353b8c0689d571387f33c9fb2b4d}{ios}}.clock = f\_max;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01450}01450         \mbox{\hyperlink{mmc__sim__if_8m_aaa2434533339a541b323777f3b4d1ea9}{cts}}-\/>\mbox{\hyperlink{structccb__trans__settings__mmc_ac6b59dc2e231369e2cf0812ca6208fad}{ios\_valid}} = \mbox{\hyperlink{cam__ccb_8h_aeaab2f0099f6495fa5b2911d9fa8f794}{MMC\_CLK}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01451}01451         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01452}01452 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01453}01453         \textcolor{comment}{/* Set bus width */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01454}01454         \textcolor{keyword}{enum} mmc\_bus\_width desired\_bus\_width = bus\_width\_1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01455}01455         \textcolor{keyword}{enum} mmc\_bus\_width max\_host\_bus\_width =}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01456}01456                 (host\_caps \& \mbox{\hyperlink{cam__ccb_8h_a96547493dbe2a6f390b0d0275956f374}{MMC\_CAP\_8\_BIT\_DATA}} ? bus\_width\_8 :}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01457}01457                  host\_caps \& \mbox{\hyperlink{cam__ccb_8h_a02a164d7aa1fd7b8114d8c4445cad464}{MMC\_CAP\_4\_BIT\_DATA}} ? bus\_width\_4 : bus\_width\_1);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01458}01458         \textcolor{keyword}{enum} mmc\_bus\_width max\_card\_bus\_width = bus\_width\_1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01459}01459         \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_a98053f314b3afb0f7c08b949346e8eb6}{CARD\_FEATURE\_SD20}} \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01460}01460             softc-\/>\mbox{\hyperlink{structsdda__softc_ac42292207c96df0922b33765bf1e78bf}{scr}}.bus\_widths \& SD\_SCR\_BUS\_WIDTH\_4)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01461}01461                 max\_card\_bus\_width = bus\_width\_4;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01462}01462         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01463}01463 \textcolor{comment}{         * Unlike SD, MMC cards don't have any information about supported bus width...}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01464}01464 \textcolor{comment}{         * So we need to perform read/write test to find out the width.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01465}01465 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01466}01466         \textcolor{comment}{/* TODO: figure out bus width for MMC; use 8-\/bit for now (to test on BBB) */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01467}01467         \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_ae502d8099a7956959b6bf93bac0009ad}{CARD\_FEATURE\_MMC}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01468}01468                 max\_card\_bus\_width = bus\_width\_8;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01469}01469 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01470}01470         desired\_bus\_width = min(max\_host\_bus\_width, max\_card\_bus\_width);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01471}01471         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01472}01472                   (\textcolor{stringliteral}{"{}Set bus width to \%s (min of host \%s and card \%s)\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01473}01473                    \mbox{\hyperlink{mmc__da_8c_aacb0f0c9abaa1d920ea0dda8a530b21c}{bus\_width\_str}}(desired\_bus\_width),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01474}01474                    \mbox{\hyperlink{mmc__da_8c_aacb0f0c9abaa1d920ea0dda8a530b21c}{bus\_width\_str}}(max\_host\_bus\_width),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01475}01475                    \mbox{\hyperlink{mmc__da_8c_aacb0f0c9abaa1d920ea0dda8a530b21c}{bus\_width\_str}}(max\_card\_bus\_width)));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01476}01476         \mbox{\hyperlink{mmc__da_8c_a50d8e77934bbc576f94e44e875c3c27c}{sdda\_set\_bus\_width}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb, desired\_bus\_width);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01477}01477 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01478}01478         softc-\/>\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}} = \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a65267511ec89d2d6d8f0a712bdacde73}{SDDA\_STATE\_NORMAL}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01479}01479 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01480}01480         \mbox{\hyperlink{cam__periph_8c_a87d933ebed78bbf0c6fce590bb487a8d}{cam\_periph\_unhold}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01481}01481         \textcolor{comment}{/* MMC partitions support */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01482}01482         \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_ae502d8099a7956959b6bf93bac0009ad}{CARD\_FEATURE\_MMC}} \&\& \mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) >= 4) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01483}01483                 \mbox{\hyperlink{mmc__da_8c_a4de14e34fa35caf3c2b67a4d2dc6562a}{sdda\_process\_mmc\_partitions}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01484}01484         \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_a6ca3cddf29f29482728a3e1be1604435}{CARD\_FEATURE\_MEMORY}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01485}01485                 \textcolor{comment}{/* For SD[HC] cards, just add one partition that is the whole card */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01486}01486                 \textcolor{keywordflow}{if} (\mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, 0, \textcolor{stringliteral}{"{}sdda"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01487}01487                     \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a2b4a50e233de9e726afe3e7e85e63960}{unit\_number}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01488}01488                     \mbox{\hyperlink{mmc__da_8c_a1bfcf14f4533a7a7485f6dc9caefa8e2}{mmc\_get\_media\_size}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01489}01489                     \mbox{\hyperlink{mmc__da_8c_a1dc4d0cab4b0bac94689eecbd21e813c}{sdda\_get\_read\_only}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb)) == \textcolor{keyword}{false})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01490}01490                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01491}01491                 softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01492}01492         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01493}01493         \mbox{\hyperlink{cam__periph_8c_a9590854e2c9bfe6a5ba541b1a211d494}{cam\_periph\_hold}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, PRIBIO|PCATCH);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01494}01494 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01495}01495         \mbox{\hyperlink{cam__xpt_8c_a62eab2d96b6a86a325df1d826c201746}{xpt\_announce\_periph}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, softc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01496}01496         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01497}01497 \textcolor{comment}{         * Add async callbacks for bus reset and bus device reset calls.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01498}01498 \textcolor{comment}{         * I don't bother checking if this fails as, in most cases,}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01499}01499 \textcolor{comment}{         * the system will function just fine without them and the only}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01500}01500 \textcolor{comment}{         * alternative would be to not attach the device on failure.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01501}01501 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01502}01502         \mbox{\hyperlink{cam__xpt_8c_a8307586c12fb4774768a25a1fa4e6388}{xpt\_register\_async}}(\mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0ac3008f99f93ca1448f9c8705b1653da5}{AC\_LOST\_DEVICE}} | \mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0a761c3deb864c8b47c8123ee11a113df6}{AC\_GETDEV\_CHANGED}} |}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01503}01503             \mbox{\hyperlink{cam__ccb_8h_a01187b765c0d47bdbc0776db5c5851f0a036a366f13e05e75d85915311d7acaf4}{AC\_ADVINFO\_CHANGED}}, \mbox{\hyperlink{mmc__da_8c_aa8afafa82880a055578509ca212bc2e9}{sddaasync}}, \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01504}01504 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01505}01505 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01506}01506 \textcolor{keyword}{static} \textcolor{keywordtype}{bool}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01507}\mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{01507}} \mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, u\_int type, \textcolor{keyword}{const} \textcolor{keywordtype}{char} *name,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01508}01508     u\_int cnt, off\_t media\_size, \textcolor{keywordtype}{bool} ro)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01509}01509 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01510}01510         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *sc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01511}01511         \textcolor{keyword}{struct} \mbox{\hyperlink{structsdda__part}{sdda\_part}} *\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01512}01512         \textcolor{keyword}{struct} \mbox{\hyperlink{structccb__pathinq}{ccb\_pathinq}} cpi;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01513}01513 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01514}01514         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01515}01515             (\textcolor{stringliteral}{"{}Partition type '\%s', size \%ju \%s\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01516}01516             \mbox{\hyperlink{mmc__da_8c_a85aba65193d4c80120dd378fae6c425d}{part\_type}}(type),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01517}01517             media\_size,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01518}01518             ro ? \textcolor{stringliteral}{"{}(read-\/only)"{}} : \textcolor{stringliteral}{"{}"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01519}01519 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01520}01520         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = sc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[type] = malloc(\textcolor{keyword}{sizeof}(*\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}), M\_DEVBUF,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01521}01521             M\_NOWAIT | M\_ZERO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01522}01522         \textcolor{keywordflow}{if} (\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} == NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01523}01523                 printf(\textcolor{stringliteral}{"{}Cannot add partition for sdda\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01524}01524                 \textcolor{keywordflow}{return} (\textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01525}01525         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01526}01526 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01527}01527         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_ae319d756b3bf72ce9d239c4d2e887a68}{cnt}} = cnt;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01528}01528         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aab504c5f3a9bc3c4d8f7037e46a1f4e2}{type}} = type;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01529}01529         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_a7a567cfda5b6505b65283807b71bfb08}{ro}} = ro;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01530}01530         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}} = sc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01531}01531         snprintf(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aaece6e5bc2f0057802633b0e7e7b342f}{name}}, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aaece6e5bc2f0057802633b0e7e7b342f}{name}}), name, \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a2b4a50e233de9e726afe3e7e85e63960}{unit\_number}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01532}01532 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01533}01533         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01534}01534 \textcolor{comment}{         * Due to the nature of RPMB partition it doesn't make much sense}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01535}01535 \textcolor{comment}{         * to add it as a disk. It would be more appropriate to create a}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01536}01536 \textcolor{comment}{         * userland tool to operate on the partition or leverage the existing}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01537}01537 \textcolor{comment}{         * tools from sysutils/mmc-\/utils.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01538}01538 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01539}01539         \textcolor{keywordflow}{if} (type == EXT\_CSD\_PART\_CONFIG\_ACC\_RPMB) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01540}01540                 \textcolor{comment}{/* TODO: Create device, assign IOCTL handler */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01541}01541                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01542}01542                     (\textcolor{stringliteral}{"{}Don't know what to do with RPMB partitions yet\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01543}01543                 \textcolor{keywordflow}{return} (\textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01544}01544         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01545}01545 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01546}01546         bioq\_init(\&\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01547}01547 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01548}01548         bzero(\&cpi, \textcolor{keyword}{sizeof}(cpi));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01549}01549         \mbox{\hyperlink{cam__xpt_8c_a64b1b7434225c072f2d9379fe39e359c}{xpt\_setup\_ccb}}(\&cpi.ccb\_h, \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam_8h_a4ea5a74a977c69b243128395749ac8e8}{CAM\_PRIORITY\_NONE}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01550}01550         cpi.ccb\_h.func\_code = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055cad34c7b5cb68e0ed050bc95a55cd87f7c}{XPT\_PATH\_INQ}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01551}01551         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}((\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *)\&cpi);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01552}01552 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01553}01553         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01554}01554 \textcolor{comment}{         * Register this media as a disk}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01555}01555 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01556}01556         (void)\mbox{\hyperlink{cam__periph_8c_a9590854e2c9bfe6a5ba541b1a211d494}{cam\_periph\_hold}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, PRIBIO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01557}01557         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01558}01558 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01559}01559         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}} = disk\_alloc();}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01560}01560         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_rotation\_rate = DISK\_RR\_NON\_ROTATING;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01561}01561         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_devstat = devstat\_new\_entry(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aaece6e5bc2f0057802633b0e7e7b342f}{name}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01562}01562             cnt, MMC\_SECTOR\_SIZE,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01563}01563             DEVSTAT\_ALL\_SUPPORTED,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01564}01564             DEVSTAT\_TYPE\_DIRECT | \mbox{\hyperlink{cam__ccb_8h_ab208430ee4ee01798ab512f38fc0cc7b}{XPORT\_DEVSTAT\_TYPE}}(cpi.transport),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01565}01565             DEVSTAT\_PRIORITY\_DISK);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01566}01566 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01567}01567         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_open = \mbox{\hyperlink{mmc__da_8c_a404d229edf232e03e26f1d7ce2156f9a}{sddaopen}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01568}01568         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_close = \mbox{\hyperlink{mmc__da_8c_a070c1034125292713ff2f3405985f715}{sddaclose}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01569}01569         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_strategy = \mbox{\hyperlink{mmc__da_8c_a7ef57618aff8b2a42229ba2e342e7d24}{sddastrategy}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01570}01570         \textcolor{keywordflow}{if} (\mbox{\hyperlink{cam__sim_8h_af3361015d6b660c5bf73f9164aa94311}{cam\_sim\_pollable}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ae0ed229feb41014e5b15ce2223a9c56d}{sim}}))}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01571}01571                 \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_dump = \mbox{\hyperlink{mmc__da_8c_a17f0fde6552e61d09ae1b57da22cac83}{sddadump}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01572}01572         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_getattr = \mbox{\hyperlink{mmc__da_8c_a27b3d9b0bd88da7e2628357427376dad}{sddagetattr}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01573}01573         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_gone = \mbox{\hyperlink{mmc__da_8c_a38188db7344833167308937a2195a837}{sddadiskgonecb}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01574}01574         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_name = \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aaece6e5bc2f0057802633b0e7e7b342f}{name}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01575}01575         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_drv1 = \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01576}01576         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_maxsize =}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01577}01577             MIN(maxphys, \mbox{\hyperlink{mmc__da_8c_ad763939d38b49332bb6cccfafa1cec5b}{sdda\_get\_max\_data}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01578}01578                     (\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *)\&cpi) * \mbox{\hyperlink{mmc__da_8c_a1680d0fdb2e480b983f44bd31e6f1949}{mmc\_get\_sector\_size}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01579}01579         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_unit = cnt;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01580}01580         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_flags = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01581}01581         strlcpy(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_descr, sc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01582}01582             MIN(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_descr), \textcolor{keyword}{sizeof}(sc-\/>\mbox{\hyperlink{structsdda__softc_ae213e31de23baca81d1383e4ce6692fa}{card\_id\_string}})));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01583}01583         strlcpy(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_ident, sc-\/>\mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{card\_sn\_string}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01584}01584             MIN(\textcolor{keyword}{sizeof}(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_ident), \textcolor{keyword}{sizeof}(sc-\/>\mbox{\hyperlink{structsdda__softc_aad3d4f26537c488b8e84222a82c474d7}{card\_sn\_string}})));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01585}01585         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_hba\_vendor = cpi.hba\_vendor;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01586}01586         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_hba\_device = cpi.hba\_device;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01587}01587         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_hba\_subvendor = cpi.hba\_subvendor;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01588}01588         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_hba\_subdevice = cpi.hba\_subdevice;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01589}01589         snprintf(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_attachment, \textcolor{keyword}{sizeof}(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_attachment),}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01590}01590             \textcolor{stringliteral}{"{}\%s\%d"{}}, cpi.dev\_name, cpi.unit\_number);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01591}01591 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01592}01592         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_sectorsize = \mbox{\hyperlink{mmc__da_8c_a1680d0fdb2e480b983f44bd31e6f1949}{mmc\_get\_sector\_size}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01593}01593         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_mediasize = media\_size;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01594}01594         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_stripesize = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01595}01595         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_fwsectors = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01596}01596         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}-\/>d\_fwheads = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01597}01597 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01598}01598         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mmc__da_8c_a00f29e2433cced208cbe3eb6c6068304}{sdda\_mmcsd\_compat}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01599}01599                 disk\_add\_alias(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}, \textcolor{stringliteral}{"{}mmcsd"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01600}01600 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01601}01601         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01602}01602 \textcolor{comment}{         * Acquire a reference to the periph before we register with GEOM.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01603}01603 \textcolor{comment}{         * We'll release this reference once GEOM calls us back (via}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01604}01604 \textcolor{comment}{         * sddadiskgonecb()) telling us that our provider has been freed.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01605}01605 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01606}01606         \textcolor{keywordflow}{if} (\mbox{\hyperlink{cam__periph_8c_a5b3dbda06d83cc62f5ba1be9622efa4b}{cam\_periph\_acquire}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01607}01607                 \mbox{\hyperlink{cam__xpt_8c_a342b8e2ed77d0b7a12ae7bc49dd2beac}{xpt\_print}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \textcolor{stringliteral}{"{}\%s: lost periph during "{}}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01608}01608                     \textcolor{stringliteral}{"{}registration!\(\backslash\)n"{}}, \_\_func\_\_);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01609}01609                 \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01610}01610                 \textcolor{keywordflow}{return} (\textcolor{keyword}{false});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01611}01611         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01612}01612         disk\_create(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_aa4926df315b5c23801ada4241e59e4ff}{disk}}, DISK\_VERSION);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01613}01613         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01614}01614         \mbox{\hyperlink{cam__periph_8c_a87d933ebed78bbf0c6fce590bb487a8d}{cam\_periph\_unhold}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01615}01615 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01616}01616         \textcolor{keywordflow}{return} (\textcolor{keyword}{true});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01617}01617 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01618}01618 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01619}01619 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01620}01620 \textcolor{comment}{ * For MMC cards, process EXT\_CSD and add partitions that are supported by}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01621}01621 \textcolor{comment}{ * this device.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01622}01622 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01623}01623 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01624}\mbox{\hyperlink{mmc__da_8c_a4de14e34fa35caf3c2b67a4d2dc6562a}{01624}} \mbox{\hyperlink{mmc__da_8c_a4de14e34fa35caf3c2b67a4d2dc6562a}{sdda\_process\_mmc\_partitions}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01625}01625 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01626}01626         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *sc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01627}01627         \textcolor{keyword}{struct} \mbox{\hyperlink{structmmc__params}{mmc\_params}} *mmcp = \&\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01628}01628         off\_t erase\_size, sector\_size, size, wp\_size;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01629}01629         \textcolor{keywordtype}{int} i;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01630}01630         \textcolor{keyword}{const} uint8\_t *ext\_csd;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01631}01631         uint8\_t rev;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01632}01632         \textcolor{keywordtype}{bool} comp, ro;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01633}01633 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01634}01634         ext\_csd = sc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01635}01635 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01636}01636         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01637}01637 \textcolor{comment}{         * Enhanced user data area and general purpose partitions are only}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01638}01638 \textcolor{comment}{         * supported in revision 1.4 (EXT\_CSD\_REV == 4) and later, the RPMB}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01639}01639 \textcolor{comment}{         * partition in revision 1.5 (MMC v4.41, EXT\_CSD\_REV == 5) and later.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01640}01640 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01641}01641         rev = ext\_csd[EXT\_CSD\_REV];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01642}01642 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01643}01643         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01644}01644 \textcolor{comment}{         * Ignore user-\/creatable enhanced user data area and general purpose}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01645}01645 \textcolor{comment}{         * partitions partitions as long as partitioning hasn't been finished.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01646}01646 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01647}01647         comp = (ext\_csd[EXT\_CSD\_PART\_SET] \& EXT\_CSD\_PART\_SET\_COMPLETED) != 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01648}01648 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01649}01649         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01650}01650 \textcolor{comment}{         * Add enhanced user data area slice, unless it spans the entirety of}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01651}01651 \textcolor{comment}{         * the user data area.  The enhanced area is of a multiple of high}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01652}01652 \textcolor{comment}{         * capacity write protect groups ((ERASE\_GRP\_SIZE + HC\_WP\_GRP\_SIZE) *}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01653}01653 \textcolor{comment}{         * 512 KB) and its offset given in either sectors or bytes, depending}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01654}01654 \textcolor{comment}{         * on whether it's a high capacity device or not.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01655}01655 \textcolor{comment}{         * NB: The slicer and its slices need to be registered before adding}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01656}01656 \textcolor{comment}{         *     the disk for the corresponding user data area as re-\/tasting is}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01657}01657 \textcolor{comment}{         *     racy.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01658}01658 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01659}01659         sector\_size = \mbox{\hyperlink{mmc__da_8c_a1680d0fdb2e480b983f44bd31e6f1949}{mmc\_get\_sector\_size}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01660}01660         size = ext\_csd[EXT\_CSD\_ENH\_SIZE\_MULT] +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01661}01661                 (ext\_csd[EXT\_CSD\_ENH\_SIZE\_MULT + 1] << 8) +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01662}01662                 (ext\_csd[EXT\_CSD\_ENH\_SIZE\_MULT + 2] << 16);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01663}01663         \textcolor{keywordflow}{if} (rev >= 4 \&\& comp == TRUE \&\& size > 0 \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01664}01664             (ext\_csd[EXT\_CSD\_PART\_SUPPORT] \&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01665}01665                 EXT\_CSD\_PART\_SUPPORT\_ENH\_ATTR\_EN) != 0 \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01666}01666             (ext\_csd[EXT\_CSD\_PART\_ATTR] \& (EXT\_CSD\_PART\_ATTR\_ENH\_USR)) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01667}01667                 erase\_size = ext\_csd[EXT\_CSD\_ERASE\_GRP\_SIZE] * 1024 *}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01668}01668                         MMC\_SECTOR\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01669}01669                 wp\_size = ext\_csd[EXT\_CSD\_HC\_WP\_GRP\_SIZE];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01670}01670                 size *= erase\_size * wp\_size;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01671}01671                 \textcolor{keywordflow}{if} (size != \mbox{\hyperlink{mmc__da_8c_a1bfcf14f4533a7a7485f6dc9caefa8e2}{mmc\_get\_media\_size}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) * sector\_size) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01672}01672                         sc-\/>\mbox{\hyperlink{structsdda__softc_a591a23e40a23eabd5618949711ee4d3b}{enh\_size}} = size;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01673}01673                         sc-\/>\mbox{\hyperlink{structsdda__softc_ac427673f1398183d25b0f03c6a81d918}{enh\_base}} = (ext\_csd[EXT\_CSD\_ENH\_START\_ADDR] +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01674}01674                             (ext\_csd[EXT\_CSD\_ENH\_START\_ADDR + 1] << 8) +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01675}01675                             (ext\_csd[EXT\_CSD\_ENH\_START\_ADDR + 2] << 16) +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01676}01676                             (ext\_csd[EXT\_CSD\_ENH\_START\_ADDR + 3] << 24)) *}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01677}01677                                 ((mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_a31af3df3316f3816ab8b744fb7dc4444}{CARD\_FEATURE\_SDHC}}) ? 1: MMC\_SECTOR\_SIZE);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01678}01678                 \} \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01679}01679                         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01680}01680                             (\textcolor{stringliteral}{"{}enhanced user data area spans entire device"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01681}01681         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01682}01682 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01683}01683         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01684}01684 \textcolor{comment}{         * Add default partition.  This may be the only one or the user}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01685}01685 \textcolor{comment}{         * data area in case partitions are supported.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01686}01686 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01687}01687         ro = \mbox{\hyperlink{mmc__da_8c_a1dc4d0cab4b0bac94689eecbd21e813c}{sdda\_get\_read\_only}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{unionccb}{ccb}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01688}01688         \mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, EXT\_CSD\_PART\_CONFIG\_ACC\_DEFAULT, \textcolor{stringliteral}{"{}sdda"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01689}01689             \mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a2b4a50e233de9e726afe3e7e85e63960}{unit\_number}}, \mbox{\hyperlink{mmc__da_8c_a1bfcf14f4533a7a7485f6dc9caefa8e2}{mmc\_get\_media\_size}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}), ro);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01690}01690         sc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}} = EXT\_CSD\_PART\_CONFIG\_ACC\_DEFAULT;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01691}01691 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01692}01692         \textcolor{keywordflow}{if} (\mbox{\hyperlink{mmc__da_8c_a0ef9ef90fb7c71c6fee6f14664731340}{mmc\_get\_spec\_vers}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}) < 3)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01693}01693                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01694}01694 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01695}01695         \textcolor{comment}{/* Belatedly announce enhanced user data slice. */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01696}01696         \textcolor{keywordflow}{if} (sc-\/>\mbox{\hyperlink{structsdda__softc_a591a23e40a23eabd5618949711ee4d3b}{enh\_size}} != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01697}01697                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01698}01698                     (\textcolor{stringliteral}{"{}enhanced user data area off 0x\%jx size \%ju bytes\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01699}01699                         sc-\/>\mbox{\hyperlink{structsdda__softc_ac427673f1398183d25b0f03c6a81d918}{enh\_base}}, sc-\/>\mbox{\hyperlink{structsdda__softc_a591a23e40a23eabd5618949711ee4d3b}{enh\_size}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01700}01700         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01701}01701 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01702}01702         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01703}01703 \textcolor{comment}{         * Determine partition switch timeout (provided in units of 10 ms)}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01704}01704 \textcolor{comment}{         * and ensure it's at least 300 ms as some eMMC chips lie.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01705}01705 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01706}01706         sc-\/>\mbox{\hyperlink{structsdda__softc_aa60874e87a5277db0918b1eeb6cd4844}{part\_time}} = max(ext\_csd[EXT\_CSD\_PART\_SWITCH\_TO] * 10 * 1000,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01707}01707             300 * 1000);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01708}01708 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01709}01709         \textcolor{comment}{/* Add boot partitions, which are of a fixed multiple of 128 KB. */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01710}01710         size = ext\_csd[EXT\_CSD\_BOOT\_SIZE\_MULT] * MMC\_BOOT\_RPMB\_BLOCK\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01711}01711         \textcolor{keywordflow}{if} (size > 0 \&\& (\mbox{\hyperlink{mmc__da_8c_a8bfa149ef851763cee2f41e0d63854f3}{sdda\_get\_host\_caps}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{unionccb}{ccb}}) \& \mbox{\hyperlink{cam__ccb_8h_a7cf60629adaef73615efb65cd9c1b9b3}{MMC\_CAP\_BOOT\_NOACC}}) == 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01712}01712                 \mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, EXT\_CSD\_PART\_CONFIG\_ACC\_BOOT0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01713}01713                     \mbox{\hyperlink{mmc__da_8c_aa269737b9a401b8f1647612e0fd0824d}{SDDA\_FMT\_BOOT}}, 0, size,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01714}01714                     ro | ((ext\_csd[EXT\_CSD\_BOOT\_WP\_STATUS] \&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01715}01715                     EXT\_CSD\_BOOT\_WP\_STATUS\_BOOT0\_MASK) != 0));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01716}01716                 \mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, EXT\_CSD\_PART\_CONFIG\_ACC\_BOOT1,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01717}01717                     \mbox{\hyperlink{mmc__da_8c_aa269737b9a401b8f1647612e0fd0824d}{SDDA\_FMT\_BOOT}}, 1, size,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01718}01718                     ro | ((ext\_csd[EXT\_CSD\_BOOT\_WP\_STATUS] \&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01719}01719                     EXT\_CSD\_BOOT\_WP\_STATUS\_BOOT1\_MASK) != 0));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01720}01720         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01721}01721 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01722}01722         \textcolor{comment}{/* Add RPMB partition, which also is of a fixed multiple of 128 KB. */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01723}01723         size = ext\_csd[EXT\_CSD\_RPMB\_MULT] * MMC\_BOOT\_RPMB\_BLOCK\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01724}01724         \textcolor{keywordflow}{if} (rev >= 5 \&\& size > 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01725}01725                 \mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, EXT\_CSD\_PART\_CONFIG\_ACC\_RPMB,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01726}01726                     \mbox{\hyperlink{mmc__da_8c_a55f26af384a86289d0dace66c95cb80f}{SDDA\_FMT\_RPMB}}, 0, size, ro);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01727}01727 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01728}01728         \textcolor{keywordflow}{if} (rev <= 3 || comp == FALSE)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01729}01729                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01730}01730 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01731}01731         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01732}01732 \textcolor{comment}{         * Add general purpose partitions, which are of a multiple of high}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01733}01733 \textcolor{comment}{         * capacity write protect groups, too.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01734}01734 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01735}01735         \textcolor{keywordflow}{if} ((ext\_csd[EXT\_CSD\_PART\_SUPPORT] \& EXT\_CSD\_PART\_SUPPORT\_EN) != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01736}01736                 erase\_size = ext\_csd[EXT\_CSD\_ERASE\_GRP\_SIZE] * 1024 *}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01737}01737                         MMC\_SECTOR\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01738}01738                 wp\_size = ext\_csd[EXT\_CSD\_HC\_WP\_GRP\_SIZE];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01739}01739                 \textcolor{keywordflow}{for} (i = 0; i < MMC\_PART\_GP\_MAX; i++) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01740}01740                         size = ext\_csd[EXT\_CSD\_GP\_SIZE\_MULT + i * 3] +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01741}01741                                 (ext\_csd[EXT\_CSD\_GP\_SIZE\_MULT + i * 3 + 1] << 8) +}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01742}01742                                 (ext\_csd[EXT\_CSD\_GP\_SIZE\_MULT + i * 3 + 2] << 16);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01743}01743                         \textcolor{keywordflow}{if} (size == 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01744}01744                                 \textcolor{keywordflow}{continue};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01745}01745                         \mbox{\hyperlink{mmc__da_8c_ab83d20b659bb3230450ddb2571860a4d}{sdda\_add\_part}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, EXT\_CSD\_PART\_CONFIG\_ACC\_GP0 + i,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01746}01746                             \mbox{\hyperlink{mmc__da_8c_a44db5cbd665d3c32f476ce160c3afb8a}{SDDA\_FMT\_GP}}, i, size * erase\_size * wp\_size, ro);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01747}01747                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01748}01748         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01749}01749 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01750}01750 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01751}01751 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01752}01752 \textcolor{comment}{ * We cannot just call mmc\_switch() since it will sleep, and we are in}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01753}01753 \textcolor{comment}{ * GEOM context and cannot sleep. Instead, create an MMCIO request to switch}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01754}01754 \textcolor{comment}{ * partitions and send it to h/w, and upon completion resume processing}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01755}01755 \textcolor{comment}{ * the I/O queue.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01756}01756 \textcolor{comment}{ * This function cannot fail, instead check switch errors in sddadone().}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01757}01757 \textcolor{comment}{ */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01758}01758 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01759}\mbox{\hyperlink{mmc__da_8c_acf65c282267a47f7505e11858c5f9d18}{01759}} \mbox{\hyperlink{mmc__da_8c_acf65c282267a47f7505e11858c5f9d18}{sdda\_init\_switch\_part}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *start\_ccb,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01760}01760     uint8\_t \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01761}01761 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01762}01762         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *sc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01763}01763         uint8\_t value;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01764}01764 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01765}01765         KASSERT(\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} < MMC\_PART\_MAX, (\textcolor{stringliteral}{"{}\%s: invalid partition index"{}}, \_\_func\_\_));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01766}01766         sc-\/>\mbox{\hyperlink{structsdda__softc_af6bbe2e4b0e8583a3a64167004bd7031}{part\_requested}} = \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01767}01767 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01768}01768         value = (sc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_PART\_CONFIG] \&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01769}01769             \string~EXT\_CSD\_PART\_CONFIG\_ACC\_MASK) | \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01770}01770 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01771}01771         \mbox{\hyperlink{mmc__da_8c_a6225fe80bc50d97d8ec2dcbedd9a0da3}{mmc\_switch\_fill\_mmcio}}(start\_ccb, EXT\_CSD\_CMD\_SET\_NORMAL,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01772}01772             EXT\_CSD\_PART\_CONFIG, value, sc-\/>\mbox{\hyperlink{structsdda__softc_aa60874e87a5277db0918b1eeb6cd4844}{part\_time}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01773}01773         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = \mbox{\hyperlink{mmc__da_8c_ac7f7185f8c44f482261d8f94cba8993f}{sddadone}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01774}01774 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01775}01775         sc-\/>\mbox{\hyperlink{structsdda__softc_a429f510a9324edb5996b58f1ae25bfb7}{outstanding\_cmds}}++;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01776}01776         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01777}01777         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01778}01778         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01779}01779 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01780}01780 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01781}01781 \textcolor{comment}{/* Called with periph lock held! */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01782}01782 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01783}\mbox{\hyperlink{mmc__da_8c_adde614c28802ee911da4e0820da41962}{01783}} \mbox{\hyperlink{mmc__da_8c_abc7bb4d36fce8f60b034ea6291f82ef3}{sddastart}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *start\_ccb)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01784}01784 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01785}01785         \textcolor{keyword}{struct }bio *bp;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01786}01786         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01787}01787         \textcolor{keyword}{struct} \mbox{\hyperlink{structsdda__part}{sdda\_part}} *\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01788}01788         \textcolor{keyword}{struct} \mbox{\hyperlink{structmmc__params}{mmc\_params}} *mmcp = \&\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01789}01789         uint8\_t part\_index;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01790}01790 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01791}01791         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddastart\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01792}01792 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01793}01793         \textcolor{keywordflow}{if} (softc-\/>\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}} != \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a65267511ec89d2d6d8f0a712bdacde73}{SDDA\_STATE\_NORMAL}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01794}01794                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}device is not in SDDA\_STATE\_NORMAL yet\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01795}01795                 \mbox{\hyperlink{cam__xpt_8c_acb560602f4997cc269e6bb54efa93725}{xpt\_release\_ccb}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01796}01796                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01797}01797         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01798}01798 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01799}01799         \textcolor{comment}{/* Find partition that has outstanding commands.  Prefer current partition. */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01800}01800         part\_index = softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01801}01801         \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}}];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01802}01802         bp = bioq\_first(\&\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01803}01803         \textcolor{keywordflow}{if} (bp == NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01804}01804                 \textcolor{keywordflow}{for} (part\_index = 0; part\_index < MMC\_PART\_MAX; part\_index++) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01805}01805                         \textcolor{keywordflow}{if} ((\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}} = softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[part\_index]) != NULL \&\&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01806}01806                             (bp = bioq\_first(\&softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[part\_index]-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}})) != NULL)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01807}01807                                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01808}01808                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01809}01809         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01810}01810         \textcolor{keywordflow}{if} (bp == NULL) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01811}01811                 \mbox{\hyperlink{cam__xpt_8c_acb560602f4997cc269e6bb54efa93725}{xpt\_release\_ccb}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01812}01812                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01813}01813         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01814}01814         \textcolor{keywordflow}{if} (part\_index != softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01815}01815                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369aa5d4cf1b6e18330ac0c17412b230ff6f}{CAM\_DEBUG\_PERIPH}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01816}01816                     (\textcolor{stringliteral}{"{}Partition  \%d -\/> \%d\(\backslash\)n"{}}, softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}}, part\_index));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01817}01817                 \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01818}01818 \textcolor{comment}{                 * According to section "{}6.2.2 Command restrictions"{} of the eMMC}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01819}01819 \textcolor{comment}{                 * specification v5.1, CMD19/CMD21 aren't allowed to be used with}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01820}01820 \textcolor{comment}{                 * RPMB partitions.  So we pause re-\/tuning along with triggering}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01821}01821 \textcolor{comment}{                 * it up-\/front to decrease the likelihood of re-\/tuning becoming}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01822}01822 \textcolor{comment}{                 * necessary while accessing an RPMB partition.  Consequently, an}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01823}01823 \textcolor{comment}{                 * RPMB partition should immediately be switched away from again}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01824}01824 \textcolor{comment}{                 * after an access in order to allow for re-\/tuning to take place}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01825}01825 \textcolor{comment}{                 * anew.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01826}01826 \textcolor{comment}{                 */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01827}01827                 \textcolor{comment}{/* TODO: pause retune if switching to RPMB partition */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01828}01828                 softc-\/>\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}} = \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a643865b7906e6e4df23ca7f687d62776}{SDDA\_STATE\_PART\_SWITCH}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01829}01829                 \mbox{\hyperlink{mmc__da_8c_acf65c282267a47f7505e11858c5f9d18}{sdda\_init\_switch\_part}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, start\_ccb, part\_index);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01830}01830                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01831}01831         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01832}01832 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01833}01833         bioq\_remove(\&\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_a3af40feaed41f7399193bec3c9668c2c}{bio\_queue}}, bp);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01834}01834 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01835}01835         \textcolor{keywordflow}{switch} (bp-\/>bio\_cmd) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01836}01836         \textcolor{keywordflow}{case} BIO\_WRITE:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01837}01837                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}BIO\_WRITE\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01838}01838                 \mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}-\/>\mbox{\hyperlink{structsdda__part_ac921cbc4e4ce091842c37b1ec267180e}{flags}} |= \mbox{\hyperlink{mmc__da_8c_a525e6641619deb56f8d342755d6dc366a7dc731f2dede334017f50803f7811f7d}{SDDA\_FLAG\_DIRTY}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01839}01839                 \textcolor{comment}{/* FALLTHROUGH */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01840}01840         \textcolor{keywordflow}{case} BIO\_READ:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01841}01841         \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01842}01842                 \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__mmcio}{ccb\_mmcio}} *mmcio;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01843}01843                 uint64\_t blockno = bp-\/>bio\_pblkno;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01844}01844                 uint16\_t count = bp-\/>bio\_bcount / MMC\_SECTOR\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01845}01845                 uint16\_t opcode;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01846}01846 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01847}01847                 \textcolor{keywordflow}{if} (bp-\/>bio\_cmd == BIO\_READ)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01848}01848                         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}BIO\_READ\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01849}01849                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01850}01850                     (\textcolor{stringliteral}{"{}Block \%"{}}PRIu64\textcolor{stringliteral}{"{} cnt \%u\(\backslash\)n"{}}, blockno, count));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01851}01851 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01852}01852                 \textcolor{comment}{/* Construct new MMC command */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01853}01853                 \textcolor{keywordflow}{if} (bp-\/>bio\_cmd == BIO\_READ) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01854}01854                         \textcolor{keywordflow}{if} (count > 1)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01855}01855                                 opcode = MMC\_READ\_MULTIPLE\_BLOCK;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01856}01856                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01857}01857                                 opcode = MMC\_READ\_SINGLE\_BLOCK;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01858}01858                 \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01859}01859                         \textcolor{keywordflow}{if} (count > 1)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01860}01860                                 opcode = MMC\_WRITE\_MULTIPLE\_BLOCK;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01861}01861                         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01862}01862                                 opcode = MMC\_WRITE\_BLOCK;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01863}01863                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01864}01864 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01865}01865                 start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca7c4cd1252b7b90f1c1aaf01cb6240fd8}{XPT\_MMC\_IO}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01866}01866                 start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = (bp-\/>bio\_cmd == BIO\_READ ? \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676a00dc62a475e9a013d8a7f90fcf08f3af}{CAM\_DIR\_IN}} : \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676adf60a86f59d84768dceb1af379c0dc3a}{CAM\_DIR\_OUT}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01867}01867                 start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01868}01868                 start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 15 * 1000;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01869}01869                 start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_afe206cd92d25dfd137df5196cdfcfdae}{cbfcnp}} = \mbox{\hyperlink{mmc__da_8c_ac7f7185f8c44f482261d8f94cba8993f}{sddadone}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01870}01870 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01871}01871                 mmcio = \&start\_ccb-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01872}01872                 mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.opcode = opcode;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01873}01873                 mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.arg = blockno;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01874}01874                 \textcolor{keywordflow}{if} (!(mmcp-\/>card\_features \& \mbox{\hyperlink{mmc_8h_a31af3df3316f3816ab8b744fb7dc4444}{CARD\_FEATURE\_SDHC}}))}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01875}01875                         mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.arg <<= 9;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01876}01876 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01877}01877                 mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.flags = MMC\_RSP\_R1 | MMC\_CMD\_ADTC;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01878}01878                 mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data = softc-\/>\mbox{\hyperlink{structsdda__softc_aed77974991ef815afe3b249db5a25561}{mmcdata}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01879}01879                 memset(mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} mmc\_data));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01880}01880                 mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>data = bp-\/>bio\_data;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01881}01881                 mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>len = MMC\_SECTOR\_SIZE * count;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01882}01882                 mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>flags = (bp-\/>bio\_cmd == BIO\_READ ? MMC\_DATA\_READ : MMC\_DATA\_WRITE);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01883}01883                 \textcolor{comment}{/* Direct h/w to issue CMD12 upon completion */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01884}01884                 \textcolor{keywordflow}{if} (count > 1) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01885}01885                         mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>flags |= MMC\_DATA\_MULTI;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01886}01886                         mmcio-\/>\mbox{\hyperlink{structccb__mmcio_a0783c59c8cd04dd221403249d15dfac2}{stop}}.opcode = MMC\_STOP\_TRANSMISSION;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01887}01887                         mmcio-\/>\mbox{\hyperlink{structccb__mmcio_a0783c59c8cd04dd221403249d15dfac2}{stop}}.flags = MMC\_RSP\_R1B | MMC\_CMD\_AC;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01888}01888                         mmcio-\/>\mbox{\hyperlink{structccb__mmcio_a0783c59c8cd04dd221403249d15dfac2}{stop}}.arg = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01889}01889                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01890}01890 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01891}01891                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01892}01892         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01893}01893         \textcolor{keywordflow}{case} BIO\_FLUSH:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01894}01894                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}BIO\_FLUSH\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01895}01895                 \mbox{\hyperlink{mmc__da_8c_a7cbf7ae706a3de5b0bda8b461bd41d73}{sddaschedule}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01896}01896                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01897}01897         \textcolor{keywordflow}{case} BIO\_DELETE:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01898}01898                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}BIO\_DELETE\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01899}01899                 \mbox{\hyperlink{mmc__da_8c_a7cbf7ae706a3de5b0bda8b461bd41d73}{sddaschedule}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01900}01900                 \textcolor{keywordflow}{break};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01901}01901         \textcolor{keywordflow}{default}:}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01902}01902                 biofinish(bp, NULL, EOPNOTSUPP);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01903}01903                 \mbox{\hyperlink{cam__xpt_8c_acb560602f4997cc269e6bb54efa93725}{xpt\_release\_ccb}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01904}01904                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01905}01905         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01906}01906         start\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.ccb\_bp = bp;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01907}01907         softc-\/>\mbox{\hyperlink{structsdda__softc_a429f510a9324edb5996b58f1ae25bfb7}{outstanding\_cmds}}++;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01908}01908         softc-\/>\mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{refcount}}++;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01909}01909         \mbox{\hyperlink{cam__periph_8h_a66d8b47f5a566db5a6be4697c17886c7}{cam\_periph\_unlock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01910}01910         \mbox{\hyperlink{cam__xpt_8c_a6ef97382f5b1590b4d2d138516a63bcc}{xpt\_action}}(start\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01911}01911         \mbox{\hyperlink{cam__periph_8h_a1f320a7fdaff6524ad067970fbab4b27}{cam\_periph\_lock}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01912}01912 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01913}01913         \textcolor{comment}{/* May have more work to do, so ensure we stay scheduled */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01914}01914         \mbox{\hyperlink{mmc__da_8c_a7cbf7ae706a3de5b0bda8b461bd41d73}{sddaschedule}}(periph);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01915}01915 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01916}01916 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01917}01917 \textcolor{keyword}{static} \textcolor{keywordtype}{void}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01918}\mbox{\hyperlink{mmc__da_8c_ac7f7185f8c44f482261d8f94cba8993f}{01918}} \mbox{\hyperlink{mmc__da_8c_ac7f7185f8c44f482261d8f94cba8993f}{sddadone}}(\textcolor{keyword}{struct} \mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph, \textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *done\_ccb)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01919}01919 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01920}01920         \textcolor{keyword}{struct }bio *bp;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01921}01921         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01922}01922         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__mmcio}{ccb\_mmcio}} *mmcio;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01923}01923         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__path}{cam\_path}} *path;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01924}01924         uint32\_t card\_status;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01925}01925         \textcolor{keywordtype}{int} error = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01926}01926 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01927}01927         softc = (\textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *)\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}-\/>\mbox{\hyperlink{structcam__periph_a6ba6ec6ae18e7f5935209ff5ca9ba385}{softc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01928}01928         mmcio = \&done\_ccb-\/>\mbox{\hyperlink{unionccb_a57bf034b38cf394fb554731856914f4d}{mmcio}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01929}01929         path = done\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a47763149d044e13fcc06abfb3ddc941f}{path}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01930}01930 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01931}01931         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}sddadone\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01932}01932         \textcolor{keywordflow}{if} ((done\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_abcec535dec8d07473cd2af995bf25d88}{status}} \& \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a82f0d57eda0654067dc2db0c2a218caa}{CAM\_STATUS\_MASK}}) != \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3a3487a040bd091973beb62275a7309324}{CAM\_REQ\_CMP}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01933}01933                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}}, (\textcolor{stringliteral}{"{}Error!!!\(\backslash\)n"{}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01934}01934                 \textcolor{keywordflow}{if} ((done\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_abcec535dec8d07473cd2af995bf25d88}{status}} \& \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3afe5c2fa0edb1c8fea0119515430d223e}{CAM\_DEV\_QFRZN}}) != 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01935}01935                         \mbox{\hyperlink{cam__periph_8c_a31248ce4d1951e8325b42cf2c309481d}{cam\_release\_devq}}(path,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01936}01936                             \textcolor{comment}{/*relsim\_flags*/}0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01937}01937                             \textcolor{comment}{/*reduction*/}0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01938}01938                             \textcolor{comment}{/*timeout*/}0,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01939}01939                             \textcolor{comment}{/*getcount\_only*/}0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01940}01940                 error = EIO;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01941}01941         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01942}01942                 \textcolor{keywordflow}{if} ((done\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_abcec535dec8d07473cd2af995bf25d88}{status}} \& \mbox{\hyperlink{cam_8h_a9ff49352334e6ad8ce937cf2fdf4cfb3afe5c2fa0edb1c8fea0119515430d223e}{CAM\_DEV\_QFRZN}}) != 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01943}01943                         panic(\textcolor{stringliteral}{"{}REQ\_CMP with QFRZN"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01944}01944                 error = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01945}01945         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01946}01946 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01947}01947         card\_status = mmcio-\/>\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.resp[0];}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01948}01948         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01949}01949             (\textcolor{stringliteral}{"{}Card status: \%08x\(\backslash\)n"{}}, R1\_STATUS(card\_status)));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01950}01950         \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01951}01951             (\textcolor{stringliteral}{"{}Current state: \%d\(\backslash\)n"{}}, R1\_CURRENT\_STATE(card\_status)));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01952}01952 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01953}01953         \textcolor{comment}{/* Process result of switching MMC partitions */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01954}01954         \textcolor{keywordflow}{if} (softc-\/>\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}} == \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a643865b7906e6e4df23ca7f687d62776}{SDDA\_STATE\_PART\_SWITCH}}) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01955}01955                 \mbox{\hyperlink{cam__debug_8h_ae79c3c2e46f2d9fca388152c3ad38ef0}{CAM\_DEBUG}}(path, \mbox{\hyperlink{cam__debug_8h_ae330349135d2d26f45cdf3cc67b2b369a079361ad1b93ba7c851ca5ca4762ecd1}{CAM\_DEBUG\_TRACE}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01956}01956                     (\textcolor{stringliteral}{"{}Completing partition switch to \%d\(\backslash\)n"{}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01957}01957                     softc-\/>\mbox{\hyperlink{structsdda__softc_af6bbe2e4b0e8583a3a64167004bd7031}{part\_requested}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01958}01958                 softc-\/>\mbox{\hyperlink{structsdda__softc_a429f510a9324edb5996b58f1ae25bfb7}{outstanding\_cmds}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01959}01959                 \textcolor{comment}{/* Complete partition switch */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01960}01960                 softc-\/>\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}} = \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a65267511ec89d2d6d8f0a712bdacde73}{SDDA\_STATE\_NORMAL}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01961}01961                 \textcolor{keywordflow}{if} (error != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01962}01962                         \textcolor{comment}{/* TODO: Unpause retune if accessing RPMB */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01963}01963                         \mbox{\hyperlink{cam__xpt_8c_acb560602f4997cc269e6bb54efa93725}{xpt\_release\_ccb}}(done\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01964}01964                         \mbox{\hyperlink{cam__xpt_8c_a26e646d0732b4acab4667d28f24d026e}{xpt\_schedule}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{cam_8h_a29369d4bf711763f232c214158987e20}{CAM\_PRIORITY\_NORMAL}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01965}01965                         \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01966}01966                 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01967}01967 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01968}01968                 softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_PART\_CONFIG] =}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01969}01969                     (softc-\/>\mbox{\hyperlink{structsdda__softc_a31a6730ac5c6534bf06df38301d558f3}{raw\_ext\_csd}}[EXT\_CSD\_PART\_CONFIG] \&}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01970}01970                         \string~EXT\_CSD\_PART\_CONFIG\_ACC\_MASK) | softc-\/>\mbox{\hyperlink{structsdda__softc_af6bbe2e4b0e8583a3a64167004bd7031}{part\_requested}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01971}01971                 \textcolor{comment}{/* TODO: Unpause retune if accessing RPMB */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01972}01972                 softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}} = softc-\/>\mbox{\hyperlink{structsdda__softc_af6bbe2e4b0e8583a3a64167004bd7031}{part\_requested}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01973}01973                 \mbox{\hyperlink{cam__xpt_8c_acb560602f4997cc269e6bb54efa93725}{xpt\_release\_ccb}}(done\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01974}01974 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01975}01975                 \textcolor{comment}{/* Return to processing BIO requests */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01976}01976                 \mbox{\hyperlink{cam__xpt_8c_a26e646d0732b4acab4667d28f24d026e}{xpt\_schedule}}(\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}}, \mbox{\hyperlink{cam_8h_a29369d4bf711763f232c214158987e20}{CAM\_PRIORITY\_NORMAL}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01977}01977                 \textcolor{keywordflow}{return};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01978}01978         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01979}01979 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01980}01980         bp = (\textcolor{keyword}{struct }bio *)done\_ccb-\/>\mbox{\hyperlink{unionccb_ab0f218bc2944e08931eb0d935ce4085f}{ccb\_h}}.ccb\_bp;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01981}01981         bp-\/>bio\_error = error;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01982}01982         if (error != 0) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01983}01983                 bp-\/>bio\_resid = bp-\/>bio\_bcount;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01984}01984                 bp-\/>bio\_flags |= BIO\_ERROR;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01985}01985         \} \textcolor{keywordflow}{else} \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01986}01986                 \textcolor{comment}{/* XXX: How many bytes remaining? */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01987}01987                 bp-\/>bio\_resid = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01988}01988                 \textcolor{keywordflow}{if} (bp-\/>bio\_resid > 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01989}01989                         bp-\/>bio\_flags |= BIO\_ERROR;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01990}01990         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01991}01991 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01992}01992         softc-\/>\mbox{\hyperlink{structsdda__softc_a429f510a9324edb5996b58f1ae25bfb7}{outstanding\_cmds}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01993}01993         \mbox{\hyperlink{cam__xpt_8c_acb560602f4997cc269e6bb54efa93725}{xpt\_release\_ccb}}(done\_ccb);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01994}01994         \textcolor{comment}{/*}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01995}01995 \textcolor{comment}{         * Release the periph refcount taken in sddastart() for each CCB.}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01996}01996 \textcolor{comment}{         */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01997}01997         KASSERT(softc-\/>\mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{refcount}} >= 1, (\textcolor{stringliteral}{"{}sddadone softc \%p refcount \%d"{}}, softc, softc-\/>\mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{refcount}}));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01998}01998         softc-\/>\mbox{\hyperlink{structsdda__softc_a20f91c3572e59cec6635d63da8b9714a}{refcount}}-\/-\/;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l01999}01999         biodone(bp);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02000}02000 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02001}02001 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02002}02002 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02003}\mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{02003}} \mbox{\hyperlink{mmc__da_8c_a34dacce9a5109c46fbca7e2b3bd753a9}{sddaerror}}(\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *\mbox{\hyperlink{unionccb}{ccb}}, u\_int32\_t \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316}{cam\_flags}}, u\_int32\_t sense\_flags)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02004}02004 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02005}02005         \textcolor{keywordflow}{return}(\mbox{\hyperlink{cam__periph_8c_ac2010c1d05ec8dff4d1c03f3ec0be8c4}{cam\_periph\_error}}(\mbox{\hyperlink{unionccb}{ccb}}, \mbox{\hyperlink{cam_8h_a14bf0cceb256c2063f776e6cc4aba316}{cam\_flags}}, sense\_flags));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02006}02006 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02007}02007 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02008}02008 \textcolor{keyword}{static} \textcolor{keywordtype}{int}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02009}\mbox{\hyperlink{mmc__da_8c_a7473f49e0f6084e90e326d7e0bae4eb5}{02009}} \mbox{\hyperlink{mmc__da_8c_a17f0fde6552e61d09ae1b57da22cac83}{sddadump}}(\textcolor{keywordtype}{void} *arg, \textcolor{keywordtype}{void} *\textcolor{keyword}{virtual}, vm\_offset\_t physical, off\_t offset,}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02010}02010     \textcolor{keywordtype}{size\_t} length)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02011}02011 \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02012}02012         \textcolor{keyword}{struct }\mbox{\hyperlink{structccb__mmcio}{ccb\_mmcio}} mmcio;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02013}02013         \textcolor{keyword}{struct }disk *dp;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02014}02014         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__part}{sdda\_part}} *part;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02015}02015         \textcolor{keyword}{struct }\mbox{\hyperlink{structsdda__softc}{sdda\_softc}} *softc;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02016}02016         \textcolor{keyword}{struct }\mbox{\hyperlink{structcam__periph}{cam\_periph}} *periph;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02017}02017         \textcolor{keyword}{struct }\mbox{\hyperlink{structmmc__params}{mmc\_params}} *mmcp;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02018}02018         uint16\_t count;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02019}02019         uint16\_t opcode;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02020}02020         \textcolor{keywordtype}{int} error;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02021}02021 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02022}02022         dp = arg;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02023}02023         part = dp-\/>d\_drv1;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02024}02024         softc = part-\/>\mbox{\hyperlink{structsdda__part_a0dd3438d19c1967b5d2e849c2fe58a6b}{sc}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02025}02025         periph = softc-\/>\mbox{\hyperlink{structsdda__softc_aa60446f9fe5a428025f1ab3ac4c8d376}{periph}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02026}02026         mmcp = \&periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}-\/>\mbox{\hyperlink{structcam__path_a0f0edbfe3286687ab3bebd9f5fe83d69}{device}}-\/>\mbox{\hyperlink{structcam__ed_a7a7a3d30522700002207ec227268da69}{mmc\_ident\_data}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02027}02027 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02028}02028         \textcolor{keywordflow}{if} (softc-\/>\mbox{\hyperlink{structsdda__softc_aa9e3b94d04142890b0f368d9cccc3e0e}{state}} != \mbox{\hyperlink{mmc__da_8c_a9b9c88bb9b8bbaa077b9aa8ab4c95ff3a65267511ec89d2d6d8f0a712bdacde73}{SDDA\_STATE\_NORMAL}})}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02029}02029                 \textcolor{keywordflow}{return} (ENXIO);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02030}02030 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02031}02031         count = length / MMC\_SECTOR\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02032}02032         \textcolor{keywordflow}{if} (count == 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02033}02033                 \textcolor{keywordflow}{return} (0);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02034}02034 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02035}02035         \textcolor{keywordflow}{if} (softc-\/>\mbox{\hyperlink{structsdda__softc_ab931ed7ae46e50bb845bacfba12aeac8}{part}}[softc-\/>\mbox{\hyperlink{structsdda__softc_aa8cb58520e8ec4807ff14fceb9bf6970}{part\_curr}}] != part)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02036}02036                 \textcolor{keywordflow}{return} (EIO);   \textcolor{comment}{/* TODO implement polled partition switch */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02037}02037 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02038}02038         memset(\&mmcio, 0, \textcolor{keyword}{sizeof}(mmcio));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02039}02039         \mbox{\hyperlink{cam__xpt_8c_a64b1b7434225c072f2d9379fe39e359c}{xpt\_setup\_ccb}}(\&mmcio.\mbox{\hyperlink{structccb__mmcio_ae49c622ac660e9fdfa99d5a9ce2f258a}{ccb\_h}}, periph-\/>\mbox{\hyperlink{structcam__periph_ab9f512b2fa31891d84372cd6279670b7}{path}}, \mbox{\hyperlink{cam_8h_a29369d4bf711763f232c214158987e20}{CAM\_PRIORITY\_NORMAL}}); \textcolor{comment}{/* XXX needed? */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02040}02040 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02041}02041         mmcio.\mbox{\hyperlink{structccb__mmcio_ae49c622ac660e9fdfa99d5a9ce2f258a}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a7439d6fedcb6191113a285c51038cd71}{func\_code}} = \mbox{\hyperlink{cam__ccb_8h_aa49540dd5ca09d2e63a5251de499055ca7c4cd1252b7b90f1c1aaf01cb6240fd8}{XPT\_MMC\_IO}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02042}02042         mmcio.\mbox{\hyperlink{structccb__mmcio_ae49c622ac660e9fdfa99d5a9ce2f258a}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_a2b92b9f93c185a3bcd5da48c751c0c05}{flags}} = \mbox{\hyperlink{cam__ccb_8h_a8a331ca6ae1e86223b907c974ef6b676adf60a86f59d84768dceb1af379c0dc3a}{CAM\_DIR\_OUT}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02043}02043         mmcio.\mbox{\hyperlink{structccb__mmcio_ae49c622ac660e9fdfa99d5a9ce2f258a}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_af69c58b4653ec0977d4ccfe89e30cfad}{retry\_count}} = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02044}02044         mmcio.\mbox{\hyperlink{structccb__mmcio_ae49c622ac660e9fdfa99d5a9ce2f258a}{ccb\_h}}.\mbox{\hyperlink{structccb__hdr_aafcc3aaf269bd00196097aa9ef85dd9b}{timeout}} = 15 * 1000;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02045}02045 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02046}02046         \textcolor{keywordflow}{if} (count > 1)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02047}02047                 opcode = MMC\_WRITE\_MULTIPLE\_BLOCK;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02048}02048         \textcolor{keywordflow}{else}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02049}02049                 opcode = MMC\_WRITE\_BLOCK;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02050}02050         mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.opcode = opcode;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02051}02051         mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.arg = offset / MMC\_SECTOR\_SIZE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02052}02052         \textcolor{keywordflow}{if} (!(mmcp-\/>\mbox{\hyperlink{structmmc__params_a9bf3e2fb1615fd94083eb8639fb2ae43}{card\_features}} \& \mbox{\hyperlink{mmc_8h_a31af3df3316f3816ab8b744fb7dc4444}{CARD\_FEATURE\_SDHC}}))}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02053}02053                 mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.arg <<= 9;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02054}02054 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02055}02055         mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.flags = MMC\_RSP\_R1 | MMC\_CMD\_ADTC;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02056}02056         mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data = softc-\/>\mbox{\hyperlink{structsdda__softc_aed77974991ef815afe3b249db5a25561}{mmcdata}};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02057}02057         memset(mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data, 0, \textcolor{keyword}{sizeof}(\textcolor{keyword}{struct} mmc\_data));}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02058}02058         mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>data = \textcolor{keyword}{virtual};}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02059}02059         mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>len = MMC\_SECTOR\_SIZE * count;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02060}02060         mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>flags = MMC\_DATA\_WRITE;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02061}02061 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02062}02062         \textcolor{comment}{/* Direct h/w to issue CMD12 upon completion */}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02063}02063         \textcolor{keywordflow}{if} (count > 1) \{}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02064}02064                 mmcio.\mbox{\hyperlink{structccb__mmcio_adcafb3aa7a8362b06dfb50f0baa5b205}{cmd}}.data-\/>flags |= MMC\_DATA\_MULTI;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02065}02065                 mmcio.\mbox{\hyperlink{structccb__mmcio_a0783c59c8cd04dd221403249d15dfac2}{stop}}.opcode = MMC\_STOP\_TRANSMISSION;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02066}02066                 mmcio.\mbox{\hyperlink{structccb__mmcio_a0783c59c8cd04dd221403249d15dfac2}{stop}}.flags = MMC\_RSP\_R1B | MMC\_CMD\_AC;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02067}02067                 mmcio.\mbox{\hyperlink{structccb__mmcio_a0783c59c8cd04dd221403249d15dfac2}{stop}}.arg = 0;}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02068}02068         \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02069}02069 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02070}02070         error = \mbox{\hyperlink{cam__periph_8c_a9eb7c5c2381f6769e4ecf63233bfff6f}{cam\_periph\_runccb}}((\textcolor{keyword}{union} \mbox{\hyperlink{unionccb}{ccb}} *)\&mmcio, \mbox{\hyperlink{cam__periph_8c_ac2010c1d05ec8dff4d1c03f3ec0be8c4}{cam\_periph\_error}},}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02071}02071             0, \mbox{\hyperlink{cam_8h_a06fc87d81c62e9abb8790b6e5713c55ba577cccbbf55745a0d97fab9485a33c86}{SF\_NO\_RECOVERY}} | \mbox{\hyperlink{cam_8h_a06fc87d81c62e9abb8790b6e5713c55ba359fe112a1d3d1e8f0ff77705af72169}{SF\_NO\_RETRY}}, NULL);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02072}02072         \textcolor{keywordflow}{if} (error != 0)}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02073}02073                 printf(\textcolor{stringliteral}{"{}Aborting dump due to I/O error.\(\backslash\)n"{}});}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02074}02074         \textcolor{keywordflow}{return} (error);}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02075}02075 \}}
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02076}02076 }
\DoxyCodeLine{\Hypertarget{mmc__da_8c_source_l02077}02077 \textcolor{preprocessor}{\#endif }\textcolor{comment}{/* \_KERNEL */}\textcolor{preprocessor}{}}

\end{DoxyCode}
