1*9055c7d1SRyan Harkin /* 2*9055c7d1SRyan Harkin * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. 3*9055c7d1SRyan Harkin * 4*9055c7d1SRyan Harkin * Redistribution and use in source and binary forms, with or without 5*9055c7d1SRyan Harkin * modification, are permitted provided that the following conditions are met: 6*9055c7d1SRyan Harkin * 7*9055c7d1SRyan Harkin * Redistributions of source code must retain the above copyright notice, this 8*9055c7d1SRyan Harkin * list of conditions and the following disclaimer. 9*9055c7d1SRyan Harkin * 10*9055c7d1SRyan Harkin * Redistributions in binary form must reproduce the above copyright notice, 11*9055c7d1SRyan Harkin * this list of conditions and the following disclaimer in the documentation 12*9055c7d1SRyan Harkin * and/or other materials provided with the distribution. 13*9055c7d1SRyan Harkin * 14*9055c7d1SRyan Harkin * Neither the name of ARM nor the names of its contributors may be used 15*9055c7d1SRyan Harkin * to endorse or promote products derived from this software without specific 16*9055c7d1SRyan Harkin * prior written permission. 17*9055c7d1SRyan Harkin * 18*9055c7d1SRyan Harkin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19*9055c7d1SRyan Harkin * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20*9055c7d1SRyan Harkin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21*9055c7d1SRyan Harkin * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22*9055c7d1SRyan Harkin * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23*9055c7d1SRyan Harkin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24*9055c7d1SRyan Harkin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25*9055c7d1SRyan Harkin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26*9055c7d1SRyan Harkin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27*9055c7d1SRyan Harkin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28*9055c7d1SRyan Harkin * POSSIBILITY OF SUCH DAMAGE. 29*9055c7d1SRyan Harkin */ 30*9055c7d1SRyan Harkin 31*9055c7d1SRyan Harkin #ifndef __DELAY_TIMER_H__ 32*9055c7d1SRyan Harkin #define __DELAY_TIMER_H__ 33*9055c7d1SRyan Harkin 34*9055c7d1SRyan Harkin #include <stdint.h> 35*9055c7d1SRyan Harkin 36*9055c7d1SRyan Harkin /******************************************************************** 37*9055c7d1SRyan Harkin * A simple timer driver providing synchronous delay functionality. 38*9055c7d1SRyan Harkin * The driver must be initialized with a structure that provides a 39*9055c7d1SRyan Harkin * function pointer to return the timer value and a clock 40*9055c7d1SRyan Harkin * multiplier/divider. The ratio of the multiplier and the divider is 41*9055c7d1SRyan Harkin * the clock frequency in MHz. 42*9055c7d1SRyan Harkin ********************************************************************/ 43*9055c7d1SRyan Harkin 44*9055c7d1SRyan Harkin typedef struct timer_ops { 45*9055c7d1SRyan Harkin uint32_t (*get_timer_value)(void); 46*9055c7d1SRyan Harkin uint32_t clk_mult; 47*9055c7d1SRyan Harkin uint32_t clk_div; 48*9055c7d1SRyan Harkin } timer_ops_t; 49*9055c7d1SRyan Harkin 50*9055c7d1SRyan Harkin void mdelay(uint32_t msec); 51*9055c7d1SRyan Harkin void udelay(uint32_t usec); 52*9055c7d1SRyan Harkin void timer_init(const timer_ops_t *ops); 53*9055c7d1SRyan Harkin 54*9055c7d1SRyan Harkin 55*9055c7d1SRyan Harkin #endif /* __DELAY_TIMER_H__ */ 56