]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/CORTEX_M4F_ATSAM4E_Atmel_Studio/src/ASF/sam/drivers/ebi/smc/smc.h
5ba786ba5af3597c4541f9c22f4594e1cfbe3f83
[freertos] / FreeRTOS / Demo / CORTEX_M4F_ATSAM4E_Atmel_Studio / src / ASF / sam / drivers / ebi / smc / smc.h
1 /**\r
2  * \file\r
3  *\r
4  * \brief Static Memory Controller (SMC) driver for SAM.\r
5  *\r
6  * Copyright (c) 2011-2013 Atmel Corporation. All rights reserved.\r
7  *\r
8  * \asf_license_start\r
9  *\r
10  * \page License\r
11  *\r
12  * Redistribution and use in source and binary forms, with or without\r
13  * modification, are permitted provided that the following conditions are met:\r
14  *\r
15  * 1. Redistributions of source code must retain the above copyright notice,\r
16  *    this list of conditions and the following disclaimer.\r
17  *\r
18  * 2. Redistributions in binary form must reproduce the above copyright notice,\r
19  *    this list of conditions and the following disclaimer in the documentation\r
20  *    and/or other materials provided with the distribution.\r
21  *\r
22  * 3. The name of Atmel may not be used to endorse or promote products derived\r
23  *    from this software without specific prior written permission.\r
24  *\r
25  * 4. This software may only be redistributed and used in connection with an\r
26  *    Atmel microcontroller product.\r
27  *\r
28  * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED\r
29  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\r
30  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE\r
31  * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR\r
32  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
33  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
34  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
35  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\r
36  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\r
37  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r
38  * POSSIBILITY OF SUCH DAMAGE.\r
39  *\r
40  * \asf_license_stop\r
41  *\r
42  */\r
43 \r
44 #ifndef SMC_H_INCLUDED\r
45 #define SMC_H_INCLUDED\r
46 \r
47 #include "compiler.h"\r
48 \r
49 /// @cond 0\r
50 /**INDENT-OFF**/\r
51 #ifdef __cplusplus\r
52 extern "C" {\r
53 #endif\r
54 /**INDENT-ON**/\r
55 /// @endcond\r
56 \r
57 #if ((SAM3S) || (SAM3U) || (SAM3XA) || (SAM4S) || (SAM4E))\r
58 void smc_set_setup_timing(Smc *p_smc, uint32_t ul_cs, uint32_t ul_setup_timing);\r
59 void smc_set_pulse_timing(Smc *p_smc, uint32_t ul_cs, uint32_t ul_pulse_timing);\r
60 void smc_set_cycle_timing(Smc *p_smc, uint32_t ul_cs, uint32_t ul_cycle_timing);\r
61 void smc_set_mode(Smc *p_smc, uint32_t ul_cs, uint32_t ul_mode);\r
62 uint32_t smc_get_mode(Smc *p_smc, uint32_t ul_cs);\r
63 void smc_enable_writeprotect(Smc *p_smc, uint32_t ul_enable);\r
64 uint32_t smc_get_writeprotect_status(Smc *p_smc);\r
65 #endif  /* ((SAM3S) || (SAM3U) || (SAM3XA)) */\r
66 \r
67 #if ((SAM3U) || (SAM3XA))\r
68 /* NFCADDR_CMD : NFC Address Command */\r
69 #define NFCADDR_CMD_CMD1      (0xFFu <<  2) /* Command Register Value for Cycle 1 */\r
70 #define NFCADDR_CMD_CMD2      (0xFFu << 10) /* Command Register Value for Cycle 2 */\r
71 #define NFCADDR_CMD_VCMD2     (0x1u << 18)  /* Valid Cycle 2 Command */\r
72 #define NFCADDR_CMD_ACYCLE    (0x7u << 19)  /* Number of Address required for the current command */\r
73 #define   NFCADDR_CMD_ACYCLE_NONE    (0x0u << 19) /* No address cycle */\r
74 #define   NFCADDR_CMD_ACYCLE_ONE     (0x1u << 19) /* One address cycle */\r
75 #define   NFCADDR_CMD_ACYCLE_TWO     (0x2u << 19) /* Two address cycles */\r
76 #define   NFCADDR_CMD_ACYCLE_THREE   (0x3u << 19) /* Three address cycles */\r
77 #define   NFCADDR_CMD_ACYCLE_FOUR    (0x4u << 19) /* Four address cycles */\r
78 #define   NFCADDR_CMD_ACYCLE_FIVE    (0x5u << 19) /* Five address cycles */\r
79 #define NFCADDR_CMD_CSID_Pos 22\r
80 #define NFCADDR_CMD_CSID_Msk (0x7u << NFCADDR_CMD_CSID_Pos) /* Chip Select Identifier */\r
81 #define NFCADDR_CMD_CSID(value) ((NFCADDR_CMD_CSID_Msk & ((value) << NFCADDR_CMD_CSID_Pos)))\r
82 #define NFCADDR_CMD_NFCEN     (0x1u << 25)  /* NFC Enable */\r
83 #define NFCADDR_CMD_NFC_READ     (0x0u << 26)  /* NFC Write Enable */\r
84 #define NFCADDR_CMD_NFC_WIRTE    (0x1u << 26)  /* NFC Write Enable */\r
85 #define NFCADDR_CMD_NFCCMD    (0x1u << 27)  /* NFC Command Enable */\r
86 \r
87 #define NFC_BUSY_FLAG    0x8000000\r
88 #define ECC_STATUS_MASK   0x07\r
89 \r
90 void smc_set_nand_timing(Smc * p_smc, uint32_t ul_cs,\r
91                 uint32_t ul_nand_timing);\r
92 void smc_nfc_init(Smc *p_smc, uint32_t ul_config);\r
93 void smc_nfc_set_page_size(Smc *p_smc, uint32_t ul_page_size);\r
94 void smc_nfc_enable_spare_read(Smc *p_smc);\r
95 void smc_nfc_disable_spare_read(Smc *p_smc);\r
96 void smc_nfc_enable_spare_write(Smc *p_smc);\r
97 void smc_nfc_disable_spare_write(Smc *p_smc);\r
98 void smc_nfc_enable(Smc *p_smc);\r
99 void smc_nfc_disable(Smc *p_smc);\r
100 uint32_t smc_nfc_get_status(Smc * p_smc);\r
101 void smc_nfc_enable_interrupt(Smc *p_smc, uint32_t ul_sources);\r
102 void smc_nfc_disable_interrupt(Smc *p_smc, uint32_t ul_sources);\r
103 uint32_t smc_nfc_get_interrupt_mask(Smc *p_smc);\r
104 void smc_nfc_set_address0(Smc *p_smc, uint8_t uc_address0);\r
105 void smc_nfc_set_bank(Smc *p_smc, uint32_t ul_bank);\r
106 void smc_nfc_send_command(Smc *p_smc, uint32_t ul_cmd, uint32_t ul_address_cycle, uint32_t ul_cycle0);\r
107 void smc_ecc_init(Smc *p_smc, uint32_t ul_type, uint32_t ul_pagesize);\r
108 uint32_t smc_ecc_get_status(Smc *p_smc, uint32_t ul_parity_number);\r
109 void smc_ecc_get_value(Smc *p_smc, uint32_t *p_ecc);\r
110 #endif  /* ((SAM3U) || (SAM3XA)) */\r
111 \r
112 /// @cond 0\r
113 /**INDENT-OFF**/\r
114 #ifdef __cplusplus\r
115 }\r
116 #endif\r
117 /**INDENT-ON**/\r
118 /// @endcond\r
119 \r
120 #endif /* SMC_H_INCLUDED */\r