1 /** 2 * \file 3 * 4 * \brief Matrix driver for SAM. 5 * 6 * Copyright (c) 2012-2015 Atmel Corporation. All rights reserved. 7 * 8 * \asf_license_start 9 * 10 * \page License 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions are met: 14 * 15 * 1. Redistributions of source code must retain the above copyright notice, 16 * this list of conditions and the following disclaimer. 17 * 18 * 2. Redistributions in binary form must reproduce the above copyright notice, 19 * this list of conditions and the following disclaimer in the documentation 20 * and/or other materials provided with the distribution. 21 * 22 * 3. The name of Atmel may not be used to endorse or promote products derived 23 * from this software without specific prior written permission. 24 * 25 * 4. This software may only be redistributed and used in connection with an 26 * Atmel microcontroller product. 27 * 28 * THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED 29 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 30 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE 31 * EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL BE LIABLE FOR 32 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 34 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 35 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 36 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 * POSSIBILITY OF SUCH DAMAGE. 39 * 40 * \asf_license_stop 41 * 42 */ 43 /* 44 * Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a> 45 */ 46 47 #ifndef MATRIX_H_INCLUDED 48 #define MATRIX_H_INCLUDED 49 50 #include "compiler.h" 51 52 /* / @cond 0 */ 53 /**INDENT-OFF**/ 54 #ifdef __cplusplus 55 extern "C" { 56 #endif 57 /**INDENT-ON**/ 58 /* / @endcond */ 59 60 #ifndef MATRIX_MCFG_ULBT 61 #define MATRIX_MCFG_ULBT(value) MATRIX_MCFG0_ULBT(value) 62 #endif 63 /** \brief Matrix master: undefined length burst type */ 64 typedef enum { 65 MATRIX_ULBT_INFINITE_LENGTH_BURST = MATRIX_MCFG_ULBT(0), 66 MATRIX_ULBT_SINGLE_ACCESS = MATRIX_MCFG_ULBT(1), 67 MATRIX_ULBT_4_BEAT_BURST = MATRIX_MCFG_ULBT(2), 68 MATRIX_ULBT_8_BEAT_BURST = MATRIX_MCFG_ULBT(3), 69 MATRIX_ULBT_16_BEAT_BURST = MATRIX_MCFG_ULBT(4), 70 #if SAM4C || SAM4CP || SAM4CM || SAM4E || SAMV71 || SAMV70 || SAME70 || SAMS70 71 MATRIX_ULBT_32_BEAT_BURST = MATRIX_MCFG_ULBT(5), 72 MATRIX_ULBT_64_BEAT_BURST = MATRIX_MCFG_ULBT(6), 73 MATRIX_ULBT_128_BEAT_BURST = MATRIX_MCFG_ULBT(7), 74 #endif 75 } burst_type_t; 76 77 /** \brief Matrix slave: default master type */ 78 typedef enum { 79 MATRIX_DEFMSTR_NO_DEFAULT_MASTER = MATRIX_SCFG_DEFMSTR_TYPE(0), 80 MATRIX_DEFMSTR_LAST_DEFAULT_MASTER = MATRIX_SCFG_DEFMSTR_TYPE(1), 81 MATRIX_DEFMSTR_FIXED_DEFAULT_MASTER = MATRIX_SCFG_DEFMSTR_TYPE(2) 82 } defaut_master_t; 83 84 #if !SAM4E && !SAM4C && !SAM4CP && !SAM4CM && \ 85 !SAMV71 && !SAMV70 && !SAMS70 && !SAME70 86 /** \brief Matrix slave: arbitration type */ 87 typedef enum { 88 MATRIX_ARBT_ROUND_ROBIN = MATRIX_SCFG_ARBT(0), 89 MATRIX_ARBT_FIXED_PRIORITY = MATRIX_SCFG_ARBT(1) 90 } arbitration_type_t; 91 #endif 92 93 void matrix_set_master_burst_type(uint32_t ul_id, burst_type_t burst_type); 94 burst_type_t matrix_get_master_burst_type(uint32_t ul_id); 95 void matrix_set_slave_slot_cycle(uint32_t ul_id, uint32_t ul_slot_cycle); 96 uint32_t matrix_get_slave_slot_cycle(uint32_t ul_id); 97 void matrix_set_slave_default_master_type(uint32_t ul_id, defaut_master_t type); 98 defaut_master_t matrix_get_slave_default_master_type(uint32_t ul_id); 99 void matrix_set_slave_fixed_default_master(uint32_t ul_id, 100 uint32_t ul_fixed_id); 101 uint32_t matrix_get_slave_fixed_default_master(uint32_t ul_id); 102 103 #if !SAM4E && !SAM4C && !SAM4CP && !SAM4CM && \ 104 !SAMV71 && !SAMV70 && !SAMS70 && !SAME70 105 void matrix_set_slave_arbitration_type(uint32_t ul_id, arbitration_type_t type); 106 arbitration_type_t matrix_get_slave_arbitration_type(uint32_t ul_id); 107 #endif 108 109 void matrix_set_slave_priority(uint32_t ul_id, uint32_t ul_prio); 110 uint32_t matrix_get_slave_priority(uint32_t ul_id); 111 #if (SAMV71 || SAMV70|| SAME70 || SAMS70) 112 void matrix_set_slave_priority_b(uint32_t ul_id, uint32_t ul_prio_b); 113 uint32_t matrix_get_slave_priority_b(uint32_t ul_id); 114 #endif 115 116 #if (SAM3XA || SAM3U || SAM4E || \ 117 SAMV71 || SAMV70 || SAMS70 || SAME70) 118 void matrix_set_master_remap(uint32_t ul_remap); 119 uint32_t matrix_get_master_remap(void); 120 121 #endif 122 123 #if (SAM3S || SAM3XA || SAM3N || SAM4S || SAM4E || SAM4N || SAM4C || SAMG || SAM4CP || SAM4CM || \ 124 SAMV71 || SAMV70 || SAMS70 || SAME70) 125 void matrix_set_system_io(uint32_t ul_io); 126 uint32_t matrix_get_system_io(void); 127 128 #endif 129 130 #if (SAM3S || SAM4S || SAM4E || SAM4C || SAM4CP || SAM4CM || \ 131 SAMV71 || SAMV70 || SAMS70 || SAME70) 132 void matrix_set_nandflash_cs(uint32_t ul_cs); 133 uint32_t matrix_get_nandflash_cs(void); 134 #endif 135 136 #if (!SAMG) 137 void matrix_set_writeprotect(uint32_t ul_enable); 138 uint32_t matrix_get_writeprotect_status(void); 139 #endif 140 141 #if SAMG55 142 void matrix_set_usb_device(void); 143 void matrix_set_usb_host(void); 144 #endif 145 146 #if (SAMV71 || SAMV70|| SAME70) 147 void matrix_set_can0_addr(uint32_t base_addr); 148 void matrix_set_can1_addr(uint32_t base_addr); 149 #endif 150 /* / @cond 0 */ 151 /**INDENT-OFF**/ 152 #ifdef __cplusplus 153 } 154 #endif 155 /**INDENT-ON**/ 156 /* / @endcond */ 157 158 #endif /* MATRIX_H_INCLUDED */ 159