Name: libaio Version: 0.3.106 Release: 1 Summary: Linux-native asynchronous I/O access library Copyright: LGPL Group: System Environment/Libraries Source: %{name}-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-root # Fix ExclusiveArch as we implement this functionality on more architectures ExclusiveArch: i386 x86_64 ia64 s390 s390x ppc ppc64 ppc64pseries ppc64iseries alpha alphaev6 %description The Linux-native asynchronous I/O facility ("async I/O", or "aio") has a richer API and capability set than the simple POSIX async I/O facility. This library, libaio, provides the Linux-native API for async I/O. The POSIX async I/O facility requires this library in order to provide kernel-accelerated async I/O capabilities, as do applications which require the Linux-native async I/O API. %package devel Summary: Development files for Linux-native asynchronous I/O access Group: Development/System Requires: libaio Provides: libaio.so.1 %description devel This package provides header files to include and libraries to link with for the Linux-native asynchronous I/O facility ("async I/O", or "aio"). %prep %setup %build make %install [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT make install prefix=$RPM_BUILD_ROOT/usr \ libdir=$RPM_BUILD_ROOT/%{_libdir} \ root=$RPM_BUILD_ROOT %clean [ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %files %defattr(-,root,root) %attr(0755,root,root) %{_libdir}/libaio.so.* %doc COPYING TODO %files devel %defattr(-,root,root) %attr(0644,root,root) %{_includedir}/* %attr(0755,root,root) %{_libdir}/libaio.so %attr(0644,root,root) %{_libdir}/libaio.a %changelog * Tue Jan 3 2006 Jeff Moyer - 0.3.106-1 - Add a .proc directive for the ia64_aio_raw_syscall macro. This sounds a lot like the previous entry, but that one fixed the __ia64_raw_syscall macro, located in syscall-ia64.h. This macro is in raw_syscall.c, which pretty much only exists for ia64. This bug prevented the package from building with newer version of gcc. * Mon Aug 1 2005 Jeff Moyer - 0.3.105-1 - Add a .proc directive for the ia64 raw syscall macro. * Fri Apr 1 2005 Jeff Moyer - 0.3.104-1 - Add Alpha architecture support. (Sergey Tikhonov ) * Tue Jan 25 2005 Jeff Moyer - 0.3.103-1 - Fix SONAME breakage. In changing file names around, I also changed the SONAME, which is a no no. * Thu Oct 14 2004 Jeff Moyer - 0.3.102-1 - S390 asm had a bug; I forgot to update the clobber list. Lucky for me, newer compilers complain about such things. - Also update the s390 asm to look more like the new kernel variants. * Wed Oct 13 2004 Jeff Moyer - 0.3.101-1 - Revert syscall return values to be -ERRNO. This was an inadvertant bug introduced when clobber lists changed. - add ppc64pseries and ppc64iseries to exclusivearch * Tue Sep 14 2004 Jeff Moyer - 0.3.100-1 - Switch around the tests for _PPC_ and _powerpc64_ so that the ppc64 platforms get the right padding. * Wed Jul 14 2004 Jeff Moyer - 0.3.99-4 - Ok, there was a race in moving the cvs module. Someone rebuild from the old cvs into fc3. *sigh* bumping rev. * Wed Jul 14 2004 Jeff Moyer - 0.3.99-3 - Actually provide libaio.so.1. * Tue Mar 30 2004 Jeff Moyer - 0.3.99-2 - Apparently the 0.3.93 patch was not meant for 0.3.96. Backed it out. * Tue Mar 30 2004 Jeff Moyer - 0.3.99-1 - Fix compat calls. - make library .so.1.0.0 and make symlinks properly. - Fix header file for inclusion in c++ code. * Thu Feb 26 2004 Jeff Moyer 0.3.98-2 - bah. fix version nr in changelog. * Thu Feb 26 2004 Jeff Moyer 0.3.98-1 - fix compiler warnings. * Thu Feb 26 2004 Jeff Moyer 0.3.97-2 - make srpm was using rpm to do a build. changed that to use rpmbuild if it exists, and fallback to rpm if it doesn't. * Tue Feb 24 2004 Jeff Moyer 0.3.97-1 - Use libc syscall(2) instead of rolling our own calling mechanism. This change is inspired due to a failure to build with newer gcc, since clobber lists were wrong. - Add -fpic to the CFLAGS for all architectures. Should address bz #109457. - change a #include from to . Fixes a build issue on s390. * Wed Jul 7 2003 Bill Nottingham 0.3.96-3 - fix paths on lib64 arches * Wed Jun 18 2003 Michael K. Johnson 0.3.96-2 - optimization in io_getevents from Arjan van de Ven in 0.3.96-1 - deal with ia64 in 0.3.96-2 * Wed May 28 2003 Michael K. Johnson 0.3.95-1 - ppc bugfix from Julie DeWandel * Tue May 20 2003 Michael K. Johnson 0.3.94-1 - symbol versioning fix from Ulrich Drepper * Mon Jan 27 2003 Benjamin LaHaise - bump to 0.3.93-3 for rebuild. * Mon Dec 16 2002 Benjamin LaHaise - libaio 0.3.93 test release - add powerpc support from Gianni Tedesco - add s/390 support from Arnd Bergmann * Fri Sep 12 2002 Benjamin LaHaise - libaio 0.3.92 test release - build on x86-64 * Thu Sep 12 2002 Benjamin LaHaise - libaio 0.3.91 test release - build on ia64 - remove libredhat-kernel from the .spec file * Thu Sep 5 2002 Benjamin LaHaise - libaio 0.3.90 test release * Mon Apr 29 2002 Benjamin LaHaise - add requires initscripts >= 6.47-1 to get boot time libredhat-kernel linkage correct. - typo fix * Thu Apr 25 2002 Benjamin LaHaise - make /usr/lib/libredhat-kernel.so point to /lib/libredhat-kernel.so.1.0.0 * Mon Apr 15 2002 Tim Powers - make the post scriptlet not use /bin/sh * Sat Apr 12 2002 Benjamin LaHaise - add /lib/libredhat-kernel* to %files. * Fri Apr 12 2002 Benjamin LaHaise - make the dummy install as /lib/libredhat-kernel.so.1.0.0 so that ldconfig will link against it if no other is installed. * Tue Jan 22 2002 Benjamin LaHaise - add io_getevents * Tue Jan 22 2002 Michael K. Johnson - Make linker happy with /usr/lib symlink for libredhat-kernel.so * Mon Jan 21 2002 Michael K. Johnson - Added stub library * Sun Jan 20 2002 Michael K. Johnson - Initial packaging ='n110' href='#n110'>110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
/*
The MIT License (MIT)

Copyright (c) 2016 Fred Sundvik

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/

#ifndef VISUALIZER_H
#define VISUALIZER_H
#include <stdlib.h>
#include <stdint.h>
#include <stdbool.h>

#include "config.h"
#include "gfx.h"

#ifdef LCD_BACKLIGHT_ENABLE
#include "lcd_backlight.h"
#endif

#ifdef BACKLIGHT_ENABLE
#include "backlight.h"
#endif

// use this function to merge both real_mods and oneshot_mods in a uint16_t
uint8_t visualizer_get_mods(void);

// This need to be called once at the start
void visualizer_init(void);
// This should be called at every matrix scan
void visualizer_update(uint32_t default_state, uint32_t state, uint8_t mods, uint32_t leds);

// This should be called when the keyboard goes to suspend state
void visualizer_suspend(void);
// This should be called when the keyboard wakes up from suspend state
void visualizer_resume(void);

// These functions are week, so they can be overridden by the keyboard
// if needed
GDisplay* get_lcd_display(void);
GDisplay* get_led_display(void);

// For emulator builds, this function need to be implemented
#ifdef EMULATOR
void draw_emulator(void);
#endif

// If you need support for more than 16 keyframes per animation, you can change this
#define MAX_VISUALIZER_KEY_FRAMES 16

struct keyframe_animation_t;

typedef struct {
    uint32_t layer;
    uint32_t default_layer;
    uint32_t leds; // See led.h for available statuses
    uint8_t mods;
    bool suspended;
#ifdef BACKLIGHT_ENABLE
    uint8_t backlight_level;
#endif
#ifdef VISUALIZER_USER_DATA_SIZE
    uint8_t user_data[VISUALIZER_USER_DATA_SIZE];
#endif
} visualizer_keyboard_status_t;

// The state struct is used by the various keyframe functions
// It's also used for setting the LCD color and layer text
// from the user customized code
typedef struct visualizer_state_t {
    // The user code should primarily be modifying these
    uint32_t target_lcd_color;
    const char* layer_text;

    // The user visualizer(and animation functions) can read these
    visualizer_keyboard_status_t status;

    // These are used by the animation functions
    uint32_t current_lcd_color;
    uint32_t prev_lcd_color;
#ifdef LCD_ENABLE
    font_t font_fixed5x8;
    font_t font_dejavusansbold12;
#endif
} visualizer_state_t;

// Any custom keyframe function should have this signature
// return true to get continuous updates, otherwise you will only get one
// update per frame
typedef bool (*frame_func)(struct keyframe_animation_t*, visualizer_state_t*);

// Represents a keyframe animation, so fields are internal to the system
// while others are meant to be initialized by the user code
typedef struct keyframe_animation_t {
    // These should be initialized
    int num_frames;
    bool loop;
    int frame_lengths[MAX_VISUALIZER_KEY_FRAMES];
    frame_func frame_functions[MAX_VISUALIZER_KEY_FRAMES];

    // Used internally by the system, and can also be read by
    // keyframe update functions
    int current_frame;
    int time_left_in_frame;
    bool first_update_of_frame;
    bool last_update_of_frame;
    bool need_update;

} keyframe_animation_t;

extern GDisplay* LCD_DISPLAY;
extern GDisplay* LED_DISPLAY;

void start_keyframe_animation(keyframe_animation_t* animation);
void stop_keyframe_animation(keyframe_animation_t* animation);
// This runs the next keyframe, but does not update the animation state
// Useful for crossfades for example
void run_next_keyframe(keyframe_animation_t* animation, visualizer_state_t* state);

// The master can set userdata which will be transferred to the slave
#ifdef VISUALIZER_USER_DATA_SIZE
void visualizer_set_user_data(void* user_data);
#endif

// These functions have to be implemented by the user
// Called regularly each time the state has changed (but not every scan loop)
void update_user_visualizer_state(visualizer_state_t* state, visualizer_keyboard_status_t* prev_status);
// Called when the computer goes to suspend, will also stop calling update_user_visualizer_state
void user_visualizer_suspend(visualizer_state_t* state);
// You have to start at least one animation as a response to the following two functions
// When the animation has finished the visualizer will resume normal operation and start calling the
// update_user_visualizer_state again
// Called when the keyboard boots up
void initialize_user_visualizer(visualizer_state_t* state);
// Called when the computer resumes from a suspend
void user_visualizer_resume(visualizer_state_t* state);

#endif /* VISUALIZER_H */