far_ptr.h
Go to the documentation of this file.
#ifndef __FAR_PTR_H_INCLUDE
#define __FAR_PTR_H_INCLUDE
#include <types.h>
#include <stdint.h>
#define TO_FAR_PTR(ofs, seg) (((FAR_PTR)seg << 16) | (FAR_PTR)ofs)
#define FAR_SEG(ptr) (((union __far_ptr *)&ptr)->segofs.seg)
#define FAR_OFS(ptr) (((union __far_ptr *)&ptr)->segofs.ofs)
#define FAR_FUNC(ptr, typ) ((typ)(((union __far_ptr *)&ptr)->segfn.fn))
#define FAR_CALL(ptr, typ, ...) (__call_banked_ptr=ptr,((typ)(&__call__banked))(__VA_ARGS__))
typedef uint32_t FAR_PTR;
union __far_ptr {
FAR_PTR ptr;
struct {
void * ofs;
uint16_t seg;
} segofs;
struct {
void (*fn)(void);
uint16_t seg;
} segfn;
};
extern volatile FAR_PTR __call_banked_ptr;
extern volatile void * __call_banked_addr;
extern volatile uint8_t __call_banked_bank;
void __call__banked(void);
uint32_t to_far_ptr(void* ofs, uint16_t seg);
#endif
FAR_PTR
uint32_t FAR_PTR
Definition: far_ptr.h:69
__call__banked
void __call__banked(void)
__call_banked_addr
volatile void * __call_banked_addr
__call_banked_bank
volatile uint8_t __call_banked_bank
__call_banked_ptr
volatile FAR_PTR __call_banked_ptr
to_far_ptr
uint32_t to_far_ptr(void *ofs, uint16_t seg)
stdint.h
uint16_t
unsigned short int uint16_t
Definition: stdint.h:52
uint32_t
unsigned long int uint32_t
Definition: stdint.h:53
uint8_t
unsigned char uint8_t
Definition: stdint.h:51
__far_ptr
Definition: far_ptr.h:73
__far_ptr::fn
void(* fn)(void)
Definition: far_ptr.h:80
__far_ptr::ofs
void * ofs
Definition: far_ptr.h:76
__far_ptr::ptr
FAR_PTR ptr
Definition: far_ptr.h:74
__far_ptr::seg
uint16_t seg
Definition: far_ptr.h:77
__far_ptr::segfn
struct __far_ptr::@8 segfn
__far_ptr::segofs
struct __far_ptr::@7 segofs