Memory to Memory DMA demo from CMSIS example. This demo execute 1000 times of 32 word memory to memory DMA (copy), and also measures number of dummy loop execution during DMA cylcles. Line 56 of "DMA_M2M.c" can change DMA source. where; 1)static : source is SRAM 2)const : source is Flash ROM

Dependencies:   mbed

Committer:
todotani
Date:
Sun Nov 14 03:26:04 2010 +0000
Revision:
0:692bf16d1455
2010/11/14

Who changed what in which revision?

UserRevisionLine numberNew contents of line
todotani 0:692bf16d1455 1 /***********************************************************************//**
todotani 0:692bf16d1455 2 * @file lpc_types.h
todotani 0:692bf16d1455 3 * @brief Contains the NXP ABL typedefs for C standard types.
todotani 0:692bf16d1455 4 * It is intended to be used in ISO C conforming development
todotani 0:692bf16d1455 5 * environments and checks for this insofar as it is possible
todotani 0:692bf16d1455 6 * to do so.
todotani 0:692bf16d1455 7 * @version 1.0
todotani 0:692bf16d1455 8 * @date 27 Jul. 2008
todotani 0:692bf16d1455 9 * @author wellsk
todotani 0:692bf16d1455 10 **************************************************************************
todotani 0:692bf16d1455 11 * Software that is described herein is for illustrative purposes only
todotani 0:692bf16d1455 12 * which provides customers with programming information regarding the
todotani 0:692bf16d1455 13 * products. This software is supplied "AS IS" without any warranties.
todotani 0:692bf16d1455 14 * NXP Semiconductors assumes no responsibility or liability for the
todotani 0:692bf16d1455 15 * use of the software, conveys no license or title under any patent,
todotani 0:692bf16d1455 16 * copyright, or mask work right to the product. NXP Semiconductors
todotani 0:692bf16d1455 17 * reserves the right to make changes in the software without
todotani 0:692bf16d1455 18 * notification. NXP Semiconductors also make no representation or
todotani 0:692bf16d1455 19 * warranty that such application will be suitable for the specified
todotani 0:692bf16d1455 20 * use without further testing or modification.
todotani 0:692bf16d1455 21 **************************************************************************/
todotani 0:692bf16d1455 22
todotani 0:692bf16d1455 23 /* Type group ----------------------------------------------------------- */
todotani 0:692bf16d1455 24 /** @defgroup LPC_Types LPC_Types
todotani 0:692bf16d1455 25 * @ingroup LPC1700CMSIS_FwLib_Drivers
todotani 0:692bf16d1455 26 * @{
todotani 0:692bf16d1455 27 */
todotani 0:692bf16d1455 28
todotani 0:692bf16d1455 29 #ifndef LPC_TYPES_H
todotani 0:692bf16d1455 30 #define LPC_TYPES_H
todotani 0:692bf16d1455 31
todotani 0:692bf16d1455 32 /* Includes ------------------------------------------------------------------- */
todotani 0:692bf16d1455 33 #include <stdint.h>
todotani 0:692bf16d1455 34
todotani 0:692bf16d1455 35
todotani 0:692bf16d1455 36 /* Public Types --------------------------------------------------------------- */
todotani 0:692bf16d1455 37 /** @defgroup LPC_Types_Public_Types LPC_Types Public Types
todotani 0:692bf16d1455 38 * @{
todotani 0:692bf16d1455 39 */
todotani 0:692bf16d1455 40
todotani 0:692bf16d1455 41 /**
todotani 0:692bf16d1455 42 * @brief Boolean Type definition
todotani 0:692bf16d1455 43 */
todotani 0:692bf16d1455 44 typedef enum {FALSE = 0, TRUE = !FALSE} Bool;
todotani 0:692bf16d1455 45
todotani 0:692bf16d1455 46 /**
todotani 0:692bf16d1455 47 * @brief Flag Status and Interrupt Flag Status type definition
todotani 0:692bf16d1455 48 */
todotani 0:692bf16d1455 49 typedef enum {RESET = 0, SET = !RESET} FlagStatus, IntStatus, SetState;
todotani 0:692bf16d1455 50 #define PARAM_SETSTATE(State) ((State==RESET) || (State==SET))
todotani 0:692bf16d1455 51
todotani 0:692bf16d1455 52 /**
todotani 0:692bf16d1455 53 * @brief Functional State Definition
todotani 0:692bf16d1455 54 */
todotani 0:692bf16d1455 55 typedef enum {DISABLE = 0, ENABLE = !DISABLE} FunctionalState;
todotani 0:692bf16d1455 56 #define PARAM_FUNCTIONALSTATE(State) ((State==DISABLE) || (State==ENABLE))
todotani 0:692bf16d1455 57
todotani 0:692bf16d1455 58 /**
todotani 0:692bf16d1455 59 * @ Status type definition
todotani 0:692bf16d1455 60 */
todotani 0:692bf16d1455 61 typedef enum {ERROR = 0, SUCCESS = !ERROR} Status;
todotani 0:692bf16d1455 62
todotani 0:692bf16d1455 63
todotani 0:692bf16d1455 64 /**
todotani 0:692bf16d1455 65 * Read/Write transfer type mode (Block or non-block)
todotani 0:692bf16d1455 66 */
todotani 0:692bf16d1455 67 typedef enum
todotani 0:692bf16d1455 68 {
todotani 0:692bf16d1455 69 NONE_BLOCKING = 0, /**< None Blocking type */
todotani 0:692bf16d1455 70 BLOCKING, /**< Blocking type */
todotani 0:692bf16d1455 71 } TRANSFER_BLOCK_Type;
todotani 0:692bf16d1455 72
todotani 0:692bf16d1455 73
todotani 0:692bf16d1455 74 /** Pointer to Function returning Void (any number of parameters) */
todotani 0:692bf16d1455 75 typedef void (*PFV)();
todotani 0:692bf16d1455 76
todotani 0:692bf16d1455 77 /** Pointer to Function returning int32_t (any number of parameters) */
todotani 0:692bf16d1455 78 typedef int32_t(*PFI)();
todotani 0:692bf16d1455 79
todotani 0:692bf16d1455 80 /**
todotani 0:692bf16d1455 81 * @}
todotani 0:692bf16d1455 82 */
todotani 0:692bf16d1455 83
todotani 0:692bf16d1455 84
todotani 0:692bf16d1455 85 /* Public Macros -------------------------------------------------------------- */
todotani 0:692bf16d1455 86 /** @defgroup LPC_Types_Public_Macros LPC_Types Public Macros
todotani 0:692bf16d1455 87 * @{
todotani 0:692bf16d1455 88 */
todotani 0:692bf16d1455 89
todotani 0:692bf16d1455 90 /* _BIT(n) sets the bit at position "n"
todotani 0:692bf16d1455 91 * _BIT(n) is intended to be used in "OR" and "AND" expressions:
todotani 0:692bf16d1455 92 * e.g., "(_BIT(3) | _BIT(7))".
todotani 0:692bf16d1455 93 */
todotani 0:692bf16d1455 94 #undef _BIT
todotani 0:692bf16d1455 95 /* Set bit macro */
todotani 0:692bf16d1455 96 #define _BIT(n) (1<<n)
todotani 0:692bf16d1455 97
todotani 0:692bf16d1455 98 /* _SBF(f,v) sets the bit field starting at position "f" to value "v".
todotani 0:692bf16d1455 99 * _SBF(f,v) is intended to be used in "OR" and "AND" expressions:
todotani 0:692bf16d1455 100 * e.g., "((_SBF(5,7) | _SBF(12,0xF)) & 0xFFFF)"
todotani 0:692bf16d1455 101 */
todotani 0:692bf16d1455 102 #undef _SBF
todotani 0:692bf16d1455 103 /* Set bit field macro */
todotani 0:692bf16d1455 104 #define _SBF(f,v) (v<<f)
todotani 0:692bf16d1455 105
todotani 0:692bf16d1455 106 /* _BITMASK constructs a symbol with 'field_width' least significant
todotani 0:692bf16d1455 107 * bits set.
todotani 0:692bf16d1455 108 * e.g., _BITMASK(5) constructs '0x1F', _BITMASK(16) == 0xFFFF
todotani 0:692bf16d1455 109 * The symbol is intended to be used to limit the bit field width
todotani 0:692bf16d1455 110 * thusly:
todotani 0:692bf16d1455 111 * <a_register> = (any_expression) & _BITMASK(x), where 0 < x <= 32.
todotani 0:692bf16d1455 112 * If "any_expression" results in a value that is larger than can be
todotani 0:692bf16d1455 113 * contained in 'x' bits, the bits above 'x - 1' are masked off. When
todotani 0:692bf16d1455 114 * used with the _SBF example above, the example would be written:
todotani 0:692bf16d1455 115 * a_reg = ((_SBF(5,7) | _SBF(12,0xF)) & _BITMASK(16))
todotani 0:692bf16d1455 116 * This ensures that the value written to a_reg is no wider than
todotani 0:692bf16d1455 117 * 16 bits, and makes the code easier to read and understand.
todotani 0:692bf16d1455 118 */
todotani 0:692bf16d1455 119 #undef _BITMASK
todotani 0:692bf16d1455 120 /* Bitmask creation macro */
todotani 0:692bf16d1455 121 #define _BITMASK(field_width) ( _BIT(field_width) - 1)
todotani 0:692bf16d1455 122
todotani 0:692bf16d1455 123 /* NULL pointer */
todotani 0:692bf16d1455 124 #ifndef NULL
todotani 0:692bf16d1455 125 #define NULL ((void*) 0)
todotani 0:692bf16d1455 126 #endif
todotani 0:692bf16d1455 127
todotani 0:692bf16d1455 128 /* Number of elements in an array */
todotani 0:692bf16d1455 129 #define NELEMENTS(array) (sizeof (array) / sizeof (array[0]))
todotani 0:692bf16d1455 130
todotani 0:692bf16d1455 131 /* Static data/function define */
todotani 0:692bf16d1455 132 #define STATIC static
todotani 0:692bf16d1455 133 /* External data/function define */
todotani 0:692bf16d1455 134 #define EXTERN extern
todotani 0:692bf16d1455 135
todotani 0:692bf16d1455 136 #define MAX(a, b) (((a) > (b)) ? (a) : (b))
todotani 0:692bf16d1455 137 #define MIN(a, b) (((a) < (b)) ? (a) : (b))
todotani 0:692bf16d1455 138
todotani 0:692bf16d1455 139 /**
todotani 0:692bf16d1455 140 * @}
todotani 0:692bf16d1455 141 */
todotani 0:692bf16d1455 142
todotani 0:692bf16d1455 143
todotani 0:692bf16d1455 144 /* Old Type Definition compatibility ------------------------------------------ */
todotani 0:692bf16d1455 145 /** @addtogroup LPC_Types_Public_Types LPC_Types Public Types
todotani 0:692bf16d1455 146 * @{
todotani 0:692bf16d1455 147 */
todotani 0:692bf16d1455 148
todotani 0:692bf16d1455 149 /** SMA type for character type */
todotani 0:692bf16d1455 150 typedef char CHAR;
todotani 0:692bf16d1455 151
todotani 0:692bf16d1455 152 /** SMA type for 8 bit unsigned value */
todotani 0:692bf16d1455 153 typedef uint8_t UNS_8;
todotani 0:692bf16d1455 154
todotani 0:692bf16d1455 155 /** SMA type for 8 bit signed value */
todotani 0:692bf16d1455 156 typedef int8_t INT_8;
todotani 0:692bf16d1455 157
todotani 0:692bf16d1455 158 /** SMA type for 16 bit unsigned value */
todotani 0:692bf16d1455 159 typedef uint16_t UNS_16;
todotani 0:692bf16d1455 160
todotani 0:692bf16d1455 161 /** SMA type for 16 bit signed value */
todotani 0:692bf16d1455 162 typedef int16_t INT_16;
todotani 0:692bf16d1455 163
todotani 0:692bf16d1455 164 /** SMA type for 32 bit unsigned value */
todotani 0:692bf16d1455 165 typedef uint32_t UNS_32;
todotani 0:692bf16d1455 166
todotani 0:692bf16d1455 167 /** SMA type for 32 bit signed value */
todotani 0:692bf16d1455 168 typedef int32_t INT_32;
todotani 0:692bf16d1455 169
todotani 0:692bf16d1455 170 /** SMA type for 64 bit signed value */
todotani 0:692bf16d1455 171 typedef int64_t INT_64;
todotani 0:692bf16d1455 172
todotani 0:692bf16d1455 173 /** SMA type for 64 bit unsigned value */
todotani 0:692bf16d1455 174 typedef uint64_t UNS_64;
todotani 0:692bf16d1455 175
todotani 0:692bf16d1455 176 /** 32 bit boolean type */
todotani 0:692bf16d1455 177 typedef Bool BOOL_32;
todotani 0:692bf16d1455 178
todotani 0:692bf16d1455 179 /** 16 bit boolean type */
todotani 0:692bf16d1455 180 typedef Bool BOOL_16;
todotani 0:692bf16d1455 181
todotani 0:692bf16d1455 182 /** 8 bit boolean type */
todotani 0:692bf16d1455 183 typedef Bool BOOL_8;
todotani 0:692bf16d1455 184
todotani 0:692bf16d1455 185 /**
todotani 0:692bf16d1455 186 * @}
todotani 0:692bf16d1455 187 */
todotani 0:692bf16d1455 188
todotani 0:692bf16d1455 189
todotani 0:692bf16d1455 190 #endif /* LPC_TYPES_H */
todotani 0:692bf16d1455 191
todotani 0:692bf16d1455 192 /**
todotani 0:692bf16d1455 193 * @}
todotani 0:692bf16d1455 194 */
todotani 0:692bf16d1455 195
todotani 0:692bf16d1455 196 /* --------------------------------- End Of File ------------------------------ */