RTEMS  5.0.0
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
66 
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
104 extern "C" {
105 #endif
106 
110 typedef struct _Mcid {
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  *----------------------------------------------------------------------------*/
141 extern void MCID_Init(sMcid *pMcid,
142  Hsmci *pMci, uint8_t bID, uint32_t dwMck,
143  sXdmad *pXdmad,
144  uint8_t bPolling);
145 
146 extern void MCID_Reset(sMcid *pMcid);
147 
148 extern void MCID_SetSlot(Hsmci *pMci, uint8_t slot);
149 
150 extern uint32_t MCID_Lock(sMcid *pMcid, uint8_t bSlot);
151 
152 extern uint32_t MCID_Release(sMcid *pMcid);
153 
154 extern void MCID_Handler(sMcid *pMcid);
155 
156 extern uint32_t MCID_SendCmd(sMcid *pMcid, void *pCmd);
157 
158 extern uint32_t MCID_CancelCmd(sMcid *pMcid);
159 
160 extern uint32_t MCID_IsCmdCompleted(sMcid *pMcid);
161 
162 extern uint32_t MCID_IOCtrl(sMcid *pMcid, uint32_t bCtl, uint32_t param);
163 
164 #ifdef __cplusplus
165 }
166 #endif
167 
169 #endif //#ifndef HSMCID_H
170 
uint8_t bPolling
Definition: mcid.h:128
struct _Mcid sMcid
MCI Driver.
uint32_t dwXfrNdx
Definition: mcid.h:122
MCI Driver.
Definition: mcid.h:110
uint8_t bID
Definition: mcid.h:126
Hsmci * pMciHw
Definition: mcid.h:112
uint8_t reserved
Definition: mcid.h:130
void * pCmd
Definition: mcid.h:116
sXdmad * pXdmad
Definition: mcid.h:114
volatile uint8_t bState
Definition: mcid.h:132
uint32_t dwXSize
Definition: mcid.h:124
Hsmci hardware registers.
Definition: component_hsmci.h:41
Definition: xdmad.h:127
uint32_t dwDmaCh
Definition: mcid.h:120
uint32_t dwMck
Definition: mcid.h:118