RTEMS 5.2
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
smc.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
36#ifndef _SMC_
37#define _SMC_
38
39/*----------------------------------------------------------------------------
40 * Headers
41 *----------------------------------------------------------------------------*/
42#include "chip.h"
43
44/*----------------------------------------------------------------------------
45 * Types
46 *----------------------------------------------------------------------------*/
47typedef union _SmcStatus {
48 uint8_t BStatus;
50 uint8_t smcSts: 1,
53 rbEdge: 1,
55 } bStatus;
56} SmcStatus;
57
58/*----------------------------------------------------------------------------
59 * Definitions
60 *----------------------------------------------------------------------------*/
61/*
62 * NFC definitions
63 */
64
66#define NFC_SRAM_BASE_ADDRESS 0x200000
68#define NFC_CMD_BASE_ADDR 0x70000000
69
70
71/* -------- NFCADDR_CMD : NFC Address Command -------- */
72#define NFCADDR_CMD_CMD1 (0xFFu << 2)
73/* Command Register Value for Cycle 1 */
74#define NFCADDR_CMD_CMD2 (0xFFu << 10)
75/* Command Register Value for Cycle 2 */
76#define NFCADDR_CMD_VCMD2 (0x1u << 18)
77/* Valid Cycle 2 Command */
78#define NFCADDR_CMD_ACYCLE (0x7u << 19)
79/* Number of Address required for the current command */
80#define NFCADDR_CMD_ACYCLE_NONE (0x0u << 19)
81/* No address cycle */
82#define NFCADDR_CMD_ACYCLE_ONE (0x1u << 19)
83/* One address cycle */
84#define NFCADDR_CMD_ACYCLE_TWO (0x2u << 19)
85/* Two address cycles */
86#define NFCADDR_CMD_ACYCLE_THREE (0x3u << 19)
87/* Three address cycles */
88#define NFCADDR_CMD_ACYCLE_FOUR (0x4u << 19)
89/* Four address cycles */
90#define NFCADDR_CMD_ACYCLE_FIVE (0x5u << 19)
91/* Five address cycles */
92#define NFCADDR_CMD_CSID (0x7u << 22)
93/* Chip Select Identifier */
94#define NFCADDR_CMD_CSID_0 (0x0u << 22)
95/* CS0 */
96#define NFCADDR_CMD_CSID_1 (0x1u << 22)
97/* CS1 */
98#define NFCADDR_CMD_CSID_2 (0x2u << 22)
99/* CS2 */
100#define NFCADDR_CMD_CSID_3 (0x3u << 22)
101/* CS3 */
102#define NFCADDR_CMD_CSID_4 (0x4u << 22)
103/* CS4 */
104#define NFCADDR_CMD_CSID_5 (0x5u << 22)
105/* CS5 */
106#define NFCADDR_CMD_CSID_6 (0x6u << 22)
107/* CS6 */
108#define NFCADDR_CMD_CSID_7 (0x7u << 22)
109/* CS7 */
110#define NFCADDR_CMD_DATAEN (0x1u << 25)
111/* NFC Data Enable */
112#define NFCADDR_CMD_DATADIS (0x0u << 25)
113/* NFC Data disable */
114#define NFCADDR_CMD_NFCRD (0x0u << 26)
115/* NFC Read Enable */
116#define NFCADDR_CMD_NFCWR (0x1u << 26)
117/* NFC Write Enable */
118#define NFCADDR_CMD_NFCCMD (0x1u << 27)
119/* NFC Command Enable */
120
121/*
122 * ECC definitions (Hsiao Code Errors)
123 */
124
126#define Hsiao_ERROR_SINGLEBIT 1
127
129#define Hsiao_ERROR_ECC 2
130
132#define Hsiao_ERROR_MULTIPLEBITS 3
133
134/*----------------------------------------------------------------------------
135 * Exported functions
136 *----------------------------------------------------------------------------*/
137
138/*
139 * NFC functions
140 */
141
142extern void SMC_NFC_Configure(uint32_t mode);
143extern void SMC_NFC_Reset(void);
144extern void SMC_NFC_EnableNfc(void);
145extern void SMC_NFC_EnableSpareRead(void);
146extern void SMC_NFC_DisableSpareRead(void);
147extern void SMC_NFC_EnableSpareWrite(void);
148extern void SMC_NFC_DisableSpareWrite(void);
149extern uint8_t SMC_NFC_isSpareRead(void);
150extern uint8_t SMC_NFC_isSpareWrite(void);
151extern uint8_t SMC_NFC_isTransferComplete(void);
152extern uint8_t SMC_NFC_isReadyBusy(void);
153extern uint8_t SMC_NFC_isNfcBusy(void);
154extern uint32_t SMC_NFC_GetStatus(void);
155
156extern void SMC_NFC_SendCommand(uint32_t cmd, uint32_t addressCycle,
157 uint32_t cycle0);
158extern void SMC_NFC_Wait_CommandDone(void);
159extern void SMC_NFC_Wait_XfrDone(void);
160extern void SMC_NFC_Wait_RBbusy(void);
161extern void SMC_NFC_Wait_HammingReady(void);
162
163extern void SMC_ECC_Configure(uint32_t type, uint32_t pageSize);
164extern uint32_t SMC_ECC_GetCorrectoinType(void);
165extern uint8_t SMC_ECC_GetStatus(uint8_t eccNumber);
166
167extern void SMC_ECC_GetValue(uint32_t *ecc);
168extern void SMC_ECC_GetEccParity(uint32_t pageDataSize, uint8_t *code,
169 uint8_t busWidth);
170extern uint8_t SMC_ECC_VerifyHsiao(uint8_t *data, uint32_t size,
171 const uint8_t *originalCode, const uint8_t *verifyCode, uint8_t busWidth);
172
173#endif /* #ifndef _SMC_ */
174
Definition: smc.h:49
uint8_t cmdDone
Definition: smc.h:52
uint8_t smcSts
Definition: smc.h:50
uint8_t rbEdge
Definition: smc.h:53
uint8_t hammingReady
Definition: smc.h:54
uint8_t xfrDone
Definition: smc.h:51
Definition: inftrees.h:24
unsigned size
Definition: tte.h:1
Definition: smc.h:47