philippe s. / mbed-dev

Fork of mbed-dev by mbed official

Committer:
neurofun
Date:
Tue Feb 23 21:59:35 2016 +0000
Revision:
70:b3a5af880266
Parent:
0:9b334a45a8ff
Edited DAC routines to allow for the simultaneous use of three channels from two DACs as seen on the STM32F334R8 and STM32F303K8. Edited ADC routines to allow for the simultaneous use of more than one ADC.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bogdanm 0:9b334a45a8ff 1 /* mbed Microcontroller Library - stackheap
bogdanm 0:9b334a45a8ff 2 * Setup a fixed single stack/heap memory model,
bogdanm 0:9b334a45a8ff 3 * between the top of the RW/ZI region and the stackpointer
bogdanm 0:9b334a45a8ff 4 *******************************************************************************
bogdanm 0:9b334a45a8ff 5 * Copyright (c) 2014, STMicroelectronics
bogdanm 0:9b334a45a8ff 6 * All rights reserved.
bogdanm 0:9b334a45a8ff 7 *
bogdanm 0:9b334a45a8ff 8 * Redistribution and use in source and binary forms, with or without
bogdanm 0:9b334a45a8ff 9 * modification, are permitted provided that the following conditions are met:
bogdanm 0:9b334a45a8ff 10 *
bogdanm 0:9b334a45a8ff 11 * 1. Redistributions of source code must retain the above copyright notice,
bogdanm 0:9b334a45a8ff 12 * this list of conditions and the following disclaimer.
bogdanm 0:9b334a45a8ff 13 * 2. Redistributions in binary form must reproduce the above copyright notice,
bogdanm 0:9b334a45a8ff 14 * this list of conditions and the following disclaimer in the documentation
bogdanm 0:9b334a45a8ff 15 * and/or other materials provided with the distribution.
bogdanm 0:9b334a45a8ff 16 * 3. Neither the name of STMicroelectronics nor the names of its contributors
bogdanm 0:9b334a45a8ff 17 * may be used to endorse or promote products derived from this software
bogdanm 0:9b334a45a8ff 18 * without specific prior written permission.
bogdanm 0:9b334a45a8ff 19 *
bogdanm 0:9b334a45a8ff 20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
bogdanm 0:9b334a45a8ff 21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
bogdanm 0:9b334a45a8ff 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
bogdanm 0:9b334a45a8ff 23 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
bogdanm 0:9b334a45a8ff 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
bogdanm 0:9b334a45a8ff 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
bogdanm 0:9b334a45a8ff 26 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
bogdanm 0:9b334a45a8ff 27 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
bogdanm 0:9b334a45a8ff 28 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
bogdanm 0:9b334a45a8ff 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
bogdanm 0:9b334a45a8ff 30 *******************************************************************************
bogdanm 0:9b334a45a8ff 31 */
bogdanm 0:9b334a45a8ff 32
bogdanm 0:9b334a45a8ff 33 #ifdef __cplusplus
bogdanm 0:9b334a45a8ff 34 extern "C" {
bogdanm 0:9b334a45a8ff 35 #endif
bogdanm 0:9b334a45a8ff 36
bogdanm 0:9b334a45a8ff 37 #include <rt_misc.h>
bogdanm 0:9b334a45a8ff 38 #include <stdint.h>
bogdanm 0:9b334a45a8ff 39
bogdanm 0:9b334a45a8ff 40 extern char Image$$RW_IRAM1$$ZI$$Limit[];
bogdanm 0:9b334a45a8ff 41
bogdanm 0:9b334a45a8ff 42 extern __value_in_regs struct __initial_stackheap __user_setup_stackheap(uint32_t R0, uint32_t R1, uint32_t R2, uint32_t R3) {
bogdanm 0:9b334a45a8ff 43 uint32_t zi_limit = (uint32_t)Image$$RW_IRAM1$$ZI$$Limit;
bogdanm 0:9b334a45a8ff 44 uint32_t sp_limit = __current_sp();
bogdanm 0:9b334a45a8ff 45
bogdanm 0:9b334a45a8ff 46 zi_limit = (zi_limit + 7) & ~0x7; // ensure zi_limit is 8-byte aligned
bogdanm 0:9b334a45a8ff 47
bogdanm 0:9b334a45a8ff 48 struct __initial_stackheap r;
bogdanm 0:9b334a45a8ff 49 r.heap_base = zi_limit;
bogdanm 0:9b334a45a8ff 50 r.heap_limit = sp_limit;
bogdanm 0:9b334a45a8ff 51 return r;
bogdanm 0:9b334a45a8ff 52 }
bogdanm 0:9b334a45a8ff 53
bogdanm 0:9b334a45a8ff 54 #ifdef __cplusplus
bogdanm 0:9b334a45a8ff 55 }
bogdanm 0:9b334a45a8ff 56 #endif