A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd
at master 67 lines 2.1 kB view raw
1/*************************************************************************** 2 * __________ __ ___. 3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___ 4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / 5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < 6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ 7 * \/ \/ \/ \/ \/ 8 * $Id$ 9 * 10 * Copyright (C) 2002 by Björn Stenberg 11 * 12 * This program is free software; you can redistribute it and/or 13 * modify it under the terms of the GNU General Public License 14 * as published by the Free Software Foundation; either version 2 15 * of the License, or (at your option) any later version. 16 * 17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY 18 * KIND, either express or implied. 19 * 20 ****************************************************************************/ 21#ifndef TICK_H 22#define TICK_H 23 24#include "config.h" 25#include "system.h" /* for NULL */ 26extern void init_tick(void) INIT_ATTR; 27 28#define HZ 100 /* number of ticks per second */ 29 30#define MAX_NUM_TICK_TASKS 8 31 32/* global tick variable */ 33#if defined(CPU_PP) && defined(BOOTLOADER) && \ 34 !defined(HAVE_BOOTLOADER_USB_MODE) 35/* We don't enable interrupts in the PP bootloader unless USB mode is 36 enabled for it, so we need to fake the current_tick variable */ 37#define current_tick (signed)(USEC_TIMER/10000) 38 39static inline void call_tick_tasks(void) 40{ 41} 42#else 43extern volatile long current_tick; 44 45/* inline helper for implementing target interrupt handler */ 46static inline void call_tick_tasks(void) 47{ 48 extern void (*tick_funcs[MAX_NUM_TICK_TASKS+1])(void); 49 void (**p)(void) = tick_funcs; 50 void (*fn)(void); 51 52 current_tick++; 53 54 for(fn = *p; fn != NULL; fn = *(++p)) 55 { 56 fn(); 57 } 58} 59#endif 60 61/* implemented in target tree */ 62extern void tick_start(unsigned int interval_in_ms) INIT_ATTR; 63 64extern int tick_add_task(void (*f)(void)); 65extern int tick_remove_task(void (*f)(void)); 66 67#endif /* TICK_H */