MacroRat / MouseCode

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sat Jun 03 00:22:44 2017 +0000
Revision:
46:b156ef445742
Parent:
18:6a4db94011d3
Final code for internal battlebot competition.

Who changed what in which revision?

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