1cc58b2d0SRyan Harkin /* 2cc58b2d0SRyan Harkin * Copyright (c) 2015, ARM Limited and Contributors. All rights reserved. 3cc58b2d0SRyan Harkin * 4cc58b2d0SRyan Harkin * Redistribution and use in source and binary forms, with or without 5cc58b2d0SRyan Harkin * modification, are permitted provided that the following conditions are met: 6cc58b2d0SRyan Harkin * 7cc58b2d0SRyan Harkin * Redistributions of source code must retain the above copyright notice, this 8cc58b2d0SRyan Harkin * list of conditions and the following disclaimer. 9cc58b2d0SRyan Harkin * 10cc58b2d0SRyan Harkin * Redistributions in binary form must reproduce the above copyright notice, 11cc58b2d0SRyan Harkin * this list of conditions and the following disclaimer in the documentation 12cc58b2d0SRyan Harkin * and/or other materials provided with the distribution. 13cc58b2d0SRyan Harkin * 14cc58b2d0SRyan Harkin * Neither the name of ARM nor the names of its contributors may be used 15cc58b2d0SRyan Harkin * to endorse or promote products derived from this software without specific 16cc58b2d0SRyan Harkin * prior written permission. 17cc58b2d0SRyan Harkin * 18cc58b2d0SRyan Harkin * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19cc58b2d0SRyan Harkin * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20cc58b2d0SRyan Harkin * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21cc58b2d0SRyan Harkin * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22cc58b2d0SRyan Harkin * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23cc58b2d0SRyan Harkin * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24cc58b2d0SRyan Harkin * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25cc58b2d0SRyan Harkin * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26cc58b2d0SRyan Harkin * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27cc58b2d0SRyan Harkin * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28cc58b2d0SRyan Harkin * POSSIBILITY OF SUCH DAMAGE. 29cc58b2d0SRyan Harkin */ 30cc58b2d0SRyan Harkin 31cc58b2d0SRyan Harkin #ifndef __SP804_DELAY_TIMER_H__ 32cc58b2d0SRyan Harkin #define __SP804_DELAY_TIMER_H__ 33cc58b2d0SRyan Harkin 34cc58b2d0SRyan Harkin #include <delay_timer.h> 35cc58b2d0SRyan Harkin #include <stdint.h> 36cc58b2d0SRyan Harkin 37cc58b2d0SRyan Harkin 38cc58b2d0SRyan Harkin uint32_t sp804_get_timer_value(void); 39cc58b2d0SRyan Harkin 40cc58b2d0SRyan Harkin void sp804_timer_ops_init(uintptr_t base_addr, const timer_ops_t *ops); 41cc58b2d0SRyan Harkin 42cc58b2d0SRyan Harkin #define sp804_timer_init(base_addr, clk_mult, clk_div) \ 43*54312877SSandrine Bailleux do { \ 44*54312877SSandrine Bailleux static const timer_ops_t sp804_timer_ops = { \ 45*54312877SSandrine Bailleux sp804_get_timer_value, \ 46*54312877SSandrine Bailleux (clk_mult), \ 47*54312877SSandrine Bailleux (clk_div) \ 48*54312877SSandrine Bailleux }; \ 49*54312877SSandrine Bailleux sp804_timer_ops_init((base_addr), &sp804_timer_ops); \ 50*54312877SSandrine Bailleux } while (0) 51cc58b2d0SRyan Harkin 52cc58b2d0SRyan Harkin #endif /* __SP804_DELAY_TIMER_H__ */ 53