Hardware Libraries  20.1
Arria 10 SoC Hardware Manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
alt_qspi.h
Go to the documentation of this file.
1 /******************************************************************************
2 *
3 * Copyright 2013 Altera Corporation. All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * 3. Neither the name of the copyright holder nor the names of its contributors
16 * may be used to endorse or promote products derived from this software without
17 * specific prior written permission.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
20 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
23 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 *
31 ******************************************************************************/
32 
33 /*
34  * $Id: //acds/rel/20.1/embedded/ip/hps/altera_hps/hwlib/include/alt_qspi.h#1 $
35  */
36 
41 #ifndef __ALT_QSPI_H__
42 #define __ALT_QSPI_H__
43 
44 #include "hwlib.h"
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif /* __cplusplus */
50 
51 /******************************************************************************/
63 /******************************************************************************/
72 /******************************************************************************/
90 ALT_STATUS_CODE alt_qspi_init(void);
91 
92 /******************************************************************************/
102 ALT_STATUS_CODE alt_qspi_uninit(void);
103 
104 /******************************************************************************/
115 ALT_STATUS_CODE alt_qspi_disable(void);
116 
117 /******************************************************************************/
124 ALT_STATUS_CODE alt_qspi_enable(void);
125 
126 /******************************************************************************/
141 {
151 
161 
166 
172 
177 
183 
188 
200 
208 
216 
224 
232 
238 
240 
241 /******************************************************************************/
254 uint32_t alt_qspi_int_status_get(void);
255 
256 /******************************************************************************/
272 ALT_STATUS_CODE alt_qspi_int_clear(const uint32_t mask);
273 
274 /******************************************************************************/
299 ALT_STATUS_CODE alt_qspi_int_disable(const uint32_t mask);
300 
301 /******************************************************************************/
326 ALT_STATUS_CODE alt_qspi_int_enable(const uint32_t mask);
327 
328 /******************************************************************************/
334 bool alt_qspi_is_idle(void);
335 
336 #if defined (soc_a10)
337 /******************************************************************************/
345 ALT_STATUS_CODE alt_qspi_ecc_start(void);
346 
347 /******************************************************************************/
362 ALT_STATUS_CODE alt_qspi_ecc_get_correct_data(uint32_t address, uint32_t * data);
363 #endif
364 
367 /******************************************************************************/
395 /******************************************************************************/
416 ALT_STATUS_CODE alt_qspi_read(void * dest, uint32_t src, size_t size);
417 
418 /******************************************************************************/
439 ALT_STATUS_CODE alt_qspi_write(uint32_t dest, const void * src, size_t size);
440 
443 /******************************************************************************/
473 /******************************************************************************/
479 typedef enum ALT_QSPI_MODE_e
480 {
492 
493 /******************************************************************************/
499 typedef enum ALT_QSPI_CS_MODE_e
500 {
507 
508 /******************************************************************************/
513 {
531 
532 /******************************************************************************/
540 {
541  uint32_t block_size;
546  uint32_t page_size;
551  uint32_t addr_size;
575 
576 /******************************************************************************/
582 {
590 
591 /******************************************************************************/
596 {
604 
605 /******************************************************************************/
615 {
625  uint32_t cs_da;
633  uint32_t cs_dads;
646  uint32_t cs_eot;
659  uint32_t cs_sot;
671  uint32_t rd_datacap;
686 
687 /******************************************************************************/
695 {
696  uint32_t op_code;
726  uint32_t dummy_cycles;
732 
733 /******************************************************************************/
740 
741 /******************************************************************************/
754 ALT_STATUS_CODE alt_qspi_baud_rate_div_set(const ALT_QSPI_BAUD_DIV_t baud_rate_div);
755 
756 /******************************************************************************/
770 ALT_STATUS_CODE alt_qspi_chip_select_config_get(uint32_t* cs, ALT_QSPI_CS_MODE_t* cs_mode);
771 
772 /******************************************************************************/
801 ALT_STATUS_CODE alt_qspi_chip_select_config_set(const uint32_t cs,
802  const ALT_QSPI_CS_MODE_t cs_mode);
803 
804 /******************************************************************************/
814 ALT_STATUS_CODE alt_qspi_mode_bit_disable(void);
815 
816 /******************************************************************************/
826 ALT_STATUS_CODE alt_qspi_mode_bit_enable(void);
827 
828 /******************************************************************************/
835 uint32_t alt_qspi_mode_bit_config_get(void);
836 
837 /******************************************************************************/
853 ALT_STATUS_CODE alt_qspi_mode_bit_config_set(const uint32_t mode_bits);
854 
855 /******************************************************************************/
868 
869 /******************************************************************************/
881 
882 /******************************************************************************/
895 
896 /******************************************************************************/
913 
914 /******************************************************************************/
927 
928 /******************************************************************************/
945 
946 /******************************************************************************/
961 
962 /******************************************************************************/
983 ALT_STATUS_CODE alt_qspi_timing_config_set(const ALT_QSPI_TIMING_CONFIG_t * cfg);
984 
987 /******************************************************************************/
1012 /******************************************************************************/
1019 ALT_STATUS_CODE alt_qspi_direct_disable(void);
1020 
1021 /******************************************************************************/
1028 ALT_STATUS_CODE alt_qspi_direct_enable(void);
1029 
1030 /******************************************************************************/
1039 uint32_t alt_qspi_ahb_remap_address_get(void);
1040 
1041 /******************************************************************************/
1057 ALT_STATUS_CODE alt_qspi_ahb_remap_address_set(const uint32_t ahb_remap_addr);
1058 
1059 /******************************************************************************/
1070 ALT_STATUS_CODE alt_qspi_ahb_address_remap_disable(void);
1071 
1072 /******************************************************************************/
1084 ALT_STATUS_CODE alt_qspi_ahb_address_remap_enable(void);
1085 
1088 /******************************************************************************/
1105 /******************************************************************************/
1138 ALT_STATUS_CODE alt_qspi_indirect_read_start(const uint32_t flash_addr,
1139  const size_t num_bytes);
1140 
1141 /******************************************************************************/
1149 ALT_STATUS_CODE alt_qspi_indirect_read_finish(void);
1150 
1151 /******************************************************************************/
1158 ALT_STATUS_CODE alt_qspi_indirect_read_cancel(void);
1159 
1160 /******************************************************************************/
1170 uint32_t alt_qspi_indirect_read_fill_level(void);
1171 
1172 /******************************************************************************/
1184 
1185 /******************************************************************************/
1201 ALT_STATUS_CODE alt_qspi_indirect_read_watermark_set(const uint32_t watermark);
1202 
1203 /******************************************************************************/
1214 
1215 /******************************************************************************/
1250 ALT_STATUS_CODE alt_qspi_indirect_write_start(const uint32_t flash_addr,
1251  const size_t num_bytes);
1252 
1253 /******************************************************************************/
1261 ALT_STATUS_CODE alt_qspi_indirect_write_finish(void);
1262 
1263 /******************************************************************************/
1270 ALT_STATUS_CODE alt_qspi_indirect_write_cancel(void);
1271 
1272 /******************************************************************************/
1282 uint32_t alt_qspi_indirect_write_fill_level(void);
1283 
1284 /******************************************************************************/
1296 
1297 /******************************************************************************/
1313 ALT_STATUS_CODE alt_qspi_indirect_write_watermark_set(const uint32_t watermark);
1314 
1315 /******************************************************************************/
1328 
1329 /******************************************************************************/
1351 #define ALT_QSPI_SRAM_FIFO_SIZE (512)
1352 
1353 /*
1354  * The size of the onboard SRAM in entries. Each entry is word (32-bit) sized.
1355  */
1356 #define ALT_QSPI_SRAM_FIFO_ENTRY_COUNT (512 / sizeof(uint32_t))
1357 
1358 /******************************************************************************/
1379 uint32_t alt_qspi_sram_partition_get(void);
1380 
1381 /******************************************************************************/
1396 ALT_STATUS_CODE alt_qspi_sram_partition_set(const uint32_t read_part_size);
1397 
1402 /******************************************************************************/
1410 /******************************************************************************/
1424 ALT_STATUS_CODE alt_qspi_query_erase_options(uint32_t * options);
1425 
1426 
1427 /******************************************************************************/
1444 ALT_STATUS_CODE alt_qspi_query_erase_span(uint32_t address, uint32_t size,
1445  uint32_t * actual_address, uint32_t * actual_size);
1446 
1447 /******************************************************************************/
1455 ALT_STATUS_CODE alt_qspi_erase_chip(void);
1456 
1457 /******************************************************************************/
1470 ALT_STATUS_CODE alt_qspi_erase(uint32_t address, uint32_t size);
1471 
1472 /******************************************************************************/
1485 ALT_STATUS_CODE alt_qspi_erase_sector(const uint32_t addr);
1486 
1487 /******************************************************************************/
1512 ALT_STATUS_CODE alt_qspi_replace(uint32_t dst, const void * src, size_t size, char *bank_buffer, uint32_t buffer_size);
1513 
1516 /******************************************************************************/
1541 /******************************************************************************/
1548 ALT_STATUS_CODE alt_qspi_dma_disable(void);
1549 
1550 /******************************************************************************/
1560 ALT_STATUS_CODE alt_qspi_dma_enable(void);
1561 
1562 /******************************************************************************/
1580 ALT_STATUS_CODE alt_qspi_dma_config_get(uint32_t * single_type_sz,
1581  uint32_t * burst_type_sz);
1582 
1583 /******************************************************************************/
1618 ALT_STATUS_CODE alt_qspi_dma_config_set(const uint32_t single_type_sz,
1619  const uint32_t burst_type_sz);
1620 
1621 
1622 /******************************************************************************/
1628 uint32_t alt_qspi_get_device_size(void);
1629 
1630 
1631 /******************************************************************************/
1638 uint32_t get_smallest_sector_size(void);
1639 
1640 
1641 /******************************************************************************/
1647 const char * alt_qspi_get_friendly_name(void);
1648 
1649 /******************************************************************************/
1656 bool alt_qspi_is_multidie(void);
1657 
1658 /******************************************************************************/
1667 uint32_t alt_qspi_get_die_size(void);
1668 
1669 /******************************************************************************/
1677 uint32_t alt_qspi_get_page_size(void);
1678 
1679 
1680 
1681 
1686 #ifdef __cplusplus
1687 }
1688 #endif /* __cplusplus */
1689 #endif /* __ALT_QSPI_H__ */