test
targets/TARGET_Maxim/TARGET_MAX32630/mxc/icc.c@2:4364577b5ad8, 2020-11-09 (annotated)
- Committer:
- elijahsj
- Date:
- Mon Nov 09 00:33:19 2020 -0500
- Revision:
- 2:4364577b5ad8
- Parent:
- 1:8a094db1347f
copied mbed library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
elijahsj | 1:8a094db1347f | 1 | /** |
elijahsj | 1:8a094db1347f | 2 | * @file |
elijahsj | 1:8a094db1347f | 3 | * @brief This file contains the function implementations for the |
elijahsj | 1:8a094db1347f | 4 | * Instruction Cache Controller. |
elijahsj | 1:8a094db1347f | 5 | */ |
elijahsj | 1:8a094db1347f | 6 | |
elijahsj | 1:8a094db1347f | 7 | /* **************************************************************************** |
elijahsj | 1:8a094db1347f | 8 | * Copyright (C) 2016 Maxim Integrated Products, Inc., All Rights Reserved. |
elijahsj | 1:8a094db1347f | 9 | * |
elijahsj | 1:8a094db1347f | 10 | * Permission is hereby granted, free of charge, to any person obtaining a |
elijahsj | 1:8a094db1347f | 11 | * copy of this software and associated documentation files (the "Software"), |
elijahsj | 1:8a094db1347f | 12 | * to deal in the Software without restriction, including without limitation |
elijahsj | 1:8a094db1347f | 13 | * the rights to use, copy, modify, merge, publish, distribute, sublicense, |
elijahsj | 1:8a094db1347f | 14 | * and/or sell copies of the Software, and to permit persons to whom the |
elijahsj | 1:8a094db1347f | 15 | * Software is furnished to do so, subject to the following conditions: |
elijahsj | 1:8a094db1347f | 16 | * |
elijahsj | 1:8a094db1347f | 17 | * The above copyright notice and this permission notice shall be included |
elijahsj | 1:8a094db1347f | 18 | * in all copies or substantial portions of the Software. |
elijahsj | 1:8a094db1347f | 19 | * |
elijahsj | 1:8a094db1347f | 20 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
elijahsj | 1:8a094db1347f | 21 | * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
elijahsj | 1:8a094db1347f | 22 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
elijahsj | 1:8a094db1347f | 23 | * IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES |
elijahsj | 1:8a094db1347f | 24 | * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
elijahsj | 1:8a094db1347f | 25 | * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
elijahsj | 1:8a094db1347f | 26 | * OTHER DEALINGS IN THE SOFTWARE. |
elijahsj | 1:8a094db1347f | 27 | * |
elijahsj | 1:8a094db1347f | 28 | * Except as contained in this notice, the name of Maxim Integrated |
elijahsj | 1:8a094db1347f | 29 | * Products, Inc. shall not be used except as stated in the Maxim Integrated |
elijahsj | 1:8a094db1347f | 30 | * Products, Inc. Branding Policy. |
elijahsj | 1:8a094db1347f | 31 | * |
elijahsj | 1:8a094db1347f | 32 | * The mere transfer of this software does not imply any licenses |
elijahsj | 1:8a094db1347f | 33 | * of trade secrets, proprietary technology, copyrights, patents, |
elijahsj | 1:8a094db1347f | 34 | * trademarks, maskwork rights, or any other form of intellectual |
elijahsj | 1:8a094db1347f | 35 | * property whatsoever. Maxim Integrated Products, Inc. retains all |
elijahsj | 1:8a094db1347f | 36 | * ownership rights. |
elijahsj | 1:8a094db1347f | 37 | * |
elijahsj | 1:8a094db1347f | 38 | * $Date: 2016-09-08 17:45:25 -0500 (Thu, 08 Sep 2016) $ |
elijahsj | 1:8a094db1347f | 39 | * $Revision: 24331 $ |
elijahsj | 1:8a094db1347f | 40 | * |
elijahsj | 1:8a094db1347f | 41 | *************************************************************************** */ |
elijahsj | 1:8a094db1347f | 42 | |
elijahsj | 1:8a094db1347f | 43 | |
elijahsj | 1:8a094db1347f | 44 | /* **** Includes **** */ |
elijahsj | 1:8a094db1347f | 45 | #include "mxc_config.h" |
elijahsj | 1:8a094db1347f | 46 | #include "icc.h" |
elijahsj | 1:8a094db1347f | 47 | /** |
elijahsj | 1:8a094db1347f | 48 | * @ingroup icc |
elijahsj | 1:8a094db1347f | 49 | * @{ |
elijahsj | 1:8a094db1347f | 50 | */ |
elijahsj | 1:8a094db1347f | 51 | |
elijahsj | 1:8a094db1347f | 52 | /* **** Definitions **** */ |
elijahsj | 1:8a094db1347f | 53 | |
elijahsj | 1:8a094db1347f | 54 | /* **** Globals **** */ |
elijahsj | 1:8a094db1347f | 55 | |
elijahsj | 1:8a094db1347f | 56 | /* **** Functions **** */ |
elijahsj | 1:8a094db1347f | 57 | |
elijahsj | 1:8a094db1347f | 58 | /* ************************************************************************* */ |
elijahsj | 1:8a094db1347f | 59 | void ICC_Enable(void) |
elijahsj | 1:8a094db1347f | 60 | { |
elijahsj | 1:8a094db1347f | 61 | /* Invalidate cache and wait until ready */ |
elijahsj | 1:8a094db1347f | 62 | MXC_ICC->invdt_all = 1; |
elijahsj | 1:8a094db1347f | 63 | while (!(MXC_ICC->ctrl_stat & MXC_F_ICC_CTRL_STAT_READY)); |
elijahsj | 1:8a094db1347f | 64 | |
elijahsj | 1:8a094db1347f | 65 | /* Enable cache */ |
elijahsj | 1:8a094db1347f | 66 | MXC_ICC->ctrl_stat |= MXC_F_ICC_CTRL_STAT_ENABLE; |
elijahsj | 1:8a094db1347f | 67 | |
elijahsj | 1:8a094db1347f | 68 | /* Must invalidate a second time for proper use */ |
elijahsj | 1:8a094db1347f | 69 | MXC_ICC->invdt_all = 1; |
elijahsj | 1:8a094db1347f | 70 | } |
elijahsj | 1:8a094db1347f | 71 | |
elijahsj | 1:8a094db1347f | 72 | /* ************************************************************************* */ |
elijahsj | 1:8a094db1347f | 73 | void ICC_Disable(void) |
elijahsj | 1:8a094db1347f | 74 | { |
elijahsj | 1:8a094db1347f | 75 | MXC_ICC->ctrl_stat &= ~MXC_F_ICC_CTRL_STAT_ENABLE; |
elijahsj | 1:8a094db1347f | 76 | } |
elijahsj | 1:8a094db1347f | 77 | /**@} end of group icc */ |