1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00
elua/inc/elua_int.h
Bogdan Marinescu 78cab3b3ad - interrupt support in Lua
- ASM interrupt support for ARM targets which eliminates the need for buggy GCC __attribute__ ((interrupt ("IRQ"))) functions
- code refactoring
2010-09-26 18:54:18 +00:00

40 lines
1.0 KiB
C

// eLua interrupt handlers support
#ifndef __ELUA_INT_H__
#define __ELUA_INT_H__
#include "type.h"
typedef u8 elua_int_id;
// The resource number is a 16-bit integer because it must be able to hold a
// port/pin combination coded as specified in platform.h
typedef u16 elua_int_resnum;
#define ELUA_INT_EMPTY_SLOT 0
#define ELUA_INT_FIRST_ID 1
#define ELUA_INT_INVALID_INTERRUPT 0xFF
// This is what gets pushed in the interrupt queue
typedef struct
{
elua_int_id id;
elua_int_resnum resnum;
} elua_int_element;
// Handler key in the registry
#define LUA_INT_HANDLER_KEY ( int )&elua_int_add
// Maximum number of interrupt sources that can appear in ANY backend
// Must be a multiple of 32
#define LUA_INT_MAX_SOURCES 128
// Function prototypes
int elua_int_add( elua_int_id inttype, elua_int_resnum resnum );
void elua_int_enable( elua_int_id inttype );
void elua_int_disable( elua_int_id inttype );
int elua_int_is_enabled( elua_int_id inttype );
void elua_int_disable_all();
#endif