RTEMS  5.0.0
alt_address_space.h
Go to the documentation of this file.
1 
11 /******************************************************************************
12 *
13 * Copyright 2013 Altera Corporation. All Rights Reserved.
14 *
15 * Redistribution and use in source and binary forms, with or without
16 * modification, are permitted provided that the following conditions are met:
17 *
18 * 1. Redistributions of source code must retain the above copyright notice,
19 * this list of conditions and the following disclaimer.
20 *
21 * 2. Redistributions in binary form must reproduce the above copyright notice,
22 * this list of conditions and the following disclaimer in the documentation
23 * and/or other materials provided with the distribution.
24 *
25 * 3. The name of the author may not be used to endorse or promote products
26 * derived from this software without specific prior written permission.
27 *
28 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY EXPRESS OR
29 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
30 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, ARE DISCLAIMED. IN NO
31 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
32 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
33 * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
36 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
37 * OF SUCH DAMAGE.
38 *
39 ******************************************************************************/
40 
41 #ifndef __ALT_ADDRESS_SPACE_H__
42 #define __ALT_ADDRESS_SPACE_H__
43 
44 #include <stdbool.h>
45 #include "hwlib.h"
46 #include "socal/hps.h"
47 
48 #ifdef __cplusplus
49 extern "C"
50 {
51 #endif /* __cplusplus */
52 
53 /******************************************************************************/
54 // ARM Level 2 Cache Controller L2C-310 Register Interface
55 
56 // Address Filtering Start Register
57 // The Address Filtering Start Register is a read and write register.
58 // Bits Field Description
59 // :-------|:--------------------------|:-----------------------------------------
60 // [31:20] | address_filtering_start | Address filtering start address for
61 // | | bits [31:20] of the filtering address.
62 // [19:1] | Reserved | SBZ/RAZ
63 // [0] | address_filtering_enable | 0 - address filtering disabled
64 // | | 1 - address filtering enabled.
65 
66 // Address Filtering Start Register Address
67 #define L2_CACHE_ADDR_FILTERING_START_OFST 0xC00
68 #define L2_CACHE_ADDR_FILTERING_START_ADDR (ALT_MPUL2_OFST + L2_CACHE_ADDR_FILTERING_START_OFST)
69 // Address Filtering Start Register - Start Value Mask
70 #define L2_CACHE_ADDR_FILTERING_START_ADDR_MASK 0xFFF00000
71 // Address Filtering Start Register - Reset Start Address Value (1 MB)
72 #define L2_CACHE_ADDR_FILTERING_START_RESET 0x100000
73 // Address Filtering Start Register - Enable Flag Mask
74 #define L2_CACHE_ADDR_FILTERING_ENABLE_MASK 0x00000001
75 // Address Filtering Start Register - Reset Enable Flag Value (Enabled)
76 #define L2_CACHE_ADDR_FILTERING_ENABLE_RESET 0x1
77 
78 // Address Filtering End Register
79 // The Address Filtering End Register is a read and write register.
80 // Bits Field Description
81 // :-------|:--------------------------|:-----------------------------------------
82 // [31:20] | address_filtering_end | Address filtering end address for bits
83 // | | [31:20] of the filtering address.
84 // [19:0] | Reserved | SBZ/RAZ
85 
86 // Address Filtering End Register Address
87 #define L2_CACHE_ADDR_FILTERING_END_OFST 0xC04
88 #define L2_CACHE_ADDR_FILTERING_END_ADDR (ALT_MPUL2_OFST + L2_CACHE_ADDR_FILTERING_END_OFST)
89 // Address Filtering End Register - End Value Mask
90 #define L2_CACHE_ADDR_FILTERING_END_ADDR_MASK 0xFFF00000
91 // Address Filtering End Register - Reset End Address Value (3 GiB)
92 #define L2_CACHE_ADDR_FILTERING_END_RESET 0xC0000000
93 
94 #ifndef __ASSEMBLY__
95 
96 /******************************************************************************/
109 /******************************************************************************/
163 /******************************************************************************/
171 {
190 
191 /******************************************************************************/
200 {
213 
214 /******************************************************************************/
220 {
231 
232 /******************************************************************************/
238 {
249 
250 /******************************************************************************/
274 ALT_STATUS_CODE alt_addr_space_remap(ALT_ADDR_SPACE_MPU_ATTR_t mpu_attr,
275  ALT_ADDR_SPACE_NONMPU_ATTR_t nonmpu_attr,
276  ALT_ADDR_SPACE_H2F_BRIDGE_ATTR_t h2f_attr,
277  ALT_ADDR_SPACE_LWH2F_BRIDGE_ATTR_t lwh2f_attr);
278 
279 /******************************************************************************/
308 
311 /******************************************************************************/
334 /******************************************************************************/
355 ALT_STATUS_CODE alt_l2_addr_filter_cfg_get(uint32_t* addr_filt_start,
356  uint32_t* addr_filt_end);
357 
358 /******************************************************************************/
384 ALT_STATUS_CODE alt_l2_addr_filter_cfg_set(uint32_t addr_filt_start,
385  uint32_t addr_filt_end);
386 
389 /******************************************************************************/
477 /******************************************************************************/
489 #define ALT_ACP_ID_MAP_MASTER_ID_MASK 0xfff
490 
492 #define ALT_ACP_ID_MAP_MASTER_ID_L2M0(var) (0x00000002 | (0x000007f8 & (var)))
493 
494 #define ALT_ACP_ID_MAP_MASTER_ID_DMA(var) (0x00000001 | (0x00000078 & (var)))
495 
496 #define ALT_ACP_ID_MAP_MASTER_ID_EMAC0(var) (0x00000801 | (0x00000878 & (var)))
497 
498 #define ALT_ACP_ID_MAP_MASTER_ID_EMAC1(var) (0x00000802 | (0x00000878 & (var)))
499 
500 #define ALT_ACP_ID_MAP_MASTER_ID_USB0 0x00000803
501 
502 #define ALT_ACP_ID_MAP_MASTER_ID_USB1 0x00000806
503 
504 #define ALT_ACP_ID_MAP_MASTER_ID_NAND(var) (0x00000804 | (0x00000ff8 & (var)))
505 
506 #define ALT_ACP_ID_MAP_MASTER_ID_TMC 0x00000800
507 
508 #define ALT_ACP_ID_MAP_MASTER_ID_DAP 0x00000004
509 
510 #define ALT_ACP_ID_MAP_MASTER_ID_SDMMC 0x00000805
511 
512 #define ALT_ACP_ID_MAP_MASTER_ID_F2H(var) (0x00000000 | (0x000007f8 & (var)))
513 
515 /******************************************************************************/
520 {
531 
537 {
543 
544 /******************************************************************************/
579 ALT_STATUS_CODE alt_acp_id_map_fixed_read_set(const uint32_t input_id,
580  const uint32_t output_id,
582  const uint32_t aruser);
583 
584 /******************************************************************************/
619 ALT_STATUS_CODE alt_acp_id_map_fixed_write_set(const uint32_t input_id,
620  const uint32_t output_id,
622  const uint32_t awuser);
623 
624 /******************************************************************************/
645 ALT_STATUS_CODE alt_acp_id_map_dynamic_read_set(const uint32_t output_id);
646 
647 /******************************************************************************/
668 ALT_STATUS_CODE alt_acp_id_map_dynamic_write_set(const uint32_t output_id);
669 
670 /******************************************************************************/
694  const uint32_t aruser);
695 
696 /******************************************************************************/
720  const uint32_t awuser);
721 
722 /******************************************************************************/
766 ALT_STATUS_CODE alt_acp_id_map_read_options_get(const uint32_t output_id,
767  bool* fixed,
768  uint32_t* input_id,
770  uint32_t* aruser);
771 
772 /******************************************************************************/
816 ALT_STATUS_CODE alt_acp_id_map_write_options_get(const uint32_t output_id,
817  bool* fixed,
818  uint32_t* input_id,
820  uint32_t* awuser);
821 
826 #endif /* __ASSEMBLY__ */
827 
828 #ifdef __cplusplus
829 }
830 #endif /* __cplusplus */
831 #endif /* __ALT_ADDRESS_SPACE_H__ */
ALT_STATUS_CODE alt_l2_addr_filter_cfg_get(uint32_t *addr_filt_start, uint32_t *addr_filt_end)
Definition: alt_address_space.c:145
enum ALT_ADDR_SPACE_H2F_BRIDGE_ATTR_e ALT_ADDR_SPACE_H2F_BRIDGE_ATTR_t
Definition: alt_address_space.h:539
ALT_ACP_ID_OUTPUT_ID_e
Definition: alt_address_space.h:519
Definition: alt_address_space.h:541
ALT_ADDR_SPACE_H2F_BRIDGE_ATTR_e
Definition: alt_address_space.h:219
enum ALT_ADDR_SPACE_LWH2F_BRIDGE_ATTR_e ALT_ADDR_SPACE_LWH2F_BRIDGE_ATTR_t
Definition: alt_address_space.h:521
Definition: alt_address_space.h:526
ALT_ADDR_SPACE_LWH2F_BRIDGE_ATTR_e
Definition: alt_address_space.h:237
enum ALT_ACP_ID_OUTPUT_ID_e ALT_ACP_ID_OUTPUT_ID_t
Definition: alt_address_space.h:181
ALT_STATUS_CODE alt_acp_id_map_read_options_get(const uint32_t output_id, bool *fixed, uint32_t *input_id, ALT_ACP_ID_MAP_PAGE_t *page, uint32_t *aruser)
Definition: alt_address_space.c:409
Definition: alt_address_space.h:525
Definition: alt_address_space.h:221
ALT_STATUS_CODE alt_acp_id_map_write_options_get(const uint32_t output_id, bool *fixed, uint32_t *input_id, ALT_ACP_ID_MAP_PAGE_t *page, uint32_t *awuser)
Definition: alt_address_space.c:463
ALT_ACP_ID_MAP_PAGE_e
Definition: alt_address_space.h:536
ALT_ADDR_SPACE_MPU_ATTR_e
Definition: alt_address_space.h:170
Definition: alt_address_space.h:227
ALT_STATUS_CODE alt_l2_addr_filter_cfg_set(uint32_t addr_filt_start, uint32_t addr_filt_end)
Definition: alt_address_space.c:162
Definition: alt_address_space.h:540
Definition: misc.c:36
ALT_STATUS_CODE alt_acp_id_map_fixed_read_set(const uint32_t input_id, const uint32_t output_id, const ALT_ACP_ID_MAP_PAGE_t page, const uint32_t aruser)
Definition: alt_address_space.c:194
ALT_STATUS_CODE alt_acp_id_map_dynamic_write_options_set(const ALT_ACP_ID_MAP_PAGE_t page, const uint32_t awuser)
Definition: alt_address_space.c:399
Definition: alt_address_space.h:204
ALT_ADDR_SPACE_NONMPU_ATTR_e
Definition: alt_address_space.h:199
Definition: alt_address_space.h:172
Definition: alt_address_space.h:527
Definition: alt_address_space.h:528
ALT_STATUS_CODE alt_addr_space_remap(ALT_ADDR_SPACE_MPU_ATTR_t mpu_attr, ALT_ADDR_SPACE_NONMPU_ATTR_t nonmpu_attr, ALT_ADDR_SPACE_H2F_BRIDGE_ATTR_t h2f_attr, ALT_ADDR_SPACE_LWH2F_BRIDGE_ATTR_t lwh2f_attr)
Definition: alt_address_space.c:55
Definition: alt_address_space.h:245
ALT_STATUS_CODE alt_acp_id_map_dynamic_read_set(const uint32_t output_id)
Definition: alt_address_space.c:305
int32_t ALT_STATUS_CODE
Definition: hwlib.h:60
Definition: alt_address_space.h:239
Definition: alt_address_space.h:538
ALT_STATUS_CODE alt_mpu_addr_space_remap_0_to_sdram(void)
Definition: alt_address_space.c:135
ALT_STATUS_CODE alt_acp_id_map_fixed_write_set(const uint32_t input_id, const uint32_t output_id, const ALT_ACP_ID_MAP_PAGE_t page, const uint32_t awuser)
Definition: alt_address_space.c:249
Definition: alt_address_space.h:201
enum ALT_ACP_ID_MAP_PAGE_e ALT_ACP_ID_MAP_PAGE_t
enum ALT_ADDR_SPACE_MPU_ATTR_e ALT_ADDR_SPACE_MPU_ATTR_t
ALT_STATUS_CODE alt_acp_id_map_dynamic_read_options_set(const ALT_ACP_ID_MAP_PAGE_t page, const uint32_t aruser)
Definition: alt_address_space.c:389
Definition: alt_address_space.h:529
ALT_STATUS_CODE alt_acp_id_map_dynamic_write_set(const uint32_t output_id)
Definition: alt_address_space.c:347
enum ALT_ADDR_SPACE_NONMPU_ATTR_e ALT_ADDR_SPACE_NONMPU_ATTR_t