RTEMS: bsps/arm/atsam/include/libchip/include/mcid.h Source File

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
mcid.h
Go to the documentation of this file.
1/* ---------------------------------------------------------------------------- */
2/* Atmel Microcontroller Software Support */
3/* SAM Software Package License */
4/* ---------------------------------------------------------------------------- */
5/* Copyright (c) 2015, Atmel Corporation */
6/* */
7/* All rights reserved. */
8/* */
9/* Redistribution and use in source and binary forms, with or without */
10/* modification, are permitted provided that the following condition is met: */
11/* */
12/* - Redistributions of source code must retain the above copyright notice, */
13/* this list of conditions and the disclaimer below. */
14/* */
15/* Atmel's name may not be used to endorse or promote products derived from */
16/* this software without specific prior written permission. */
17/* */
18/* DISCLAIMER: THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR */
19/* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF */
20/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE */
21/* DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR ANY DIRECT, INDIRECT, */
22/* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */
23/* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */
24/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF */
25/* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */
26/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, */
27/* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
28/* ---------------------------------------------------------------------------- */
29
64#ifndef MCID_H
65#define MCID_H
70/*----------------------------------------------------------------------------
71 * Headers
72 *----------------------------------------------------------------------------*/
73
74#include "chip.h"
75
76#include <stdint.h>
77#include <stdio.h>
78
82/*----------------------------------------------------------------------------
83 * Constants
84 *----------------------------------------------------------------------------*/
85
87#define MCID_IDLE 0
88#define MCID_LOCKED 1
89#define MCID_CMD 2
90#define MCID_ERROR 3
93#define MCI_INITIAL_SPEED 400000
94
97/*----------------------------------------------------------------------------
98 * Types
99 *----------------------------------------------------------------------------*/
103#ifdef __cplusplus
104extern "C" {
105#endif
106
110 typedef struct _Mcid {
112 Hsmci *pMciHw;
114 sXdmad *pXdmad;
116 void *pCmd;
118 uint32_t dwMck;
120 uint32_t dwDmaCh;
122 uint32_t dwXfrNdx;
124 uint32_t dwXSize;
126 uint8_t bID;
128 uint8_t bPolling;
130 uint8_t reserved;
132 volatile uint8_t bState;
133} sMcid;
134
136/*----------------------------------------------------------------------------
137 * Exported functions
138 *----------------------------------------------------------------------------*/
141extern void MCID_Init(sMcid *pMcid,
142 Hsmci *pMci, uint8_t bID, uint32_t dwMck,
143 sXdmad *pXdmad,
144 uint8_t bPolling);
145
146extern void MCID_Reset(sMcid *pMcid);
147
148extern void MCID_SetSlot(Hsmci *pMci, uint8_t slot);
149
150extern uint32_t MCID_Lock(sMcid *pMcid, uint8_t bSlot);
151
152extern uint32_t MCID_Release(sMcid *pMcid);
153
154extern void MCID_Handler(sMcid *pMcid);
155
156extern uint32_t MCID_SendCmd(sMcid *pMcid, void *pCmd);
157
158extern uint32_t MCID_CancelCmd(sMcid *pMcid);
159
160extern uint32_t MCID_IsCmdCompleted(sMcid *pMcid);
161
162extern uint32_t MCID_IOCtrl(sMcid *pMcid, uint32_t bCtl, uint32_t param);
163
164#ifdef __cplusplus
165}
166#endif
169#endif //#ifndef HSMCID_H
170
sMcid
struct _Mcid sMcid
MCI Driver.
Hsmci
Hsmci hardware registers.
Definition: component_hsmci.h:41
_Mcid
MCI Driver.
Definition: mcid.h:110
_Mcid::dwDmaCh
uint32_t dwDmaCh
Definition: mcid.h:120
_Mcid::reserved
uint8_t reserved
Definition: mcid.h:130
_Mcid::pXdmad
sXdmad * pXdmad
Definition: mcid.h:114
_Mcid::bID
uint8_t bID
Definition: mcid.h:126
_Mcid::pCmd
void * pCmd
Definition: mcid.h:116
_Mcid::dwXfrNdx
uint32_t dwXfrNdx
Definition: mcid.h:122
_Mcid::dwXSize
uint32_t dwXSize
Definition: mcid.h:124
_Mcid::dwMck
uint32_t dwMck
Definition: mcid.h:118
_Mcid::pMciHw
Hsmci * pMciHw
Definition: mcid.h:112
_Mcid::bState
volatile uint8_t bState
Definition: mcid.h:132
_Mcid::bPolling
uint8_t bPolling
Definition: mcid.h:128
_Xdmad
Definition: xdmad.h:127