Removed headers and sources not needed for build platform version for libbe.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34212 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,249 +0,0 @@
|
||||
#if !defined(_ACCELERANT_H_)
|
||||
#define _ACCELERANT_H_
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define B_ACCELERANT_ENTRY_POINT "get_accelerant_hook"
|
||||
#define B_ACCELERANT_VERSION 1
|
||||
|
||||
typedef void * (*GetAccelerantHook)(uint32, void *);
|
||||
|
||||
_EXPORT void * get_accelerant_hook(uint32 feature, void *data);
|
||||
|
||||
enum {
|
||||
/* initialization */
|
||||
B_INIT_ACCELERANT = 0, /* required */
|
||||
B_ACCELERANT_CLONE_INFO_SIZE, /* required */
|
||||
B_GET_ACCELERANT_CLONE_INFO, /* required */
|
||||
B_CLONE_ACCELERANT, /* required */
|
||||
B_UNINIT_ACCELERANT, /* required */
|
||||
B_GET_ACCELERANT_DEVICE_INFO, /* required */
|
||||
B_ACCELERANT_RETRACE_SEMAPHORE, /* optional */
|
||||
|
||||
/* mode configuration */
|
||||
B_ACCELERANT_MODE_COUNT = 0x100, /* required */
|
||||
B_GET_MODE_LIST, /* required */
|
||||
B_PROPOSE_DISPLAY_MODE, /* optional */
|
||||
B_SET_DISPLAY_MODE, /* required */
|
||||
B_GET_DISPLAY_MODE, /* required */
|
||||
B_GET_FRAME_BUFFER_CONFIG, /* required */
|
||||
B_GET_PIXEL_CLOCK_LIMITS, /* required */
|
||||
B_GET_TIMING_CONSTRAINTS, /* optional */
|
||||
B_MOVE_DISPLAY, /* optional */
|
||||
B_SET_INDEXED_COLORS, /* required if driver supports 8bit indexed modes */
|
||||
B_DPMS_CAPABILITIES, /* required if driver supports DPMS */
|
||||
B_DPMS_MODE, /* required if driver supports DPMS */
|
||||
B_SET_DPMS_MODE, /* required if driver supports DPMS */
|
||||
|
||||
/* cursor managment */
|
||||
B_MOVE_CURSOR = 0x200, /* optional */
|
||||
B_SET_CURSOR_SHAPE, /* optional */
|
||||
B_SHOW_CURSOR, /* optional */
|
||||
|
||||
/* synchronization */
|
||||
B_ACCELERANT_ENGINE_COUNT = 0x300, /* required */
|
||||
B_ACQUIRE_ENGINE, /* required */
|
||||
B_RELEASE_ENGINE, /* required */
|
||||
B_WAIT_ENGINE_IDLE, /* required */
|
||||
B_GET_SYNC_TOKEN, /* required */
|
||||
B_SYNC_TO_TOKEN, /* required */
|
||||
|
||||
/* 2D acceleration */
|
||||
B_SCREEN_TO_SCREEN_BLIT = 0x400, /* optional */
|
||||
B_FILL_RECTANGLE, /* optional */
|
||||
B_INVERT_RECTANGLE, /* optional */
|
||||
B_FILL_SPAN, /* optional */
|
||||
B_SCREEN_TO_SCREEN_TRANSPARENT_BLIT, /* optional */
|
||||
B_SCREEN_TO_SCREEN_SCALED_FILTERED_BLIT, /* optional. NOTE: source and dest may NOT overlap */
|
||||
|
||||
/* 3D acceleration */
|
||||
B_ACCELERANT_PRIVATE_START = (int)0x80000000
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint32 version; /* structure version number */
|
||||
char name[32]; /* a name the user will recognize the device by */
|
||||
char chipset[32]; /* the chipset used by the device */
|
||||
char serial_no[32]; /* serial number for the device */
|
||||
uint32 memory; /* amount of memory on the device, in bytes */
|
||||
uint32 dac_speed; /* nominal DAC speed, in MHz */
|
||||
} accelerant_device_info;
|
||||
|
||||
typedef struct {
|
||||
uint32 pixel_clock; /* kHz */
|
||||
uint16 h_display; /* in pixels (not character clocks) */
|
||||
uint16 h_sync_start;
|
||||
uint16 h_sync_end;
|
||||
uint16 h_total;
|
||||
uint16 v_display; /* in lines */
|
||||
uint16 v_sync_start;
|
||||
uint16 v_sync_end;
|
||||
uint16 v_total;
|
||||
uint32 flags; /* sync polarity, etc. */
|
||||
} display_timing;
|
||||
|
||||
typedef struct {
|
||||
display_timing timing; /* CTRC info */
|
||||
uint32 space; /* pixel configuration */
|
||||
uint16 virtual_width; /* in pixels */
|
||||
uint16 virtual_height; /* in lines */
|
||||
uint16 h_display_start; /* first displayed pixel in line */
|
||||
uint16 v_display_start; /* first displayed line */
|
||||
uint32 flags; /* mode flags */
|
||||
} display_mode;
|
||||
|
||||
typedef struct {
|
||||
void *frame_buffer; /* pointer to first byte of frame buffer in virtual memory */
|
||||
void *frame_buffer_dma; /* pointer to first byte of frame buffer in physical memory for DMA */
|
||||
uint32 bytes_per_row; /* number of bytes in one virtual_width line */
|
||||
/* not neccesarily the same as virtual_width * byte_per_pixel */
|
||||
} frame_buffer_config;
|
||||
|
||||
typedef struct {
|
||||
uint16 h_res; /* minimum effective change in horizontal pixels, usually 8 */
|
||||
uint16 h_sync_min; /* min/max horizontal sync pulse width in pixels, a multiple of h_res */
|
||||
uint16 h_sync_max;
|
||||
uint16 h_blank_min; /* min/max horizontal blank pulse width in pixels, a multiple of h_res */
|
||||
uint16 h_blank_max;
|
||||
uint16 v_res; /* minimum effective change in vertical lines, usually 1 */
|
||||
uint16 v_sync_min; /* min/max vertical sync pulse width in lines, a multiple of v_res */
|
||||
uint16 v_sync_max;
|
||||
uint16 v_blank_min; /* min/max vertical blank pulse width in linex, a multiple of v_res */
|
||||
uint16 v_blank_max;
|
||||
} display_timing_constraints;
|
||||
|
||||
enum { /* mode flags */
|
||||
B_SCROLL = 1 << 0,
|
||||
B_8_BIT_DAC = 1 << 1,
|
||||
B_HARDWARE_CURSOR = 1 << 2,
|
||||
B_PARALLEL_ACCESS = 1 << 3,
|
||||
B_DPMS = 1 << 4,
|
||||
B_IO_FB_NA = 1 << 5
|
||||
};
|
||||
|
||||
enum { /* power saver flags */
|
||||
B_DPMS_ON = 1 << 0,
|
||||
B_DPMS_STAND_BY = 1 << 1,
|
||||
B_DPMS_SUSPEND = 1 << 2,
|
||||
B_DPMS_OFF = 1 << 3
|
||||
};
|
||||
|
||||
enum { /* timing flags */
|
||||
B_BLANK_PEDESTAL = 1 << 27,
|
||||
B_TIMING_INTERLACED = 1 << 28,
|
||||
B_POSITIVE_HSYNC = 1 << 29,
|
||||
B_POSITIVE_VSYNC = 1 << 30,
|
||||
B_SYNC_ON_GREEN = 1 << 31
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint16 src_left; /* guaranteed constrained to virtual width and height */
|
||||
uint16 src_top;
|
||||
uint16 dest_left;
|
||||
uint16 dest_top;
|
||||
uint16 width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
|
||||
uint16 height; /* 0 to M, where zero means one line, one means two lines, etc. */
|
||||
} blit_params;
|
||||
|
||||
typedef struct {
|
||||
uint16 src_left; /* guaranteed constrained to virtual width and height */
|
||||
uint16 src_top;
|
||||
uint16 src_width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
|
||||
uint16 src_height; /* 0 to M, where zero means one line, one means two lines, etc. */
|
||||
uint16 dest_left;
|
||||
uint16 dest_top;
|
||||
uint16 dest_width; /* 0 to N, where zero means one pixel, one means two pixels, etc. */
|
||||
uint16 dest_height; /* 0 to M, where zero means one line, one means two lines, etc. */
|
||||
} scaled_blit_params;
|
||||
|
||||
typedef struct {
|
||||
uint16 left; /* guaranteed constrained to virtual width and height */
|
||||
uint16 top;
|
||||
uint16 right;
|
||||
uint16 bottom;
|
||||
} fill_rect_params;
|
||||
|
||||
typedef struct {
|
||||
uint32 engine_id; /* 0 == no engine, 1,2,3 etc individual engines */
|
||||
uint32 capability_mask; /* features this engine supports */
|
||||
void *opaque; /* optional pointer to engine private storage */
|
||||
} engine_token;
|
||||
|
||||
enum { /* engine capabilities */
|
||||
B_2D_ACCELERATION = 1 << 0,
|
||||
B_3D_ACCELERATION = 1 << 1
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
uint64 counter; /* counts issued primatives */
|
||||
uint32 engine_id; /* what engine the counter is for */
|
||||
char opaque[12]; /* 12 bytes of private storage */
|
||||
} sync_token;
|
||||
|
||||
/* Masks for color info */
|
||||
/* B_CMAP8 - 0x000000ff */
|
||||
/* B_RGB15/16 - 0x0000ffff */
|
||||
/* B_RGB24 - 0x00ffffff */
|
||||
/* B_RGB32 - 0xffffffff */
|
||||
|
||||
typedef status_t (*init_accelerant)(int fd);
|
||||
typedef ssize_t (*accelerant_clone_info_size)(void);
|
||||
typedef void (*get_accelerant_clone_info)(void *data);
|
||||
typedef status_t (*clone_accelerant)(void *data);
|
||||
typedef void (*uninit_accelerant)(void);
|
||||
typedef status_t (*get_accelerant_device_info)(accelerant_device_info *adi);
|
||||
|
||||
typedef uint32 (*accelerant_mode_count)(void);
|
||||
typedef status_t (*get_mode_list)(display_mode *);
|
||||
typedef status_t (*propose_display_mode)(display_mode *target, display_mode *low, display_mode *high);
|
||||
typedef status_t (*set_display_mode)(display_mode *mode_to_set);
|
||||
typedef status_t (*get_display_mode)(display_mode *current_mode);
|
||||
typedef status_t (*get_frame_buffer_config)(frame_buffer_config *a_frame_buffer);
|
||||
typedef status_t (*get_pixel_clock_limits)(display_mode *dm, uint32 *low, uint32 *high);
|
||||
typedef status_t (*move_display_area)(uint16 h_display_start, uint16 v_display_start);
|
||||
typedef status_t (*get_timing_constraints)(display_timing_constraints *dtc);
|
||||
typedef void (*set_indexed_colors)(uint count, uint8 first, uint8 *color_data, uint32 flags);
|
||||
typedef uint32 (*dpms_capabilities)(void);
|
||||
typedef uint32 (*dpms_mode)(void);
|
||||
typedef status_t (*set_dpms_mode)(uint32 dpms_flags);
|
||||
typedef sem_id (*accelerant_retrace_semaphore)(void);
|
||||
|
||||
typedef status_t (*set_cursor_shape)(uint16 width, uint16 height, uint16 hot_x, uint16 hot_y, uint8 *andMask, uint8 *xorMask);
|
||||
typedef void (*move_cursor)(uint16 x, uint16 y);
|
||||
typedef void (*show_cursor)(bool is_visible);
|
||||
|
||||
typedef uint32 (*accelerant_engine_count)(void);
|
||||
typedef status_t (*acquire_engine)(uint32 capabilities, uint32 max_wait, sync_token *st, engine_token **et);
|
||||
typedef status_t (*release_engine)(engine_token *et, sync_token *st);
|
||||
typedef void (*wait_engine_idle)(void);
|
||||
typedef status_t (*get_sync_token)(engine_token *et, sync_token *st);
|
||||
typedef status_t (*sync_to_token)(sync_token *st);
|
||||
|
||||
typedef void (*screen_to_screen_blit)(engine_token *et, blit_params *list, uint32 count);
|
||||
typedef void (*fill_rectangle)(engine_token *et, uint32 color, fill_rect_params *list, uint32 count);
|
||||
typedef void (*invert_rectangle)(engine_token *et, fill_rect_params *list, uint32 count);
|
||||
typedef void (*screen_to_screen_transparent_blit)(engine_token *et, uint32 transparent_color, blit_params *list, uint32 count);
|
||||
typedef void (*screen_to_screen_scaled_filtered_blit)(engine_token *et, scaled_blit_params *list, uint32 count);
|
||||
|
||||
typedef void (*fill_span)(engine_token *et, uint32 color, uint16 *list, uint32 count);
|
||||
/*
|
||||
The uint16 *list points to a list of tripples:
|
||||
list[N+0] Y co-ordinate of span
|
||||
list[N+1] Left x co-ordinate of span
|
||||
list[N+2] Right x co-ordinate of span
|
||||
where N is in the range 0 to count-1.
|
||||
*/
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,188 +0,0 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: GraphicsCard.h
|
||||
/
|
||||
/ Description: App Server interface for graphics card add-ons.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _GRAPHICS_CARD_H
|
||||
#define _GRAPHICS_CARD_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Command Constants -------------------------------------*/
|
||||
|
||||
enum {
|
||||
B_OPEN_GRAPHICS_CARD,
|
||||
B_CLOSE_GRAPHICS_CARD,
|
||||
B_GET_GRAPHICS_CARD_INFO,
|
||||
B_GET_GRAPHICS_CARD_HOOKS,
|
||||
B_SET_INDEXED_COLOR,
|
||||
B_GET_SCREEN_SPACES,
|
||||
B_CONFIG_GRAPHICS_CARD,
|
||||
B_GET_REFRESH_RATES,
|
||||
B_SET_SCREEN_GAMMA,
|
||||
|
||||
B_GET_INFO_FOR_CLONE_SIZE,
|
||||
B_GET_INFO_FOR_CLONE,
|
||||
B_SET_CLONED_GRAPHICS_CARD,
|
||||
B_CLOSE_CLONED_GRAPHICS_CARD,
|
||||
B_PROPOSE_FRAME_BUFFER,
|
||||
B_SET_FRAME_BUFFER,
|
||||
B_SET_DISPLAY_AREA,
|
||||
B_MOVE_DISPLAY_AREA}
|
||||
;
|
||||
|
||||
/*----- Optional ---------------*/
|
||||
|
||||
enum {
|
||||
B_CRT_CONTROL = 0x0001,
|
||||
B_GAMMA_CONTROL = 0x0002,
|
||||
B_FRAME_BUFFER_CONTROL = 0x0004,
|
||||
B_PARALLEL_BUFFER_ACCESS = 0x0008,
|
||||
B_LAME_ASS_CARD = 0x0010
|
||||
};
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Structures --------------------------------------------*/
|
||||
|
||||
typedef struct {
|
||||
int16 version;
|
||||
int16 id;
|
||||
void *frame_buffer;
|
||||
char rgba_order[4];
|
||||
int16 flags;
|
||||
int16 bits_per_pixel;
|
||||
int16 bytes_per_row;
|
||||
int16 width;
|
||||
int16 height;
|
||||
} graphics_card_info;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int32 index;
|
||||
rgb_color color;
|
||||
} indexed_color;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32 space;
|
||||
float refresh_rate;
|
||||
uchar h_position;
|
||||
uchar v_position;
|
||||
uchar h_size;
|
||||
uchar v_size;
|
||||
} graphics_card_config;
|
||||
|
||||
|
||||
typedef struct {
|
||||
float min;
|
||||
float max;
|
||||
float current;
|
||||
} refresh_rate_info;
|
||||
|
||||
|
||||
typedef struct {
|
||||
void *screen_base;
|
||||
void *io_base;
|
||||
uint32 vendor_id;
|
||||
uint32 device_id;
|
||||
uint32 _reserved1_;
|
||||
uint32 _reserved2_;
|
||||
} graphics_card_spec;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16 x1;
|
||||
int16 y1;
|
||||
int16 x2;
|
||||
int16 y2;
|
||||
rgb_color color;
|
||||
} rgb_color_line;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16 x1;
|
||||
int16 y1;
|
||||
int16 x2;
|
||||
int16 y2;
|
||||
uchar color;
|
||||
} indexed_color_line;
|
||||
|
||||
|
||||
typedef struct {
|
||||
int16 bits_per_pixel;
|
||||
int16 bytes_per_row;
|
||||
int16 width;
|
||||
int16 height;
|
||||
int16 display_width;
|
||||
int16 display_height;
|
||||
int16 display_x;
|
||||
int16 display_y;
|
||||
} frame_buffer_info;
|
||||
|
||||
|
||||
typedef struct {
|
||||
uchar red[256];
|
||||
uchar green[256];
|
||||
uchar blue[256];
|
||||
} screen_gamma;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Hook Function -----------------------------------------*/
|
||||
|
||||
typedef void (*graphics_card_hook) ();
|
||||
|
||||
#define B_GRAPHICS_HOOK_COUNT 48
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
_EXPORT int32 control_graphics_card(uint32, void*);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Debugging Functions ------------------------------------*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void dprintf(const char *format, ...);
|
||||
bool set_dprintf_enabled(bool); /* returns old enable flag */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*----- Obsolete ---------------------------------------------*/
|
||||
#define B_HOOK_COUNT B_GRAPHICS_HOOK_COUNT
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _GRAPHICS_CARD_H */
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: InputServerDevice.h
|
||||
/
|
||||
/ Description: Add-on class for input_server devices.
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _INPUTSERVERDEVICE_H
|
||||
#define _INPUTSERVERDEVICE_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Input.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
struct input_device_ref {
|
||||
char *name;
|
||||
input_device_type type;
|
||||
void *cookie;
|
||||
};
|
||||
|
||||
|
||||
enum {
|
||||
// B_KEYBOARD_DEVICE notifications
|
||||
B_KEY_MAP_CHANGED = 1,
|
||||
B_KEY_LOCKS_CHANGED,
|
||||
B_KEY_REPEAT_DELAY_CHANGED,
|
||||
B_KEY_REPEAT_RATE_CHANGED,
|
||||
|
||||
// B_POINTING_DEVICE notifications
|
||||
B_MOUSE_TYPE_CHANGED,
|
||||
B_MOUSE_MAP_CHANGED,
|
||||
B_MOUSE_SPEED_CHANGED,
|
||||
B_CLICK_SPEED_CHANGED,
|
||||
B_MOUSE_ACCELERATION_CHANGED
|
||||
};
|
||||
|
||||
|
||||
class _BDeviceAddOn_;
|
||||
|
||||
|
||||
class BInputServerDevice {
|
||||
public:
|
||||
BInputServerDevice();
|
||||
virtual ~BInputServerDevice();
|
||||
|
||||
virtual status_t InitCheck();
|
||||
virtual status_t SystemShuttingDown();
|
||||
|
||||
virtual status_t Start(const char *device, void *cookie);
|
||||
virtual status_t Stop(const char *device, void *cookie);
|
||||
virtual status_t Control(const char *device,
|
||||
void *cookie,
|
||||
uint32 code,
|
||||
BMessage *message);
|
||||
|
||||
status_t RegisterDevices(input_device_ref **devices);
|
||||
status_t UnregisterDevices(input_device_ref **devices);
|
||||
|
||||
status_t EnqueueMessage(BMessage *message);
|
||||
|
||||
status_t StartMonitoringDevice(const char *device);
|
||||
status_t StopMonitoringDevice(const char *device);
|
||||
|
||||
private:
|
||||
_BDeviceAddOn_* fOwner;
|
||||
|
||||
virtual void _ReservedInputServerDevice1();
|
||||
virtual void _ReservedInputServerDevice2();
|
||||
virtual void _ReservedInputServerDevice3();
|
||||
virtual void _ReservedInputServerDevice4();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,39 +0,0 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: InputServerFilter.h
|
||||
/
|
||||
/ Description: Add-on class for input_server filters.
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _INPUTSERVERFILTER_H
|
||||
#define _INPUTSERVERFILTER_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <MessageFilter.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class BInputServerFilter {
|
||||
public:
|
||||
BInputServerFilter();
|
||||
virtual ~BInputServerFilter();
|
||||
|
||||
virtual status_t InitCheck();
|
||||
|
||||
virtual filter_result Filter(BMessage *message, BList *outList);
|
||||
|
||||
status_t GetScreenRegion(BRegion *region) const;
|
||||
|
||||
private:
|
||||
virtual void _ReservedInputServerFilter1();
|
||||
virtual void _ReservedInputServerFilter2();
|
||||
virtual void _ReservedInputServerFilter3();
|
||||
virtual void _ReservedInputServerFilter4();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,51 +0,0 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: InputServerMethod.h
|
||||
/
|
||||
/ Description: Add-on class for input_server methods.
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
******************************************************************************/
|
||||
|
||||
#ifndef _INPUTSERVERMETHOD_H
|
||||
#define _INPUTSERVERMETHOD_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <InputServerFilter.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
class _BMethodAddOn_;
|
||||
class AddOnManager;
|
||||
class InputServer;
|
||||
|
||||
class BInputServerMethod : public BInputServerFilter {
|
||||
public:
|
||||
BInputServerMethod(const char *name,
|
||||
const uchar *icon);
|
||||
virtual ~BInputServerMethod();
|
||||
|
||||
virtual status_t MethodActivated(bool active);
|
||||
|
||||
status_t EnqueueMessage(BMessage *message);
|
||||
|
||||
status_t SetName(const char *name);
|
||||
status_t SetIcon(const uchar *icon);
|
||||
status_t SetMenu(const BMenu *menu, const BMessenger target);
|
||||
|
||||
private:
|
||||
_BMethodAddOn_* fOwner;
|
||||
|
||||
friend class AddOnManager;
|
||||
friend class InputServer;
|
||||
|
||||
virtual void _ReservedInputServerMethod1();
|
||||
virtual void _ReservedInputServerMethod2();
|
||||
virtual void _ReservedInputServerMethod3();
|
||||
virtual void _ReservedInputServerMethod4();
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,82 +0,0 @@
|
||||
#if ! defined _SCREENSAVER_H
|
||||
#define _SCREENSAVER_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <DirectWindow.h> // for direct_buffer_info
|
||||
#include <image.h>
|
||||
#include <Message.h>
|
||||
|
||||
class BView;
|
||||
|
||||
class BScreenSaver
|
||||
{
|
||||
public:
|
||||
BScreenSaver(BMessage *archive, image_id);
|
||||
virtual ~BScreenSaver();
|
||||
|
||||
// Return an error if something goes wrong or if you don't
|
||||
// like the running environment (lack of 3D acceleration,
|
||||
// lack of sound, ...).
|
||||
virtual status_t InitCheck();
|
||||
|
||||
// Animation start and stop. The view is not yet visible when
|
||||
// StartSaver is called.
|
||||
virtual status_t StartSaver(BView *view, bool preview);
|
||||
virtual void StopSaver();
|
||||
|
||||
// This hook is called periodically, you should
|
||||
// override it to do the drawing. Notice that you
|
||||
// should clear the screen when frame == 0 if you
|
||||
// don't want to paint over the desktop.
|
||||
virtual void Draw(BView *view, int32 frame);
|
||||
|
||||
// These hooks are for direct screen access, the first is
|
||||
// called every time the settings change, the second is
|
||||
// the equivalent of Draw to be called to access the screen
|
||||
// directly. Draw and DirectDraw can be used at the same time.
|
||||
virtual void DirectConnected(direct_buffer_info *info);
|
||||
virtual void DirectDraw(int32 frame);
|
||||
|
||||
// configuration dialog methods
|
||||
virtual void StartConfig(BView *configView);
|
||||
virtual void StopConfig();
|
||||
|
||||
// Module should fill this in with metadata
|
||||
// example: randomizable = true
|
||||
virtual void SupplyInfo(BMessage *info) const;
|
||||
|
||||
// Send all the metadata info to the module
|
||||
virtual void ModulesChanged(const BMessage *info);
|
||||
|
||||
// BArchivable like parameter saver method
|
||||
virtual status_t SaveState(BMessage *into) const;
|
||||
|
||||
// These methods can be used to control drawing frequency.
|
||||
void SetTickSize(bigtime_t ts);
|
||||
bigtime_t TickSize() const;
|
||||
|
||||
// These methods can be used to control animation loop cycles
|
||||
void SetLoop(int32 on_count, int32 off_count);
|
||||
int32 LoopOnCount() const;
|
||||
int32 LoopOffCount() const;
|
||||
|
||||
private:
|
||||
virtual void _ReservedScreenSaver1();
|
||||
virtual void _ReservedScreenSaver2();
|
||||
virtual void _ReservedScreenSaver3();
|
||||
virtual void _ReservedScreenSaver4();
|
||||
virtual void _ReservedScreenSaver5();
|
||||
virtual void _ReservedScreenSaver6();
|
||||
virtual void _ReservedScreenSaver7();
|
||||
virtual void _ReservedScreenSaver8();
|
||||
|
||||
bigtime_t ticksize;
|
||||
int32 looponcount;
|
||||
int32 loopoffcount;
|
||||
|
||||
uint32 _reservedScreenSaver[6];
|
||||
};
|
||||
|
||||
extern "C" _EXPORT BScreenSaver *instantiate_screen_saver(BMessage *msg, image_id id);
|
||||
|
||||
#endif
|
||||
@@ -1,44 +0,0 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: Background.h
|
||||
/
|
||||
/ Description: Defines constants for setting Tracker background images
|
||||
/
|
||||
/ Copyright 1998-1999, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _TRACKER_BACKGROUND_H
|
||||
#define _TRACKER_BACKGROUND_H
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Tracker background attribute name ----------------------*/
|
||||
|
||||
#define B_BACKGROUND_INFO "be:bgndimginfo"
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Tracker background BMessage entries --------------------*/
|
||||
|
||||
#define B_BACKGROUND_IMAGE "be:bgndimginfopath" // string path
|
||||
#define B_BACKGROUND_MODE "be:bgndimginfomode" // int32, the enum below
|
||||
#define B_BACKGROUND_ORIGIN "be:bgndimginfooffset" // BPoint
|
||||
#define B_BACKGROUND_ERASE_TEXT "be:bgndimginfoerasetext" // bool
|
||||
#define B_BACKGROUND_WORKSPACES "be:bgndimginfoworkspaces" // uint32
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----- Background mode values ---------------------------------*/
|
||||
|
||||
enum {
|
||||
B_BACKGROUND_MODE_USE_ORIGIN,
|
||||
B_BACKGROUND_MODE_CENTERED, // only works on Desktop
|
||||
B_BACKGROUND_MODE_SCALED, // only works on Desktop
|
||||
B_BACKGROUND_MODE_TILED
|
||||
};
|
||||
|
||||
/*----------------------------------------------------------------*/
|
||||
/*----------------------------------------------------------------*/
|
||||
|
||||
const int32 B_RESTORE_BACKGROUND_IMAGE = 'Tbgr'; // force a Tracker window to
|
||||
// use a new background image
|
||||
|
||||
#endif /* _TRACKER_BACKGROUND_H */
|
||||
@@ -1,27 +0,0 @@
|
||||
/******************************************************************************
|
||||
/
|
||||
/ File: TrackerAddOn.h
|
||||
/
|
||||
/ Description: Protocol for the process_refs() hook function.
|
||||
/
|
||||
/ Copyright 1995-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _TRACKER_ADDON_H
|
||||
#define _TRACKER_ADDON_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
|
||||
struct entry_ref;
|
||||
class BMessage;
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*------- This is why you're here: ----------------------------*/
|
||||
extern "C" _EXPORT void process_refs(entry_ref dir_ref, BMessage* msg, void*);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/*-------------------------------------------------------------*/
|
||||
|
||||
#endif /* _TRACKER_ADDON_H */
|
||||
@@ -1,105 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: Clipboard.h
|
||||
// Author: Gabe Yoder ([email protected])
|
||||
// Description: BClipboard provides an interface to a system-wide clipboard
|
||||
// storage area.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _CLIPBOARD_H
|
||||
#define _CLIPBOARD_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Messenger.h>
|
||||
#include <Locker.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
class BMessage;
|
||||
|
||||
enum {
|
||||
B_CLIPBOARD_CHANGED = 'CLCH'
|
||||
};
|
||||
|
||||
// BClipboard class ---------------------------------------------------------------
|
||||
class BClipboard {
|
||||
public:
|
||||
BClipboard(const char *name, bool transient = false);
|
||||
virtual ~BClipboard();
|
||||
|
||||
const char *Name() const;
|
||||
|
||||
uint32 LocalCount() const;
|
||||
uint32 SystemCount() const;
|
||||
status_t StartWatching(BMessenger target);
|
||||
status_t StopWatching(BMessenger target);
|
||||
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
bool IsLocked() const;
|
||||
|
||||
status_t Clear();
|
||||
status_t Commit();
|
||||
status_t Revert();
|
||||
|
||||
BMessenger DataSource() const;
|
||||
BMessage *Data() const;
|
||||
|
||||
/*----- Private or reserved -----------------------------------------*/
|
||||
private:
|
||||
BClipboard(const BClipboard &);
|
||||
BClipboard &operator=(const BClipboard &);
|
||||
|
||||
virtual void _ReservedClipboard1();
|
||||
virtual void _ReservedClipboard2();
|
||||
virtual void _ReservedClipboard3();
|
||||
|
||||
bool AssertLocked() const;
|
||||
status_t DownloadFromSystem(bool force = false);
|
||||
status_t UploadToSystem();
|
||||
|
||||
uint32 _reserved0;
|
||||
BMessage *fData;
|
||||
BLocker fLock;
|
||||
BMessenger fClipHandler;
|
||||
BMessenger fDataSource;
|
||||
uint32 fCount;
|
||||
char *fName;
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
//----- Global Clipboard -------------------------------------------------------
|
||||
|
||||
extern _IMPEXP_BE BClipboard *be_clipboard;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _CLIPBOARD_H
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: Cursor.h
|
||||
// Author: Frans van Nispen ([email protected])
|
||||
// Description: BCursor describes a view-wide or application-wide cursor.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _CURSOR_H
|
||||
#define _CURSOR_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <Archivable.h>
|
||||
#include <BeBuild.h>
|
||||
#include <InterfaceDefs.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
// BCursor class ---------------------------------------------------------------
|
||||
class BCursor : BArchivable {
|
||||
public:
|
||||
BCursor(const void* cursorData);
|
||||
BCursor(BMessage* data);
|
||||
virtual ~BCursor();
|
||||
|
||||
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||
static BArchivable* Instantiate(BMessage* data);
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
virtual status_t Perform(perform_code d, void* arg);
|
||||
|
||||
private:
|
||||
|
||||
virtual void _ReservedCursor1();
|
||||
virtual void _ReservedCursor2();
|
||||
virtual void _ReservedCursor3();
|
||||
virtual void _ReservedCursor4();
|
||||
|
||||
friend class BApplication;
|
||||
friend class BView;
|
||||
|
||||
int32 m_serverToken;
|
||||
int32 m_needToFree;
|
||||
uint32 _reserved[6];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _CURSOR_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: Invoker.h
|
||||
// Author: Frans van Nispen ([email protected])
|
||||
// Description: BInvoker class defines a protocol for objects that
|
||||
// post messages to a "target".
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _INVOKER_H
|
||||
#define _INVOKER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Messenger.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BHandler;
|
||||
class BLooper;
|
||||
class BMessage;
|
||||
|
||||
// BInvoker class --------------------------------------------------------------
|
||||
class BInvoker {
|
||||
public:
|
||||
BInvoker();
|
||||
BInvoker(BMessage *message,
|
||||
const BHandler *handler,
|
||||
const BLooper *looper = NULL);
|
||||
BInvoker(BMessage *message, BMessenger target);
|
||||
virtual ~BInvoker();
|
||||
|
||||
virtual status_t SetMessage(BMessage *message);
|
||||
BMessage *Message() const;
|
||||
uint32 Command() const;
|
||||
|
||||
virtual status_t SetTarget(const BHandler *h, const BLooper *loop = NULL);
|
||||
virtual status_t SetTarget(BMessenger messenger);
|
||||
bool IsTargetLocal() const;
|
||||
BHandler *Target(BLooper **looper = NULL) const;
|
||||
BMessenger Messenger() const;
|
||||
|
||||
virtual status_t SetHandlerForReply(BHandler *handler);
|
||||
BHandler *HandlerForReply() const;
|
||||
|
||||
virtual status_t Invoke(BMessage *msg = NULL);
|
||||
|
||||
// Invoke with BHandler notification. Use this to perform an
|
||||
// Invoke() with some other kind of notification change code.
|
||||
// (A raw invoke should always notify as B_CONTROL_INVOKED.)
|
||||
// Unlike a raw Invoke(), there is no standard message that is
|
||||
// sent. If 'msg' is NULL, then nothing will be sent to this
|
||||
// invoker's target... however, a notification message will
|
||||
// still be sent to any watchers of the invoker's handler.
|
||||
// Note that the BInvoker class does not actually implement
|
||||
// any of this behavior -- it is up to subclasses to override
|
||||
// Invoke() and call Notify() with the appropriate change code.
|
||||
status_t InvokeNotify(BMessage *msg, uint32 kind = B_CONTROL_INVOKED);
|
||||
status_t SetTimeout(bigtime_t timeout);
|
||||
bigtime_t Timeout() const;
|
||||
|
||||
protected:
|
||||
// Return the change code for a notification. This is either
|
||||
// B_CONTROL_INVOKED for raw Invoke() calls, or the kind
|
||||
// supplied to InvokeNotify(). In addition, 'notify' will be
|
||||
// set to true if this was an InvokeNotify() call, else false.
|
||||
uint32 InvokeKind(bool* notify = NULL);
|
||||
|
||||
// Start and end an InvokeNotify context around an Invoke() call.
|
||||
// These are only needed for writing custom methods that
|
||||
// emulate the standard InvokeNotify() call.
|
||||
void BeginInvokeNotify(uint32 kind = B_CONTROL_INVOKED);
|
||||
void EndInvokeNotify();
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
private:
|
||||
// to be able to keep binary compatibility
|
||||
virtual void _ReservedInvoker1();
|
||||
virtual void _ReservedInvoker2();
|
||||
virtual void _ReservedInvoker3();
|
||||
|
||||
BInvoker(const BInvoker&);
|
||||
BInvoker &operator=(const BInvoker&);
|
||||
|
||||
BMessage *fMessage;
|
||||
BMessenger fMessenger;
|
||||
BHandler *fReplyTo;
|
||||
bigtime_t fTimeout;
|
||||
uint32 fNotifyKind;
|
||||
uint32 _reserved[1]; // to be able to keep binary compatibility
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _INVOKER_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: MessageFilter.h
|
||||
// Author: Erik Jaesler ([email protected])
|
||||
// Description: BMessageFilter class creates objects that filter
|
||||
// in-coming BMessages.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _MESSAGE_FILTER_H
|
||||
#define _MESSAGE_FILTER_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <Handler.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BMessage;
|
||||
|
||||
// filter_hook Return Codes and Protocol ---------------------------------------
|
||||
enum filter_result {
|
||||
B_SKIP_MESSAGE,
|
||||
B_DISPATCH_MESSAGE
|
||||
};
|
||||
|
||||
typedef filter_result (*filter_hook)
|
||||
(BMessage* message, BHandler** target, BMessageFilter* filter);
|
||||
|
||||
|
||||
// BMessageFilter invocation criteria ------------------------------------------
|
||||
enum message_delivery {
|
||||
B_ANY_DELIVERY,
|
||||
B_DROPPED_DELIVERY,
|
||||
B_PROGRAMMED_DELIVERY
|
||||
};
|
||||
|
||||
enum message_source {
|
||||
B_ANY_SOURCE,
|
||||
B_REMOTE_SOURCE,
|
||||
B_LOCAL_SOURCE
|
||||
};
|
||||
|
||||
// BMessageFilter Class --------------------------------------------------------
|
||||
class BMessageFilter {
|
||||
|
||||
public:
|
||||
BMessageFilter( uint32 what,
|
||||
filter_hook func = NULL);
|
||||
BMessageFilter( message_delivery delivery,
|
||||
message_source source,
|
||||
filter_hook func = NULL);
|
||||
BMessageFilter( message_delivery delivery,
|
||||
message_source source,
|
||||
uint32 what,
|
||||
filter_hook func = NULL);
|
||||
BMessageFilter(const BMessageFilter& filter);
|
||||
BMessageFilter(const BMessageFilter* filter);
|
||||
virtual ~BMessageFilter();
|
||||
|
||||
BMessageFilter &operator=(const BMessageFilter& from);
|
||||
|
||||
// Hook function; ignored if filter_hook is non-NULL
|
||||
virtual filter_result Filter(BMessage* message, BHandler** target);
|
||||
|
||||
message_delivery MessageDelivery() const;
|
||||
message_source MessageSource() const;
|
||||
uint32 Command() const;
|
||||
bool FiltersAnyCommand() const;
|
||||
BLooper *Looper() const;
|
||||
|
||||
// Private or reserved ---------------------------------------------------------
|
||||
private:
|
||||
friend class BLooper;
|
||||
friend class BHandler;
|
||||
|
||||
virtual void _ReservedMessageFilter1();
|
||||
virtual void _ReservedMessageFilter2();
|
||||
|
||||
void SetLooper(BLooper* owner);
|
||||
filter_hook FilterFunction() const;
|
||||
bool fFiltersAny;
|
||||
uint32 what;
|
||||
message_delivery fDelivery;
|
||||
message_source fSource;
|
||||
BLooper *fLooper;
|
||||
filter_hook fFilterFunction;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _MESSAGE_FILTER_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: MessageRunner.h
|
||||
// Author: Ingo Weinhold ([email protected])
|
||||
// Description: A BMessageRunner periodically sends a message to a
|
||||
// specified target.
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _MESSAGE_RUNNER_H
|
||||
#define _MESSAGE_RUNNER_H
|
||||
|
||||
#include <Messenger.h>
|
||||
|
||||
class BMessageRunner {
|
||||
public:
|
||||
BMessageRunner(BMessenger target, const BMessage *message,
|
||||
bigtime_t interval, int32 count = -1);
|
||||
BMessageRunner(BMessenger target, const BMessage *message,
|
||||
bigtime_t interval, int32 count, BMessenger replyTo);
|
||||
virtual ~BMessageRunner();
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
status_t SetInterval(bigtime_t interval);
|
||||
status_t SetCount(int32 count);
|
||||
status_t GetInfo(bigtime_t *interval, int32 *count) const;
|
||||
|
||||
|
||||
private:
|
||||
BMessageRunner(const BMessageRunner &);
|
||||
BMessageRunner &operator=(const BMessageRunner &);
|
||||
|
||||
void InitData(BMessenger target, const BMessage *message,
|
||||
bigtime_t interval, int32 count, BMessenger replyTo);
|
||||
status_t SetParams(bool resetInterval, bigtime_t interval, bool resetCount,
|
||||
int32 count);
|
||||
|
||||
virtual void _ReservedMessageRunner1();
|
||||
virtual void _ReservedMessageRunner2();
|
||||
virtual void _ReservedMessageRunner3();
|
||||
virtual void _ReservedMessageRunner4();
|
||||
virtual void _ReservedMessageRunner5();
|
||||
virtual void _ReservedMessageRunner6();
|
||||
|
||||
int32 fToken;
|
||||
uint32 _reserved[6];
|
||||
};
|
||||
|
||||
#endif // _MESSAGE_RUNNER_H
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright 2009, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*/
|
||||
#ifndef _PROPERTY_INFO_H
|
||||
#define _PROPERTY_INFO_H
|
||||
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Flattenable.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <TypeConstants.h>
|
||||
|
||||
|
||||
struct compound_type {
|
||||
struct field_pair {
|
||||
const char* name;
|
||||
type_code type;
|
||||
};
|
||||
field_pair pairs[5];
|
||||
};
|
||||
|
||||
|
||||
struct property_info {
|
||||
const char* name;
|
||||
uint32 commands[10];
|
||||
uint32 specifiers[10];
|
||||
const char* usage;
|
||||
uint32 extra_data;
|
||||
uint32 types[10];
|
||||
compound_type ctypes[3];
|
||||
uint32 _reserved[10];
|
||||
};
|
||||
|
||||
|
||||
enum value_kind {
|
||||
B_COMMAND_KIND = 0,
|
||||
B_TYPE_CODE_KIND = 1
|
||||
};
|
||||
|
||||
|
||||
struct value_info {
|
||||
const char* name;
|
||||
uint32 value;
|
||||
value_kind kind;
|
||||
const char* usage;
|
||||
uint32 extra_data;
|
||||
uint32 _reserved[10];
|
||||
};
|
||||
|
||||
|
||||
class BPropertyInfo : public BFlattenable {
|
||||
public:
|
||||
BPropertyInfo(property_info* prop = NULL,
|
||||
value_info* value = NULL,
|
||||
bool freeOnDelete = false);
|
||||
virtual ~BPropertyInfo();
|
||||
|
||||
virtual int32 FindMatch(BMessage* msg, int32 index,
|
||||
BMessage* specifier, int32 form,
|
||||
const char* prop, void* data = NULL) const;
|
||||
|
||||
virtual bool IsFixedSize() const;
|
||||
virtual type_code TypeCode() const;
|
||||
virtual ssize_t FlattenedSize() const;
|
||||
virtual status_t Flatten(void* buffer, ssize_t size) const;
|
||||
virtual bool AllowsTypeCode(type_code code) const;
|
||||
virtual status_t Unflatten(type_code code, const void* buffer,
|
||||
ssize_t size);
|
||||
|
||||
const property_info* Properties() const;
|
||||
const value_info* Values() const;
|
||||
int32 CountProperties() const;
|
||||
int32 CountValues() const;
|
||||
|
||||
void PrintToStream() const;
|
||||
|
||||
protected:
|
||||
static bool FindCommand(uint32 what, int32 index,
|
||||
property_info* info);
|
||||
static bool FindSpecifier(uint32 form, property_info* info);
|
||||
|
||||
private:
|
||||
virtual void _ReservedPropertyInfo1();
|
||||
virtual void _ReservedPropertyInfo2();
|
||||
virtual void _ReservedPropertyInfo3();
|
||||
virtual void _ReservedPropertyInfo4();
|
||||
|
||||
BPropertyInfo(const BPropertyInfo& other);
|
||||
BPropertyInfo& operator=(const BPropertyInfo& other);
|
||||
void FreeMem();
|
||||
|
||||
property_info* fPropInfo;
|
||||
value_info* fValueInfo;
|
||||
int32 fPropCount;
|
||||
bool fInHeap;
|
||||
uint16 fValueCount;
|
||||
uint32 _reserved[4];
|
||||
};
|
||||
|
||||
#endif /* _PROPERTY_INFO_H */
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku Inc.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _ARCH_PPC_DEBUGGER_H
|
||||
#define _ARCH_PPC_DEBUGGER_H
|
||||
|
||||
struct debug_cpu_state {
|
||||
uint32 dummy;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
#endif // _ARCH_PPC_DEBUGGER_H
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _ARCH_X86_DEBUGGER_H
|
||||
#define _ARCH_X86_DEBUGGER_H
|
||||
|
||||
struct debug_cpu_state {
|
||||
uint8 extended_regs[512];
|
||||
|
||||
uint32 gs;
|
||||
uint32 fs;
|
||||
uint32 es;
|
||||
uint32 ds;
|
||||
uint32 edi;
|
||||
uint32 esi;
|
||||
uint32 ebp;
|
||||
uint32 esp;
|
||||
uint32 ebx;
|
||||
uint32 edx;
|
||||
uint32 ecx;
|
||||
uint32 eax;
|
||||
uint32 vector;
|
||||
uint32 error_code;
|
||||
uint32 eip;
|
||||
uint32 cs;
|
||||
uint32 eflags;
|
||||
uint32 user_esp;
|
||||
uint32 user_ss;
|
||||
} __attribute__((aligned(8)));
|
||||
|
||||
#endif // _ARCH_X86_DEBUGGER_H
|
||||
@@ -1,122 +0,0 @@
|
||||
/* ACPI Bus Manger Interface
|
||||
* Copyright 2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License
|
||||
*/
|
||||
|
||||
#ifndef _ACPI_H
|
||||
#define _ACPI_H
|
||||
|
||||
#include <bus_manager.h>
|
||||
#include <KernelExport.h>
|
||||
|
||||
typedef struct acpi_module_info acpi_module_info;
|
||||
typedef struct acpi_object_type acpi_object_type;
|
||||
|
||||
struct acpi_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
/* Fixed Event Management */
|
||||
|
||||
void (*enable_fixed_event) (uint32 event);
|
||||
void (*disable_fixed_event) (uint32 event);
|
||||
|
||||
uint32 (*fixed_event_status) (uint32 event);
|
||||
/* Returns 1 if event set, 0 otherwise */
|
||||
void (*reset_fixed_event) (uint32 event);
|
||||
|
||||
status_t (*install_fixed_event_handler) (uint32 event, interrupt_handler *handler, void *data);
|
||||
status_t (*remove_fixed_event_handler) (uint32 event, interrupt_handler *handler);
|
||||
|
||||
/* Namespace Access */
|
||||
|
||||
status_t (*get_next_entry) (uint32 object_type, const char *base, char *result, size_t len, void **counter);
|
||||
status_t (*get_device) (const char *hid, uint32 index, char *result);
|
||||
|
||||
status_t (*get_device_hid) (const char *path, char *hid);
|
||||
uint32 (*get_object_type) (const char *path);
|
||||
|
||||
/* Control method execution and data acquisition */
|
||||
|
||||
status_t (*evaluate_object) (const char *object, acpi_object_type *return_value, size_t buf_len);
|
||||
status_t (*evaluate_method) (const char *object, const char *method, acpi_object_type *return_value, size_t buf_len, acpi_object_type *args, int num_args);
|
||||
/* Power state setting */
|
||||
|
||||
status_t (*enter_sleep_state) (uint8 state);
|
||||
/* Sleep state values:
|
||||
0: On (Working)
|
||||
1: Sleep
|
||||
2: Software Off
|
||||
3: Mechanical Off
|
||||
4: Hibernate
|
||||
5: Software Off */
|
||||
};
|
||||
|
||||
|
||||
#ifndef __ACTYPES_H__
|
||||
|
||||
/* ACPI fixed event types */
|
||||
|
||||
enum {
|
||||
ACPI_EVENT_PMTIMER = 0,
|
||||
ACPI_EVENT_GLOBAL,
|
||||
ACPI_EVENT_POWER_BUTTON,
|
||||
ACPI_EVENT_SLEEP_BUTTON,
|
||||
ACPI_EVENT_RTC
|
||||
};
|
||||
|
||||
/* ACPI Object Types */
|
||||
|
||||
enum {
|
||||
ACPI_TYPE_ANY = 0,
|
||||
ACPI_TYPE_INTEGER,
|
||||
ACPI_TYPE_STRING,
|
||||
ACPI_TYPE_BUFFER,
|
||||
ACPI_TYPE_PACKAGE,
|
||||
ACPI_TYPE_FIELD_UNIT,
|
||||
ACPI_TYPE_DEVICE,
|
||||
ACPI_TYPE_EVENT,
|
||||
ACPI_TYPE_METHOD,
|
||||
ACPI_TYPE_MUTEX,
|
||||
ACPI_TYPE_REGION,
|
||||
ACPI_TYPE_POWER,
|
||||
ACPI_TYPE_PROCESSOR,
|
||||
ACPI_TYPE_THERMAL,
|
||||
ACPI_TYPE_BUFFER_FIELD
|
||||
};
|
||||
|
||||
/* ACPI control method arg type */
|
||||
|
||||
struct acpi_object_type {
|
||||
uint32 object_type;
|
||||
union {
|
||||
uint32 integer;
|
||||
struct {
|
||||
uint32 len;
|
||||
char *string; /* You have to allocate string space yourself */
|
||||
} string;
|
||||
struct {
|
||||
size_t length;
|
||||
void *buffer;
|
||||
} buffer;
|
||||
struct {
|
||||
uint32 count;
|
||||
acpi_object_type *objects;
|
||||
} package;
|
||||
struct {
|
||||
uint32 cpu_id;
|
||||
|
||||
int pblk_address;
|
||||
size_t pblk_length;
|
||||
} processor;
|
||||
struct {
|
||||
uint32 min_power_state;
|
||||
uint32 resource_order;
|
||||
} power_resource;
|
||||
} data;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#define B_ACPI_MODULE_NAME "bus_managers/acpi/v1"
|
||||
|
||||
#endif /* _ACPI_H */
|
||||
@@ -1,84 +0,0 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: ISA.h
|
||||
/
|
||||
/ Description: Interface to ISA module
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _ISA_H
|
||||
#define _ISA_H
|
||||
|
||||
//#include <SupportDefs.h>
|
||||
#include <bus_manager.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ---
|
||||
ISA scatter/gather dma support.
|
||||
--- */
|
||||
|
||||
typedef struct {
|
||||
ulong address; /* memory address (little endian!) 4 bytes */
|
||||
ushort transfer_count; /* # transfers minus one (little endian!) 2 bytes*/
|
||||
uchar reserved; /* filler, 1byte*/
|
||||
uchar flag; /* end of link flag, 1byte */
|
||||
} isa_dma_entry;
|
||||
|
||||
#define B_LAST_ISA_DMA_ENTRY 0x80 /* sets end of link flag in isa_dma_entry */
|
||||
|
||||
enum {
|
||||
B_8_BIT_TRANSFER,
|
||||
B_16_BIT_TRANSFER
|
||||
};
|
||||
|
||||
#define B_MAX_ISA_DMA_COUNT 0x10000
|
||||
|
||||
typedef struct isa_module_info isa_module_info;
|
||||
struct isa_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
uint8 (*read_io_8) (int mapped_io_addr);
|
||||
void (*write_io_8) (int mapped_io_addr, uint8 value);
|
||||
uint16 (*read_io_16) (int mapped_io_addr);
|
||||
void (*write_io_16) (int mapped_io_addr, uint16 value);
|
||||
uint32 (*read_io_32) (int mapped_io_addr);
|
||||
void (*write_io_32) (int mapped_io_addr, uint32 value);
|
||||
|
||||
void * (*ram_address) (const void *physical_address_in_system_memory);
|
||||
|
||||
long (*make_isa_dma_table) (
|
||||
const void *buffer, /* buffer to make a table for */
|
||||
long buffer_size, /* buffer size */
|
||||
ulong num_bits, /* dma transfer size that will be used */
|
||||
isa_dma_entry *table, /* -> caller-supplied scatter/gather table */
|
||||
long num_entries /* max # entries in table */
|
||||
);
|
||||
long (*start_isa_dma) (
|
||||
long channel, /* dma channel to use */
|
||||
void *buf, /* buffer to transfer */
|
||||
long transfer_count, /* # transfers */
|
||||
uchar mode, /* mode flags */
|
||||
uchar e_mode /* extended mode flags */
|
||||
);
|
||||
long (*start_scattered_isa_dma) (
|
||||
long channel, /* channel # to use */
|
||||
const isa_dma_entry *table, /* physical address of scatter/gather table */
|
||||
uchar mode, /* mode flags */
|
||||
uchar emode /* extended mode flags */
|
||||
);
|
||||
long (*lock_isa_dma_channel) (long channel);
|
||||
long (*unlock_isa_dma_channel) (long channel);
|
||||
};
|
||||
|
||||
#define B_ISA_MODULE_NAME "bus_managers/isa/v1"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _ISA_H */
|
||||
@@ -1,223 +0,0 @@
|
||||
/* Kernel only exports for kernel add-ons
|
||||
*
|
||||
* Copyright 2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _KERNEL_EXPORT_H
|
||||
#define _KERNEL_EXPORT_H
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* interrupts and spinlocks */
|
||||
|
||||
/* disable/restore interrupts on the current CPU */
|
||||
|
||||
typedef ulong cpu_status;
|
||||
|
||||
extern cpu_status disable_interrupts(void);
|
||||
extern void restore_interrupts(cpu_status status);
|
||||
|
||||
|
||||
/* spinlocks. Note that acquire/release should be called with
|
||||
* interrupts disabled.
|
||||
*/
|
||||
|
||||
typedef vint32 spinlock;
|
||||
|
||||
extern void acquire_spinlock(spinlock *lock);
|
||||
extern void release_spinlock(spinlock *lock);
|
||||
|
||||
|
||||
/* interrupt handling support for device drivers */
|
||||
|
||||
typedef int32 (*interrupt_handler)(void *data);
|
||||
|
||||
/* Values returned by interrupt handlers */
|
||||
#define B_UNHANDLED_INTERRUPT 0 /* pass to next handler */
|
||||
#define B_HANDLED_INTERRUPT 1 /* don't pass on */
|
||||
#define B_INVOKE_SCHEDULER 2 /* don't pass on; invoke the scheduler */
|
||||
|
||||
/* Flags that can be passed to install_io_interrupt_handler() */
|
||||
#define B_NO_ENABLE_COUNTER 1
|
||||
|
||||
extern status_t install_io_interrupt_handler(long interrupt_number,
|
||||
interrupt_handler handler, void *data, ulong flags);
|
||||
extern status_t remove_io_interrupt_handler(long interrupt_number,
|
||||
interrupt_handler handler, void *data);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* timer interrupts services */
|
||||
|
||||
/* The BeOS qent structure is probably part of a general double linked list
|
||||
* interface used all over the kernel; a struct is required to have a qent
|
||||
* entry struct as first element, so it can be linked to other elements
|
||||
* easily. The key field is probably just an id, eventually used to order
|
||||
* the list.
|
||||
* Since we don't use this kind of interface, but we have to provide it
|
||||
* to keep compatibility, we can use the qent struct for other purposes...
|
||||
*
|
||||
* ToDo: don't do this! Drop source compatibility, but don't overdefine those values!
|
||||
*/
|
||||
typedef struct qent {
|
||||
int64 key; /* We use this as the sched time */
|
||||
struct qent *next; /* This is used as a pointer to next timer */
|
||||
struct qent *prev; /* This can be used for callback args */
|
||||
} qent;
|
||||
|
||||
typedef struct timer timer;
|
||||
typedef int32 (*timer_hook)(timer *);
|
||||
|
||||
struct timer {
|
||||
qent entry;
|
||||
uint16 flags;
|
||||
uint16 cpu;
|
||||
timer_hook hook;
|
||||
bigtime_t period;
|
||||
};
|
||||
|
||||
#define B_ONE_SHOT_ABSOLUTE_TIMER 1
|
||||
#define B_ONE_SHOT_RELATIVE_TIMER 2
|
||||
#define B_PERIODIC_TIMER 3
|
||||
|
||||
extern status_t add_timer(timer *t, timer_hook hook, bigtime_t period, int32 flags);
|
||||
extern bool cancel_timer(timer *t);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* kernel threads */
|
||||
|
||||
extern thread_id spawn_kernel_thread(thread_func function, const char *threadName,
|
||||
int32 priority, void *arg);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* signal functions */
|
||||
|
||||
extern int send_signal_etc(pid_t thread, uint sig, uint32 flags);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* virtual memory buffer functions */
|
||||
|
||||
#define B_DMA_IO 0x00000001
|
||||
#define B_READ_DEVICE 0x00000002
|
||||
|
||||
typedef struct {
|
||||
void *address; /* address in physical memory */
|
||||
ulong size; /* size of block */
|
||||
} physical_entry;
|
||||
|
||||
extern long lock_memory(void *buffer, ulong numBytes, ulong flags);
|
||||
extern long unlock_memory(void *buffer, ulong numBytes, ulong flags);
|
||||
extern long get_memory_map(const void *buffer, ulong size,
|
||||
physical_entry *table, long numEntries);
|
||||
|
||||
/* address specifications for mapping physical memory */
|
||||
#define B_ANY_KERNEL_BLOCK_ADDRESS (B_ANY_KERNEL_ADDRESS + 1)
|
||||
|
||||
/* area protection flags for the kernel */
|
||||
#define B_KERNEL_READ_AREA 16
|
||||
#define B_KERNEL_WRITE_AREA 32
|
||||
#define B_USER_CLONEABLE_AREA 256
|
||||
|
||||
/* call to map physical memory - typically used for memory-mapped i/o */
|
||||
|
||||
extern area_id map_physical_memory(const char *areaName, void *physicalAddress,
|
||||
size_t size, uint32 flags, uint32 protection, void **mappedAddress);
|
||||
|
||||
|
||||
/* MTR attributes for mapping physical memory (Intel Architecture only) */
|
||||
// ToDo: what have those to do here?
|
||||
#define B_MTR_UC 0x10000000
|
||||
#define B_MTR_WC 0x20000000
|
||||
#define B_MTR_WT 0x30000000
|
||||
#define B_MTR_WP 0x40000000
|
||||
#define B_MTR_WB 0x50000000
|
||||
#define B_MTR_MASK 0xf0000000
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* hardware inquiry */
|
||||
|
||||
/* platform_type return value is defined in OS.h */
|
||||
|
||||
extern platform_type platform();
|
||||
|
||||
#if __POWERPC__
|
||||
extern long motherboard_version(void);
|
||||
extern long io_card_version(void);
|
||||
#endif
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* primitive kernel debugging facilities */
|
||||
|
||||
/* Standard debug output is on...
|
||||
* mac: modem port
|
||||
* pc: com1
|
||||
* ...at 19.2 kbaud, no parity, 8 bit, 1 stop bit.
|
||||
*
|
||||
* Note: the kernel settings file can override these defaults
|
||||
*/
|
||||
|
||||
#if __GNUC__
|
||||
extern void dprintf(const char *format, ...) /* just like printf */
|
||||
__attribute__ ((format (__printf__, 1, 2)));
|
||||
extern void kprintf(const char *fmt, ...) /* only for debugger cmds */
|
||||
__attribute__ ((format (__printf__, 1, 2)));
|
||||
#else
|
||||
extern void dprintf(const char *format, ...); /* just like printf */
|
||||
extern void kprintf(const char *fmt, ...); /* only for debugger cmds */
|
||||
#endif
|
||||
|
||||
extern bool set_dprintf_enabled(bool new_state); /* returns old state */
|
||||
|
||||
extern void panic(const char *format, ...);
|
||||
|
||||
extern void kernel_debugger(const char *message); /* enter kernel debugger */
|
||||
extern uint32 parse_expression(const char *string); /* utility for debugger cmds */
|
||||
|
||||
/* special return codes for kernel debugger */
|
||||
#define B_KDEBUG_CONT 2
|
||||
#define B_KDEBUG_QUIT 3
|
||||
|
||||
typedef int (*debugger_command_hook)(int argc, char **argv);
|
||||
|
||||
extern int add_debugger_command(char *name, debugger_command_hook hook, char *help);
|
||||
extern int remove_debugger_command(char *name, debugger_command_hook hook);
|
||||
|
||||
extern status_t load_driver_symbols(const char *driverName);
|
||||
|
||||
|
||||
/*-------------------------------------------------------------*/
|
||||
/* misc */
|
||||
|
||||
extern void spin(bigtime_t microseconds);
|
||||
/* does a busy delay loop for at least "microseconds" */
|
||||
|
||||
typedef void (*daemon_hook)(void *arg, int iteration);
|
||||
|
||||
extern status_t register_kernel_daemon(daemon_hook hook, void *arg, int frequency);
|
||||
extern status_t unregister_kernel_daemon(daemon_hook hook, void *arg);
|
||||
|
||||
extern void call_all_cpus(void (*f)(void *, int), void *cookie);
|
||||
extern void call_all_cpus_sync(void (*f)(void *, int), void *cookie);
|
||||
|
||||
/* safe methods to access user memory without having to lock it */
|
||||
extern status_t user_memcpy(void *to, const void *from, size_t size);
|
||||
extern ssize_t user_strlcpy(char *to, const char *from, size_t size);
|
||||
extern status_t user_memset(void *start, char c, size_t count);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _KERNEL_EXPORT_H */
|
||||
@@ -1,604 +0,0 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: PCI.h
|
||||
/
|
||||
/ Description: Interface to the PCI bus.
|
||||
/ For more information, see "PCI Local Bus Specification, Revision 2.1",
|
||||
/ PCI Special Interest Group, 1995.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _PCI_H
|
||||
#define _PCI_H
|
||||
|
||||
//#include <BeBuild.h>
|
||||
//#include <SupportDefs.h>
|
||||
#include <bus_manager.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* -----
|
||||
pci device info
|
||||
----- */
|
||||
|
||||
typedef struct pci_info {
|
||||
ushort vendor_id; /* vendor id */
|
||||
ushort device_id; /* device id */
|
||||
uchar bus; /* bus number */
|
||||
uchar device; /* device number on bus */
|
||||
uchar function; /* function number in device */
|
||||
uchar revision; /* revision id */
|
||||
uchar class_api; /* specific register interface type */
|
||||
uchar class_sub; /* specific device function */
|
||||
uchar class_base; /* device type (display vs network, etc) */
|
||||
uchar line_size; /* cache line size in 32 bit words */
|
||||
uchar latency; /* latency timer */
|
||||
uchar header_type; /* header type */
|
||||
uchar bist; /* built-in self-test */
|
||||
uchar reserved; /* filler, for alignment */
|
||||
union {
|
||||
struct {
|
||||
ulong cardbus_cis; /* CardBus CIS pointer */
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
ulong rom_size; /* rom size */
|
||||
ulong base_registers[6]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[6]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[6]; /* size of what base regs point to */
|
||||
uchar base_register_flags[6]; /* flags from base address fields */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
uchar min_grant; /* burst period @ 33 Mhz */
|
||||
uchar max_latency; /* how often PCI access needed */
|
||||
} h0;
|
||||
struct {
|
||||
ulong base_registers[2]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[2]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[2]; /* size of what base regs point to */
|
||||
uchar base_register_flags[2]; /* flags from base address fields */
|
||||
uchar primary_bus;
|
||||
uchar secondary_bus;
|
||||
uchar subordinate_bus;
|
||||
uchar secondary_latency;
|
||||
uchar io_base;
|
||||
uchar io_limit;
|
||||
ushort secondary_status;
|
||||
ushort memory_base;
|
||||
ushort memory_limit;
|
||||
ushort prefetchable_memory_base;
|
||||
ushort prefetchable_memory_limit;
|
||||
ulong prefetchable_memory_base_upper32;
|
||||
ulong prefetchable_memory_limit_upper32;
|
||||
ushort io_base_upper16;
|
||||
ushort io_limit_upper16;
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
ushort bridge_control;
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
} h1;
|
||||
struct {
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
} h2;
|
||||
} u;
|
||||
} pci_info;
|
||||
|
||||
|
||||
typedef struct pci_module_info pci_module_info;
|
||||
|
||||
struct pci_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
uint8 (*read_io_8) (int mapped_io_addr);
|
||||
void (*write_io_8) (int mapped_io_addr, uint8 value);
|
||||
uint16 (*read_io_16) (int mapped_io_addr);
|
||||
void (*write_io_16) (int mapped_io_addr, uint16 value);
|
||||
uint32 (*read_io_32) (int mapped_io_addr);
|
||||
void (*write_io_32) (int mapped_io_addr, uint32 value);
|
||||
|
||||
long (*get_nth_pci_info) (
|
||||
long index, /* index into pci device table */
|
||||
pci_info *info /* caller-supplied buffer for info */
|
||||
);
|
||||
uint32 (*read_pci_config) (
|
||||
uchar bus, /* bus number */
|
||||
uchar device, /* device # on bus */
|
||||
uchar function, /* function # in device */
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size /* # bytes to read (1, 2 or 4) */
|
||||
);
|
||||
void (*write_pci_config) (
|
||||
uchar bus, /* bus number */
|
||||
uchar device, /* device # on bus */
|
||||
uchar function, /* function # in device */
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size, /* # bytes to write (1, 2 or 4) */
|
||||
uint32 value /* value to write */
|
||||
);
|
||||
|
||||
void * (*ram_address) (const void *physical_address_in_system_memory);
|
||||
};
|
||||
|
||||
#define B_PCI_MODULE_NAME "bus_managers/pci/v1"
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of the predefined
|
||||
header common to all header types
|
||||
--- */
|
||||
|
||||
#define PCI_vendor_id 0x00 /* (2 byte) vendor id */
|
||||
#define PCI_device_id 0x02 /* (2 byte) device id */
|
||||
#define PCI_command 0x04 /* (2 byte) command */
|
||||
#define PCI_status 0x06 /* (2 byte) status */
|
||||
#define PCI_revision 0x08 /* (1 byte) revision id */
|
||||
#define PCI_class_api 0x09 /* (1 byte) specific register interface type */
|
||||
#define PCI_class_sub 0x0a /* (1 byte) specific device function */
|
||||
#define PCI_class_base 0x0b /* (1 byte) device type (display vs network, etc) */
|
||||
#define PCI_line_size 0x0c /* (1 byte) cache line size in 32 bit words */
|
||||
#define PCI_latency 0x0d /* (1 byte) latency timer */
|
||||
#define PCI_header_type 0x0e /* (1 byte) header type */
|
||||
#define PCI_bist 0x0f /* (1 byte) built-in self-test */
|
||||
|
||||
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of the predefined
|
||||
header common to header types 0x00 and 0x01
|
||||
--- */
|
||||
#define PCI_base_registers 0x10 /* base registers (size varies) */
|
||||
#define PCI_interrupt_line 0x3c /* (1 byte) interrupt line */
|
||||
#define PCI_interrupt_pin 0x3d /* (1 byte) interrupt pin */
|
||||
|
||||
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of header type 0x00
|
||||
--- */
|
||||
|
||||
#define PCI_cardbus_cis 0x28 /* (4 bytes) CardBus CIS (Card Information Structure) pointer (see PCMCIA v2.10 Spec) */
|
||||
#define PCI_subsystem_vendor_id 0x2c /* (2 bytes) subsystem (add-in card) vendor id */
|
||||
#define PCI_subsystem_id 0x2e /* (2 bytes) subsystem (add-in card) id */
|
||||
#define PCI_rom_base 0x30 /* (4 bytes) expansion rom base address */
|
||||
#define PCI_capabilities_ptr 0x34 /* (1 byte) pointer to the start of the capabilities list */
|
||||
#define PCI_min_grant 0x3e /* (1 byte) burst period @ 33 Mhz */
|
||||
#define PCI_max_latency 0x3f /* (1 byte) how often PCI access needed */
|
||||
|
||||
|
||||
/* ---
|
||||
offsets in PCI configuration space to the elements of header type 0x01 (PCI-to-PCI bridge)
|
||||
--- */
|
||||
|
||||
#define PCI_primary_bus 0x18 /* (1 byte) */
|
||||
#define PCI_secondary_bus 0x19 /* (1 byte) */
|
||||
#define PCI_subordinate_bus 0x1A /* (1 byte) */
|
||||
#define PCI_secondary_latency 0x1B /* (1 byte) latency of secondary bus */
|
||||
#define PCI_io_base 0x1C /* (1 byte) io base address register for 2ndry bus*/
|
||||
#define PCI_io_limit 0x1D /* (1 byte) */
|
||||
#define PCI_secondary_status 0x1E /* (2 bytes) */
|
||||
#define PCI_memory_base 0x20 /* (2 bytes) */
|
||||
#define PCI_memory_limit 0x22 /* (2 bytes) */
|
||||
#define PCI_prefetchable_memory_base 0x24 /* (2 bytes) */
|
||||
#define PCI_prefetchable_memory_limit 0x26 /* (2 bytes) */
|
||||
#define PCI_prefetchable_memory_base_upper32 0x28
|
||||
#define PCI_prefetchable_memory_limit_upper32 0x2C
|
||||
#define PCI_io_base_upper16 0x30 /* (2 bytes) */
|
||||
#define PCI_io_limit_upper16 0x32 /* (2 bytes) */
|
||||
#define PCI_sub_vendor_id_1 0x34 /* (2 bytes) */
|
||||
#define PCI_sub_device_id_1 0x36 /* (2 bytes) */
|
||||
#define PCI_bridge_rom_base 0x38
|
||||
#define PCI_bridge_control 0x3E /* (1 byte) */
|
||||
|
||||
|
||||
/* PCI type 2 header offsets */
|
||||
#define PCI_capabilities_ptr_2 0x14 /* (1 byte) */
|
||||
#define PCI_secondary_status_2 0x16 /* (2 bytes) */
|
||||
#define PCI_primary_bus_2 0x18 /* (1 byte) */
|
||||
#define PCI_secondary_bus_2 0x19 /* (1 byte) */
|
||||
#define PCI_subordinate_bus_2 0x1A /* (1 byte) */
|
||||
#define PCI_secondary_latency_2 0x1B /* (1 byte) latency of secondary bus */
|
||||
#define PCI_memory_base0_2 0x1C /* (4 bytes) */
|
||||
#define PCI_memory_limit0_2 0x20 /* (4 bytes) */
|
||||
#define PCI_memory_base1_2 0x24 /* (4 bytes) */
|
||||
#define PCI_memory_limit1_2 0x28 /* (4 bytes) */
|
||||
#define PCI_io_base0_2 0x2c /* (4 bytes) */
|
||||
#define PCI_io_limit0_2 0x30 /* (4 bytes) */
|
||||
#define PCI_io_base1_2 0x34 /* (4 bytes) */
|
||||
#define PCI_io_limit1_2 0x38 /* (4 bytes) */
|
||||
#define PCI_bridge_control_2 0x3E /* (1 byte) */
|
||||
|
||||
#define PCI_sub_vendor_id_2 0x40 /* (2 bytes) */
|
||||
#define PCI_sub_device_id_2 0x42 /* (2 bytes) */
|
||||
|
||||
#define PCI_card_interface_2 0x44 /* ?? */
|
||||
|
||||
/* ---
|
||||
values for the class_base field in the common header
|
||||
--- */
|
||||
|
||||
#define PCI_early 0x00 /* built before class codes defined */
|
||||
#define PCI_mass_storage 0x01 /* mass storage_controller */
|
||||
#define PCI_network 0x02 /* network controller */
|
||||
#define PCI_display 0x03 /* display controller */
|
||||
#define PCI_multimedia 0x04 /* multimedia device */
|
||||
#define PCI_memory 0x05 /* memory controller */
|
||||
#define PCI_bridge 0x06 /* bridge controller */
|
||||
#define PCI_simple_communications 0x07 /* simple communications controller */
|
||||
#define PCI_base_peripheral 0x08 /* base system peripherals */
|
||||
#define PCI_input 0x09 /* input devices */
|
||||
#define PCI_docking_station 0x0a /* docking stations */
|
||||
#define PCI_processor 0x0b /* processors */
|
||||
#define PCI_serial_bus 0x0c /* serial_bus_controller */
|
||||
#define PCI_wireless 0x0d
|
||||
#define PCI_intelligent_io 0x0e
|
||||
#define PCI_satellite_communications 0x0f
|
||||
#define PCI_encryption_decryption 0x10
|
||||
#define PCI_data_acquisition 0x11
|
||||
|
||||
#define PCI_undefined 0xFF /* not in any defined class */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x00 (built before
|
||||
class codes were defined)
|
||||
--- */
|
||||
|
||||
#define PCI_early_not_vga 0x00 /* all except vga */
|
||||
#define PCI_early_vga 0x01 /* vga devices */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x01 (mass storage)
|
||||
--- */
|
||||
|
||||
#define PCI_scsi 0x00 /* SCSI controller */
|
||||
#define PCI_ide 0x01 /* IDE controller */
|
||||
#define PCI_floppy 0x02 /* floppy disk controller */
|
||||
#define PCI_ipi 0x03 /* IPI bus controller */
|
||||
#define PCI_raid 0x04 /* RAID controller */
|
||||
#define PCI_mass_storage_other 0x80 /* other mass storage controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x02 (network)
|
||||
--- */
|
||||
|
||||
#define PCI_ethernet 0x00 /* Ethernet controller */
|
||||
#define PCI_token_ring 0x01 /* Token Ring controller */
|
||||
#define PCI_fddi 0x02 /* FDDI controller */
|
||||
#define PCI_atm 0x03 /* ATM controller */
|
||||
#define PCI_isdn 0x04 /* ISDN controller */
|
||||
#define PCI_network_other 0x80 /* other network controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x03 (display)
|
||||
--- */
|
||||
|
||||
#define PCI_vga 0x00 /* VGA controller */
|
||||
#define PCI_xga 0x01 /* XGA controller */
|
||||
#define PCI_3d 0x02 /* £d controller */
|
||||
#define PCI_display_other 0x80 /* other display controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x04 (multimedia device)
|
||||
--- */
|
||||
|
||||
#define PCI_video 0x00 /* video */
|
||||
#define PCI_audio 0x01 /* audio */
|
||||
#define PCI_telephony 0x02 /* computer telephony device */
|
||||
#define PCI_multimedia_other 0x80 /* other multimedia device */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x05 (memory)
|
||||
--- */
|
||||
|
||||
#define PCI_ram 0x00 /* RAM */
|
||||
#define PCI_flash 0x01 /* flash */
|
||||
#define PCI_memory_other 0x80 /* other memory controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x06 (bridge)
|
||||
--- */
|
||||
|
||||
#define PCI_host 0x00 /* host bridge */
|
||||
#define PCI_isa 0x01 /* ISA bridge */
|
||||
#define PCI_eisa 0x02 /* EISA bridge */
|
||||
#define PCI_microchannel 0x03 /* MicroChannel bridge */
|
||||
#define PCI_pci 0x04 /* PCI-to-PCI bridge */
|
||||
#define PCI_pcmcia 0x05 /* PCMCIA bridge */
|
||||
#define PCI_nubus 0x06 /* NuBus bridge */
|
||||
#define PCI_cardbus 0x07 /* CardBus bridge */
|
||||
#define PCI_raceway 0x08 /* RACEway bridge */
|
||||
#define PCI_bridge_other 0x80 /* other bridge device */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x07 (simple
|
||||
communications controllers)
|
||||
--- */
|
||||
|
||||
#define PCI_serial 0x00 /* serial port controller */
|
||||
#define PCI_parallel 0x01 /* parallel port */
|
||||
#define PCI_multiport_serial 0x02 /* multiport serial controller */
|
||||
#define PCI_modem 0x03 /* modem */
|
||||
#define PCI_simple_communications_other 0x80 /* other communications device */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x07 (simple communications), and
|
||||
class_sub = 0x00 (serial port controller)
|
||||
--- */
|
||||
|
||||
#define PCI_serial_xt 0x00 /* XT-compatible serial controller */
|
||||
#define PCI_serial_16450 0x01 /* 16450-compatible serial controller */
|
||||
#define PCI_serial_16550 0x02 /* 16550-compatible serial controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x07 (simple communications), and
|
||||
class_sub = 0x01 (parallel port)
|
||||
--- */
|
||||
|
||||
#define PCI_parallel_simple 0x00 /* simple (output-only) parallel port */
|
||||
#define PCI_parallel_bidirectional 0x01 /* bidirectional parallel port */
|
||||
#define PCI_parallel_ecp 0x02 /* ECP 1.x compliant parallel port */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x08 (generic
|
||||
system peripherals)
|
||||
--- */
|
||||
|
||||
#define PCI_pic 0x00 /* periperal interrupt controller */
|
||||
#define PCI_dma 0x01 /* dma controller */
|
||||
#define PCI_timer 0x02 /* timers */
|
||||
#define PCI_rtc 0x03 /* real time clock */
|
||||
#define PCI_generic_hot_plug 0x04 /* generic PCI hot-plug controller */
|
||||
#define PCI_system_peripheral_other 0x80 /* other generic system peripheral */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x00 (peripheral interrupt controller)
|
||||
--- */
|
||||
|
||||
#define PCI_pic_8259 0x00 /* generic 8259 */
|
||||
#define PCI_pic_isa 0x01 /* ISA pic */
|
||||
#define PCI_pic_eisa 0x02 /* EISA pic */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x01 (dma controller)
|
||||
--- */
|
||||
|
||||
#define PCI_dma_8237 0x00 /* generic 8237 */
|
||||
#define PCI_dma_isa 0x01 /* ISA dma */
|
||||
#define PCI_dma_eisa 0x02 /* EISA dma */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x02 (timer)
|
||||
--- */
|
||||
|
||||
#define PCI_timer_8254 0x00 /* generic 8254 */
|
||||
#define PCI_timer_isa 0x01 /* ISA timer */
|
||||
#define PCI_timer_eisa 0x02 /* EISA timers (2 timers) */
|
||||
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x08 (generic system peripherals)
|
||||
class_sub = 0x03 (real time clock
|
||||
--- */
|
||||
|
||||
#define PCI_rtc_generic 0x00 /* generic real time clock */
|
||||
#define PCI_rtc_isa 0x01 /* ISA real time clock */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x09 (input devices)
|
||||
--- */
|
||||
|
||||
#define PCI_keyboard 0x00 /* keyboard controller */
|
||||
#define PCI_pen 0x01 /* pen */
|
||||
#define PCI_mouse 0x02 /* mouse controller */
|
||||
#define PCI_scanner 0x03 /* scanner controller */
|
||||
#define PCI_gameport 0x04 /* gameport controller */
|
||||
#define PCI_input_other 0x80 /* other input controller */
|
||||
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x0a (docking stations)
|
||||
--- */
|
||||
|
||||
#define PCI_docking_generic 0x00 /* generic docking station */
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x0b (processor)
|
||||
--- */
|
||||
|
||||
#define PCI_386 0x00 /* 386 */
|
||||
#define PCI_486 0x01 /* 486 */
|
||||
#define PCI_pentium 0x02 /* Pentium */
|
||||
#define PCI_alpha 0x10 /* Alpha */
|
||||
#define PCI_PowerPC 0x20 /* PowerPC */
|
||||
#define PCI_mips 0x30 /* MIPS */
|
||||
#define PCI_coprocessor 0x40 /* co-processor */
|
||||
|
||||
/* ---
|
||||
values for the class_sub field for class_base = 0x0c (serial bus
|
||||
controller)
|
||||
--- */
|
||||
|
||||
#define PCI_firewire 0x00 /* FireWire (IEEE 1394) */
|
||||
#define PCI_access 0x01 /* ACCESS bus */
|
||||
#define PCI_ssa 0x02 /* SSA */
|
||||
#define PCI_usb 0x03 /* Universal Serial Bus */
|
||||
#define PCI_fibre_channel 0x04 /* Fibre channel */
|
||||
|
||||
/* ---
|
||||
values of the class_api field for
|
||||
class_base = 0x0c ( serial bus controller )
|
||||
class_sub = 0x03 ( Universal Serial Bus )
|
||||
--- */
|
||||
|
||||
#define PCI_usb_uhci 0x00 /* Universal Host Controller Interface */
|
||||
#define PCI_usb_ohci 0x10 /* Open Host Controller Interface */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for command register bits
|
||||
--- */
|
||||
|
||||
#define PCI_command_io 0x001 /* 1/0 i/o space en/disabled */
|
||||
#define PCI_command_memory 0x002 /* 1/0 memory space en/disabled */
|
||||
#define PCI_command_master 0x004 /* 1/0 pci master en/disabled */
|
||||
#define PCI_command_special 0x008 /* 1/0 pci special cycles en/disabled */
|
||||
#define PCI_command_mwi 0x010 /* 1/0 memory write & invalidate en/disabled */
|
||||
#define PCI_command_vga_snoop 0x020 /* 1/0 vga pallette snoop en/disabled */
|
||||
#define PCI_command_parity 0x040 /* 1/0 parity check en/disabled */
|
||||
#define PCI_command_address_step 0x080 /* 1/0 address stepping en/disabled */
|
||||
#define PCI_command_serr 0x100 /* 1/0 SERR# en/disabled */
|
||||
#define PCI_command_fastback 0x200 /* 1/0 fast back-to-back en/disabled */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for status register bits
|
||||
--- */
|
||||
|
||||
#define PCI_status_capabilities 0x0010 /* capabilities list */
|
||||
#define PCI_status_66_MHz_capable 0x0020 /* 66 Mhz capable */
|
||||
#define PCI_status_udf_supported 0x0040 /* user-definable-features (udf) supported */
|
||||
#define PCI_status_fastback 0x0080 /* fast back-to-back capable */
|
||||
#define PCI_status_parity_signalled 0x0100 /* parity error signalled */
|
||||
#define PCI_status_devsel 0x0600 /* devsel timing (see below) */
|
||||
#define PCI_status_target_abort_signalled 0x0800 /* signaled a target abort */
|
||||
#define PCI_status_target_abort_received 0x1000 /* received a target abort */
|
||||
#define PCI_status_master_abort_received 0x2000 /* received a master abort */
|
||||
#define PCI_status_serr_signalled 0x4000 /* signalled SERR# */
|
||||
#define PCI_status_parity_error_detected 0x8000 /* parity error detected */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for devsel field in status register
|
||||
--- */
|
||||
|
||||
#define PCI_status_devsel_fast 0x0000 /* fast */
|
||||
#define PCI_status_devsel_medium 0x0200 /* medium */
|
||||
#define PCI_status_devsel_slow 0x0400 /* slow */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for header type register
|
||||
--- */
|
||||
|
||||
#define PCI_header_type_mask 0x7F /* header type field */
|
||||
#define PCI_multifunction 0x80 /* multifunction device flag */
|
||||
|
||||
|
||||
/** types of PCI header */
|
||||
|
||||
#define PCI_header_type_generic 0x00
|
||||
#define PCI_header_type_PCI_to_PCI_bridge 0x01
|
||||
#define PCI_header_type_cardbus 0x02
|
||||
|
||||
|
||||
/* ---
|
||||
masks for built in self test (bist) register bits
|
||||
--- */
|
||||
|
||||
#define PCI_bist_code 0x0F /* self-test completion code, 0 = success */
|
||||
#define PCI_bist_start 0x40 /* 1 = start self-test */
|
||||
#define PCI_bist_capable 0x80 /* 1 = self-test capable */
|
||||
|
||||
|
||||
/** masks for flags in the various base address registers */
|
||||
|
||||
#define PCI_address_space 0x01 /* 0 = memory space, 1 = i/o space */
|
||||
#define PCI_register_start 0x10
|
||||
#define PCI_register_end 0x24
|
||||
#define PCI_register_ppb_end 0x18
|
||||
#define PCI_register_pcb_end 0x14
|
||||
|
||||
/** masks for flags in memory space base address registers */
|
||||
|
||||
#define PCI_address_type_32 0x00 /* locate anywhere in 32 bit space */
|
||||
#define PCI_address_type_32_low 0x02 /* locate below 1 Meg */
|
||||
#define PCI_address_type_64 0x04 /* locate anywhere in 64 bit space */
|
||||
#define PCI_address_type 0x06 /* type (see below) */
|
||||
#define PCI_address_prefetchable 0x08 /* 1 if prefetchable (see PCI spec) */
|
||||
|
||||
#define PCI_address_memory_32_mask 0xFFFFFFF0 /* mask to get 32bit memory space base address */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for flags in i/o space base address registers
|
||||
--- */
|
||||
|
||||
#define PCI_address_io_mask 0xFFFFFFFC /* mask to get i/o space base address */
|
||||
|
||||
|
||||
/* ---
|
||||
masks for flags in expansion rom base address registers
|
||||
--- */
|
||||
|
||||
#define PCI_rom_enable 0x00000001 /* 1 = expansion rom decode enabled */
|
||||
#define PCI_rom_address_mask 0xFFFFF800 /* mask to get expansion rom addr */
|
||||
|
||||
/** PCI interrupt pin values */
|
||||
#define PCI_pin_mask 0x07
|
||||
#define PCI_pin_none 0x00
|
||||
#define PCI_pin_a 0x01
|
||||
#define PCI_pin_b 0x02
|
||||
#define PCI_pin_c 0x03
|
||||
#define PCI_pin_d 0x04
|
||||
#define PCI_pin_max 0x04
|
||||
|
||||
/** PCI Capability Codes */
|
||||
#define PCI_cap_id_reserved 0x00
|
||||
#define PCI_cap_id_pm 0x01 /* Power management */
|
||||
#define PCI_cap_id_agp 0x02 /* AGP */
|
||||
#define PCI_cap_id_vpd 0x03 /* Vital product data */
|
||||
#define PCI_cap_id_slotid 0x04 /* Slot ID */
|
||||
#define PCI_cap_id_msi 0x05 /* Message signalled interrupt ??? */
|
||||
#define PCI_cap_id_chswp 0x06 /* Compact PCI HotSwap */
|
||||
#define PCI_cap_id_pcix 0x07
|
||||
#define PCI_cap_id_ldt 0x08
|
||||
#define PCI_cap_id_vendspec 0x09
|
||||
#define PCI_cap_id_debugport 0x0a
|
||||
#define PCI_cap_id_cpci_rsrcctl 0x0b
|
||||
#define PCI_cap_id_hotplug 0x0c
|
||||
|
||||
/** Power Management Control Status Register settings */
|
||||
#define PCI_pm_mask 0x03
|
||||
#define PCI_pm_ctrl 0x02
|
||||
#define PCI_pm_d1supp 0x0200
|
||||
#define PCI_pm_d2supp 0x0400
|
||||
#define PCI_pm_status 0x04
|
||||
#define PCI_pm_state_d0 0x00
|
||||
#define PCI_pm_state_d1 0x01
|
||||
#define PCI_pm_state_d2 0x02
|
||||
#define PCI_pm_state_d3 0x03
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PCI_H */
|
||||
@@ -1,189 +0,0 @@
|
||||
/*
|
||||
** USB.h - Version 2 USB Device Driver API
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_H
|
||||
#define _USB_H
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <bus_manager.h>
|
||||
|
||||
#include <USB_spec.h>
|
||||
#include <USB_rle.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct usb_module_info usb_module_info;
|
||||
|
||||
/* these are opaque handles to internal stack objects */
|
||||
typedef struct usb_device usb_device;
|
||||
typedef struct usb_interface usb_interface;
|
||||
typedef struct usb_pipe usb_pipe;
|
||||
|
||||
typedef struct usb_endpoint_info usb_endpoint_info;
|
||||
typedef struct usb_interface_info usb_interface_info;
|
||||
typedef struct usb_interface_list usb_interface_list;
|
||||
typedef struct usb_configuration_info usb_configuration_info;
|
||||
|
||||
typedef struct usb_notify_hooks {
|
||||
status_t (*device_added)(const usb_device *device, void **cookie);
|
||||
status_t (*device_removed)(void *cookie);
|
||||
} usb_notify_hooks;
|
||||
|
||||
typedef struct usb_support_descriptor {
|
||||
uint8 dev_class;
|
||||
uint8 dev_subclass;
|
||||
uint8 dev_protocol;
|
||||
uint16 vendor;
|
||||
uint16 product;
|
||||
} usb_support_descriptor;
|
||||
|
||||
/* ie, I support any hub device:
|
||||
** usb_support_descriptor hub_devs = { 9, 0, 0, 0, 0 };
|
||||
*/
|
||||
|
||||
struct usb_endpoint_info {
|
||||
usb_endpoint_descriptor *descr; /* descriptor and handle */
|
||||
usb_pipe *handle; /* of this endpoint/pipe */
|
||||
};
|
||||
|
||||
struct usb_interface_info {
|
||||
usb_interface_descriptor *descr; /* descriptor and handle */
|
||||
usb_interface *handle; /* of this interface */
|
||||
|
||||
size_t endpoint_count; /* count and list of endpoints */
|
||||
usb_endpoint_info *endpoint; /* in this interface */
|
||||
|
||||
size_t generic_count; /* unparsed descriptors in this */
|
||||
usb_descriptor **generic; /* interface */
|
||||
};
|
||||
|
||||
struct usb_interface_list {
|
||||
size_t alt_count; /* count and list of alternate */
|
||||
usb_interface_info *alt; /* interfaces available */
|
||||
|
||||
usb_interface_info *active; /* currently active alternate */
|
||||
};
|
||||
|
||||
struct usb_configuration_info {
|
||||
usb_configuration_descriptor *descr; /* descriptor of this config */
|
||||
|
||||
size_t interface_count; /* interfaces in this config */
|
||||
usb_interface_list *interface;
|
||||
};
|
||||
|
||||
|
||||
typedef void (*usb_callback_func)(void *cookie, uint32 status,
|
||||
void *data, uint32 actual_len);
|
||||
|
||||
struct usb_module_info {
|
||||
bus_manager_info binfo;
|
||||
|
||||
/* inform the bus manager of our intent to support a set of devices */
|
||||
status_t (*register_driver)(const char *driver_name,
|
||||
const usb_support_descriptor *descriptors,
|
||||
size_t count,
|
||||
const char *optional_republish_driver_name);
|
||||
|
||||
/* request notification from the bus manager for add/remove of devices we
|
||||
support */
|
||||
status_t (*install_notify)(const char *driver_name,
|
||||
const usb_notify_hooks *hooks);
|
||||
status_t (*uninstall_notify)(const char *driver_name);
|
||||
|
||||
/* get the device descriptor */
|
||||
const usb_device_descriptor *(*get_device_descriptor)(const usb_device *dev);
|
||||
|
||||
/* get the nth supported configuration */
|
||||
const usb_configuration_info *(*get_nth_configuration)(const usb_device *dev, uint index);
|
||||
|
||||
/* get the active configuration */
|
||||
const usb_configuration_info *(*get_configuration)(const usb_device *dev);
|
||||
|
||||
/* set the active configuration */
|
||||
status_t (*set_configuration)(const usb_device *dev,
|
||||
const usb_configuration_info *configuration);
|
||||
|
||||
status_t (*set_alt_interface)(const usb_device *dev,
|
||||
const usb_interface_info *ifc);
|
||||
|
||||
/* standard device requests -- convenience functions */
|
||||
/* obj may be a usb_device*, usb_pipe*, or usb_interface* */
|
||||
status_t (*set_feature)(const void *object, uint16 selector);
|
||||
status_t (*clear_feature)(const void *object, uint16 selector);
|
||||
status_t (*get_status)(const void *object, uint16 *status);
|
||||
|
||||
status_t (*get_descriptor)(const usb_device *d,
|
||||
uint8 type, uint8 index, uint16 lang,
|
||||
void *data, size_t len, size_t *actual_len);
|
||||
|
||||
/* generic device request function */
|
||||
status_t (*send_request)(const usb_device *d,
|
||||
uint8 request_type, uint8 request,
|
||||
uint16 value, uint16 index, uint16 length,
|
||||
void *data, size_t data_len, size_t *actual_len);
|
||||
|
||||
/* async request queueing */
|
||||
status_t (*queue_interrupt)(const usb_pipe *handle,
|
||||
void *data, size_t len,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*queue_bulk)(const usb_pipe *handle,
|
||||
void *data, size_t len,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*queue_isochronous)(const usb_pipe *handle,
|
||||
void *data, size_t len,
|
||||
rlea* rle_array, uint16 buffer_duration_ms,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*queue_request)(const usb_device *d,
|
||||
uint8 request_type, uint8 request,
|
||||
uint16 value, uint16 index, uint16 length,
|
||||
void *data, size_t data_len,
|
||||
usb_callback_func notify, void *cookie);
|
||||
|
||||
status_t (*set_pipe_policy)(const usb_pipe *handle, uint8 max_num_queued_packets,
|
||||
uint16 max_buffer_duration_ms, uint16 sample_size);
|
||||
|
||||
/* cancel pending async requests to an endpoint */
|
||||
status_t (*cancel_queued_transfers)(const usb_pipe *handle);
|
||||
|
||||
/* tuning, timeouts, etc */
|
||||
status_t (*usb_ioctl)(uint32 opcode, void* buf, size_t buf_size);
|
||||
};
|
||||
|
||||
/* status code for usb callback functions */
|
||||
#define B_USB_STATUS_SUCCESS 0x0000
|
||||
#define B_USB_STATUS_DEVICE_CRC_ERROR 0x0002
|
||||
#define B_USB_STATUS_DEVICE_TIMEOUT 0x0004
|
||||
#define B_USB_STATUS_DEVICE_STALLED 0x0008
|
||||
#define B_USB_STATUS_IRP_CANCELLED_BY_REQUEST 0x0010
|
||||
#define B_USB_STATUS_DRIVER_INTERNAL_ERROR 0x0020
|
||||
#define B_USB_STATUS_ADAPTER_HARDWARE_ERROR 0x0040
|
||||
#define B_USB_STATUS_ISOCH_IRP_ABORTED 0x0080
|
||||
|
||||
/* result codes for usb bus manager functions */
|
||||
#define B_USBD_SUCCESS 0
|
||||
#define B_USBD_BAD_HANDLE 1
|
||||
#define B_USBD_BAD_ARGS 2
|
||||
#define B_USBD_NO_DATA 3
|
||||
#define B_USBD_DEVICE_FAILURE 4
|
||||
#define B_USBD_COMMAND_FAILED 5
|
||||
#define B_USBD_PIPE_NOT_CONFIGURED 6
|
||||
#define B_USBD_DEVICE_ERROR 7
|
||||
#define B_USBD_PIPE_ERROR 8
|
||||
#define B_USBD_NO_MEMORY 9
|
||||
|
||||
#define B_USB_MODULE_NAME "bus_managers/usb/v2"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,36 +0,0 @@
|
||||
/*
|
||||
** USB_printer.h
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_PRINTER_H
|
||||
#define _USB_PRINTER_H
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ioctl() opcodes for usb_printer driver */
|
||||
|
||||
enum
|
||||
{
|
||||
USB_PRINTER_GET_DEVICE_ID = B_DEVICE_OP_CODES_END+1
|
||||
};
|
||||
|
||||
|
||||
/* Maximum length of the DEVICE_ID. User MUST allocate this size
|
||||
when calling USB_PRINTER_GET_DEVICE_ID ioctl() */
|
||||
|
||||
#define USB_PRINTER_DEVICE_ID_LENGTH 256
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
** USB_rle.h
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_RLE_H
|
||||
#define _USB_RLE_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct _usbd_param_hdr;
|
||||
|
||||
/*
|
||||
Run Length encoding records for isochronous IN transfers.
|
||||
|
||||
Run Length encoding records are used to identify which samples in
|
||||
the buffer are good which are bad and which are missing.
|
||||
Bad bytes are not extracted from the buffer, but are padded to next
|
||||
nearest sample boundary. The ultimate consumer of the buffer
|
||||
should also receive the RLE array.
|
||||
|
||||
RLE records are constructed based on the following rules:
|
||||
|
||||
1. an RLE record contains a sample count and a status
|
||||
(good, bad, missing or unknown). A buffer has
|
||||
associated with it an array of rle records. The number of
|
||||
rle records available is specified in the RLE header. The
|
||||
number used is also in the RLE header.
|
||||
|
||||
2. Within the scope of a buffer, successive packets with the
|
||||
same completion status are represented with (1) rle record.
|
||||
For example, after three transactions which have completion
|
||||
status of success, the byte count in the rle record for this
|
||||
position in the data stream represents the bytes received in
|
||||
all three packets.
|
||||
|
||||
3. New rle records are initialized each time the status for a
|
||||
given packet differs from that of the previous packet.
|
||||
|
||||
*/
|
||||
|
||||
#define RLE_GOOD 1
|
||||
#define RLE_BAD 2
|
||||
#define RLE_MISSING 3
|
||||
#define RLE_UNKNOWN 4
|
||||
|
||||
/*
|
||||
Name: rle
|
||||
Purpose: used to represent the state of a portion of a data buffer
|
||||
Fields:
|
||||
rle_status will contain only the values: RLE_GOOD, RLE_BAD, RLE_MISSING
|
||||
sample_count the number of usb samples in the buffer associated with this rle
|
||||
record.
|
||||
Notes:
|
||||
If the buffer length field in queue_buffer_single structure changes to an
|
||||
uint32 from uin16, then the sample_count data type must
|
||||
track this change.
|
||||
*/
|
||||
typedef struct rle {
|
||||
uint16 rle_status;
|
||||
uint16 sample_count;
|
||||
} rle;
|
||||
|
||||
|
||||
/*
|
||||
Name: rlea
|
||||
Purpose: used as the primary rle information data structure between the
|
||||
USB driver stack and a consuming client.
|
||||
|
||||
Fields:
|
||||
length the number of rle records available in this structure.
|
||||
num_valid filled in by the USB driver. indicates the number of valid
|
||||
records filled.
|
||||
rles[] unconstrained array of rle records.
|
||||
*/
|
||||
typedef struct rlea {
|
||||
uint16 length;
|
||||
uint16 num_valid;
|
||||
rle rles[1];
|
||||
} rlea;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,144 +0,0 @@
|
||||
/*
|
||||
** USB_spec.h
|
||||
**
|
||||
** Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
**
|
||||
** This file contains structures and constants based on the USB Specification 1.1
|
||||
**
|
||||
*/
|
||||
|
||||
#ifndef _USB_SPEC_H
|
||||
#define _USB_SPEC_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* request types (target & direction) for send_request() */
|
||||
/* cf USB Spec Rev 1.1, table 9-2, p 183 */
|
||||
#define USB_REQTYPE_DEVICE_IN 0x80
|
||||
#define USB_REQTYPE_DEVICE_OUT 0x00
|
||||
#define USB_REQTYPE_INTERFACE_IN 0x81
|
||||
#define USB_REQTYPE_INTERFACE_OUT 0x01
|
||||
#define USB_REQTYPE_ENDPOINT_IN 0x82
|
||||
#define USB_REQTYPE_ENDPOINT_OUT 0x02
|
||||
#define USB_REQTYPE_OTHER_OUT 0x03
|
||||
#define USB_REQTYPE_OTHER_IN 0x83
|
||||
|
||||
/* request types for send_request() */
|
||||
/* cf USB Spec Rev 1.1, table 9-2, p 183 */
|
||||
#define USB_REQTYPE_STANDARD 0x00
|
||||
#define USB_REQTYPE_CLASS 0x20
|
||||
#define USB_REQTYPE_VENDOR 0x40
|
||||
#define USB_REQTYPE_RESERVED 0x60
|
||||
#define USB_REQTYPE_MASK 0x9F
|
||||
|
||||
/* standard request values for send_request() */
|
||||
/* cf USB Spec Rev 1.1, table 9-4, p 187 */
|
||||
#define USB_REQUEST_GET_STATUS 0
|
||||
#define USB_REQUEST_CLEAR_FEATURE 1
|
||||
#define USB_REQUEST_SET_FEATURE 3
|
||||
#define USB_REQUEST_SET_ADDRESS 5
|
||||
#define USB_REQUEST_GET_DESCRIPTOR 6
|
||||
#define USB_REQUEST_SET_DESCRIPTOR 7
|
||||
#define USB_REQUEST_GET_CONFIGURATION 8
|
||||
#define USB_REQUEST_SET_CONFIGURATION 9
|
||||
#define USB_REQUEST_GET_INTERFACE 10
|
||||
#define USB_REQUEST_SET_INTERFACE 11
|
||||
#define USB_REQUEST_SYNCH_FRAME 12
|
||||
|
||||
/* used by {set,get}_descriptor() */
|
||||
/* cf USB Spec Rev 1.1, table 9-5, p 187 */
|
||||
#define USB_DESCRIPTOR_DEVICE 1
|
||||
#define USB_DESCRIPTOR_CONFIGURATION 2
|
||||
#define USB_DESCRIPTOR_STRING 3
|
||||
#define USB_DESCRIPTOR_INTERFACE 4
|
||||
#define USB_DESCRIPTOR_ENDPOINT 5
|
||||
|
||||
/* used by {set,clear}_feature() */
|
||||
/* cf USB Spec Rev 1.1, table 9-6, p 188 */
|
||||
#define USB_FEATURE_DEVICE_REMOTE_WAKEUP 1
|
||||
#define USB_FEATURE_ENDPOINT_HALT 0
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-7, p 197 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_DEVICE */
|
||||
uint16 usb_version; /* USB_DESCRIPTOR_DEVICE_LENGTH */
|
||||
uint8 device_class;
|
||||
uint8 device_subclass;
|
||||
uint8 device_protocol;
|
||||
uint8 max_packet_size_0;
|
||||
uint16 vendor_id;
|
||||
uint16 product_id;
|
||||
uint16 device_version;
|
||||
uint8 manufacturer;
|
||||
uint8 product;
|
||||
uint8 serial_number;
|
||||
uint8 num_configurations;
|
||||
} _PACKED usb_device_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-8, p 199 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_CONFIGURATION */
|
||||
uint16 total_length; /* USB_DESCRIPTOR_CONFIGURATION_LENGTH */
|
||||
uint8 number_interfaces;
|
||||
uint8 configuration_value;
|
||||
uint8 configuration;
|
||||
uint8 attributes;
|
||||
uint8 max_power;
|
||||
} _PACKED usb_configuration_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-9, p 202 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_INTERFACE */
|
||||
uint8 interface_number; /* USB_DESCRIPTOR_INTERFACE_LENGTH */
|
||||
uint8 alternate_setting;
|
||||
uint8 num_endpoints;
|
||||
uint8 interface_class;
|
||||
uint8 interface_subclass;
|
||||
uint8 interface_protocol;
|
||||
uint8 interface;
|
||||
} _PACKED usb_interface_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-10, p 203 */
|
||||
uint8 length;
|
||||
uint8 descriptor_type; /* USB_DESCRIPTOR_ENDPOINT */
|
||||
uint8 endpoint_address; /* USB_DESCRIPTOR_ENDPOINT_LENGTH */
|
||||
uint8 attributes;
|
||||
uint16 max_packet_size;
|
||||
uint8 interval;
|
||||
} _PACKED usb_endpoint_descriptor;
|
||||
|
||||
typedef struct {
|
||||
/* cf USB Spec Rev 1.1, table 9-12, p 205 */
|
||||
uint8 length; /* USB_DESCRIPTOR_STRING */
|
||||
uint8 descriptor_type;
|
||||
uchar string[1];
|
||||
} _PACKED usb_string_descriptor;
|
||||
|
||||
typedef struct {
|
||||
uint8 length;
|
||||
uint8 descriptor_type;
|
||||
uint8 data[1];
|
||||
} _PACKED usb_generic_descriptor;
|
||||
|
||||
typedef union {
|
||||
usb_generic_descriptor generic;
|
||||
usb_device_descriptor device;
|
||||
usb_interface_descriptor interface;
|
||||
usb_endpoint_descriptor endpoint;
|
||||
usb_configuration_descriptor configuration;
|
||||
usb_string_descriptor string;
|
||||
} usb_descriptor;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,97 +0,0 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: atomizer.h
|
||||
/
|
||||
/ Description: Kernel atomizer module API
|
||||
/
|
||||
/ Copyright 1999, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _ATOMIZER_MODULE_H_
|
||||
#define _ATOMIZER_MODULE_H_
|
||||
|
||||
#include <module.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
An atomizer is a software device that returns a unique token for a
|
||||
null-terminated UTF8 string.
|
||||
|
||||
Each atomizer comprises a separate token space. The same string interned
|
||||
in two different atomizers will generate two distinct tokens.
|
||||
|
||||
Atomizers and the tokens they generate are only guaranteed valid between
|
||||
matched calls to get_module/put_module.
|
||||
|
||||
void * find_or_make_atomizer(const char *string)
|
||||
Returns a token that identifies the named atomizer, creating a new
|
||||
atomizer if the named atomizer does not exist. Pass null, a zero
|
||||
length string, or the value B_SYSTEM_ATOMIZER_NAME for string will
|
||||
return a pointer to the system atomizer. Returns (void *)(0)
|
||||
if the atomizer could not be created (for whatever reason). A return
|
||||
value of (void *)(-1) refers to the system atomizer.
|
||||
|
||||
status_t delete_atomizer(void *atomizer)
|
||||
Delete the atomizer specified. Returns B_OK if successfull, B_ERROR
|
||||
otherwise. An error return usually means that a race condition was
|
||||
detected while destroying the atomizer.
|
||||
|
||||
void * atomize(void *atomizer, const char *string, int create)
|
||||
Return the unique token for the specified string, creating a new token
|
||||
if the string was not previously atomized and create is non-zero. If
|
||||
atomizer is (void *)(-1), use the system atomizer (saving the step of
|
||||
looking it up with find_or_make_atomizer(). Returns (const char *)(0)
|
||||
if there were any errors detected: insufficient memory or a race
|
||||
condition with someone deleting the atomizer.
|
||||
|
||||
const char * string_for_token(void *atomizer, void *atom)
|
||||
Return a pointer to the string described by atom in the provided atomizer.
|
||||
Returns (const char *)(0) if either the atomizer or the atom were invalid.
|
||||
|
||||
status_t get_next_atomizer_info(void **cookie, atomizer_info *info)
|
||||
Returns info about the next atomizer in the list of atomizers by modifying
|
||||
the contents of info. The pointer specified by *cookie should be set to
|
||||
(void *)(0) to retrieve the first atomizer, and should not be modified
|
||||
thereafter. Returns B_ERROR when there are no more atomizers.
|
||||
Adding or deleting atomizers between calls to get_next_atomizer() results
|
||||
in a safe but undefined behavior.
|
||||
|
||||
void * get_next_atom(void *atomizer, uint32 *cookie)
|
||||
Returns the next atom interned in specified atomizer, *cookie
|
||||
should be set to (uint32)(0) to get the first atom. Returns
|
||||
(void *)(0) when there are no more atoms. Adding atoms between
|
||||
calls to get_next_atom() may cause atoms to be skipped.
|
||||
|
||||
Atomizers are SMP-safe. Check return codes for errors!
|
||||
|
||||
*/
|
||||
|
||||
#define B_ATOMIZER_MODULE_NAME "generic/atomizer/v1"
|
||||
#define B_SYSTEM_ATOMIZER_NAME "BeOS System Atomizer"
|
||||
|
||||
typedef struct {
|
||||
void *atomizer; /* An opaque token representing the atomizer. */
|
||||
char name[B_OS_NAME_LENGTH]; /* The first B_OS_NAME_LENGTH bytes of the atomizer name, null terminated. */
|
||||
uint32 atom_count; /* The number of atoms currently interned in this atomizer. */
|
||||
} atomizer_info;
|
||||
|
||||
typedef struct {
|
||||
module_info minfo;
|
||||
const void * (*find_or_make_atomizer)(const char *string);
|
||||
status_t (*delete_atomizer)(const void *atomizer);
|
||||
const void * (*atomize)(const void *atomizer, const char *string, int create);
|
||||
const char * (*string_for_token)(const void * atomizer, const void *atom);
|
||||
status_t (*get_next_atomizer_info)(void **cookie, atomizer_info *info);
|
||||
const void * (*get_next_atom)(const void *atomizer, uint32 *cookie);
|
||||
} atomizer_module_info;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,100 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __BLOCK_IO_H__
|
||||
#define __BLOCK_IO_H__
|
||||
|
||||
/*
|
||||
Part of Open block device manager
|
||||
|
||||
Block devices can be easily written by providing the interface
|
||||
specified hereinafter. The block device manager takes care of
|
||||
DMA and other restrictions imposed by underlying controller or
|
||||
protocol and transparently handles transmission of partial blocks
|
||||
by using a buffer (performance will suffer, though).
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
// cookies issued by block_io
|
||||
typedef struct block_io_device_info *block_io_device;
|
||||
typedef struct block_io_handle_info *block_io_handle;
|
||||
|
||||
// cookies issued by device driver
|
||||
typedef struct block_device_device_cookie *block_device_device_cookie;
|
||||
typedef struct block_device_handle_cookie *block_device_handle_cookie;
|
||||
|
||||
|
||||
// two reason why to use array of size 1:
|
||||
// 1. zero-sized arrays aren't standard C
|
||||
// 2. it's handy if you need a temporary global variable with num=1
|
||||
typedef struct phys_vecs {
|
||||
size_t num;
|
||||
size_t total_len;
|
||||
physical_entry vec[1];
|
||||
} phys_vecs;
|
||||
|
||||
#define PHYS_VECS(name, size) \
|
||||
uint8 name[sizeof(phys_vecs) + (size - 1)*sizeof(phys_vec)]; \
|
||||
phys_vecs *name = (phys_vecs *)name
|
||||
|
||||
|
||||
// Block Device Node
|
||||
|
||||
// attributes:
|
||||
|
||||
// if true, this device may be a BIOS drive (uint8, optional, default: false)
|
||||
#define B_BLOCK_DEVICE_IS_BIOS_DRIVE "block_device/is_bios_drive"
|
||||
// address bits that must be 0 - must be 2^i-1 for some i (uint32, optional, default: 0)
|
||||
#define B_BLOCK_DEVICE_DMA_ALIGNMENT "block_device/dma_alignment"
|
||||
// maximum number of blocks per transfer (uint32, optional, default: unlimited)
|
||||
#define B_BLOCK_DEVICE_MAX_BLOCKS_ITEM "block_device/max_blocks"
|
||||
// mask of bits that can change in one sg block (uint32, optional, default: ~0)
|
||||
#define B_BLOCK_DEVICE_DMA_BOUNDARY "block_device/dma_boundary"
|
||||
// maximum size of one block in scatter/gather list (uint32, optional, default: ~0)
|
||||
#define B_BLOCK_DEVICE_MAX_SG_BLOCK_SIZE "block_device/max_sg_block_size"
|
||||
// maximum number of scatter/gather blocks (uint32, optional, default: unlimited)
|
||||
#define B_BLOCK_DEVICE_MAX_SG_BLOCKS "block_device/max_sg_blocks"
|
||||
|
||||
|
||||
// interface to be provided by device driver
|
||||
typedef struct block_device_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// iovecs are physical address here
|
||||
// pos and num_blocks are in blocks; bytes_transferred in bytes
|
||||
// vecs are guaranteed to describe enough data for given block count
|
||||
status_t (*open)(block_device_device_cookie device, block_device_handle_cookie *handle);
|
||||
status_t (*close)(block_device_handle_cookie handle);
|
||||
status_t (*free)(block_device_handle_cookie handle);
|
||||
|
||||
status_t (*read)(block_device_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
size_t num_blocks, uint32 block_size, size_t *bytes_transferred);
|
||||
status_t (*write)(block_device_handle_cookie handle, const phys_vecs *vecs, off_t pos,
|
||||
size_t num_blocks, uint32 block_size, size_t *bytes_transferred);
|
||||
|
||||
status_t (*ioctl)(block_device_handle_cookie handle, int op, void *buf, size_t len);
|
||||
} block_device_interface;
|
||||
|
||||
#define B_BLOCK_IO_MODULE_NAME "generic/block_io/v1"
|
||||
|
||||
|
||||
// Interface for Drivers
|
||||
|
||||
// blkman interface used for callbacks done by driver
|
||||
typedef struct block_io_for_driver_interface {
|
||||
module_info info;
|
||||
|
||||
// block_size - block size in bytes
|
||||
// ld_block_size - log2( block_size) (set to zero if block_size is not power of two)
|
||||
// capacity - capacity in blocks
|
||||
void (*set_media_params)(block_io_device device, uint32 block_size, uint32 ld_block_size,
|
||||
uint64 capacity);
|
||||
} block_io_for_driver_interface;
|
||||
|
||||
#define B_BLOCK_IO_FOR_DRIVER_MODULE_NAME "generic/block_io/driver/v1"
|
||||
|
||||
#endif /* __BLOCK_IO_H__ */
|
||||
@@ -1,360 +0,0 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Part of Open IDE bus manager
|
||||
|
||||
IDE bus manager interface
|
||||
*/
|
||||
|
||||
#ifndef __IDE_H__
|
||||
#define __IDE_H__
|
||||
|
||||
#include <bus_manager.h>
|
||||
#include <iovec.h>
|
||||
#include <lendian_bitfield.h>
|
||||
#include <device_manager.h>
|
||||
#include <KernelExport.h>
|
||||
|
||||
// IDE task file.
|
||||
// contains the command block interpreted under different conditions with
|
||||
// first byte being first command register, second byte second command register
|
||||
// etc.; for lba48, registers must be written twice, therefore there
|
||||
// are twice as many bytes as registers - the first eight bytes are those
|
||||
// that must be written first, the second eight bytes are those that
|
||||
// must be written second.
|
||||
typedef union {
|
||||
struct {
|
||||
uint8 features;
|
||||
uint8 sector_count;
|
||||
uint8 sector_number;
|
||||
uint8 cylinder_0_7;
|
||||
uint8 cylinder_8_15;
|
||||
LBITFIELD8_3(
|
||||
head : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
} chs;
|
||||
struct {
|
||||
uint8 features;
|
||||
uint8 sector_count;
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
lba_24_27 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
} lba;
|
||||
struct {
|
||||
LBITFIELD8_3(
|
||||
dma : 1,
|
||||
ovl : 1,
|
||||
_0_res2 : 6
|
||||
);
|
||||
LBITFIELD8_2(
|
||||
_1_res0 : 3,
|
||||
tag : 5
|
||||
);
|
||||
uint8 _2_res;
|
||||
uint8 byte_count_0_7;
|
||||
uint8 byte_count_8_15;
|
||||
LBITFIELD8_6(
|
||||
lun : 3,
|
||||
_5_res3 : 1,
|
||||
device : 1,
|
||||
_5_one5 : 1,
|
||||
_5_res6 : 1,
|
||||
_5_one7 : 1
|
||||
);
|
||||
uint8 command;
|
||||
} packet;
|
||||
struct {
|
||||
LBITFIELD8_5(
|
||||
ili : 1,
|
||||
eom : 1,
|
||||
abrt : 1,
|
||||
_0_res3 : 1,
|
||||
sense_key : 4
|
||||
);
|
||||
LBITFIELD8_4(
|
||||
cmd_or_data : 1, // 1 - cmd, 0 - data
|
||||
input_or_output : 1, // 0 - input (to device), 1 - output
|
||||
release : 1,
|
||||
tag : 5
|
||||
);
|
||||
uint8 _2_res;
|
||||
uint8 byte_count_0_7;
|
||||
uint8 byte_count_8_15;
|
||||
LBITFIELD8_5(
|
||||
_4_res0 : 4,
|
||||
device : 1,
|
||||
_4_obs5 : 1,
|
||||
_4_res6 : 1,
|
||||
_4_obs7 : 1
|
||||
);
|
||||
LBITFIELD8_7(
|
||||
chk : 1,
|
||||
_7_res1 : 2,
|
||||
drq : 1,
|
||||
serv : 1,
|
||||
dmrd : 1,
|
||||
drdy : 1,
|
||||
bsy : 1
|
||||
);
|
||||
} packet_res;
|
||||
struct {
|
||||
uint8 sector_count;
|
||||
LBITFIELD8_4( // only <tag> is defined for write
|
||||
cmd_or_data : 1, // 1 - cmd, 0 - data
|
||||
input_or_output : 1, // 0 - input (to device), 1 - output
|
||||
release : 1,
|
||||
tag : 5
|
||||
);
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
lba_24_27 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
} queued;
|
||||
struct {
|
||||
// low order bytes
|
||||
uint8 features;
|
||||
uint8 sector_count_0_7;
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
_5low_res0 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
|
||||
// high order bytes
|
||||
uint8 _0high_res;
|
||||
uint8 sector_count_8_15;
|
||||
uint8 lba_24_31;
|
||||
uint8 lba_32_39;
|
||||
uint8 lba_40_47;
|
||||
} lba48;
|
||||
struct {
|
||||
// low order bytes
|
||||
uint8 sector_count_0_7;
|
||||
LBITFIELD8_4(
|
||||
cmd_or_data : 1, // 1 - cmd, 0 - data
|
||||
input_or_output : 1, // 0 - input (to device), 1 - output
|
||||
release : 1,
|
||||
tag : 5
|
||||
);
|
||||
uint8 lba_0_7;
|
||||
uint8 lba_8_15;
|
||||
uint8 lba_16_23;
|
||||
LBITFIELD8_3(
|
||||
_5low_res0 : 4,
|
||||
device : 1,
|
||||
mode : 3
|
||||
);
|
||||
uint8 command;
|
||||
|
||||
// high order bytes
|
||||
uint8 sector_count_8_15;
|
||||
uint8 _1high_res;
|
||||
uint8 lba_24_31;
|
||||
uint8 lba_32_39;
|
||||
uint8 lba_40_47;
|
||||
} queued48;
|
||||
struct {
|
||||
uint8 _0_res[3];
|
||||
uint8 ver; // RMSN version
|
||||
LBITFIELD8_3(
|
||||
pena : 1, // previously enabled
|
||||
lock : 1, // capable of locking
|
||||
pej : 1 // can physically eject
|
||||
);
|
||||
} set_MSN_res;
|
||||
struct {
|
||||
uint8 r[7+5];
|
||||
} raw;
|
||||
struct {
|
||||
uint8 features;
|
||||
uint8 sector_count;
|
||||
uint8 sector_number;
|
||||
uint8 cylinder_low;
|
||||
uint8 cylinder_high;
|
||||
uint8 device_head;
|
||||
uint8 command;
|
||||
} write;
|
||||
struct {
|
||||
uint8 error;
|
||||
uint8 sector_count;
|
||||
uint8 sector_number;
|
||||
uint8 cylinder_low;
|
||||
uint8 cylinder_high;
|
||||
uint8 device_head;
|
||||
uint8 status;
|
||||
} read;
|
||||
} ide_task_file;
|
||||
|
||||
// content of "mode" field
|
||||
enum {
|
||||
ide_mode_chs = 5,
|
||||
ide_mode_lba = 7
|
||||
};
|
||||
|
||||
// mask for ide_task_file fields to be written
|
||||
typedef enum {
|
||||
ide_mask_features = 0x01,
|
||||
ide_mask_sector_count = 0x02,
|
||||
|
||||
// CHS
|
||||
ide_mask_sector_number = 0x04,
|
||||
ide_mask_cylinder_low = 0x08,
|
||||
ide_mask_cylinder_high = 0x10,
|
||||
|
||||
// LBA
|
||||
ide_mask_LBA_low = 0x04,
|
||||
ide_mask_LBA_mid = 0x08,
|
||||
ide_mask_LBA_high = 0x10,
|
||||
|
||||
// packet
|
||||
ide_mask_byte_count = 0x18,
|
||||
|
||||
// packet and dma queued result
|
||||
ide_mask_error = 0x01,
|
||||
ide_mask_ireason = 0x02,
|
||||
|
||||
ide_mask_device_head = 0x20,
|
||||
ide_mask_command = 0x40,
|
||||
|
||||
ide_mask_status = 0x40,
|
||||
|
||||
// for 48 bits, the following flags tell which registers to load twice
|
||||
ide_mask_features_48 = 0x80 | ide_mask_features,
|
||||
ide_mask_sector_count_48 = 0x80 | ide_mask_sector_count,
|
||||
ide_mask_LBA_low_48 = 0x100 | ide_mask_LBA_low,
|
||||
ide_mask_LBA_mid_48 = 0x200 | ide_mask_LBA_mid,
|
||||
ide_mask_LBA_high_48 = 0x400 | ide_mask_LBA_high,
|
||||
|
||||
ide_mask_HOB = 0x780
|
||||
|
||||
//ide_mask_all = 0x7f
|
||||
} ide_reg_mask;
|
||||
|
||||
// status register
|
||||
enum {
|
||||
ide_status_err = 0x01, // error
|
||||
ide_status_index = 0x02, // obsolete
|
||||
ide_status_corr = 0x04, // obsolete
|
||||
ide_status_drq = 0x08, // data request
|
||||
ide_status_dsc = 0x10, // reserved
|
||||
ide_status_service = 0x10, // ready to service device
|
||||
ide_status_dwf = 0x20, // reserved
|
||||
ide_status_dma = 0x20, // reserved
|
||||
ide_status_dmrd = 0x20, // packet: DMA ready
|
||||
ide_status_df = 0x20, // packet: disk failure
|
||||
ide_status_drdy = 0x40, // device ready
|
||||
ide_status_bsy = 0x80 // busy
|
||||
} ide_status_mask;
|
||||
|
||||
// device control register
|
||||
enum {
|
||||
// bit 0 must be zero
|
||||
ide_devctrl_nien = 0x02, // disable INTRQ
|
||||
ide_devctrl_srst = 0x04, // software device reset
|
||||
ide_devctrl_bit3 = 0x08, // don't know, but must be set
|
||||
// bits inbetween are reserved
|
||||
ide_devctrl_hob = 0x80 // read high order byte (for 48-bit lba)
|
||||
} ide_devcntrl_mask;
|
||||
|
||||
// error register - most bits are command specific
|
||||
enum {
|
||||
// always used
|
||||
ide_error_abrt = 0x04, // command aborted
|
||||
|
||||
// used for Ultra DMA modes
|
||||
ide_error_icrc = 0x80, // interface CRC error
|
||||
|
||||
// used by reading data transfers
|
||||
ide_error_unc = 0x40, // uncorrectable data error
|
||||
// used by writing data transfers
|
||||
ide_error_wp = 0x40, // media write protect
|
||||
|
||||
// used by all data transfer commands
|
||||
ide_error_mc = 0x20, // medium changed
|
||||
ide_error_idnf = 0x10, // CHS translation not init./ invalid CHS address
|
||||
ide_error_mcr = 0x08, // media change requested
|
||||
ide_error_nm = 0x02, // no media (for removable media devices)
|
||||
} ide_error_mask;
|
||||
|
||||
|
||||
// Controller Driver Node
|
||||
|
||||
// attributes:
|
||||
|
||||
// node type
|
||||
#define IDE_BUS_TYPE_NAME "bus/ide/v1"
|
||||
// maximum number of devices connected to controller (uint8, optional, default:2)
|
||||
#define IDE_CONTROLLER_MAX_DEVICES_ITEM "ide/max_devices"
|
||||
// set to not-0 if DMA is supported (uint8, optional, default:0)
|
||||
// (if so, publish necessary blkdev restriction too)
|
||||
#define IDE_CONTROLLER_CAN_DMA_ITEM "ide/can_DMA"
|
||||
// set to not-0 if CQ is supported (uint8, optional, default:1)
|
||||
#define IDE_CONTROLLER_CAN_CQ_ITEM "ide/can_CQ"
|
||||
// name of controller (string, required)
|
||||
#define IDE_CONTROLLER_CONTROLLER_NAME_ITEM "ide/controller_name"
|
||||
|
||||
// interface of controller driver
|
||||
typedef struct {
|
||||
driver_module_info info;
|
||||
|
||||
status_t (*write_command_block_regs)
|
||||
(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask);
|
||||
status_t (*read_command_block_regs)
|
||||
(void *channel_cookie, ide_task_file *tf, ide_reg_mask mask);
|
||||
|
||||
uint8 (*get_altstatus) (void *channel_cookie);
|
||||
status_t (*write_device_control) (void *channel_cookie, uint8 val);
|
||||
|
||||
status_t (*write_pio) (void *channel_cookie, uint16 *data, int count, bool force_16bit );
|
||||
status_t (*read_pio) (void *channel_cookie, uint16 *data, int count, bool force_16bit );
|
||||
|
||||
status_t (*prepare_dma)(void *channel_cookie,
|
||||
const physical_entry *sg_list, size_t sg_list_count,
|
||||
bool write);
|
||||
status_t (*start_dma)(void *channel_cookie);
|
||||
status_t (*finish_dma)(void *channel_cookie);
|
||||
} ide_controller_interface;
|
||||
|
||||
|
||||
// channel cookie, issued by ide bus manager
|
||||
typedef struct ide_bus_info *ide_channel;
|
||||
|
||||
|
||||
// Interface for Controller Driver
|
||||
|
||||
// interface of bus manager as seen from controller driver
|
||||
// use this interface as the fixed consumer of your controller driver
|
||||
typedef struct {
|
||||
driver_module_info info;
|
||||
|
||||
// status - status read from controller (_not_ alt_status, as reading
|
||||
// normal status acknowledges IRQ request of device)
|
||||
status_t (*irq_handler)( ide_channel channel, uint8 status );
|
||||
} ide_for_controller_interface;
|
||||
|
||||
|
||||
#define IDE_FOR_CONTROLLER_MODULE_NAME "bus_managers/ide/controller/v1"
|
||||
|
||||
|
||||
#endif /* __IDE_H__ */
|
||||
@@ -1,67 +0,0 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
ISA bus manager
|
||||
|
||||
This is an improper name - this bus manager uses the PnP manager to
|
||||
load device drivers, but calling it ISA PnP manager would be wrong as
|
||||
ISA PnP information isn't used at all.
|
||||
|
||||
All ISA drivers must be Universal driver (see pnp_manager.h), as they
|
||||
are all direct children of the ISA bus node. Having an ISA PnP bus manager
|
||||
(which we don't), one node would be created per ISA device and thus you
|
||||
could write Specific drivers, but under normal ISA we don't even know
|
||||
how many devices are there, therefore the Universal driver trick.
|
||||
|
||||
Apart from the loading, the main change is the resource manager. In
|
||||
a driver, you must allocate the resources before registering the node and
|
||||
deallocate it when your node is removed and if the driver isn't loaded at
|
||||
this time. If it is, you must delay deallocation until the driver gets
|
||||
unloaded to make sure no new driver touches the same resources like you
|
||||
meanwhile.
|
||||
*/
|
||||
|
||||
#ifndef _ISA2_H
|
||||
#define _ISA2_H
|
||||
|
||||
#include <device_manager.h>
|
||||
#include <ISA.h>
|
||||
|
||||
// maximum size of one dma transfer
|
||||
// (in bytes for 8 bit transfer, in words for 16 bit transfer)
|
||||
#define B_MAX_ISA_DMA_COUNT 0x10000
|
||||
|
||||
typedef struct isa2_module_info {
|
||||
bus_module_info info;
|
||||
|
||||
uint8 (*read_io_8)( int mapped_io_addr );
|
||||
void (*write_io_8)( int mapped_io_addr, uint8 value );
|
||||
uint16 (*read_io_16)( int mapped_io_addr );
|
||||
void (*write_io_16)( int mapped_io_addr, uint16 value );
|
||||
uint32 (*read_io_32)( int mapped_io_addr );
|
||||
void (*write_io_32)( int mapped_io_addr, uint32 value );
|
||||
|
||||
// don't know what it's for, remains for compatibility
|
||||
void *(*ram_address)( const void *physical_address_in_system_memory );
|
||||
|
||||
// start dma transfer (scattered DMA is not supported as it's EISA specific)
|
||||
status_t (*start_isa_dma)(
|
||||
long channel, // dma channel to use
|
||||
void *buf, // buffer to transfer
|
||||
long transfer_count, // # transfers
|
||||
uchar mode, // mode flags
|
||||
uchar e_mode // extended mode flags
|
||||
);
|
||||
} isa2_module_info;
|
||||
|
||||
// type of isa device
|
||||
#define ISA_DEVICE_TYPE_NAME "isa/device/v1"
|
||||
// directory of ISA drivers
|
||||
// (there is only one device node, so put all drivers under "universal")
|
||||
#define ISA_DRIVERS_DIR "isa"
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,158 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
PCI bus manager
|
||||
*/
|
||||
|
||||
#ifndef _PCI2_H
|
||||
#define _PCI2_H
|
||||
|
||||
#include <device_manager.h>
|
||||
#include <PCI.h>
|
||||
|
||||
// currently, this structure is disabled to avoid collision with R5 header
|
||||
#if 0
|
||||
|
||||
typedef struct pci_info {
|
||||
ushort vendor_id; /* vendor id */
|
||||
ushort device_id; /* device id */
|
||||
uchar bus; /* bus number */
|
||||
uchar device; /* device number on bus */
|
||||
uchar function; /* function number in device */
|
||||
uchar revision; /* revision id */
|
||||
uchar class_api; /* specific register interface type */
|
||||
uchar class_sub; /* specific device function */
|
||||
uchar class_base; /* device type (display vs network, etc) */
|
||||
uchar line_size; /* cache line size in 32 bit words */
|
||||
uchar latency; /* latency timer */
|
||||
uchar header_type; /* header type */
|
||||
uchar bist; /* built-in self-test */
|
||||
uchar reserved; /* filler, for alignment */
|
||||
union {
|
||||
struct {
|
||||
ulong cardbus_cis; /* CardBus CIS pointer */
|
||||
ushort subsystem_id; /* subsystem (add-in card) id */
|
||||
ushort subsystem_vendor_id; /* subsystem (add-in card) vendor id */
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
ulong rom_size; /* rom size */
|
||||
ulong base_registers[6]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[6]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[6]; /* size of what base regs point to */
|
||||
uchar base_register_flags[6]; /* flags from base address fields */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
uchar min_grant; /* burst period @ 33 Mhz */
|
||||
uchar max_latency; /* how often PCI access needed */
|
||||
} h0;
|
||||
struct {
|
||||
ulong base_registers[2]; /* base registers, viewed from host */
|
||||
ulong base_registers_pci[2]; /* base registers, viewed from pci */
|
||||
ulong base_register_sizes[2]; /* size of what base regs point to */
|
||||
uchar base_register_flags[2]; /* flags from base address fields */
|
||||
uchar primary_bus;
|
||||
uchar secondary_bus;
|
||||
uchar subordinate_bus;
|
||||
uchar secondary_latency;
|
||||
uchar io_base;
|
||||
uchar io_limit;
|
||||
ushort secondary_status;
|
||||
ushort memory_base;
|
||||
ushort memory_limit;
|
||||
ushort prefetchable_memory_base;
|
||||
ushort prefetchable_memory_limit;
|
||||
ulong prefetchable_memory_base_upper32;
|
||||
ulong prefetchable_memory_limit_upper32;
|
||||
ushort io_base_upper16;
|
||||
ushort io_limit_upper16;
|
||||
ulong rom_base; /* rom base address, viewed from host */
|
||||
ulong rom_base_pci; /* rom base addr, viewed from pci */
|
||||
uchar interrupt_line; /* interrupt line */
|
||||
uchar interrupt_pin; /* interrupt pin */
|
||||
ushort bridge_control;
|
||||
} h1;
|
||||
} u;
|
||||
} pci_info;
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct pci_device_info *pci_device;
|
||||
|
||||
// Interface to one PCI device.
|
||||
// Actually, this is a _function_ of a device only, but
|
||||
// pci_function_module_info would be a bit non-intuitive
|
||||
typedef struct pci_device_module_info {
|
||||
driver_module_info info;
|
||||
|
||||
uint8 (*read_io_8)(pci_device device, int mapped_io_addr);
|
||||
void (*write_io_8)(pci_device device, int mapped_io_addr, uint8 value);
|
||||
uint16 (*read_io_16)(pci_device device, int mapped_io_addr);
|
||||
void (*write_io_16)(pci_device device, int mapped_io_addr, uint16 value);
|
||||
uint32 (*read_io_32)(pci_device device, int mapped_io_addr);
|
||||
void (*write_io_32)(pci_device device, int mapped_io_addr, uint32 value);
|
||||
|
||||
uint32 (*read_pci_config)(pci_device device,
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size); /* # bytes to read (1, 2 or 4) */
|
||||
void (*write_pci_config)(pci_device device,
|
||||
uchar offset, /* offset in configuration space */
|
||||
uchar size, /* # bytes to write (1, 2 or 4) */
|
||||
uint32 value); /* value to write */
|
||||
|
||||
void *(*ram_address)(pci_device device, const void *physical_address_in_system_memory);
|
||||
|
||||
/* status_t (*allocate_iomem)( void *base, size_t len, const char *name );
|
||||
status_t (*release_iomem)( void *base, size_t len );
|
||||
|
||||
status_t (*allocate_ioports)( uint16 ioport_base, size_t len, const char *name );
|
||||
status_t (*release_ioports)( uint16 ioport_base, size_t len );*/
|
||||
} pci_device_module_info;
|
||||
|
||||
|
||||
// directory of PCI drivers
|
||||
#define PCI_DRIVERS_DIR "pci"
|
||||
|
||||
// attributes of PCI device nodes
|
||||
// bus idx (uint8)
|
||||
#define PCI_DEVICE_BUS_ITEM "pci/bus"
|
||||
// device idx (uint8)
|
||||
#define PCI_DEVICE_DEVICE_ITEM "pci/device"
|
||||
// function idx (uint8)
|
||||
#define PCI_DEVICE_FUNCTION_ITEM "pci/function"
|
||||
|
||||
// vendor id (uint16)
|
||||
#define PCI_DEVICE_VENDOR_ID_ITEM "pci/vendor_id"
|
||||
// device id (uint16)
|
||||
#define PCI_DEVICE_DEVICE_ID_ITEM "pci/device_id"
|
||||
// subsystem id (uint16)
|
||||
#define PCI_DEVICE_SUBSYSTEM_ID_ITEM "pci/subsystem_id"
|
||||
// subvendor id (uint16)
|
||||
#define PCI_DEVICE_SUBVENDOR_ID_ITEM "pci/subvendor_id"
|
||||
|
||||
// device base class (uint16)
|
||||
#define PCI_DEVICE_BASE_CLASS_ID_ITEM "pci/class/base_id"
|
||||
// device subclass (uint16)
|
||||
#define PCI_DEVICE_SUB_CLASS_ID_ITEM "pci/class/sub_id"
|
||||
// device api (uint16)
|
||||
#define PCI_DEVICE_API_ID_ITEM "pci/class/api_id"
|
||||
|
||||
|
||||
// dynamic consumer patterns for PCI devices
|
||||
#define PCI_DEVICE_DYNAMIC_CONSUMER_0 \
|
||||
PCI_DRIVERS_DIR "/" \
|
||||
"vendor %" PCI_DEVICE_VENDOR_ID_ITEM "%|" \
|
||||
", device %" PCI_DEVICE_DEVICE_ID_ITEM "%|" \
|
||||
", subsystem %" PCI_DEVICE_SUBSYSTEM_ID_ITEM "%|" \
|
||||
", subvendor %" PCI_DEVICE_SUBVENDOR_ID_ITEM "%"
|
||||
|
||||
#define PCI_DEVICE_DYNAMIC_CONSUMER_1 \
|
||||
PCI_DRIVERS_DIR "/" \
|
||||
"base_class %" PCI_DEVICE_BASE_CLASS_ID_ITEM "%|" \
|
||||
", sub_class %" PCI_DEVICE_SUB_CLASS_ID_ITEM "%|" \
|
||||
", api %" PCI_DEVICE_API_ID_ITEM "%"
|
||||
|
||||
#endif
|
||||
@@ -1,456 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef __SCSI_BUSMANAGER_H__
|
||||
#define __SCSI_BUSMANAGER_H__
|
||||
|
||||
/*
|
||||
Part of Open SCSI bus manager
|
||||
|
||||
SCSI bus manager interface
|
||||
|
||||
The bus manager interface is _based_ on CAM, but I've modified it because :-
|
||||
- HBA engine, target mode and queue freezing (and probably other features)
|
||||
aren't supported (at least the first two aren't supported by linux too ;)
|
||||
- Asynchronous events aren't supported (no OS/driver I know uses them)
|
||||
- P/T/L was defined by number not by handle, requiring many redundant tests
|
||||
and thus making adding/removing of devices/busses very hard, especially if
|
||||
PnP is to be supported
|
||||
- single entry system as proposed by CAM involves extra tests and overhead
|
||||
because of generalized data structure
|
||||
|
||||
|
||||
For peripheral driver writers:
|
||||
|
||||
Something about requests involving data transfer: you can either specify
|
||||
the virtual address in <data> of CCB (in which case it must be continuous),
|
||||
or store a pointer to a S/G list that contains physical addresses in
|
||||
<sg_list>/<sg_cnt>. If <sg_list> is non-Null, <data> is ignored.
|
||||
The S/G list must be in kernel space because the request can be executed
|
||||
in a different thread context. This is also the reason why the S/G list has
|
||||
to contain physical addresses. For obvious reason, the data buffer specified
|
||||
by <sg_list> must be locked, but <data> doesn't need to be.
|
||||
|
||||
You can either execute the request synchronously ("sync_io") or
|
||||
asynchronously ("async_io"; you have to acquire <completion_sem> to find
|
||||
out when the request is finished). In the first case you can use either
|
||||
<data> or <sg_list>, in the latter <sg_list> only.
|
||||
|
||||
The SCSI bus manager takes care that the controller can access the data
|
||||
via DMA by copying it into a buffer if necessary. For the paging path,
|
||||
this can lead to problems (if the system writes a page to disk and the SCSI
|
||||
bus manager has to allocate a buffer during execution you are in trouble),
|
||||
therefore the blk_man takes care that is not necessary for reads/writes.
|
||||
To safe some microseconds, you should set the SCSI_DMA_SAFE flag for these
|
||||
requests, so the SCSI bus manager ommittes the test.
|
||||
|
||||
Effectively, using synchronous execution and specifying the address via
|
||||
<data> is a safe bet.
|
||||
|
||||
|
||||
For SIM writers:
|
||||
|
||||
Requests sent by peripheral drivers are forwarded to the <scsi_io> entry
|
||||
of the SIM. You should return as soon as some waiting is required.
|
||||
Usually, the controller raises an IRQ when a request can be continued
|
||||
or is finished. As interrupt handlers must be as fast as possible, you
|
||||
can schedule a DPC in the handler (<schedule_dpc>) which executed by a
|
||||
high priority service thread that is spawned by the SCSI bus manager
|
||||
for each bus. This service thread also takes care to submit waiting
|
||||
requests.
|
||||
|
||||
You can specify a maximum number of concurrent requests per bus via
|
||||
path_inquiry (<hba_queue_size>) for the bus. The device limit is
|
||||
determined via INQUIRY. If you need a lower/dynamic limit, you can refuse
|
||||
a request by <requeue>. If <bus_overflow> is true, no further requests
|
||||
to the bus will be sent, if <bus_overflow> is false, no further requests
|
||||
to the device will be sent. To terminate the overflow condition, call
|
||||
<cont_send_device>/<cont_send_bus>. It also terminated when a request
|
||||
for the bus/device is finished via <finished> or <resubmit>.
|
||||
Because of the asynchronous nature, requests may still arrive after the
|
||||
overflow condition being signalled, so you should add a safety test to
|
||||
<scsi_io>.
|
||||
|
||||
If a problem occurs during execution, you can ask for a restart via
|
||||
<resubmit>. The request in question will be submitted as soon as possible.
|
||||
|
||||
If you want to be not disturbed, you can block further requests via
|
||||
<block_bus>/<block_device>. As said above, you must have a safety test
|
||||
at <scsi_io> though.
|
||||
|
||||
If the SIM uses a non-SCSI protocol, it can ask the SCSI bus manager
|
||||
to emulate unsupported SCSI commands by translating them other (supported)
|
||||
commands. The bus manager calls <get_restriction> during detection for
|
||||
each device, setting <is_atapi> on return makes the bus manager translate
|
||||
READ6/WRITE6 commands to READ10/WRITE10 commands, MODE REQUEST6/SENSE6
|
||||
to MODE REQUEST10/SENSE10 and fix the version fields of INQUIRY results,
|
||||
so ATAPI devices can be used like standard SCSI devices. Further, the
|
||||
SCSI bus manager can emulate auto-sense by executing a REQUEST SENSE
|
||||
if <subsys_status> is SCSI_REQ_CMP_ERR and <device_status> is
|
||||
SCSI_DEVICE_CHECK_CONDITION when a request is finished. This emulation
|
||||
may be enhanced/generalized in the future.
|
||||
*/
|
||||
|
||||
|
||||
#include <KernelExport.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
|
||||
#define SCSI_MAX_CDB_SIZE 16 // max size of cdb
|
||||
#define SCSI_MAX_SENSE_SIZE 64 // max size of sense data
|
||||
#define SCSI_SIM_PRIV 1536 // SIM private data; this may be a bit much but
|
||||
// we currently need that for the compatibility layer
|
||||
|
||||
// bus/device handle
|
||||
typedef struct scsi_bus_info *scsi_bus;
|
||||
typedef struct scsi_device_info *scsi_device;
|
||||
|
||||
|
||||
// structure of one scsi i/o CCB (command control block)
|
||||
typedef struct scsi_ccb
|
||||
{
|
||||
struct scsi_ccb *next, *prev; // internal
|
||||
|
||||
uchar subsys_status; // Returned subsystem status
|
||||
uchar device_status; // Returned scsi device status
|
||||
|
||||
uchar path_id; // Path ID for the request
|
||||
uchar target_id; // Target device ID
|
||||
uchar target_lun; // Target LUN number
|
||||
uint32 flags; // Flags for operation of the subsystem
|
||||
|
||||
// released once after asynchronous execution of request;
|
||||
// initialised by alloc_ccb, can be replaced for action but
|
||||
// must be restored before returning via free_ccb
|
||||
sem_id completion_sem;
|
||||
|
||||
uint8 cdb[SCSI_MAX_CDB_SIZE]; // command data block
|
||||
uchar cdb_len; // length of command in bytes
|
||||
int64 sort; // value of command to sort on (<0 means n/a)
|
||||
bigtime_t timeout; // timeout - 0 = use default
|
||||
|
||||
uchar *data; // pointer to data
|
||||
const physical_entry *sg_list; // SG list
|
||||
uint16 sg_cnt; // number of SG entries
|
||||
uint32 data_len; // length of data
|
||||
int32 data_resid; // data transfer residual length: 2's comp
|
||||
|
||||
uchar sense[SCSI_MAX_SENSE_SIZE]; // autosense data
|
||||
uchar sense_resid; // autosense resid length: 2's comp
|
||||
|
||||
// private
|
||||
bool ordered : 1; // request cannot overtake/be overtaken by others
|
||||
bool buffered : 1; // data is buffered to make it DMA safe
|
||||
bool emulated : 1; // command is executed as part of emulation
|
||||
|
||||
scsi_bus bus; // associated bus
|
||||
scsi_device device; // associated device
|
||||
struct dma_buffer *dma_buffer; // used dma buffer, or NULL
|
||||
uchar state; // bus manager state
|
||||
|
||||
// original data before command emulation was applied
|
||||
uint8 orig_cdb[SCSI_MAX_CDB_SIZE];
|
||||
uchar orig_cdb_len;
|
||||
const physical_entry *orig_sg_list;
|
||||
uint16 orig_sg_cnt;
|
||||
uint32 orig_data_len;
|
||||
|
||||
// private SIM data
|
||||
uchar sim_state; // set to zero when request is submitted first time
|
||||
uchar sim_priv[SCSI_SIM_PRIV]; /* SIM private data area */
|
||||
} scsi_ccb;
|
||||
|
||||
|
||||
// Defines for the subsystem status field
|
||||
|
||||
#define SCSI_REQ_INPROG 0x00 /* request is in progress */
|
||||
#define SCSI_REQ_CMP 0x01 /* request completed w/out error */
|
||||
#define SCSI_REQ_ABORTED 0x02 /* request aborted by the host */
|
||||
#define SCSI_UA_ABORT 0x03 /* Unable to Abort request */
|
||||
#define SCSI_REQ_CMP_ERR 0x04 /* request completed with an err */
|
||||
#define SCSI_BUSY 0x05 /* subsystem is busy */
|
||||
#define SCSI_REQ_INVALID 0x06 /* request is invalid */
|
||||
#define SCSI_PATH_INVALID 0x07 /* Path ID supplied is invalid */
|
||||
#define SCSI_DEV_NOT_THERE 0x08 /* SCSI device not installed/there */
|
||||
#define SCSI_UA_TERMIO 0x09 /* Unable to Terminate I/O req */
|
||||
#define SCSI_SEL_TIMEOUT 0x0A /* Target selection timeout */
|
||||
#define SCSI_CMD_TIMEOUT 0x0B /* Command timeout */
|
||||
#define SCSI_MSG_REJECT_REC 0x0D /* Message reject received */
|
||||
#define SCSI_SCSI_BUS_RESET 0x0E /* SCSI bus reset sent/received */
|
||||
#define SCSI_UNCOR_PARITY 0x0F /* Uncorrectable parity err occurred */
|
||||
#define SCSI_AUTOSENSE_FAIL 0x10 /* Autosense: Request sense cmd fail */
|
||||
#define SCSI_NO_HBA 0x11 /* No HBA detected Error */
|
||||
#define SCSI_DATA_RUN_ERR 0x12 /* Data overrun/underrun error */
|
||||
#define SCSI_UNEXP_BUSFREE 0x13 /* Unexpected BUS free */
|
||||
#define SCSI_SEQUENCE_FAIL 0x14 /* Target bus phase sequence failure */
|
||||
#define SCSI_PROVIDE_FAIL 0x16 /* Unable to provide requ. capability */
|
||||
#define SCSI_BDR_SENT 0x17 /* A SCSI BDR msg was sent to target */
|
||||
#define SCSI_REQ_TERMIO 0x18 /* request terminated by the host */
|
||||
#define SCSI_HBA_ERR 0x19 /* Unrecoverable host bus adaptor err*/
|
||||
#define SCSI_BUS_RESET_DENIED 0x1A /* SCSI bus reset denied */
|
||||
|
||||
#define SCSI_IDE 0x33 /* Initiator Detected Error Received */
|
||||
#define SCSI_RESRC_UNAVAIL 0x34 /* Resource unavailable */
|
||||
#define SCSI_UNACKED_EVENT 0x35 /* Unacknowledged event by host */
|
||||
#define SCSI_LUN_INVALID 0x38 /* LUN supplied is invalid */
|
||||
#define SCSI_TID_INVALID 0x39 /* Target ID supplied is invalid */
|
||||
#define SCSI_FUNC_NOTAVAIL 0x3A /* The requ. func is not available */
|
||||
#define SCSI_NO_NEXUS 0x3B /* Nexus is not established */
|
||||
#define SCSI_IID_INVALID 0x3C /* The initiator ID is invalid */
|
||||
#define SCSI_CDB_RECVD 0x3D /* The SCSI CDB has been received */
|
||||
#define SCSI_LUN_ALLREADY_ENAB 0x3E /* LUN already enabled */
|
||||
#define SCSI_SCSI_BUSY 0x3F /* SCSI bus busy */
|
||||
|
||||
#define SCSI_AUTOSNS_VALID 0x80 /* Autosense data valid for target */
|
||||
|
||||
#define SCSI_SUBSYS_STATUS_MASK 0x3F /* Mask bits for just the status # */
|
||||
|
||||
|
||||
// Defines for the flags field
|
||||
|
||||
#define SCSI_DIR_RESV 0x00000000 /* Data direction (00: reserved) */
|
||||
#define SCSI_DIR_IN 0x00000040 /* Data direction (01: DATA IN) */
|
||||
#define SCSI_DIR_OUT 0x00000080 /* Data direction (10: DATA OUT) */
|
||||
#define SCSI_DIR_NONE 0x000000C0 /* Data direction (11: no data) */
|
||||
#define SCSI_DIR_MASK 0x000000C0
|
||||
|
||||
#define SCSI_DIS_AUTOSENSE 0x00000020 /* Disable autosense feature */
|
||||
#define SCSI_ORDERED_QTAG 0x00000010 // ordered queue (cannot overtake/be overtaken)
|
||||
#define SCSI_DMA_SAFE 0x00000008 // set if data buffer is DMA approved
|
||||
|
||||
#define SCSI_DIS_DISCONNECT 0x00008000 /* Disable disconnect */
|
||||
#define SCSI_INITIATE_SYNC 0x00004000 /* Attempt Sync data xfer, and SDTR */
|
||||
#define SCSI_DIS_SYNC 0x00002000 /* Disable sync, go to async */
|
||||
#define SCSI_ENG_SYNC 0x00000200 /* Flush resid bytes before cmplt */
|
||||
|
||||
|
||||
// Defines for the Path Inquiry CCB fields
|
||||
|
||||
// flags in hba_inquiry
|
||||
#define SCSI_PI_MDP_ABLE 0x80 /* Supports MDP message */
|
||||
#define SCSI_PI_WIDE_32 0x40 /* Supports 32 bit wide SCSI */
|
||||
#define SCSI_PI_WIDE_16 0x20 /* Supports 16 bit wide SCSI */
|
||||
#define SCSI_PI_SDTR_ABLE 0x10 /* Supports SDTR message */
|
||||
#define SCSI_PI_TAG_ABLE 0x02 /* Supports tag queue message */
|
||||
#define SCSI_PI_SOFT_RST 0x01 /* Supports soft reset */
|
||||
|
||||
// flags in hba_misc
|
||||
#define SCSI_PIM_SCANHILO 0x80 /* Bus scans from ID 7 to ID 0 */
|
||||
#define SCSI_PIM_NOREMOVE 0x40 /* Removable dev not included in scan */
|
||||
|
||||
// sizes of inquiry fields
|
||||
#define SCSI_VUHBA 14 /* Vendor Unique HBA length */
|
||||
#define SCSI_SIM_ID 16 /* ASCII string len for SIM ID */
|
||||
#define SCSI_HBA_ID 16 /* ASCII string len for HBA ID */
|
||||
#define SCSI_FAM_ID 16 /* ASCII string len for FAMILY ID */
|
||||
#define SCSI_TYPE_ID 16 /* ASCII string len for TYPE ID */
|
||||
#define SCSI_VERS 8 /* ASCII string len for SIM & HBA vers */
|
||||
|
||||
|
||||
// Path inquiry, extended by BeOS XPT_EXTENDED_PATH_INQ parameters
|
||||
typedef struct
|
||||
{
|
||||
uchar version_num; /* Version number for the SIM/HBA */
|
||||
uchar hba_inquiry; /* Mimic of INQ byte 7 for the HBA */
|
||||
uchar hba_misc; /* Misc HBA feature flags */
|
||||
uint32 sim_priv; /* Size of SIM private data area */
|
||||
uchar vuhba_flags[SCSI_VUHBA];/* Vendor unique capabilities */
|
||||
uchar initiator_id; /* ID of the HBA on the SCSI bus */
|
||||
uint32 hba_queue_size; // size of adapaters command queue
|
||||
char sim_vid[SCSI_SIM_ID]; /* Vendor ID of the SIM */
|
||||
char hba_vid[SCSI_HBA_ID]; /* Vendor ID of the HBA */
|
||||
|
||||
char sim_version[SCSI_VERS]; /* SIM version number */
|
||||
char hba_version[SCSI_VERS]; /* HBA version number */
|
||||
char controller_family[SCSI_FAM_ID]; /* Controller family */
|
||||
char controller_type[SCSI_TYPE_ID]; /* Controller type */
|
||||
} scsi_path_inquiry;
|
||||
|
||||
|
||||
// Device node
|
||||
|
||||
// target (uint8)
|
||||
#define SCSI_DEVICE_TARGET_ID_ITEM "scsi/target_id"
|
||||
// lun (uint8)
|
||||
#define SCSI_DEVICE_TARGET_LUN_ITEM "scsi/target_lun"
|
||||
// node type
|
||||
#define SCSI_DEVICE_TYPE_NAME "scsi/device/v1"
|
||||
// device inquiry data (raw scsi_res_inquiry)
|
||||
#define SCSI_DEVICE_INQUIRY_ITEM "scsi/device_inquiry"
|
||||
// device type (uint8)
|
||||
#define SCSI_DEVICE_TYPE_ITEM "scsi/type"
|
||||
// vendor name (string)
|
||||
#define SCSI_DEVICE_VENDOR_ITEM "scsi/vendor"
|
||||
// product name (string)
|
||||
#define SCSI_DEVICE_PRODUCT_ITEM "scsi/product"
|
||||
// revision (string)
|
||||
#define SCSI_DEVICE_REVISION_ITEM "scsi/revision"
|
||||
|
||||
// directory containing links to peripheral drivers
|
||||
#define SCSI_PERIPHERAL_DRIVERS_DIR "scsi"
|
||||
|
||||
// bus manager device interface for peripheral driver
|
||||
typedef struct scsi_device_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// get CCB
|
||||
// warning: if pool of CCBs is exhausted, this call is delayed until a
|
||||
// CCB is freed, so don't try to allocate more then one CCB at once!
|
||||
scsi_ccb *(*alloc_ccb)(scsi_device device);
|
||||
// free CCB
|
||||
void (*free_ccb)(scsi_ccb *ccb);
|
||||
|
||||
// execute command asynchronously
|
||||
// when it's finished, the semaphore of the ccb is released
|
||||
// you must provide a S/G list if data_len != 0
|
||||
void (*async_io)(scsi_ccb *ccb);
|
||||
// execute command synchronously
|
||||
// you don't need to provide a S/G list nor have to lock data
|
||||
void (*sync_io)(scsi_ccb *ccb);
|
||||
|
||||
// abort request
|
||||
uchar (*abort)(scsi_ccb *ccb_to_abort);
|
||||
// reset device
|
||||
uchar (*reset_device)(scsi_device device);
|
||||
// terminate request
|
||||
uchar (*term_io)(scsi_ccb *ccb_to_terminate);
|
||||
} scsi_device_interface;
|
||||
|
||||
#define SCSI_DEVICE_MODULE_NAME "bus_managers/scsi/driver/v1"
|
||||
|
||||
|
||||
// Bus node
|
||||
|
||||
// attributes:
|
||||
|
||||
// path (uint8)
|
||||
#define SCSI_BUS_PATH_ID_ITEM "scsi/path_id"
|
||||
// node type
|
||||
#define SCSI_BUS_TYPE_NAME "scsi/bus"
|
||||
|
||||
// SCSI bus node driver.
|
||||
// This interface can be used by peripheral drivers to access the
|
||||
// bus directly.
|
||||
typedef struct scsi_bus_interface {
|
||||
bus_module_info info;
|
||||
|
||||
// get information about host controller
|
||||
uchar (*path_inquiry)(scsi_bus bus, scsi_path_inquiry *inquiry_data);
|
||||
// reset SCSI bus
|
||||
uchar (*reset_bus)(scsi_bus bus);
|
||||
} scsi_bus_interface;
|
||||
|
||||
// name of SCSI bus node driver
|
||||
#define SCSI_BUS_MODULE_NAME "bus_managers/scsi/bus/v1"
|
||||
|
||||
|
||||
// Interface for SIM
|
||||
|
||||
// cookie for dpc
|
||||
typedef struct scsi_dpc_info *scsi_dpc_cookie;
|
||||
|
||||
// Bus manager interface used by SCSI controller drivers.
|
||||
// SCSI controller drivers get this interface passed via their init_device
|
||||
// method. Further, they must specify this driver as their fixed consumer.
|
||||
typedef struct scsi_for_sim_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// put request into wait queue because of overflow
|
||||
// bus_overflow: true - too many bus requests
|
||||
// false - too many device requests
|
||||
// bus/device won't receive requests until cont_sent_bus/cont_send_device
|
||||
// is called or a request is finished via finished();
|
||||
// to avoid race conditions (reporting a full and a available bus at once)
|
||||
// the SIM should synchronize calls to requeue, resubmit and finished
|
||||
void (*requeue)(scsi_ccb *ccb, bool bus_overflow);
|
||||
// resubmit request ASAP
|
||||
// to be used if execution of request went wrong and must be retried
|
||||
void (*resubmit)(scsi_ccb *ccb);
|
||||
// mark request as being finished
|
||||
// num_requests: number of requests that were handled by device
|
||||
// when the request was sent (read: how full was the device
|
||||
// queue); needed to find out how large the device queue is;
|
||||
// e.g. if three were already running plus this request makes
|
||||
// num_requests=4
|
||||
void (*finished)(scsi_ccb *ccb, uint num_requests);
|
||||
|
||||
// following functions return error on invalid arguments only
|
||||
status_t (*alloc_dpc)(scsi_dpc_cookie *dpc);
|
||||
status_t (*free_dpc)(scsi_dpc_cookie dpc);
|
||||
status_t (*schedule_dpc)(scsi_bus cookie, scsi_dpc_cookie dpc, /*int flags,*/
|
||||
void (*func)( void * ), void *arg);
|
||||
|
||||
// block entire bus (can be nested)
|
||||
// no more request will be submitted to this bus
|
||||
void (*block_bus)(scsi_bus bus);
|
||||
// unblock entire bus
|
||||
// requests will be submitted to bus ASAP
|
||||
void (*unblock_bus)(scsi_bus bus);
|
||||
// block one device
|
||||
// no more requests will be submitted to this device
|
||||
void (*block_device)(scsi_device device);
|
||||
// unblock device
|
||||
// requests for this device will be submitted ASAP
|
||||
void (*unblock_device)(scsi_device device);
|
||||
|
||||
// terminate bus overflow condition (see "requeue")
|
||||
void (*cont_send_bus)(scsi_bus bus);
|
||||
// terminate device overflow condition (see "requeue")
|
||||
void (*cont_send_device)(scsi_device device);
|
||||
} scsi_for_sim_interface;
|
||||
|
||||
|
||||
#define SCSI_FOR_SIM_MODULE_NAME "bus_managers/scsi/sim/v1"
|
||||
|
||||
|
||||
// SIM Node
|
||||
|
||||
// attributes:
|
||||
|
||||
// node type
|
||||
#define SCSI_SIM_TYPE_NAME "bus/scsi/v1"
|
||||
// controller name (required, string)
|
||||
#define SCSI_DESCRIPTION_CONTROLLER_NAME "controller_name"
|
||||
|
||||
typedef struct scsi_sim_cookie *scsi_sim_cookie;
|
||||
|
||||
// SIM interface
|
||||
// SCSI controller drivers must provide this interface
|
||||
typedef struct scsi_sim_interface {
|
||||
driver_module_info info;
|
||||
|
||||
// execute request
|
||||
void (*scsi_io)( scsi_sim_cookie cookie, scsi_ccb *ccb );
|
||||
// abort request
|
||||
uchar (*abort)( scsi_sim_cookie cookie, scsi_ccb *ccb_to_abort );
|
||||
// reset device
|
||||
uchar (*reset_device)( scsi_sim_cookie cookie, uchar target_id, uchar target_lun );
|
||||
// terminate request
|
||||
uchar (*term_io)( scsi_sim_cookie cookie, scsi_ccb *ccb_to_terminate );
|
||||
|
||||
// get information about bus
|
||||
uchar (*path_inquiry)( scsi_sim_cookie cookie, scsi_path_inquiry *inquiry_data );
|
||||
// scan bus
|
||||
// this is called immediately before the SCSI bus manager scans the bus
|
||||
uchar (*scan_bus)( scsi_sim_cookie cookie );
|
||||
// reset bus
|
||||
uchar (*reset_bus)( scsi_sim_cookie cookie );
|
||||
|
||||
// get restrictions of one device
|
||||
// (used for non-SCSI transport protocols and bug fixes)
|
||||
void (*get_restrictions)(
|
||||
scsi_sim_cookie cookie,
|
||||
uchar target_id, // target id
|
||||
bool *is_atapi, // set to true if this is an ATAPI device that
|
||||
// needs some commands emulated
|
||||
bool *no_autosense, // set to true if there is no autosense;
|
||||
// the SCSI bus manager will request sense on
|
||||
// SCSI_REQ_CMP_ERR/SCSI_DEVICE_CHECK_CONDITION
|
||||
uint32 *max_blocks ); // maximum number of blocks per transfer if > 0;
|
||||
// used for buggy devices that cannot handle
|
||||
// large transfers (read: ATAPI ZIP drives)
|
||||
} scsi_sim_interface;
|
||||
|
||||
|
||||
#endif /* __SCSI_BUSMANAGER_H__ */
|
||||
@@ -1,220 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005, Axel Dörfler, [email protected]. All rights reserved.
|
||||
* Copyright 2002-04, Thomas Kurschel. All rights reserved.
|
||||
*
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _IDE_PCI_H
|
||||
#define _IDE_PCI_H
|
||||
|
||||
/*
|
||||
IDE adapter library
|
||||
|
||||
Module to simplify writing an IDE adapter driver.
|
||||
|
||||
The interface is not very abstract, i.e. the actual driver is
|
||||
free to access any controller or channel data of this library.
|
||||
*/
|
||||
|
||||
|
||||
#include <bus/PCI.h>
|
||||
#include <bus/IDE.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
|
||||
// one Physical Region Descriptor (PRD)
|
||||
// (one region must not cross 64K boundary;
|
||||
// the PRD table must not cross a 64K boundary)
|
||||
typedef struct prd_entry {
|
||||
uint32 address; // physical address of block (must be even)
|
||||
uint16 count; // size of block, 0 stands for 65536 (must be even)
|
||||
uint8 res6;
|
||||
LBITFIELD8_2(
|
||||
res7_0 : 7,
|
||||
EOT : 1 // 1 for last entry
|
||||
);
|
||||
} prd_entry;
|
||||
|
||||
|
||||
// command register
|
||||
typedef struct ide_bm_command {
|
||||
LBITFIELD8_4(
|
||||
start_stop : 1, // start BM by changing from 0 to 1;
|
||||
// stop BM by changing from 1 to 0
|
||||
res0_1 : 2,
|
||||
from_device : 1, // true - read from device, false - write to device
|
||||
res0_4 : 4
|
||||
);
|
||||
} ide_bm_command;
|
||||
|
||||
|
||||
// status register
|
||||
typedef struct ide_bm_status {
|
||||
LBITFIELD8_7(
|
||||
active : 1, // 1, if BM is active
|
||||
error : 1, // 1, if error occured; write 1 to reset
|
||||
interrupt : 1, // 1, if INTRQ was raised, write 1 to reset
|
||||
res0_3 : 2,
|
||||
device0_dma : 1, // 1, if BIOS/driver has setup DMA for device 0
|
||||
device1_dma : 1, // 1, if BIOS/driver has setup DMA for device 1
|
||||
simplex : 1 // 1, if only one channel can use DMA at a time
|
||||
);
|
||||
} ide_bm_status;
|
||||
|
||||
|
||||
// offset of bus master registers
|
||||
enum {
|
||||
ide_bm_command_reg = 0, // see ide_bm_command
|
||||
ide_bm_status_reg = 2, // see ide_bm_status
|
||||
ide_bm_prdt_address = 4 // offset of PRDT register; content must be dword-aligned
|
||||
};
|
||||
|
||||
// bit mask in class_api of PCI configuration
|
||||
// (for adapters that can run in compatability mode)
|
||||
enum {
|
||||
ide_api_primary_native = 1, // primary channel is in native mode
|
||||
ide_api_primary_fixed = 2, // primary channel can be switched to native mode
|
||||
ide_api_secondary_native = 4, // secondary channel is in native mode
|
||||
ide_api_secondary_fixed = 8 // secondary channel can be switched to native mode
|
||||
};
|
||||
|
||||
|
||||
// (maximum) size of S/G table
|
||||
// there are so many restrictions that we want to keep it inside one page
|
||||
// to be sure that we fulfill them all
|
||||
#define IDE_ADAPTER_MAX_SG_COUNT (B_PAGE_SIZE / sizeof( prd_entry ))
|
||||
|
||||
|
||||
// channel node items
|
||||
// io address of command block (uint16)
|
||||
#define IDE_ADAPTER_COMMAND_BLOCK_BASE "ide_adapter/command_block_base"
|
||||
// io address of control block (uint16)
|
||||
#define IDE_ADAPTER_CONTROL_BLOCK_BASE "ide_adapter/control_block_base"
|
||||
// interrupt number (uint8)
|
||||
// can also be defined in controller node if both channels use same IRQ!
|
||||
#define IDE_ADAPTER_INTNUM "ide_adapter/irq"
|
||||
// 0 if primary channel, 1 if secondary channel, 2 if tertiary, ... (uint8)
|
||||
#define IDE_ADAPTER_CHANNEL_INDEX "ide_adapter/channel_index"
|
||||
|
||||
|
||||
// controller node items
|
||||
// io address of bus master registers (uint16)
|
||||
#define IDE_ADAPTER_BUS_MASTER_BASE "ide_adapter/bus_master_base"
|
||||
|
||||
|
||||
// info about one channel
|
||||
typedef struct ide_adapter_channel_info {
|
||||
pci_device_module_info *pci;
|
||||
pci_device device;
|
||||
|
||||
uint16 command_block_base; // io address command block
|
||||
uint16 control_block_base; // io address control block
|
||||
uint16 bus_master_base;
|
||||
int intnum; // interrupt number
|
||||
|
||||
uint32 lost; // != 0 if device got removed, i.e. if it must not
|
||||
// be accessed anymore
|
||||
|
||||
ide_channel ide_channel;
|
||||
device_node_handle node;
|
||||
|
||||
int32 (*inthand)( void *arg );
|
||||
|
||||
area_id prd_area;
|
||||
prd_entry *prdt;
|
||||
uint32 prdt_phys;
|
||||
uint32 dmaing;
|
||||
} ide_adapter_channel_info;
|
||||
|
||||
|
||||
// info about controller
|
||||
typedef struct ide_adapter_controller_info {
|
||||
pci_device_module_info *pci;
|
||||
pci_device device;
|
||||
|
||||
uint16 bus_master_base;
|
||||
|
||||
uint32 lost; // != 0 if device got removed, i.e. if it must not
|
||||
// be accessed anymore
|
||||
|
||||
device_node_handle node;
|
||||
} ide_adapter_controller_info;
|
||||
|
||||
|
||||
// interface of IDE adapter library
|
||||
typedef struct {
|
||||
module_info info;
|
||||
|
||||
// function calls that can be forwarded from actual driver
|
||||
status_t (*write_command_block_regs)(ide_adapter_channel_info *channel,
|
||||
ide_task_file *tf, ide_reg_mask mask);
|
||||
status_t (*read_command_block_regs)(ide_adapter_channel_info *channel,
|
||||
ide_task_file *tf, ide_reg_mask mask);
|
||||
|
||||
uint8 (*get_altstatus) (ide_adapter_channel_info *channel);
|
||||
status_t (*write_device_control) (ide_adapter_channel_info *channel, uint8 val);
|
||||
|
||||
status_t (*write_pio)(ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit);
|
||||
status_t (*read_pio)(ide_adapter_channel_info *channel, uint16 *data, int count, bool force_16bit);
|
||||
|
||||
status_t (*prepare_dma)(ide_adapter_channel_info *channel, const physical_entry *sg_list,
|
||||
size_t sg_list_count, bool to_device);
|
||||
status_t (*start_dma)(ide_adapter_channel_info *channel);
|
||||
status_t (*finish_dma)(ide_adapter_channel_info *channel);
|
||||
|
||||
// default functions that should be replaced by a more specific version
|
||||
// (copy them from source code of this library and modify them at will)
|
||||
int32 (*inthand)(void *arg);
|
||||
|
||||
// functions that must be called by init/uninit etc. of channel driver
|
||||
status_t (*init_channel)(device_node_handle node, ide_channel ide_channel,
|
||||
ide_adapter_channel_info **cookie, size_t total_data_size,
|
||||
int32 (*inthand)(void *arg));
|
||||
status_t (*uninit_channel)(ide_adapter_channel_info *channel);
|
||||
void (*channel_removed)(device_node_handle node, ide_adapter_channel_info *channel);
|
||||
|
||||
// publish channel node
|
||||
status_t (*publish_channel)(device_node_handle controller_node,
|
||||
const char *channel_module_name, uint16 command_block_base,
|
||||
uint16 control_block_base, uint8 intnum, bool can_dma,
|
||||
uint8 channel_index, const char *name,
|
||||
io_resource_handle *resources, device_node_handle *node);
|
||||
// verify channel configuration and publish node on success
|
||||
status_t (*detect_channel)(pci_device_module_info *pci, pci_device pci_device,
|
||||
device_node_handle controller_node, const char *channel_module_name,
|
||||
bool controller_can_dma, uint16 command_block_base,
|
||||
uint16 control_block_base, uint16 bus_master_base,
|
||||
uint8 intnum, uint8 channel_index, const char *name,
|
||||
device_node_handle *node, bool supports_compatibility_mode);
|
||||
|
||||
// functions that must be called by init/uninit etc. of controller driver
|
||||
status_t (*init_controller)(device_node_handle node, void *user_cookie,
|
||||
ide_adapter_controller_info **cookie, size_t total_data_size);
|
||||
status_t (*uninit_controller)(ide_adapter_controller_info *controller);
|
||||
void (*controller_removed)(device_node_handle node, ide_adapter_controller_info *controller);
|
||||
|
||||
// publish controller node
|
||||
status_t (*publish_controller)(device_node_handle parent, uint16 bus_master_base,
|
||||
io_resource_handle *resources, const char *controller_driver,
|
||||
const char *controller_driver_type, const char *controller_name,
|
||||
bool can_dma, bool can_cq, uint32 dma_alignment, uint32 dma_boundary,
|
||||
uint32 max_sg_block_size, device_node_handle *node);
|
||||
// verify controller configuration and publish node on success
|
||||
status_t (*detect_controller)(pci_device_module_info *pci, pci_device pci_device,
|
||||
device_node_handle parent, uint16 bus_master_base,
|
||||
const char *controller_driver, const char *controller_driver_type,
|
||||
const char *controller_name, bool can_dma, bool can_cq,
|
||||
uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
|
||||
device_node_handle *node);
|
||||
// standard master probe for controller that registers controller and channel nodes
|
||||
status_t (*probe_controller)(device_node_handle parent, const char *controller_driver,
|
||||
const char *controller_driver_type, const char *controller_name,
|
||||
const char *channel_module_name, bool can_dma, bool can_cq,
|
||||
uint32 dma_alignment, uint32 dma_boundary, uint32 max_sg_block_size,
|
||||
bool supports_compatibility_mode);
|
||||
} ide_adapter_interface;
|
||||
|
||||
|
||||
#define IDE_ADAPTER_MODULE_NAME "generic/ide_adapter/v1"
|
||||
|
||||
#endif /* _IDE_PCI_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,164 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Part of Open SCSI Peripheral Driver
|
||||
|
||||
Use this module to minimize work required to write a SCSI
|
||||
peripheral driver.
|
||||
|
||||
It takes care of:
|
||||
- error handling
|
||||
- medium changes (including restarting the medium)
|
||||
- detection of medium capacity
|
||||
*/
|
||||
|
||||
#ifndef __SCSI_PERIPH_H__
|
||||
#define __SCSI_PERIPH_H__
|
||||
|
||||
#include <bus/SCSI.h>
|
||||
#include <block_io.h>
|
||||
#include <bus/scsi/scsi_cmds.h>
|
||||
#include <Drivers.h>
|
||||
|
||||
// cookie issued by module per device
|
||||
typedef struct scsi_periph_device_info *scsi_periph_device;
|
||||
// cookie issued by module per file handle
|
||||
typedef struct scsi_periph_handle_info *scsi_periph_handle;
|
||||
|
||||
// "standardized" error code to simplify handling of scsi errors
|
||||
typedef enum {
|
||||
err_act_ok, // executed successfully
|
||||
err_act_retry, // failed, retry 3 times
|
||||
err_act_fail, // failed, don't retry
|
||||
err_act_many_retries, // failed, retry multiple times (currently 10 times)
|
||||
err_act_start, // devices requires a "start" command
|
||||
err_act_invalid_req // request is invalid
|
||||
} err_act;
|
||||
|
||||
// packed scsi command result
|
||||
typedef struct err_res {
|
||||
status_t error_code : 32; // Be error code
|
||||
uint32 action : 8; // err_act code
|
||||
} err_res;
|
||||
|
||||
#define MK_ERROR( aaction, code ) ({ \
|
||||
err_res res = {error_code: (code), action: (aaction) }; \
|
||||
res; \
|
||||
})
|
||||
|
||||
// device icon type
|
||||
typedef enum {
|
||||
icon_type_disk,
|
||||
icon_type_removal,
|
||||
icon_type_floppy,
|
||||
icon_type_cd
|
||||
} icon_type;
|
||||
|
||||
// cookie issued by driver to identify itself
|
||||
//typedef struct periph_info *periph_cookie;
|
||||
// cookie issued by driver per device
|
||||
typedef struct periph_device_info *periph_device_cookie;
|
||||
// cookie issued by driver per file handle
|
||||
typedef struct periph_handle_info *periph_handle_cookie;
|
||||
|
||||
|
||||
// callbacks to be provided by peripheral driver
|
||||
typedef struct scsi_periph_callbacks {
|
||||
// *** block devices ***
|
||||
// informs of new size of medium
|
||||
// (set to NULL if not a block device)
|
||||
void (*set_capacity)( periph_device_cookie periph_device, uint64 capacity,
|
||||
uint32 block_size );
|
||||
|
||||
// *** removable devices
|
||||
// called when media got changed (can be NULL if medium is not changable)
|
||||
// (you don't need to call periph->media_changed, but it's doesn't if you do)
|
||||
// ccb - request at your disposal
|
||||
void (*media_changed)( periph_device_cookie periph_device,
|
||||
scsi_ccb *request );
|
||||
} scsi_periph_callbacks;
|
||||
|
||||
|
||||
// functions provided by this module
|
||||
typedef struct scsi_periph_interface {
|
||||
module_info info;
|
||||
|
||||
// *** init/cleanup ***
|
||||
status_t (*register_device)(
|
||||
periph_device_cookie periph_device,
|
||||
scsi_periph_callbacks *callbacks,
|
||||
scsi_device scsi_device,
|
||||
scsi_device_interface *scsi,
|
||||
device_node_handle node,
|
||||
bool removable,
|
||||
scsi_periph_device *driver );
|
||||
status_t (*unregister_device)( scsi_periph_device driver );
|
||||
|
||||
// *** basic command execution ***
|
||||
// exec command, retrying on problems
|
||||
status_t (*safe_exec)(
|
||||
scsi_periph_device periph_device,
|
||||
scsi_ccb *request );
|
||||
// exec simple command
|
||||
status_t (*simple_exec)( scsi_periph_device device,
|
||||
void *cdb, uchar cdb_len, void *data, size_t data_len,
|
||||
int ccb_flags );
|
||||
|
||||
// *** file handling ***
|
||||
// to be called when a new file is opened
|
||||
status_t (*handle_open)( scsi_periph_device device,
|
||||
periph_handle_cookie periph_handle, scsi_periph_handle *res_handle );
|
||||
// to be called when a file is closed
|
||||
status_t (*handle_close)( scsi_periph_handle handle );
|
||||
// to be called when a file is freed
|
||||
status_t (*handle_free)( scsi_periph_handle handle );
|
||||
|
||||
// *** default implementation for block devices ***
|
||||
// block read
|
||||
// preferred_ccb_size - preferred command size; if zero, the shortest is used
|
||||
status_t (*read)( scsi_periph_handle handle, const phys_vecs *vecs,
|
||||
off_t pos, size_t num_blocks, uint32 block_size, size_t *bytes_transferred,
|
||||
int preferred_ccb_size );
|
||||
// block write
|
||||
// (see block_read)
|
||||
status_t (*write)( scsi_periph_handle handle, const phys_vecs *vecs,
|
||||
off_t pos, size_t num_blocks, uint32 block_size, size_t *bytes_transferred,
|
||||
int preferred_ccb_size );
|
||||
// block ioctls
|
||||
status_t (*ioctl)( scsi_periph_handle handle, int op, void *buf, size_t len );
|
||||
// check medium capacity (calls set_capacity callback on success)
|
||||
// request - ccb for this device; is used to talk to device
|
||||
status_t (*check_capacity)( scsi_periph_device device, scsi_ccb *request );
|
||||
|
||||
// *** removable media ***
|
||||
// to be called when a medium change is detected to block subsequent commands
|
||||
void (*media_changed)( scsi_periph_device device );
|
||||
// convert result of *request to err_res
|
||||
err_res (*check_error)( scsi_periph_device device, scsi_ccb *request );
|
||||
// send start or stop command to device
|
||||
// with_LoEj = true - include loading/ejecting,
|
||||
// false - only do allow/deny
|
||||
err_res (*send_start_stop)( scsi_periph_device device, scsi_ccb *request,
|
||||
bool start, bool with_LoEj );
|
||||
// checks media status and waits for device to become ready
|
||||
// returns: B_OK, B_DEV_MEDIA_CHANGE_REQUESTED, B_NO_MEMORY or
|
||||
// pending error reported by handle_get_error
|
||||
status_t (*get_media_status)( scsi_periph_handle handle );
|
||||
|
||||
// compose device name consisting of prefix and path/target/LUN
|
||||
// (result must be freed by caller)
|
||||
char *(*compose_device_name)(device_node_handle device_node, const char *prefix);
|
||||
|
||||
// fill data with icon (for B_GET_ICON ioctl)
|
||||
status_t (*get_icon)( icon_type type, device_icon *data );
|
||||
|
||||
// synchronizes (flush) the device cache
|
||||
err_res(*synchronize_cache)(scsi_periph_device device, scsi_ccb *request);
|
||||
} scsi_periph_interface;
|
||||
|
||||
#define SCSI_PERIPH_MODULE_NAME "generic/scsi_periph/v1"
|
||||
|
||||
#endif
|
||||
@@ -1,31 +0,0 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: bus_managers.h
|
||||
/
|
||||
/ Description: bus manager API
|
||||
/
|
||||
/ Copyright 1998, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _BUS_MANAGER_H
|
||||
#define _BUS_MANAGER_H
|
||||
|
||||
#include <module.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct bus_manager_info bus_manager_info;
|
||||
|
||||
struct bus_manager_info {
|
||||
module_info minfo;
|
||||
status_t (*rescan)();
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _BUS_MANAGER_H */
|
||||
@@ -1,115 +0,0 @@
|
||||
#ifndef _CONFIG_MANAGER_H
|
||||
#define _CONFIG_MANAGER_H
|
||||
|
||||
#include <module.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef enum {
|
||||
B_ISA_BUS,
|
||||
B_PCI_BUS,
|
||||
B_PCMCIA_BUS,
|
||||
B_UNKNOWN_BUS = 0x80
|
||||
} bus_type;
|
||||
|
||||
typedef struct {
|
||||
uchar base;
|
||||
uchar subtype;
|
||||
uchar interface;
|
||||
} device_type;
|
||||
|
||||
typedef struct {
|
||||
uint32 mask;
|
||||
uint32 flags;
|
||||
uint32 cookie;
|
||||
} resource_mask_descriptor;
|
||||
|
||||
typedef struct {
|
||||
uint32 minbase;
|
||||
uint32 maxbase;
|
||||
uint32 basealign;
|
||||
uint32 len;
|
||||
uint32 flags;
|
||||
uint32 cookie;
|
||||
} resource_range_descriptor;
|
||||
|
||||
typedef enum {
|
||||
B_IRQ_RESOURCE,
|
||||
B_DMA_RESOURCE,
|
||||
B_IO_PORT_RESOURCE,
|
||||
B_MEMORY_RESOURCE
|
||||
} resource_type;
|
||||
|
||||
typedef struct {
|
||||
resource_type type;
|
||||
union {
|
||||
resource_mask_descriptor m;
|
||||
resource_range_descriptor r;
|
||||
uint32 for_padding[7];
|
||||
} d;
|
||||
} resource_descriptor;
|
||||
|
||||
struct device_configuration {
|
||||
uint32 flags;
|
||||
uint32 num_resources;
|
||||
resource_descriptor resources[0];
|
||||
};
|
||||
|
||||
struct possible_device_configurations {
|
||||
uint32 flags;
|
||||
uint32 num_possible;
|
||||
struct device_configuration possible[0];
|
||||
};
|
||||
|
||||
struct device_info {
|
||||
uint32 size;
|
||||
uint32 bus_dependent_info_offset;
|
||||
bus_type bus;
|
||||
device_type devtype;
|
||||
uint32 id[4]; /* unique (per-bus) normally-persistent id for device */
|
||||
uint32 flags;
|
||||
status_t config_status;
|
||||
|
||||
/* bus-dependent data goes here... */
|
||||
};
|
||||
|
||||
#define B_DEVICE_INFO_ENABLED 1
|
||||
#define B_DEVICE_INFO_CONFIGURED 2
|
||||
#define B_DEVICE_INFO_CAN_BE_DISABLED 4
|
||||
|
||||
typedef struct config_manager_for_driver_module_info {
|
||||
module_info minfo;
|
||||
|
||||
status_t (*get_next_device_info)(bus_type bus, uint64 *cookie,
|
||||
struct device_info *info, uint32 len);
|
||||
status_t (*get_device_info_for)(uint64 device,
|
||||
struct device_info *info, uint32 len);
|
||||
|
||||
status_t (*get_size_of_current_configuration_for)(uint64 device);
|
||||
status_t (*get_current_configuration_for)(uint64 device,
|
||||
struct device_configuration *config, uint32 len);
|
||||
|
||||
status_t (*get_size_of_possible_configurations_for)(uint64 device);
|
||||
status_t (*get_possible_configurations_for)(uint64 device,
|
||||
struct possible_device_configurations *possible,
|
||||
uint32 len);
|
||||
|
||||
/* helper routines for drivers */
|
||||
status_t (*count_resource_descriptors_of_type)(
|
||||
const struct device_configuration *config,
|
||||
resource_type type);
|
||||
status_t (*get_nth_resource_descriptor_of_type)(
|
||||
const struct device_configuration *config, uint32 n,
|
||||
resource_type type, resource_descriptor *descriptor,
|
||||
uint32 len);
|
||||
} config_manager_for_driver_module_info;
|
||||
|
||||
#define B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME "bus_managers/config_manager/driver/v1"
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _CONFIG_MANAGER_H */
|
||||
@@ -1,197 +0,0 @@
|
||||
/*
|
||||
* Copyright 2004-2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT license.
|
||||
*/
|
||||
#ifndef _DEVICE_MANAGER_H
|
||||
#define _DEVICE_MANAGER_H
|
||||
|
||||
|
||||
#include <TypeConstants.h>
|
||||
#include <Drivers.h>
|
||||
#include <module.h>
|
||||
|
||||
|
||||
// type of I/O resource
|
||||
enum {
|
||||
IO_MEM = 1,
|
||||
IO_PORT = 2,
|
||||
ISA_DMA_CHANNEL = 3
|
||||
};
|
||||
|
||||
|
||||
// I/O resource description
|
||||
typedef struct {
|
||||
uint32 type;
|
||||
// type of I/O resource
|
||||
|
||||
uint32 base;
|
||||
// I/O memory: first physical address (32 bit)
|
||||
// I/O port: first port address (16 bit)
|
||||
// ISA DMA channel: channel number (0-7)
|
||||
|
||||
uint32 length;
|
||||
// I/O memory: size of address range (32 bit)
|
||||
// I/O port: size of port range (16 bit)
|
||||
// ISA DMA channel: must be 1
|
||||
} io_resource;
|
||||
|
||||
// attribute of a device node
|
||||
typedef struct {
|
||||
const char *name;
|
||||
type_code type; // for supported types, see value
|
||||
union {
|
||||
uint8 ui8; // B_UINT8_TYPE
|
||||
uint16 ui16; // B_UINT16_TYPE
|
||||
uint32 ui32; // B_UINT32_TYPE
|
||||
uint64 ui64; // B_UINT64_TYPE
|
||||
const char *string; // B_STRING_TYPE
|
||||
struct { // B_RAW_TYPE
|
||||
void *data;
|
||||
size_t length;
|
||||
} raw;
|
||||
} value;
|
||||
} device_attr;
|
||||
|
||||
|
||||
typedef struct device_node_info *device_node_handle;
|
||||
typedef struct io_resource_info *io_resource_handle;
|
||||
typedef struct device_attr_info *device_attr_handle;
|
||||
|
||||
typedef struct driver_module_info driver_module_info;
|
||||
|
||||
|
||||
// interface of the device manager
|
||||
|
||||
typedef struct device_manager_info {
|
||||
module_info info;
|
||||
|
||||
status_t (*init_driver)(device_node_handle node, void *userCookie,
|
||||
driver_module_info **interface, void **cookie);
|
||||
status_t (*uninit_driver)(device_node_handle node);
|
||||
|
||||
status_t (*rescan)(device_node_handle node);
|
||||
|
||||
status_t (*register_device)(device_node_handle parent,
|
||||
const device_attr *attrs,
|
||||
const io_resource_handle *io_resources,
|
||||
device_node_handle *node);
|
||||
status_t (*unregister_device)(device_node_handle node);
|
||||
|
||||
status_t (*get_next_child_device)(device_node_handle parent,
|
||||
device_node_handle *_node, const device_attr *attrs);
|
||||
device_node_handle (*get_parent)(device_node_handle node);
|
||||
void (*put_device_node)(device_node_handle node);
|
||||
|
||||
status_t (*acquire_io_resources)(io_resource *resources,
|
||||
io_resource_handle *handles);
|
||||
status_t (*release_io_resources)(const io_resource_handle *handles);
|
||||
|
||||
int32 (*create_id)(const char *generator);
|
||||
status_t (*free_id)(const char *generator, uint32 id);
|
||||
|
||||
status_t (*get_attr_uint8)(device_node_handle node,
|
||||
const char *name, uint8 *value, bool recursive);
|
||||
status_t (*get_attr_uint16)(device_node_handle node,
|
||||
const char *name, uint16 *value, bool recursive);
|
||||
status_t (*get_attr_uint32)(device_node_handle node,
|
||||
const char *name, uint32 *value, bool recursive);
|
||||
status_t (*get_attr_uint64)(device_node_handle node,
|
||||
const char *name, uint64 *value, bool recursive);
|
||||
status_t (*get_attr_string)(device_node_handle node,
|
||||
const char *name, char **value, bool recursive);
|
||||
status_t (*get_attr_raw)(device_node_handle node,
|
||||
const char *name, void **data, size_t *_size,
|
||||
bool recursive);
|
||||
|
||||
status_t (*get_next_attr)(device_node_handle node,
|
||||
device_attr_handle *attrHandle);
|
||||
status_t (*release_attr)(device_node_handle node,
|
||||
device_attr_handle attr_handle);
|
||||
status_t (*retrieve_attr)(device_attr_handle attr_handle,
|
||||
const device_attr **attr);
|
||||
status_t (*write_attr)(device_node_handle node,
|
||||
const device_attr *attr);
|
||||
status_t (*remove_attr)(device_node_handle node, const char *name);
|
||||
} device_manager_info;
|
||||
|
||||
|
||||
#define B_DEVICE_MANAGER_MODULE_NAME "system/device_manager/v1"
|
||||
|
||||
|
||||
// interface of device driver
|
||||
|
||||
struct driver_module_info {
|
||||
module_info info;
|
||||
|
||||
float (*supports_device)(device_node_handle parent, bool *_noConnection);
|
||||
status_t (*register_device)(device_node_handle parent);
|
||||
|
||||
status_t (*init_driver)(device_node_handle node, void *user_cookie, void **_cookie);
|
||||
status_t (*uninit_driver)(void *cookie);
|
||||
|
||||
void (*device_removed)(device_node_handle node, void *cookie);
|
||||
void (*device_cleanup)(device_node_handle node);
|
||||
|
||||
void (*get_supported_paths)(const char ***_busses, const char ***_devices);
|
||||
};
|
||||
|
||||
|
||||
// standard device node attributes
|
||||
|
||||
#define PNP_MANAGER_ID_GENERATOR "id_generator"
|
||||
// if you are using an id generator (see create_id), you can let the
|
||||
// manager automatically free the id when the node is deleted by setting
|
||||
// the following attributes:
|
||||
// name of generator (string)
|
||||
#define PNP_MANAGER_AUTO_ID "auto_id"
|
||||
// generated id (uint32)
|
||||
|
||||
#define B_DRIVER_MODULE "driver/module"
|
||||
#define B_DRIVER_PRETTY_NAME "driver/pretty name"
|
||||
#define B_DRIVER_FIXED_CHILD "driver/fixed child"
|
||||
#define B_DRIVER_MAPPING "driver/mapping"
|
||||
#define B_DRIVER_BUS "driver/bus"
|
||||
#define B_DRIVER_FIND_DEVICES_ON_DEMAND "driver/on demand"
|
||||
#define B_DRIVER_EXPLORE_LAST "driver/explore last"
|
||||
|
||||
#define B_DRIVER_UNIQUE_DEVICE_ID "unique id"
|
||||
#define B_DRIVER_DEVICE_TYPE "device type"
|
||||
|
||||
#define B_AUDIO_DRIVER_TYPE "audio"
|
||||
#define B_BUS_DRIVER_TYPE "bus"
|
||||
#define B_DISK_DRIVER_TYPE "disk"
|
||||
#define B_GRAPHICS_DRIVER_TYPE "graphics"
|
||||
#define B_INPUT_DRIVER_TYPE "input"
|
||||
#define B_MISC_DRIVER_TYPE "misc"
|
||||
#define B_NETWORK_DRIVER_TYPE "net"
|
||||
#define B_VIDEO_DRIVER_TYPE "video"
|
||||
|
||||
#define PNP_DRIVER_CONNECTION "connection"
|
||||
// connection of parent the device is attached to (optional, string)
|
||||
// there can be only one device per connection
|
||||
|
||||
|
||||
// interface of a bus device driver
|
||||
|
||||
typedef struct bus_module_info {
|
||||
driver_module_info info;
|
||||
|
||||
// scan the bus and register all devices.
|
||||
status_t (*register_child_devices)(void *cookie);
|
||||
|
||||
// user initiated rescan of the bus - only propagate changes
|
||||
// you only need to implement this, if you cannot detect device changes yourself
|
||||
// driver is always loaded during this call, but other hooks may
|
||||
// be called concurrently
|
||||
status_t (*rescan_bus)(void *cookie);
|
||||
} bus_module_info;
|
||||
|
||||
|
||||
// standard attributes
|
||||
|
||||
// PnP bus identification (required, uint8)
|
||||
// define this to let the PnP manager know that this is a PnP bus
|
||||
// the actual content is ignored
|
||||
#define PNP_BUS_IS_BUS "bus/is_bus"
|
||||
|
||||
#endif /* _DEVICE_MANAGER_H */
|
||||
@@ -1,126 +0,0 @@
|
||||
// disk_device_manager.h
|
||||
//
|
||||
// C API exported by the disk device manager.
|
||||
// Currently only functions of interest for partition modules/FS add-ons
|
||||
// are considered.
|
||||
|
||||
#ifndef _DISK_DEVICE_MANAGER_H
|
||||
#define _DISK_DEVICE_MANAGER_H
|
||||
|
||||
#include <Drivers.h>
|
||||
|
||||
#include <storage/DiskDeviceDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// C API partition representation
|
||||
// Fields marked [sys] are set by the system and are not to be changed by
|
||||
// the disk system modules.
|
||||
typedef struct partition_data {
|
||||
partition_id id; // [sys]
|
||||
off_t offset;
|
||||
off_t size;
|
||||
off_t content_size;
|
||||
uint32 block_size;
|
||||
int32 child_count;
|
||||
int32 index; // [sys]
|
||||
uint32 status;
|
||||
uint32 flags;
|
||||
dev_t volume; // [sys]
|
||||
void *mount_cookie; // [sys]
|
||||
char *name; // max: B_OS_NAME_LENGTH
|
||||
char *content_name; //
|
||||
char *type; //
|
||||
const char *content_type; // [sys]
|
||||
char *parameters;
|
||||
char *content_parameters;
|
||||
void *cookie;
|
||||
void *content_cookie;
|
||||
} partition_data;
|
||||
|
||||
// C API disk device representation
|
||||
typedef struct disk_device_data {
|
||||
partition_id id; // equal to that of the root partition
|
||||
uint32 flags;
|
||||
char *path;
|
||||
device_geometry geometry;
|
||||
} disk_device_data;
|
||||
|
||||
// C API partitionable space representation
|
||||
typedef struct partitionable_space_data {
|
||||
off_t offset;
|
||||
off_t size;
|
||||
} partitionable_space_data;
|
||||
|
||||
// operations on partitions
|
||||
enum {
|
||||
B_PARTITION_DEFRAGMENT,
|
||||
B_PARTITION_REPAIR,
|
||||
B_PARTITION_RESIZE,
|
||||
B_PARTITION_RESIZE_CHILD,
|
||||
B_PARTITION_MOVE,
|
||||
B_PARTITION_MOVE_CHILD,
|
||||
B_PARTITION_SET_NAME,
|
||||
B_PARTITION_SET_CONTENT_NAME,
|
||||
B_PARTITION_SET_TYPE,
|
||||
B_PARTITION_SET_PARAMETERS,
|
||||
B_PARTITION_SET_CONTENT_PARAMETERS,
|
||||
B_PARTITION_INITIALIZE,
|
||||
B_PARTITION_CREATE_CHILD,
|
||||
B_PARTITION_DELETE_CHILD,
|
||||
};
|
||||
|
||||
// disk device job cancel status
|
||||
enum {
|
||||
B_DISK_DEVICE_JOB_CONTINUE,
|
||||
B_DISK_DEVICE_JOB_CANCEL,
|
||||
B_DISK_DEVICE_JOB_REVERSE,
|
||||
};
|
||||
|
||||
// disk device locking
|
||||
disk_device_data *write_lock_disk_device(partition_id partitionID);
|
||||
void write_unlock_disk_device(partition_id partitionID);
|
||||
disk_device_data *read_lock_disk_device(partition_id partitionID);
|
||||
void read_unlock_disk_device(partition_id partitionID);
|
||||
// parameter is the ID of any partition on the device
|
||||
|
||||
// getting disk devices/partitions by path
|
||||
// (no locking required)
|
||||
int32 find_disk_device(const char *path);
|
||||
int32 find_partition(const char *path);
|
||||
|
||||
// disk device/partition read access
|
||||
// (read lock required)
|
||||
disk_device_data *get_disk_device(partition_id partitionID);
|
||||
partition_data *get_partition(partition_id partitionID);
|
||||
partition_data *get_parent_partition(partition_id partitionID);
|
||||
partition_data *get_child_partition(partition_id partitionID, int32 index);
|
||||
|
||||
// partition write access
|
||||
// (write lock required)
|
||||
partition_data *create_child_partition(partition_id partitionID, int32 index,
|
||||
partition_id childID);
|
||||
// childID is an optional input parameter -- -1 to be ignored
|
||||
bool delete_partition(partition_id partitionID);
|
||||
void partition_modified(partition_id partitionID);
|
||||
// tells the disk device manager, that the parition has been modified
|
||||
|
||||
// disk systems
|
||||
disk_system_id find_disk_system(const char *name);
|
||||
|
||||
// jobs
|
||||
bool update_disk_device_job_progress(disk_job_id jobID, float progress);
|
||||
bool update_disk_device_job_extra_progress(disk_job_id jobID,
|
||||
const char *info);
|
||||
bool set_disk_device_job_error_message(disk_job_id jobID, const char *message);
|
||||
uint32 update_disk_device_job_interrupt_properties(disk_job_id jobID,
|
||||
uint32 interruptProperties);
|
||||
// returns one of B_DISK_DEVICE_JOB_{CONTINUE,CANCEL,REVERSE}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _DISK_DEVICE_MANAGER_H
|
||||
@@ -1,80 +0,0 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Fast logging facilities.
|
||||
|
||||
This logging is much faster then dprintf and is saver
|
||||
against buffer overflow conditions.
|
||||
|
||||
Clients have to define events by creating an array of
|
||||
fast_log_type entries, each consisting of a code and the
|
||||
associated human-readable description. During logging,
|
||||
only the code is stored to save space and time. Also,
|
||||
all arguments are stored binary (currently, they must
|
||||
be of type uint32). Conversion to human-readable text is
|
||||
post-poned until the logging data is read or a client
|
||||
connection is closed (as this invalidates the event-
|
||||
description binding).
|
||||
|
||||
The reader interface is /dev/FAST_LOG_DEVFS_NAME. This
|
||||
device can only be read from (no seeking or further
|
||||
functionality) and does not block if there is no data.
|
||||
This is because if you want to store the log into a
|
||||
file, the file access may lead to further logging data,
|
||||
so doing a sleep between reads saves logging entries.
|
||||
*/
|
||||
|
||||
#ifndef FAST_LOG_H
|
||||
#define FAST_LOG_H
|
||||
|
||||
#include <module.h>
|
||||
|
||||
// one event type as defined by client
|
||||
typedef struct fast_log_event_type {
|
||||
// code of event (zero means end-of-list)
|
||||
int16 event;
|
||||
// human-readable description
|
||||
const char *description;
|
||||
} fast_log_event_type;
|
||||
|
||||
|
||||
// handle of client connection
|
||||
typedef struct fast_log_connection *fast_log_handle;
|
||||
|
||||
|
||||
// client interface
|
||||
typedef struct fast_log_info {
|
||||
module_info minfo;
|
||||
|
||||
// open client connection
|
||||
// prefix - prefix to print in log before each event
|
||||
// types - array of event types; last entry must have event=0
|
||||
fast_log_handle (*start_log)(const char *prefix, fast_log_event_type types[]);
|
||||
// close client connection
|
||||
void (*stop_log)(fast_log_handle handle);
|
||||
|
||||
// log an entry without arguments
|
||||
void (*log_0)(fast_log_handle handle, int event);
|
||||
// log an entry with one argument
|
||||
void (*log_1)(fast_log_handle handle, int event, uint32 param1);
|
||||
// log an entry with two arguments
|
||||
void (*log_2)(fast_log_handle handle, int event, uint32 param1, uint32 param2);
|
||||
// log an entry with three arguments
|
||||
void (*log_3)(fast_log_handle handle, int event, uint32 param1, uint32 param2, uint32 param3);
|
||||
// log an entry with four arguments
|
||||
void (*log_4)(fast_log_handle handle, int event, uint32 param1, uint32 param2, uint32 param3, uint32 param4);
|
||||
|
||||
// log an entry with n arguments
|
||||
// don't cheat on num_params!
|
||||
void (*log_n)(fast_log_handle handle, int event, int num_params, ...);
|
||||
} fast_log_info;
|
||||
|
||||
// name of client interface module
|
||||
#define FAST_LOG_MODULE_NAME "generic/fast_log/v1"
|
||||
// name of device to read logging data from
|
||||
#define FAST_LOG_DEVFS_NAME "fast_log"
|
||||
|
||||
#endif
|
||||
@@ -1,63 +0,0 @@
|
||||
/* File System File and Block Caches
|
||||
*
|
||||
* Copyright 2004-2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _FS_CACHE_H
|
||||
#define _FS_CACHE_H
|
||||
|
||||
|
||||
#include <fs_interface.h>
|
||||
|
||||
|
||||
typedef void (*transaction_notification_hook)(int32 id, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* transactions */
|
||||
extern int32 cache_start_transaction(void *_cache);
|
||||
extern status_t cache_sync_transaction(void *_cache, int32 id);
|
||||
extern status_t cache_end_transaction(void *_cache, int32 id, transaction_notification_hook hook, void *data);
|
||||
extern status_t cache_abort_transaction(void *_cache, int32 id);
|
||||
extern int32 cache_detach_sub_transaction(void *_cache, int32 id);
|
||||
extern status_t cache_abort_sub_transaction(void *_cache, int32 id);
|
||||
extern status_t cache_start_sub_transaction(void *_cache, int32 id);
|
||||
extern status_t cache_next_block_in_transaction(void *_cache, int32 id, uint32 *_cookie,
|
||||
off_t *_blockNumber, void **_data, void **_unchangedData);
|
||||
|
||||
/* block cache */
|
||||
extern void block_cache_delete(void *_cache, bool allowWrites);
|
||||
extern void *block_cache_create(int fd, off_t numBlocks, size_t blockSize);
|
||||
extern status_t block_cache_sync(void *_cache);
|
||||
|
||||
extern status_t block_cache_make_writable(void *_cache, off_t blockNumber, int32 transaction);
|
||||
extern void *block_cache_get_writable_etc(void *_cache, off_t blockNumber, off_t base,
|
||||
off_t length, int32 transaction);
|
||||
extern void *block_cache_get_writable(void *_cache, off_t blockNumber, int32 transaction);
|
||||
extern void *block_cache_get_empty(void *_cache, off_t blockNumber, int32 transaction);
|
||||
extern const void *block_cache_get_etc(void *_cache, off_t blockNumber, off_t base, off_t length);
|
||||
extern const void *block_cache_get(void *_cache, off_t blockNumber);
|
||||
extern status_t block_cache_set_dirty(void *_cache, off_t blockNumber, bool isDirty, int32 transaction);
|
||||
extern void block_cache_put(void *_cache, off_t blockNumber);
|
||||
|
||||
/* file cache */
|
||||
extern void *file_cache_create(mount_id mountID, vnode_id vnodeID, off_t size, int fd);
|
||||
extern void file_cache_delete(void *_cacheRef);
|
||||
extern status_t file_cache_set_size(void *_cacheRef, off_t size);
|
||||
extern status_t file_cache_sync(void *_cache);
|
||||
extern status_t file_cache_invalidate_file_map(void *_cacheRef, off_t offset, off_t size);
|
||||
|
||||
extern status_t file_cache_read_pages(void *_cacheRef, off_t offset,
|
||||
const iovec *vecs, size_t count, size_t *_numBytes);
|
||||
extern status_t file_cache_write_pages(void *_cacheRef, off_t offset,
|
||||
const iovec *vecs, size_t count, size_t *_numBytes);
|
||||
extern status_t file_cache_read(void *_cacheRef, off_t offset, void *bufferBase, size_t *_size);
|
||||
extern status_t file_cache_write(void *_cacheRef, off_t offset, const void *buffer, size_t *_size);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FS_CACHE_H */
|
||||
@@ -1,258 +0,0 @@
|
||||
/* File System Interface Layer Definition
|
||||
*
|
||||
* Copyright 2004-2005, Haiku Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _FS_INTERFACE_H
|
||||
#define _FS_INTERFACE_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <Select.h>
|
||||
#include <module.h>
|
||||
#include <disk_device_manager.h>
|
||||
|
||||
#include <sys/uio.h>
|
||||
|
||||
|
||||
struct dirent;
|
||||
struct stat;
|
||||
struct fs_info;
|
||||
struct select_sync;
|
||||
|
||||
typedef dev_t mount_id;
|
||||
typedef ino_t vnode_id;
|
||||
|
||||
/* the file system's private data structures */
|
||||
typedef void *fs_volume;
|
||||
typedef void *fs_cookie;
|
||||
typedef void *fs_vnode;
|
||||
|
||||
/* passed to write_stat() */
|
||||
enum write_stat_mask {
|
||||
FS_WRITE_STAT_MODE = 0x0001,
|
||||
FS_WRITE_STAT_UID = 0x0002,
|
||||
FS_WRITE_STAT_GID = 0x0004,
|
||||
FS_WRITE_STAT_SIZE = 0x0008,
|
||||
FS_WRITE_STAT_ATIME = 0x0010,
|
||||
FS_WRITE_STAT_MTIME = 0x0020,
|
||||
FS_WRITE_STAT_CRTIME = 0x0040
|
||||
// NOTE: Changing these constants will break
|
||||
// src/kits/storage/LibBeAdapter.cpp:_kern_write_stat().
|
||||
};
|
||||
|
||||
/* passed to write_fs_info() */
|
||||
#define FS_WRITE_FSINFO_NAME 0x0001
|
||||
|
||||
struct file_io_vec {
|
||||
off_t offset;
|
||||
off_t length;
|
||||
};
|
||||
|
||||
#define B_CURRENT_FS_API_VERSION "/v1"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct file_system_module_info {
|
||||
struct module_info info;
|
||||
const char *pretty_name;
|
||||
|
||||
/* scanning (the device is write locked) */
|
||||
float (*identify_partition)(int fd, partition_data *partition,
|
||||
void **cookie);
|
||||
status_t (*scan_partition)(int fd, partition_data *partition,
|
||||
void *cookie);
|
||||
void (*free_identify_partition_cookie)(partition_data *partition,
|
||||
void *cookie);
|
||||
void (*free_partition_content_cookie)(partition_data *partition);
|
||||
|
||||
/* general operations */
|
||||
status_t (*mount)(mount_id id, const char *device, uint32 flags,
|
||||
const char *args, fs_volume *_fs, vnode_id *_rootVnodeID);
|
||||
status_t (*unmount)(fs_volume fs);
|
||||
|
||||
status_t (*read_fs_info)(fs_volume fs, struct fs_info *info);
|
||||
status_t (*write_fs_info)(fs_volume fs, const struct fs_info *info, uint32 mask);
|
||||
status_t (*sync)(fs_volume fs);
|
||||
|
||||
/* vnode operations */
|
||||
status_t (*lookup)(fs_volume fs, fs_vnode dir, const char *name, vnode_id *_id, int *_type);
|
||||
status_t (*get_vnode_name)(fs_volume fs, fs_vnode vnode, char *buffer, size_t bufferSize);
|
||||
|
||||
status_t (*get_vnode)(fs_volume fs, vnode_id id, fs_vnode *_vnode, bool reenter);
|
||||
status_t (*put_vnode)(fs_volume fs, fs_vnode vnode, bool reenter);
|
||||
status_t (*remove_vnode)(fs_volume fs, fs_vnode vnode, bool reenter);
|
||||
|
||||
/* VM file access */
|
||||
bool (*can_page)(fs_volume fs, fs_vnode vnode, fs_cookie cookie);
|
||||
status_t (*read_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes);
|
||||
status_t (*write_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes);
|
||||
|
||||
/* cache file access */
|
||||
status_t (*get_file_map)(fs_volume fs, fs_vnode vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count);
|
||||
|
||||
/* common operations */
|
||||
status_t (*ioctl)(fs_volume fs, fs_vnode v, fs_cookie cookie, ulong op, void *buffer, size_t length);
|
||||
status_t (*set_flags)(fs_volume fs, fs_vnode v, fs_cookie cookie, int flags);
|
||||
status_t (*select)(fs_volume fs, fs_vnode v, fs_cookie cookie, uint8 event,
|
||||
uint32 ref, selectsync *sync);
|
||||
status_t (*deselect)(fs_volume fs, fs_vnode v, fs_cookie cookie,
|
||||
uint8 event, selectsync *sync);
|
||||
status_t (*fsync)(fs_volume fs, fs_vnode v);
|
||||
|
||||
status_t (*read_link)(fs_volume fs, fs_vnode link, char *buffer, size_t *_bufferSize);
|
||||
status_t (*write_link)(fs_volume fs, fs_vnode link, char *toPath);
|
||||
status_t (*create_symlink)(fs_volume fs, fs_vnode dir, const char *name, const char *path, int mode);
|
||||
|
||||
status_t (*link)(fs_volume fs, fs_vnode dir, const char *name, fs_vnode vnode);
|
||||
status_t (*unlink)(fs_volume fs, fs_vnode dir, const char *name);
|
||||
status_t (*rename)(fs_volume fs, fs_vnode fromDir, const char *fromName, fs_vnode toDir, const char *toName);
|
||||
|
||||
status_t (*access)(fs_volume fs, fs_vnode vnode, int mode);
|
||||
status_t (*read_stat)(fs_volume fs, fs_vnode vnode, struct stat *stat);
|
||||
status_t (*write_stat)(fs_volume fs, fs_vnode vnode, const struct stat *stat, uint32 statMask);
|
||||
|
||||
/* file operations */
|
||||
status_t (*create)(fs_volume fs, fs_vnode dir, const char *name, int openMode, int perms, fs_cookie *_cookie, vnode_id *_newVnodeID);
|
||||
status_t (*open)(fs_volume fs, fs_vnode v, int openMode, fs_cookie *_cookie);
|
||||
status_t (*close)(fs_volume fs, fs_vnode v, fs_cookie cookie);
|
||||
status_t (*free_cookie)(fs_volume fs, fs_vnode v, fs_cookie cookie);
|
||||
status_t (*read)(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, void *buffer, size_t *length);
|
||||
status_t (*write)(fs_volume fs, fs_vnode v, fs_cookie cookie, off_t pos, const void *buffer, size_t *length);
|
||||
|
||||
/* directory operations */
|
||||
status_t (*create_dir)(fs_volume fs, fs_vnode parent, const char *name, int perms, vnode_id *_newVnodeID);
|
||||
status_t (*remove_dir)(fs_volume fs, fs_vnode parent, const char *name);
|
||||
status_t (*open_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie);
|
||||
status_t (*close_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie);
|
||||
status_t (*free_dir_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie);
|
||||
status_t (*read_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num);
|
||||
status_t (*rewind_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie);
|
||||
|
||||
/* attribute directory operations */
|
||||
status_t (*open_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie);
|
||||
status_t (*close_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie);
|
||||
status_t (*free_attr_dir_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie);
|
||||
status_t (*read_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num);
|
||||
status_t (*rewind_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie);
|
||||
|
||||
/* attribute operations */
|
||||
status_t (*create_attr)(fs_volume fs, fs_vnode file, const char *name, uint32 type, int openMode, fs_cookie *_cookie);
|
||||
status_t (*open_attr)(fs_volume fs, fs_vnode file, const char *name, int openMode, fs_cookie *_cookie);
|
||||
status_t (*close_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie);
|
||||
status_t (*free_attr_cookie)(fs_volume fs, fs_vnode file, fs_cookie cookie);
|
||||
status_t (*read_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie, off_t pos, void *buffer, size_t *length);
|
||||
status_t (*write_attr)(fs_volume fs, fs_vnode file, fs_cookie cookie, off_t pos, const void *buffer, size_t *length);
|
||||
|
||||
status_t (*read_attr_stat)(fs_volume fs, fs_vnode file, fs_cookie cookie, struct stat *stat);
|
||||
status_t (*write_attr_stat)(fs_volume fs, fs_vnode file, fs_cookie cookie, const struct stat *stat, int statMask);
|
||||
status_t (*rename_attr)(fs_volume fs, fs_vnode fromFile, const char *fromName, fs_vnode toFile, const char *toName);
|
||||
status_t (*remove_attr)(fs_volume fs, fs_vnode file, const char *name);
|
||||
|
||||
/* index directory & index operations */
|
||||
status_t (*open_index_dir)(fs_volume fs, fs_cookie *cookie);
|
||||
status_t (*close_index_dir)(fs_volume fs, fs_cookie cookie);
|
||||
status_t (*free_index_dir_cookie)(fs_volume fs, fs_cookie cookie);
|
||||
status_t (*read_index_dir)(fs_volume fs, fs_cookie cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num);
|
||||
status_t (*rewind_index_dir)(fs_volume fs, fs_cookie cookie);
|
||||
|
||||
status_t (*create_index)(fs_volume fs, const char *name, uint32 type, uint32 flags);
|
||||
status_t (*remove_index)(fs_volume fs, const char *name);
|
||||
status_t (*read_index_stat)(fs_volume fs, const char *name, struct stat *stat);
|
||||
|
||||
/* query operations */
|
||||
status_t (*open_query)(fs_volume fs, const char *query, uint32 flags, port_id port, uint32 token, fs_cookie *_cookie);
|
||||
status_t (*close_query)(fs_volume fs, fs_cookie cookie);
|
||||
status_t (*free_query_cookie)(fs_volume fs, fs_cookie cookie);
|
||||
status_t (*read_query)(fs_volume fs, fs_cookie cookie,
|
||||
struct dirent *buffer, size_t bufferSize, uint32 *_num);
|
||||
status_t (*rewind_query)(fs_volume fs, fs_cookie cookie);
|
||||
|
||||
/* capability querying (the device is read locked) */
|
||||
// ToDo: this will probably be combined to a single call
|
||||
bool (*supports_defragmenting)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_repairing)(partition_data *partition,
|
||||
bool checkOnly, bool *whileMounted);
|
||||
bool (*supports_resizing)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_moving)(partition_data *partition, bool *isNoOp);
|
||||
bool (*supports_setting_content_name)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_setting_content_parameters)(partition_data *partition,
|
||||
bool *whileMounted);
|
||||
bool (*supports_initializing)(partition_data *partition);
|
||||
|
||||
bool (*validate_resize)(partition_data *partition, off_t *size);
|
||||
bool (*validate_move)(partition_data *partition, off_t *start);
|
||||
bool (*validate_set_content_name)(partition_data *partition,
|
||||
char *name);
|
||||
bool (*validate_set_content_parameters)(partition_data *partition,
|
||||
const char *parameters);
|
||||
bool (*validate_initialize)(partition_data *partition, char *name,
|
||||
const char *parameters);
|
||||
|
||||
/* shadow partition modification (device is write locked) */
|
||||
status_t (*shadow_changed)(partition_data *partition,
|
||||
uint32 operation);
|
||||
|
||||
/* writing (the device is NOT locked) */
|
||||
status_t (*defragment)(int fd, partition_id partition,
|
||||
disk_job_id job);
|
||||
status_t (*repair)(int fd, partition_id partition, bool checkOnly,
|
||||
disk_job_id job);
|
||||
status_t (*resize)(int fd, partition_id partition, off_t size,
|
||||
disk_job_id job);
|
||||
status_t (*move)(int fd, partition_id partition, off_t offset,
|
||||
disk_job_id job);
|
||||
status_t (*set_content_name)(int fd, partition_id partition,
|
||||
const char *name, disk_job_id job);
|
||||
status_t (*set_content_parameters)(int fd, partition_id partition,
|
||||
const char *parameters, disk_job_id job);
|
||||
status_t (*initialize)(const char *partition, const char *name,
|
||||
const char *parameters, disk_job_id job);
|
||||
// This is pretty close to how the hook in R5 looked. Save the job ID, of
|
||||
// course and that the parameters were given as (void*, size_t) pair.
|
||||
} file_system_module_info;
|
||||
|
||||
|
||||
/* file system add-ons only prototypes */
|
||||
extern status_t new_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode);
|
||||
extern status_t publish_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode privateNode);
|
||||
extern status_t get_vnode(mount_id mountID, vnode_id vnodeID, fs_vnode *_privateNode);
|
||||
extern status_t put_vnode(mount_id mountID, vnode_id vnodeID);
|
||||
extern status_t remove_vnode(mount_id mountID, vnode_id vnodeID);
|
||||
extern status_t unremove_vnode(mount_id mountID, vnode_id vnodeID);
|
||||
|
||||
extern status_t notify_listener(int op, mount_id device, vnode_id parentNode,
|
||||
vnode_id toParentNode, vnode_id node, const char *name);
|
||||
extern status_t send_notification(port_id port, long token, ulong what, long op,
|
||||
mount_id device, mount_id toDevice, vnode_id parentNode,
|
||||
vnode_id toParentNode, vnode_id node, const char *name);
|
||||
|
||||
extern status_t notify_entry_created(mount_id device, vnode_id directory,
|
||||
const char *name, vnode_id node);
|
||||
extern status_t notify_entry_removed(mount_id device, vnode_id directory,
|
||||
const char *name, vnode_id node);
|
||||
extern status_t notify_entry_moved(mount_id device, vnode_id fromDirectory,
|
||||
const char *fromName, vnode_id toDirectory,
|
||||
const char *toName, vnode_id node);
|
||||
extern status_t notify_stat_changed(mount_id device, vnode_id node,
|
||||
uint32 statFields);
|
||||
extern status_t notify_attribute_changed(mount_id device, vnode_id node,
|
||||
const char *attribute, int32 cause);
|
||||
|
||||
extern status_t notify_query_entry_created(port_id port, int32 token,
|
||||
mount_id device, vnode_id directory, const char *name,
|
||||
vnode_id node);
|
||||
extern status_t notify_query_entry_removed(port_id port, int32 token,
|
||||
mount_id device, vnode_id directory, const char *name,
|
||||
vnode_id node);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FS_INTERFACE_H */
|
||||
@@ -1,68 +0,0 @@
|
||||
#ifndef _ISA_CONFIG_H
|
||||
#define _ISA_CONFIG_H
|
||||
|
||||
#include <config_manager.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
uint32 id;
|
||||
uchar b[4];
|
||||
} EISA_PRODUCT_ID;
|
||||
|
||||
/* uint32 MAKE_EISA_PRODUCT_ID(EISA_PRODUCT_ID* ptr, char ch0, char ch1, char ch2, uint12 prod_num, uint4 rev) */
|
||||
/* example: MAKE_EISA_PRODUCT_ID(&foo_id, 'F','O','O', 0xdb1, 3); */
|
||||
/* makes correct little-endian format */
|
||||
#define MAKE_EISA_PRODUCT_ID(ptr, ch0, ch1, ch2, prod_num, rev) \
|
||||
do { \
|
||||
(ptr)->b[0] = (uint8)(((((ch0) - 'A' + 1) & 0x1f) << 2) | ((((ch1) - 'A' + 1) & 0x18) >> 3)); \
|
||||
(ptr)->b[1] = (uint8)(((((ch1) - 'A' + 1) & 0x07) << 5) | ((((ch2) - 'A' + 1) & 0x1f) )); \
|
||||
(ptr)->b[2] = (uint8)((((prod_num) & 0xff0) >> 4)); \
|
||||
(ptr)->b[3] = (uint8)((((prod_num) & 0x00f) << 4) | ((rev) & 0xf) ); \
|
||||
} while(0)
|
||||
|
||||
/* Compare IDs without revision */
|
||||
/* bool EQUAL_EISA_PRODUCT_ID(EISA_PRODUCT_ID id1, EISA_PRODUCT_ID id2); */
|
||||
#define EQUAL_EISA_PRODUCT_ID(id1, id2) \
|
||||
(((id1).b[0] == (id2).b[0]) && ((id1).b[1] == (id2).b[1]) && ((id1).b[2] == (id2).b[2]) && (((id1).b[3] & 0xf0) == ((id2).b[3] & 0xf0)))
|
||||
|
||||
#define B_MAX_COMPATIBLE_IDS 8
|
||||
|
||||
/* This structure is deprecated and will be going away in the next release */
|
||||
struct isa_device_info {
|
||||
struct device_info info;
|
||||
|
||||
uchar csn;
|
||||
uchar ldn;
|
||||
uint32 vendor_id;
|
||||
uint32 card_id; /* a.k.a. serial number */
|
||||
uint32 logical_device_id;
|
||||
uint32 num_compatible_ids;
|
||||
uint32 compatible_ids[B_MAX_COMPATIBLE_IDS];
|
||||
char card_name[B_OS_NAME_LENGTH];
|
||||
char logical_device_name[B_OS_NAME_LENGTH];
|
||||
};
|
||||
|
||||
/* So use this instead */
|
||||
struct isa_info {
|
||||
uchar csn;
|
||||
uchar ldn;
|
||||
uint32 vendor_id;
|
||||
uint32 card_id; /* a.k.a. serial number */
|
||||
uint32 logical_device_id;
|
||||
uint32 num_compatible_ids;
|
||||
uint32 compatible_ids[B_MAX_COMPATIBLE_IDS];
|
||||
char card_name[B_OS_NAME_LENGTH];
|
||||
char logical_device_name[B_OS_NAME_LENGTH];
|
||||
};
|
||||
|
||||
/* for the mem_descriptor cookie */
|
||||
#define B_ISA_MEMORY_32_BIT 0x100
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,68 +0,0 @@
|
||||
/*
|
||||
** Copyright 2002, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
#ifndef LENDIAN_BITFIELD_H
|
||||
#define LENDIAN_BITFIELD_H
|
||||
|
||||
#include <ByteOrder.h>
|
||||
#define B_HOST_IS_LENDIAN 1
|
||||
|
||||
#if B_HOST_IS_BENDIAN
|
||||
|
||||
#define LBITFIELD8_2(b1,b2) uint8 b2,b1
|
||||
#define LBITFIELD8_3(b1,b2,b3) uint8 b3,b2,b1
|
||||
#define LBITFIELD8_4(b1,b2,b3,b4) uint8 b4,b3,b2,b1
|
||||
#define LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b5,b4,b3,b2,b1
|
||||
#define LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b8,b7,b6,b5,b4,b3,b2,b1
|
||||
|
||||
|
||||
#define LBITFIELD2(b1,b2) uint16 b2,b1
|
||||
#define LBITFIELD3(b1,b2,b3) uint16 b3,b2,b1
|
||||
#define LBITFIELD4(b1,b2,b3,b4) uint16 b4,b3,b2,b1
|
||||
#define LBITFIELD5(b1,b2,b3,b4,b5) uint16 b5,b4,b3,b2,b1
|
||||
#define LBITFIELD6(b1,b2,b3,b4,b5,b6) uint16 b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD7(b1,b2,b3,b4,b5,b6,b7) uint16 b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b16,b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#elif B_HOST_IS_LENDIAN
|
||||
|
||||
#define LBITFIELD8_2(b1,b2) uint8 b1,b2
|
||||
#define LBITFIELD8_3(b1,b2,b3) uint8 b1,b2,b3
|
||||
#define LBITFIELD8_4(b1,b2,b3,b4) uint8 b1,b2,b3,b4
|
||||
#define LBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b1,b2,b3,b4,b5
|
||||
#define LBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b1,b2,b3,b4,b5,b6
|
||||
#define LBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b1,b2,b3,b4,b5,b6,b7
|
||||
#define LBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b1,b2,b3,b4,b5,b6,b7,b8
|
||||
|
||||
#define LBITFIELD2(b1,b2) uint16 b1,b2
|
||||
#define LBITFIELD3(b1,b2,b3) uint16 b1,b2,b3
|
||||
#define LBITFIELD4(b1,b2,b3,b4) uint16 b1,b2,b3,b4
|
||||
#define LBITFIELD5(b1,b2,b3,b4,b5) uint16 b1,b2,b3,b4,b5
|
||||
#define LBITFIELD6(b1,b2,b3,b4,b5,b6) uint16 b1,b2,b3,b4,b5,b6
|
||||
#define LBITFIELD7(b1,b2,b3,b4,b5,b6,b7) uint16 b1,b2,b3,b4,b5,b6,b7
|
||||
#define LBITFIELD8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b1,b2,b3,b4,b5,b6,b7,b8
|
||||
#define LBITFIELD9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9
|
||||
#define LBITFIELD10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10
|
||||
#define LBITFIELD11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11
|
||||
#define LBITFIELD12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
|
||||
#define LBITFIELD13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
|
||||
#define LBITFIELD14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14
|
||||
#define LBITFIELD15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15
|
||||
#define LBITFIELD16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16
|
||||
|
||||
#else
|
||||
#error "Unknown host endianness"
|
||||
#endif
|
||||
|
||||
#endif /* LENDIAN_BITFIELD_H */
|
||||
@@ -1,70 +0,0 @@
|
||||
/*
|
||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
/*
|
||||
Paging-safe allocation of locked memory.
|
||||
|
||||
Library for managing temporary, locked memory with the condition of
|
||||
not calling any function during allocation that can lead to paging.
|
||||
Such memory is needed by drivers that are used to access the page file
|
||||
but still need locked memory to execute requests.
|
||||
|
||||
Basically, a background thread manages a memory pool where blocks
|
||||
are allocated from. If the pool is empty, allocation is delayed until
|
||||
either a blocks is freed or the pool is enlarged by the background
|
||||
thread.
|
||||
|
||||
All memory blocks must have same size and can be pre-initialized when
|
||||
added to memory pool (and cleaned-up when removed from pool). The
|
||||
free list is stored within free memory blocks, so you have to specify
|
||||
a block offset where the manager can store the list pointers without
|
||||
interfering with pre-initialization.
|
||||
|
||||
You can also specify an alignment, e.g. if the blocks are used for
|
||||
DMA access, a minimum pool size (in blocks), a maximum pool size
|
||||
(in blocks) and the size of memory chunks to be added if the entire
|
||||
pool is allocated.
|
||||
*/
|
||||
|
||||
#ifndef __LOCKED_POOL_H__
|
||||
#define __LOCKED_POOL_H__
|
||||
|
||||
#include <device_manager.h>
|
||||
|
||||
typedef struct locked_pool *locked_pool_cookie;
|
||||
|
||||
typedef status_t (*locked_pool_add_hook)(void *block, void *arg);
|
||||
typedef void (*locked_pool_remove_hook)(void *block, void *arg);
|
||||
|
||||
typedef struct {
|
||||
module_info minfo;
|
||||
|
||||
// allocate block
|
||||
void *(*alloc)(locked_pool_cookie pool);
|
||||
// free block
|
||||
void (*free)(locked_pool_cookie pool, void *block);
|
||||
|
||||
// create new pool
|
||||
// block_size - size of one memory block
|
||||
// alignment - set address bits here that must be zero for block addresses
|
||||
// next_ofs - offset in block where internal next-pointer can be stored
|
||||
// chunk_size - how much system memory is to be allocated at once
|
||||
// max_blocks - maximum number of blocks
|
||||
// min_free_block - minimum number of free blocks
|
||||
// name - name of pool
|
||||
// lock_flags - flags to be passed to lock_memory()
|
||||
// alloc_hook - hook to be called when new block is added to pool (can be NULL )
|
||||
// free_hook - hook to be called when block is removed from pool (can be NULL )
|
||||
// hook_arg - value to be passed to hooks as arg
|
||||
locked_pool_cookie (*create)(int block_size, int alignment, int next_ofs,
|
||||
int chunk_size, int max_blocks, int min_free_blocks, const char *name,
|
||||
uint32 lock_flags, locked_pool_add_hook add_hook,
|
||||
locked_pool_remove_hook remove_hook, void *hook_arg);
|
||||
void (*destroy)(locked_pool_cookie pool);
|
||||
} locked_pool_interface;
|
||||
|
||||
#define LOCKED_POOL_MODULE_NAME "generic/locked_pool/v1"
|
||||
|
||||
#endif
|
||||
@@ -1,118 +0,0 @@
|
||||
/* ++++++++++
|
||||
FILE: midi_driver.h
|
||||
REVS: $Revision: 1.1 $
|
||||
NAME: herold
|
||||
DATE: Tue Jun 4 15:23:29 PDT 1996
|
||||
|
||||
Interface to /dev/midi, the midi driver
|
||||
+++++ */
|
||||
/*
|
||||
Copyright 1999, Be Incorporated. All Rights Reserved.
|
||||
This file may be used under the terms of the Be Sample Code License.
|
||||
*/
|
||||
|
||||
#ifndef _MIDI_DRIVER_H
|
||||
#define _MIDI_DRIVER_H
|
||||
|
||||
#include <Drivers.h>
|
||||
#include <module.h>
|
||||
|
||||
/* -----
|
||||
ioctl codes
|
||||
----- */
|
||||
|
||||
/* the old opcodes are deprecated, and may or may not work
|
||||
in newer drivers */
|
||||
enum {
|
||||
B_MIDI_GET_READ_TIMEOUT = B_MIDI_DRIVER_BASE,
|
||||
B_MIDI_SET_READ_TIMEOUT,
|
||||
B_MIDI_TIMED_READ,
|
||||
B_MIDI_TIMED_WRITE,
|
||||
B_MIDI_WRITE_SYNC,
|
||||
B_MIDI_WRITE_CLEAR,
|
||||
B_MIDI_GET_READ_TIMEOUT_OLD = B_DEVICE_OP_CODES_END + 1,
|
||||
B_MIDI_SET_READ_TIMEOUT_OLD
|
||||
};
|
||||
|
||||
/* the default timeout when you open a midi driver */
|
||||
#define B_MIDI_DEFAULT_TIMEOUT 1000000000000000LL
|
||||
|
||||
/* Usage:
|
||||
To read, set "data" to a pointer to your buffer, and "size" to the
|
||||
maximum size of this buffer. On return, "when" will contain the time
|
||||
at which the data was received (first byte) and "size" will contain
|
||||
the actual amount of data read.
|
||||
Call ioctl(fd, B_MIDI_TIMED_READ, &midi_timed_data, sizeof(midi_timed_data));
|
||||
To write, set "when" to when you want the first byte to go out the
|
||||
wire, set "data" to point to your data, and set "size" to the size
|
||||
of your data.
|
||||
Call ioctl(fd, B_MIDI_TIMED_WRITE, &midi_timed_data, sizeof(midi_timed_data));
|
||||
*/
|
||||
typedef struct {
|
||||
bigtime_t when;
|
||||
size_t size;
|
||||
unsigned char * data;
|
||||
} midi_timed_data;
|
||||
|
||||
|
||||
/* The MIDI parser returns the number of bytes that a message contains, given the */
|
||||
/* initial byte. For some messages, this is not known until the second byte is seen. */
|
||||
/* For such messages, a state > 0 is returned as well as some count > 0. When state */
|
||||
/* is > 0, you should call (*parse) for the next byte as well, which might modify */
|
||||
/* the returned message size. Message size will always be returned with the current */
|
||||
/* byte being counted as byte 1. A return of 0 means that the byte initiates a new */
|
||||
/* message. SysX is handled by returning max_size until the end or next initial message */
|
||||
/* is seen. So your loop looks something like: */
|
||||
/*
|
||||
uint32 state = 0; // Only set this to 0 the first time you call the parser.
|
||||
// preserve the 'state' between invocations of your read() hook.
|
||||
int todo = 0;
|
||||
unsigned char * end = in_buf+buf_size
|
||||
unsigned char * out_buf = in_buf;
|
||||
while (true) {
|
||||
uchar byte = read_midi();
|
||||
if (!todo || state) {
|
||||
todo = (*parser->parse)(&state, byte, end-out_buf);
|
||||
}
|
||||
if (todo < 1) {
|
||||
unput_midi(byte);
|
||||
} else {
|
||||
*(out_buf++) = byte;
|
||||
todo--;
|
||||
}
|
||||
if (todo < 1 || out_buf >= end) {
|
||||
received_midi_message(in_buf, out_buf-in_buf);
|
||||
todo = 0;
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
#define B_MIDI_PARSER_MODULE_NAME "media/midiparser/v1"
|
||||
|
||||
typedef struct _midi_parser_module_info {
|
||||
module_info minfo;
|
||||
int (*parse)(uint32 * state, uchar byte, size_t max_size);
|
||||
int _reserved_;
|
||||
} midi_parser_module_info;
|
||||
|
||||
#define B_MPU_401_MODULE_NAME "generic/mpu401/v1"
|
||||
|
||||
enum {
|
||||
B_MPU_401_ENABLE_CARD_INT = 1,
|
||||
B_MPU_401_DISABLE_CARD_INT
|
||||
};
|
||||
typedef struct _generic_mpu401_module {
|
||||
module_info minfo;
|
||||
status_t (*create_device)(int port, void ** out_storage, uint32 workarounds, void (*interrupt_op)(int32 op, void * card), void * card);
|
||||
status_t (*delete_device)(void * storage);
|
||||
status_t (*open_hook)(void * storage, uint32 flags, void ** out_cookie);
|
||||
status_t (*close_hook)(void * cookie);
|
||||
status_t (*free_hook)(void * cookie);
|
||||
status_t (*control_hook)(void * cookie, uint32 op, void * data, size_t len);
|
||||
status_t (*read_hook)(void * cookie, off_t pos, void * data, size_t * len);
|
||||
status_t (*write_hook)(void * cookie, off_t pos, const void * data, size_t * len);
|
||||
bool (*interrupt_hook)(void * cookie);
|
||||
int _reserved_;
|
||||
} generic_mpu401_module;
|
||||
|
||||
#endif
|
||||
@@ -1,56 +0,0 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: mime_table.h
|
||||
/
|
||||
/ Description: Kernel mime table and matcher module API
|
||||
/
|
||||
/ Copyright 2005, François Revol.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _MIME_TABLE_MODULE_H_
|
||||
#define _MIME_TABLE_MODULE_H_
|
||||
|
||||
#include <module.h>
|
||||
|
||||
struct ext_mime {
|
||||
char *extension;
|
||||
char *mime;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
status_t get_table(struct ext_mime **table)
|
||||
Returns the current kernel mime table.
|
||||
You must call free_table() when finished with it.
|
||||
|
||||
void free_table(struct ext_mime *table)
|
||||
Frees the given mime table;
|
||||
|
||||
const char * mime_for_ext(const char *ext)
|
||||
Returns the known mime type for the given extension.
|
||||
|
||||
const char * ext_for_mime(const char *mime)
|
||||
Returns the known extension for the given mime type.
|
||||
|
||||
*/
|
||||
|
||||
#define B_MIME_TABLE_MODULE_NAME "generic/mime_table/v1"
|
||||
|
||||
typedef struct {
|
||||
module_info minfo;
|
||||
status_t (*get_table)(struct ext_mime **table);
|
||||
void (*free_table)(struct ext_mime *table);
|
||||
const char * (*mime_for_ext)(const char *ext);
|
||||
const char * (*ext_for_mime)(const char *mime);
|
||||
} mime_table_module_info;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/* Modules Definitions
|
||||
**
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
#ifndef _MODULE_H
|
||||
#define _MODULE_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
/* Every module exports a list of module_info structures.
|
||||
* It defines the interface of the module and the name
|
||||
* that is used to access the interface.
|
||||
*/
|
||||
|
||||
typedef struct module_info {
|
||||
const char *name;
|
||||
uint32 flags;
|
||||
status_t (*std_ops)(int32, ...);
|
||||
} module_info;
|
||||
|
||||
/* module standard operations */
|
||||
#define B_MODULE_INIT 1
|
||||
#define B_MODULE_UNINIT 2
|
||||
|
||||
/* module flags */
|
||||
#define B_KEEP_LOADED 0x00000001
|
||||
|
||||
|
||||
/* Use the module_dependency structure to let the
|
||||
* kernel automatically load modules yet depend on
|
||||
* before B_MODULE_INIT is called.
|
||||
*/
|
||||
|
||||
typedef struct module_dependency {
|
||||
const char *name;
|
||||
module_info **info;
|
||||
} module_dependency;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern status_t get_module(const char *path, module_info **_info);
|
||||
extern status_t put_module(const char *path);
|
||||
extern status_t get_next_loaded_module_name(uint32 *cookie, char *buffer, size_t *_bufferSize);
|
||||
extern void *open_module_list(const char *prefix);
|
||||
extern status_t close_module_list(void *cookie);
|
||||
extern status_t read_next_module_name(void *cookie, char *buffer, size_t *_bufferSize);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _MODULE_H */
|
||||
@@ -1,22 +0,0 @@
|
||||
/* Node monitor calls for kernel add-ons
|
||||
**
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
#ifndef _DRIVERS_NODE_MONITOR_H
|
||||
#define _DRIVERS_NODE_MONITOR_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <storage/NodeMonitor.h>
|
||||
|
||||
|
||||
extern status_t stop_notifying(port_id port, uint32 token);
|
||||
extern status_t start_watching(dev_t device, ino_t node, uint32 flags,
|
||||
port_id port, uint32 token);
|
||||
extern status_t stop_watching(dev_t device, ino_t node, uint32 flags,
|
||||
port_id port, uint32 token);
|
||||
|
||||
// ToDo: add simple message parsing convenience functionality
|
||||
|
||||
#endif /* _DRIVERS_NODE_MONITOR_H */
|
||||
@@ -1,55 +0,0 @@
|
||||
/*
|
||||
* Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
/*
|
||||
PnP devfs driver interface.
|
||||
|
||||
The interface follows the normal pnp driver rules, i.e.
|
||||
your driver creates a node for it and chooses PNP_DEVFS_MODULE_NAME
|
||||
as the consumer, the type must be PNP_DEVFS_TYPE_NAME. The file
|
||||
name is set via a PNP_DEVFS_FILENAME item.
|
||||
|
||||
Loading and unloading of your driver is done via the pnp manager.
|
||||
Hooks are similar to the original devfs interface, but the open
|
||||
hook gets the driver cookie (as returned by init_device of the
|
||||
driver) instead of a filename.
|
||||
*/
|
||||
|
||||
#ifndef _PNP_DEVFS_H
|
||||
#define _PNP_DEVFS_H
|
||||
|
||||
|
||||
#include <Drivers.h>
|
||||
#include <device_manager.h>
|
||||
|
||||
|
||||
// changed open hook - gets cookie returned by init_device instead of name
|
||||
typedef status_t (*pnp_device_open_hook)(void *device_cookie, uint32 flags,
|
||||
void **handle_cookie);
|
||||
|
||||
// new interface to devfs
|
||||
typedef struct pnp_devfs_driver_info {
|
||||
driver_module_info info;
|
||||
|
||||
pnp_device_open_hook open; // called to open the device
|
||||
device_close_hook close; // called to close the device
|
||||
device_free_hook free; // called to free the cookie
|
||||
device_control_hook control; // called to control the device
|
||||
device_read_hook read; // reads from the device
|
||||
device_write_hook write; // writes to the device
|
||||
device_select_hook select; // start select (can be NULL)
|
||||
device_deselect_hook deselect; // stop select (can be NULL)
|
||||
device_read_pages_hook read_pages; // scatter-gather read from the device (can be NULL)
|
||||
device_write_pages_hook write_pages; // scatter-gather write to the device (can be NULL)
|
||||
} pnp_devfs_driver_info;
|
||||
|
||||
|
||||
// items:
|
||||
// name under which the device should be published under /dev (required, string)
|
||||
#define PNP_DEVFS_FILENAME "devfs/filename"
|
||||
|
||||
#define PNP_DEVFS_MODULE_NAME "system/devfs/device_v1"
|
||||
|
||||
#endif
|
||||
@@ -1,144 +0,0 @@
|
||||
#ifndef USB_AUDIO_H
|
||||
#define USB_AUDIO_H
|
||||
|
||||
// (Partial) USB Class Definitions for Audio Devices, version 1.0
|
||||
// Reference: http://www.usb.org/developers/devclass_docs/audio10.pdf
|
||||
|
||||
#include <BeBuild.h> // for _PACKED definition
|
||||
|
||||
#define USB_AUDIO_DEVICE_CLASS 0x01
|
||||
#define USB_AUDIO_CLASS_VERSION 0x0100
|
||||
|
||||
enum {
|
||||
USB_AUDIO_INTERFACE_AUDIO_CLASS = 0x01
|
||||
};
|
||||
|
||||
enum { // Audio Interface Subclasses
|
||||
USB_AUDIO_INTERFACE_AUDIOCONTROL_SUBCLASS = 0x01, //
|
||||
USB_AUDIO_INTERFACE_AUDIOSTREAMING_SUBCLASS, //
|
||||
USB_AUDIO_INTERFACE_MIDISTREAMING_SUBCLASS //
|
||||
};
|
||||
|
||||
enum { // Audio Class-Specific AudioControl Interface descriptor subtypes
|
||||
USB_AUDIO_AC_HEADER = 0x01,
|
||||
USB_AUDIO_AC_INPUT_TERMINAL,
|
||||
USB_AUDIO_AC_OUTPUT_TERMINAL,
|
||||
USB_AUDIO_AC_MIXER_UNIT,
|
||||
USB_AUDIO_AC_SELECTOR_UNIT,
|
||||
USB_AUDIO_AC_FEATURE_UNIT,
|
||||
USB_AUDIO_AC_PROCESSING_UNIT,
|
||||
USB_AUDIO_AC_EXTENSION_UNIT
|
||||
};
|
||||
|
||||
enum { // Audio Class-Specific AudioStreaming Interface descriptor subtypes
|
||||
USB_AUDIO_AS_GENERAL = 0x01,
|
||||
USB_AUDIO_AS_FORMAT_TYPE,
|
||||
USB_AUDIO_AS_FORMAT_SPECIFIC
|
||||
};
|
||||
|
||||
enum { // Processing Unit Process Types (for USB_AUDIO_AC_PROCESSING_UNIT)
|
||||
USB_AUDIO_UPDOWNMIX_PROCESS = 0x01,
|
||||
USB_AUDIO_DOLBY_PROLOGIC_PROCESS,
|
||||
USB_AUDIO_3D_STEREO_EXTENDER_PROCESS,
|
||||
USB_AUDIO_REVERBERATION_PROCESS,
|
||||
USB_AUDIO_CHORUS_PROCESS,
|
||||
USB_AUDIO_DYN_RANGE_COMP_PROCESS
|
||||
};
|
||||
|
||||
// AudioControl request codes
|
||||
#define USB_AUDIO_SET_CURRENT 0x01
|
||||
#define USB_AUDIO_GET_CURRENT 0x81
|
||||
#define USB_AUDIO_SET_MIN 0x02
|
||||
#define USB_AUDIO_GET_MIN 0x82
|
||||
#define USB_AUDIO_SET_MAX 0x03
|
||||
#define USB_AUDIO_GET_MAX 0x83
|
||||
#define USB_AUDIO_SET_RES 0x04
|
||||
#define USB_AUDIO_GET_RES 0x84
|
||||
#define USB_AUDIO_SET_MEM 0x05
|
||||
#define USB_AUDIO_GET_MEM 0x85
|
||||
#define USB_AUDIO_GET_STATUS 0xFF
|
||||
|
||||
enum { // Terminal Control Selectors
|
||||
USB_AUDIO_COPY_PROTECT_CONTROL = 0x01
|
||||
};
|
||||
|
||||
/* A.10.2 Feature Unit Control Selectors */
|
||||
#define AC_FU_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_MUTE_CONTROL 0x01
|
||||
#define USB_AUDIO_VOLUME_CONTROL 0x02
|
||||
#define USB_AUDIO_BASS_CONTROL 0x03
|
||||
#define USB_AUDIO_MID_CONTROL 0x04
|
||||
#define USB_AUDIO_TREBLE_CONTROL 0x05
|
||||
#define USB_AUDIO_GRAPHIC_EQUALIZER_CONTROL 0x06
|
||||
#define USB_AUDIO_AUTOMATIC_GAIN_CONTROL 0x07
|
||||
#define USB_AUDIO_DELAY_CONTROL 0x08
|
||||
#define USB_AUDIO_BASS_BOOST_CONTROL 0x09
|
||||
#define USB_AUDIO_LOUDNESS_CONTROL 0x0A
|
||||
|
||||
/* A.10.3.1 Up/Down-mix Processing Unit Control Selectors */
|
||||
#define USB_AUDIO_UD_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_UD_ENABLED_CONTROL 0x01
|
||||
#define USB_AUDIO_UD_MODE_SELECT_CONTROL 0x02
|
||||
|
||||
/* A.10.3.2 Dolby Prologic(tm) Processing Unit Control Selectors */
|
||||
#define USB_AUDIO_DP_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_DP_ENABLE_CONTROL 0x01
|
||||
#define USB_AUDIO_DP_MODE_SELECT_CONTROL 0x02
|
||||
|
||||
/* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
|
||||
#define USB_AUDIO_3D_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_3D_ENABLED_CONTROL 0x01
|
||||
#define USB_AUDIO_3D_SPACIOUSNESS_CONTROL 0x03
|
||||
|
||||
/* A.10.3.4 Reverberation Processing Unit Control Selectors */
|
||||
#define USB_AUDIO_RV_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_RV_ENABLE_CONTROL 0x01
|
||||
#define USB_AUDIO_RV_REVERB_LEVEL_CONTROL 0x02
|
||||
#define USB_AUDIO_RV_REVERB_TIME_CONTROL 0x03
|
||||
#define USB_AUDIO_RV_REVERB_FEEDBACK_CONTROL 0x04
|
||||
|
||||
/* A.10.3.5 Chorus Processing Unit Control Selectors */
|
||||
#define USB_AUDIO_CH_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_CH_ENABLE_CONTROL 0x01
|
||||
#define USB_AUDIO_CHORUS_LEVEL_CONTROL 0x02
|
||||
#define USB_AUDIO_CHORUS_RATE_CONTROL 0x03
|
||||
#define USB_AUDIO_CHORUS_DETH_CONTROL 0x04
|
||||
|
||||
/* A.10.3.6 Dynamic Range Compressor Processing Unit Control Selectors */
|
||||
#define USB_AUDIO_DR_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_DR_ENABLE_CONTROL 0x01
|
||||
#define USB_AUDIO_COMPRESSION_RATE_CONTROL 0x02
|
||||
#define USB_AUDIO_MAXAMPL_CONTROL 0x03
|
||||
#define USB_AUDIO_THRESHOLD_CONTROL 0x04
|
||||
#define USB_AUDIO_ATTACK_TIME 0x05
|
||||
#define USB_AUDIO_RELEASE_TIME 0x06
|
||||
|
||||
/* A.10.4 Extension Unit Control Selectors */
|
||||
#define USB_AUDIO_XU_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_XU_ENABLE_CONTROL 0x01
|
||||
|
||||
/* A.10.5 Endpoint Control Selectors */
|
||||
#define USB_AUDIO_EP_CONTROL_UNDEFINED 0x00
|
||||
#define USB_AUDIO_SAMPLING_FREQ_CONTROL 0x01
|
||||
#define USB_AUDIO_PITCH_CONTROL 0x02
|
||||
|
||||
typedef struct {
|
||||
uint8 length;
|
||||
uint8 type;
|
||||
uint8 subtype;
|
||||
uint8 format_type;
|
||||
uint8 num_channels;
|
||||
uint8 subframe_size;
|
||||
uint8 bit_resolution;
|
||||
uint8 sample_freq_type;
|
||||
uint8 sample_freq[3]; // [0] + [1] << 8 + [2] << 16
|
||||
// if sample_freq_type != 1,
|
||||
// (sample_freq_type - 1) x uint8 sample_freq[3] follows...
|
||||
} _PACKED usb_audio_format_type_descriptor;
|
||||
|
||||
#define USB_AUDIO_FORMAT_TYPE_UNDEFINED 0x00
|
||||
#define USB_AUDIO_FORMAT_TYPE_I 0x01
|
||||
#define USB_AUDIO_FORMAT_TYPE_II 0x02
|
||||
#define USB_AUDIO_FORMAT_TYPE_III 0x03
|
||||
|
||||
#endif // USB_AUDIO_H
|
||||
@@ -1,136 +0,0 @@
|
||||
#ifndef USB_CDC_H
|
||||
#define USB_CDC_H
|
||||
|
||||
// (Partial) USB Class Definitions for Communication Devices (CDC), version 1.1
|
||||
// Reference: http://www.usb.org/developers/devclass_docs/usbcdc11.pdf
|
||||
|
||||
#define USB_COMMUNICATION_DEVICE_CLASS 0x02
|
||||
|
||||
#define USB_CDC_COMMUNICATION_INTERFACE_CLASS 0x02
|
||||
#define USB_CDC_CLASS_VERSION 0x0101
|
||||
|
||||
enum { // Communication Interface Subclasses
|
||||
USB_CDC_COMMUNICATION_INTERFACE_DLCM_SUBCLASS = 0x01, // Direct Line Control Model
|
||||
USB_CDC_COMMUNICATION_INTERFACE_ACM_SUBCLASS, // Abstract Control Model
|
||||
USB_CDC_COMMUNICATION_INTERFACE_TCM_SUBCLASS, // Telephone Control Model
|
||||
USB_CDC_COMMUNICATION_INTERFACE_MCCM_SUBCLASS, // Multi-Channel Control Model
|
||||
USB_CDC_COMMUNICATION_INTERFACE_CAPICM_SUBCLASS, // CAPI Control Model
|
||||
USB_CDC_COMMUNICATION_INTERFACE_ENCM_SUBCLASS, // Ethernet Networking Control Model
|
||||
USB_CDC_COMMUNICATION_INTERFACE_ATMNCM_SUBCLASS // ATM Networking Control Model
|
||||
};
|
||||
|
||||
enum { // Communication Interface Class Control Protocols
|
||||
USB_CDC_COMMUNICATION_INTERFACE_NONE_PROTOCOL = 0x00, // No class specific protocol required
|
||||
USB_CDC_COMMUNICATION_INTERFACE_V25TER_PROTOCOL = 0x01, // Common AT commands (also knowns as "Hayes compatible")
|
||||
USB_CDC_COMMUNICATION_INTERFACE_SPECIFIC_PROTOCOL = 0xff // Vendor-specific protocol
|
||||
};
|
||||
|
||||
#define USB_CDC_DATA_INTERFACE_CLASS 0x0a
|
||||
|
||||
enum { // Management Element Requests (p62)
|
||||
USB_CDC_SEND_ENCAPSULATED_COMMAND = 0x00,
|
||||
USB_CDC_GET_ENCAPSULATED_RESPONSE,
|
||||
USB_CDC_SET_COMM_FEATURE,
|
||||
USB_CDC_GET_COMM_FEATURE,
|
||||
USB_CDC_CLEAR_COMM_FEATURE,
|
||||
// 0x05 -> 0x0F: reserved for future use
|
||||
USB_CDC_SET_AUX_LINE_STATE = 0x10,
|
||||
USB_CDC_SET_HOOK_STATE,
|
||||
USB_CDC_PULSE_SETUP,
|
||||
USB_CDC_SEND_PULSE,
|
||||
USB_CDC_SET_PULSE_TIME,
|
||||
USB_CDC_RING_AUX_JACK,
|
||||
// 0x16 -> 0x1F: reserved for future use
|
||||
USB_CDC_SET_LINE_CODING = 0x20,
|
||||
USB_CDC_GET_LINE_CODING,
|
||||
USB_CDC_SET_CONTROL_LINE_STATE,
|
||||
USB_CDC_SEND_BREAK,
|
||||
// 0x24 -> 0x2F: reserved for future use
|
||||
USB_CDC_SET_RINGER_PARMS = 0x30,
|
||||
USB_CDC_GET_RINGER_PARMS,
|
||||
USB_CDC_SET_OPERATION_PARMS,
|
||||
USB_CDC_GET_OPERATION_PARMS,
|
||||
USB_CDC_SET_LINE_PARMS,
|
||||
USB_CDC_GET_LINE_PARMS,
|
||||
USB_CDC_DIAL_DIGITS,
|
||||
USB_CDC_SET_UNIT_PARAMETER,
|
||||
USB_CDC_GET_UNIT_PARAMETER,
|
||||
USB_CDC_CLEAR_UNIT_PARAMETER,
|
||||
USB_CDC_GET_PROFILE,
|
||||
// 0x3B -> 0x3F: reserved for future use
|
||||
USB_CDC_SET_ETHERNET_MULTICAST_FILTERS = 0x40,
|
||||
USB_CDC_SET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER,
|
||||
USB_CDC_GET_ETHERNET_POWER_MANAGEMENT_PATTERN_FILTER,
|
||||
USB_CDC_SET_ETHERNET_PACKET_FILTER,
|
||||
USB_CDC_GET_ETHERNET_STATISTIC,
|
||||
// 0x45 -> 0x4F: reserved for future use
|
||||
USB_CDC_SET_ATM_DATA_FORMAT = 0x50,
|
||||
USB_CDC_GET_ATM_DEVICE_STATISTICS,
|
||||
USB_CDC_SET_ATM_DEFAULT_VC,
|
||||
USB_CDC_GET_ATM_VC_STATISTICS
|
||||
// 0x54 -> 0xFF: reserved for future use
|
||||
};
|
||||
|
||||
enum { // Feature Selector (for USB_CDC_SET/GET/CLEAR_COMM_FEATURE (p65-66))
|
||||
USB_CDC_ABSTRACT_STATE = 0x01,
|
||||
USB_CDC_COUNTRY_SETTING = 0x02
|
||||
};
|
||||
|
||||
enum { // ABSTRACT_STATE bitmap (for USB_CDC_ABSTRAT_STATE Feature Selector (p66))
|
||||
USB_CDC_ABSTRACT_STATE_IDLE = 0x01,
|
||||
USB_CDC_ABSTRACT_STATE_DATA_MULTIPLEXED = 0x02
|
||||
};
|
||||
|
||||
typedef struct { // Line Coding Structure (for USB_CDC_SET/GET_LINE_CODING (p69))
|
||||
uint32 speed;
|
||||
uint8 stopbits;
|
||||
uint8 parity;
|
||||
uint8 databits;
|
||||
} _PACKED usb_cdc_line_coding;
|
||||
|
||||
enum { // CDC stopbits values (for Line Coding Structure stopbits field)
|
||||
USB_CDC_1_STOPBIT = 0,
|
||||
USB_CDC_1_5_STOPBITS,
|
||||
USB_CDC_2_STOPBITS
|
||||
};
|
||||
|
||||
enum { // CDC parity values (for Line Coding Structure parity field)
|
||||
USB_CDC_NO_PARITY = 0,
|
||||
USB_CDC_ODD_PARITY,
|
||||
USB_CDC_EVEN_PARITY,
|
||||
USB_CDC_MARK_PARITY,
|
||||
USB_CDC_SPACE_PARITY
|
||||
};
|
||||
|
||||
enum { // CDC Control Signal bitmap (for CDC_SET_CONTROL_LINE_STATE request)
|
||||
USB_CDC_CONTROL_SIGNAL_STATE_DTR = 0x01,
|
||||
USB_CDC_CONTROL_SIGNAL_STATE_RTS = 0x02
|
||||
};
|
||||
|
||||
enum { // Notification Elements notifications (p84)
|
||||
USB_CDC_NETWORK_CONNECTION = 0x00,
|
||||
USB_CDC_RESPONSE_AVAILABLE,
|
||||
// 0x02 -> 0x07: reserved for future use
|
||||
USB_CDC_AUX_JACK_HOOK_STATE = 0x08,
|
||||
USB_CDC_RING_DETECT,
|
||||
// 0x0a -> 0x1f: reserved for future use
|
||||
USB_CDC_SERIAL_STATE = 0x20,
|
||||
// 0x21 -> 0x27: reserved for future use
|
||||
USB_CDC_CALL_STATE_CHANGE = 0x28,
|
||||
USB_CDC_LINE_STATE_CHANGE,
|
||||
USB_CDC_CONNECTION_SPEED_CHANGE
|
||||
// 0x2b -> 0xff: reserved for future use
|
||||
};
|
||||
|
||||
enum { // CDC UART State bitmap (for USB_CDC_SERIAL_STATE notification)
|
||||
USB_CDC_UART_STATE_DCD = 0x01,
|
||||
USB_CDC_UART_STATE_DSR = 0x02,
|
||||
USB_CDC_UART_STATE_BREAK = 0x04,
|
||||
USB_CDC_UART_STATE_RING = 0x08,
|
||||
USB_CDC_UART_STATE_FRAMING_ERROR = 0x10,
|
||||
USB_CDC_UART_STATE_PARITY_ERROR = 0x20,
|
||||
USB_CDC_UART_STATE_OVERRUN_ERROR = 0x40
|
||||
};
|
||||
|
||||
#endif // USB_CDC_H
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
#ifndef USB_HID_H
|
||||
#define USB_HID_H
|
||||
|
||||
// (Partial) USB Class Definitions for HID Devices, version 1.11
|
||||
// Reference: http://www.usb.org/developers/devclass_docs/hid1_11.pdf
|
||||
|
||||
#define USB_HID_DEVICE_CLASS 0x03
|
||||
#define USB_HID_CLASS_VERSION 0x0100
|
||||
|
||||
enum { // HID Interface Subclasses
|
||||
USB_HID_INTERFACE_NO_SUBCLASS = 0x00, // No Subclass
|
||||
USB_HID_INTERFACE_BOOT_SUBCLASS // Boot Interface Subclass
|
||||
};
|
||||
|
||||
enum { // HID Class-Specific descriptor subtypes
|
||||
USB_HID_DESCRIPTOR_HID = 0x21,
|
||||
USB_HID_DESCRIPTOR_REPORT,
|
||||
USB_HID_DESCRIPTOR_PHYSICAL
|
||||
};
|
||||
|
||||
enum { // HID Class-specific requests
|
||||
USB_REQUEST_HID_GET_REPORT = 0x01,
|
||||
USB_REQUEST_HID_GET_IDLE,
|
||||
USB_REQUEST_HID_GET_PROTOCOL,
|
||||
|
||||
USB_REQUEST_HID_SET_REPORT = 0x09,
|
||||
USB_REQUEST_HID_SET_IDLE,
|
||||
USB_REQUEST_HID_SET_PROTOCOL
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint8 length;
|
||||
uint8 descriptor_type;
|
||||
uint16 hid_version;
|
||||
uint8 country_code;
|
||||
uint8 num_descriptors;
|
||||
struct
|
||||
{
|
||||
uint8 descriptor_type;
|
||||
uint16 descriptor_length;
|
||||
} _PACKED descriptor_info [1];
|
||||
} _PACKED usb_hid_descriptor;
|
||||
|
||||
|
||||
/*
|
||||
Usage Pages/IDs
|
||||
*/
|
||||
|
||||
enum
|
||||
{
|
||||
USAGE_PAGE_GENERIC_DESKTOP = 0x1,
|
||||
USAGE_PAGE_SIMULATION,
|
||||
USAGE_PAGE_VR,
|
||||
USAGE_PAGE_SPORT,
|
||||
USAGE_PAGE_GAME,
|
||||
USAGE_PAGE_GENERIC,
|
||||
USAGE_PAGE_KEYBOARD,
|
||||
USAGE_PAGE_LED,
|
||||
USAGE_PAGE_BUTTON,
|
||||
USAGE_PAGE_ORDINAL,
|
||||
USAGE_PAGE_TELEPHONY,
|
||||
USAGE_PAGE_CONSUMER,
|
||||
USAGE_PAGE_DIGITIZER,
|
||||
USAGE_PAGE_PID = 0xf,
|
||||
USAGE_PAGE_UNICODE,
|
||||
USAGE_PAGE_ALPHANUM_DISPLAY = 0x14,
|
||||
USAGE_PAGE_MEDICAL = 0x40
|
||||
};
|
||||
|
||||
/* Page 1: Generic Desktop */
|
||||
|
||||
enum
|
||||
{
|
||||
USAGE_ID_POINTER = 0x1,
|
||||
USAGE_ID_MOUSE,
|
||||
USAGE_ID_JOYSTICK = 0x4,
|
||||
USAGE_ID_GAMEPAD,
|
||||
USAGE_ID_KEYBOARD,
|
||||
USAGE_ID_KEYPAD,
|
||||
USAGE_ID_MULTIAXIS = 0x8,
|
||||
|
||||
USAGE_ID_X = 0x30,
|
||||
USAGE_ID_Y,
|
||||
USAGE_ID_Z,
|
||||
USAGE_ID_RX,
|
||||
USAGE_ID_RY,
|
||||
USAGE_ID_RZ,
|
||||
USAGE_ID_SLIDER,
|
||||
USAGE_ID_DIAL,
|
||||
USAGE_ID_WHEEL,
|
||||
USAGE_ID_HAT_SWITCH,
|
||||
USAGE_ID_COUNTED_BUFFER,
|
||||
USAGE_ID_BYTE_COUNT,
|
||||
USAGE_ID_MOTION_WAKEUP,
|
||||
USAGE_ID_START,
|
||||
USAGE_ID_SELECT,
|
||||
USAGE_ID_VX = 0x40,
|
||||
USAGE_ID_VY,
|
||||
USAGE_ID_VZ,
|
||||
USAGE_ID_VBRX,
|
||||
USAGE_ID_VBRY,
|
||||
USAGE_ID_VBRZ,
|
||||
USAGE_ID_VNO,
|
||||
USAGE_ID_FEATURE_NOTIFICATION
|
||||
};
|
||||
|
||||
/* Page 2: Simulation */
|
||||
|
||||
enum
|
||||
{
|
||||
USAGE_ID_RUDDER = 0xBA,
|
||||
USAGE_ID_THROTTLE = 0xBB,
|
||||
};
|
||||
|
||||
#endif // USB_HID_H
|
||||
@@ -1,173 +0,0 @@
|
||||
#ifndef USB_LANGIDS_H
|
||||
#define USB_LANGIDS_H
|
||||
|
||||
// USB Language Identifiers, 3/29/2000, version 1.0
|
||||
// Reference: http://www.usb.org/developers/docs/USB_LANGIDs.pdf
|
||||
|
||||
#define USB_LANGIDS_VERSION 0x0100 // version 1.0
|
||||
|
||||
// descriptor string index 0 = supported LANGIDs array
|
||||
#define USB_LANGIDS_STRING_INDEX (0)
|
||||
|
||||
#define USB_PRIMARY_LANGID_MASK (0x003F) // 9 to 0 bits
|
||||
#define USB_SUB_LANGID_MASK (0xFC00) // 15 to 10 bits
|
||||
|
||||
#define USB_PRIMARY_LANGID(id) (id & USB_PRIMARY_LANGID_MASK)
|
||||
#define USB_SUB_LANGID(id) ((id & USB_SUB_LANGID_MASK) >> 10)
|
||||
|
||||
enum {
|
||||
USB_LANGID_AFRIKAANS = 0x0436, // Afrikaans
|
||||
USB_LANGID_ALBANIAN = 0x041c, // Albanian
|
||||
USB_LANGID_ARABIC_SAUDI_ARABIA = 0x0401, // Arabic (Saudi Arabia)
|
||||
USB_LANGID_ARABIC_IRAK = 0x0801, // Arabic (Irak)
|
||||
USB_LANGID_ARABIC_EGYPT = 0x0c01, // Arabic (Egypt)
|
||||
USB_LANGID_ARABIC_LYBYA = 0x1001, // Arabic (Libya)
|
||||
USB_LANGID_ARABIC_ALGERIA = 0x1401, // Arabic (Algeria)
|
||||
USB_LANGID_ARABIC_MOROCCO = 0x1801, // Arabic (Morocco)
|
||||
USB_LANGID_ARABIC_TUNISIA = 0x1c01, // Arabic (Tunisia)
|
||||
USB_LANGID_ARABIC_OMAN = 0x2001, // Arabic (Oman)
|
||||
USB_LANGID_ARABIC_YEMEN = 0x2401, // Arabic (Yemen)
|
||||
USB_LANGID_ARABIC_SYRIA = 0x2801, // Arabic (Syria)
|
||||
USB_LANGID_ARABIC_JORDAN = 0x2c01, // Arabic (Jordan)
|
||||
USB_LANGID_ARABIC_LEBANON = 0x3001, // Arabic (Lebanon)
|
||||
USB_LANGID_ARABIC_KUWAIT = 0x3401, // Arabic (Kuwait)
|
||||
USB_LANGID_ARABIC_UAE = 0x3801, // Arabic (U.A.E.)
|
||||
USB_LANGID_ARABIC_BAHRAIN = 0x3c01, // Arabic (Bahrain)
|
||||
USB_LANGID_ARABIC_QATAR = 0x4001, // Arabic (Qatar)
|
||||
USB_LANGID_ARMENIAN = 0x042b, // Armenian
|
||||
USB_LANGID_ASSAMESE = 0x044d, // Assamese
|
||||
USB_LANGID_AZERI_LATIN = 0x042c, // Azeri (Latin)
|
||||
USB_LANGID_AZERI_CYRILLIC = 0x082c, // Azeri (Cyrillic)
|
||||
USB_LANGID_BASQUE = 0x042d, // Basque
|
||||
USB_LANGID_BELARUSSIAN = 0x0423, // Belarussian
|
||||
USB_LANGID_BENGALI = 0x0445, // Bengali
|
||||
USB_LANGID_BULGARIAN = 0x0402, // Bulgarian
|
||||
USB_LANGID_BURMESE = 0x0455, // Burmese
|
||||
USB_LANGID_CATALAN = 0x0403, // Catalan
|
||||
USB_LANGID_CHINESE_TAIWAN = 0x0404, // Chinese (Taiwan)
|
||||
USB_LANGID_CHINESE_PRC = 0x0804, // Chinese (PRC = People Republic of Chinese)
|
||||
USB_LANGID_CHINESE_HONG_KONG = 0x0c04, // Chinese (Hong Kong)
|
||||
USB_LANGID_CHINESE_SINGAPORE = 0x1004, // Chinese (Singapore)
|
||||
USB_LANGID_CHINESE_MACAU_SAR = 0x1404, // Chinese (Macau SAR)
|
||||
USB_LANGID_CROATIAN = 0x041a, // Croatian
|
||||
USB_LANGID_CZECH = 0x0405, // Czech
|
||||
USB_LANGID_DANISH = 0x0406, // Danish
|
||||
USB_LANGID_DUTCH_NETHERLANDS = 0x0413, // Dutch (Netherlands)
|
||||
USB_LANGID_DUTCH_BELGIUM = 0x0813, // Dutch (Belgium)
|
||||
USB_LANGID_ENGLISH_UNITED_STATES = 0x0409, // English (United States)
|
||||
USB_LANGID_ENGLISH_UNITED_KINGDOM = 0x0809, // English (United Kingdom)
|
||||
USB_LANGID_ENGLISH_AUSTRALIAN = 0x0c09, // English (Australian)
|
||||
USB_LANGID_ENGLISH_CANADIAN = 0x1009, // English (Canadian)
|
||||
USB_LANGID_ENGLISH_NEW_ZEALAND = 0x1409, // English (New Zealand)
|
||||
USB_LANGID_ENGLISH_IRELAND = 0x1809, // English (Ireland)
|
||||
USB_LANGID_ENGLISH_SOUTH_AFRICA = 0x1c09, // English (South Africa)
|
||||
USB_LANGID_ENGLISH_JAMAICA = 0x2009, // English (Jamaica)
|
||||
USB_LANGID_ENGLISH_CARIBBEAN = 0x2409, // English (Caribbean)
|
||||
USB_LANGID_ENGLISH_BELIZE = 0x2809, // English (Belize)
|
||||
USB_LANGID_ENGLISH_TRINIDAD = 0x2c09, // English (Trinidad)
|
||||
USB_LANGID_ENGLISH_ZIMBABWE = 0x3009, // English (Zimbabwe)
|
||||
USB_LANGID_ENGLISH_PHLIPPINES = 0x3409, // English (Philippines)
|
||||
USB_LANGID_ESTONIAN = 0x0425, // Estonian
|
||||
USB_LANGID_FAEROESE = 0x0438, // Faeroese
|
||||
USB_LANGID_FARSI = 0x0429, // Farsi
|
||||
USB_LANGID_FINNISH = 0x040b, // Finnish
|
||||
USB_LANGID_FRENCH_STANDARD = 0x040c, // French (Standard)
|
||||
USB_LANGID_FRENCH_BELGIAN = 0x080c, // French (Belgian)
|
||||
USB_LANGID_FRENCH_CANADIAN = 0x0c0c, // French (Canadian)
|
||||
USB_LANGID_FRENCH_SWITZERLAND = 0x100c, // French (Switzerland)
|
||||
USB_LANGID_FRENCH_LUXEMBOURG = 0x140c, // French (Luxembourg)
|
||||
USB_LANGID_FRENCH_MONACO = 0x180c, // French (Monaco)
|
||||
USB_LANGID_GEORGIAN = 0x0437, // Georgian
|
||||
USB_LANGID_GERMAN_STANDARD = 0x0407, // German (Standard)
|
||||
USB_LANGID_GERMAN_SWITZERLAND = 0x0807, // German (Switzerland)
|
||||
USB_LANGID_GERMAN_AUSTRIA = 0x0c07, // German (Austria)
|
||||
USB_LANGID_GERMAN_LUXEMBOURG = 0x1007, // German (Luxembourg)
|
||||
USB_LANGID_GERMAN_LIECHTENSTEIN = 0x1407, // German (Liechtenstein)
|
||||
USB_LANGID_GREEK = 0x0408, // Greek
|
||||
USB_LANGID_GUJARATI = 0x0447, // Gujarati
|
||||
USB_LANGID_HEBREW = 0x040d, // Hebrew
|
||||
USB_LANGID_HINDI = 0x0439, // Hindi
|
||||
USB_LANGID_HUNGARIAN = 0x040e, // Hungarian
|
||||
USB_LANGID_ICELANDIC = 0x040f, // Icelandic
|
||||
USB_LANGID_INDONESIAN = 0x0421, // Indonesian
|
||||
USB_LANGID_ITALIAN_STANDARD = 0x0410, // Italian (Standard)
|
||||
USB_LANGID_ITALIAN_SWITZERLAND = 0x0810, // Italian (Switzerland)
|
||||
USB_LANGID_JAPANESE = 0x0411, // Japanese
|
||||
USB_LANGID_KANNADA = 0x044b, // Kannada
|
||||
USB_LANGID_KASHMIRI_INDIA = 0x0860, // Kashmiri (India)
|
||||
USB_LANGID_KAZAKH = 0x043f, // Kazakh
|
||||
USB_LANGID_KONKANI = 0x0457, // Konkani
|
||||
USB_LANGID_KOREAN_JOHAB = 0x0412, // Korean (Johab)
|
||||
USB_LANGID_LATVIAN = 0x0426, // Latvian
|
||||
USB_LANGID_LITHUANIAN = 0x0427, // Lithuanian
|
||||
USB_LANGID_LITHUANIAN_CLASSIC = 0x0827, // Lithuanian (Classic)
|
||||
USB_LANGID_MACEDONIAN = 0x042f, // Macedonian
|
||||
USB_LANGID_MALAY_MALAYSIAN = 0x043e, // Malay (Malaysian)
|
||||
USB_LANGID_MALAY_BRUNEI_DARUSSALAM = 0x083e, // Malay (Brunei Darussalam)
|
||||
USB_LANGID_MALAYALAM = 0x044c, // Malayalam
|
||||
USB_LANGID_MANIPURI = 0x0458, // Manipuri
|
||||
USB_LANGID_MARATHI = 0x044e, // Marathi
|
||||
USB_LANGID_NEPALI_INDIA = 0x0861, // Nepali (India)
|
||||
USB_LANGID_NORWEGIAN_BOKMAL = 0x0414, // Norwegian (Bokmal)
|
||||
USB_LANGID_NORWEGIAN_NYNORSK = 0x0814, // Norwegian (Nynorsk)
|
||||
USB_LANGID_ORIYA = 0x0448, // Oriya
|
||||
USB_LANGID_POLISH = 0x0415, // Polish
|
||||
USB_LANGID_PORTUGUESE_BRAZIL = 0x0416, // Portuguese (Brazil)
|
||||
USB_LANGID_PORTUGUESE_STANDARD = 0x0816, // Portuguese (Standard)
|
||||
USB_LANGID_PUNJABI = 0x0446, // Punjabi
|
||||
USB_LANGID_ROMANIAN = 0x0418, // Romanian
|
||||
USB_LANGID_RUSSIAN = 0x0419, // Russian
|
||||
USB_LANGID_SANSKRIT = 0x044f, // Sanskrit
|
||||
USB_LANGID_SERBIAN_CYRILLIC = 0x0c1a, // Serbian (Cyrillic)
|
||||
USB_LANGID_SERBIAN_LATIN = 0x081a, // Serbian (Latin)
|
||||
USB_LANGID_SINDHI = 0x0459, // Sindhi
|
||||
USB_LANGID_SLOVAK = 0x041b, // Slovak
|
||||
USB_LANGID_SLOVENIAN = 0x0424, // Slovenian
|
||||
USB_LANGID_SPANNISH_TRADITIONAL_SORT= 0x040a, // Spannish (Traditional Sort)
|
||||
USB_LANGID_SPANNISH_MEXICAN = 0x080a, // Spannish (Mexican)
|
||||
USB_LANGID_SPANNISH_MODERN_SORT = 0x0c0a, // Spannish (Modern Sort)
|
||||
USB_LANGID_SPANNISH_GUATEMALA = 0x100a, // Spannish (Guatemala)
|
||||
USB_LANGID_SPANNISH_COSTA_RICA = 0x140a, // Spannish (Costa Rica)
|
||||
USB_LANGID_SPANNISH_PANAMA = 0x180a, // Spannish (Panama)
|
||||
USB_LANGID_SPANNISH_DOMINICAN_REPUBLIC = 0x1c0a, // Spannish (Dominican Republic)
|
||||
USB_LANGID_SPANNISH_VENEZUELA = 0x200a, // Spannish (Venezuela)
|
||||
USB_LANGID_SPANNISH_COLOMBIA = 0x240a, // Spannish (Colombia)
|
||||
USB_LANGID_SPANNISH_PERU = 0x280a, // Spannish (Peru)
|
||||
USB_LANGID_SPANNISH_ARGENTINA = 0x2c0a, // Spannish (Argentina)
|
||||
USB_LANGID_SPANNISH_ECUADOR = 0x300a, // Spannish (Ecuador)
|
||||
USB_LANGID_SPANNISH_CHILE = 0x340a, // Spannish (Chile)
|
||||
USB_LANGID_SPANNISH_URUGUAY = 0x380a, // Spannish (Uruguay)
|
||||
USB_LANGID_SPANNISH_PARAGUAY = 0x3c0a, // Spannish (Paraguay)
|
||||
USB_LANGID_SPANNISH_BOLIVIA = 0x400a, // Spannish (Bolivia)
|
||||
USB_LANGID_SPANNISH_EL_SALVADOR = 0x440a, // Spannish (El Salvador)
|
||||
USB_LANGID_SPANNISH_HONDURAS = 0x480a, // Spannish (Honduras)
|
||||
USB_LANGID_SPANNISH_NICARAGUA = 0x4c0a, // Spannish (Nicaragua)
|
||||
USB_LANGID_SPANNISH_PUERTO_RICO = 0x500a, // Spannish (Puerto Rico)
|
||||
USB_LANGID_SUTU = 0x0430, // Sutu
|
||||
USB_LANGID_SWAHILI_KENYA = 0x0441, // Swahili (Kenya)
|
||||
USB_LANGID_SWEDISH = 0x041d, // Swedish
|
||||
USB_LANGID_SWEDISH_FINLAND = 0x081d, // Swedish (Finland)
|
||||
USB_LANGID_TAMIL = 0x0449, // Tamil
|
||||
USB_LANGID_TATAR_TATARSTAN = 0x0444, // Tatar (Tatarstan)
|
||||
USB_LANGID_TELUGU = 0x044a, // Telugu
|
||||
USB_LANGID_THAI = 0x041e, // Thai
|
||||
USB_LANGID_TURKISH = 0x041f, // Turkish
|
||||
USB_LANGID_UKRAINIAN = 0x0422, // Ukrainian
|
||||
USB_LANGID_URDU_PAKISTAN = 0x0420, // Urdu (Pakistan)
|
||||
USB_LANGID_URDU_INDIA = 0x0820, // Urdu (India)
|
||||
USB_LANGID_UZBEK_LATIN = 0x0443, // Uzbek (Latin)
|
||||
USB_LANGID_UZBEK_CYRILLIC = 0x0843, // Uzbek (Cyrillic)
|
||||
USB_LANGID_VIETNAMESE = 0x042a, // Vietnamese
|
||||
|
||||
USB_LANGID_HID_UDD = 0x04ff, // HID (Usage Data Descriptor)
|
||||
USB_LANGID_HID1 = 0xf0ff, // HID (Vendor Defined 1)
|
||||
USB_LANGID_HID2 = 0xf4ff, // HID (Vendor Defined 2)
|
||||
USB_LANGID_HID3 = 0xf8ff, // HID (Vendor Defined 3)
|
||||
USB_LANGID_HID4 = 0xfcff, // HID (Vendor Defined 4)
|
||||
|
||||
USB_LANGID_INVALID = 0x0000 // Invalid LANG ID
|
||||
};
|
||||
|
||||
#endif // USB_LANGIDS_H
|
||||
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
#ifndef USB_MIDI_H
|
||||
#define USB_MIDI_H
|
||||
|
||||
#include "USB_audio.h"
|
||||
|
||||
// (Partial) USB Class Definitions for MIDI Devices, version 1.0
|
||||
// Reference: http://www.usb.org/developers/devclass_docs/midi10.pdf
|
||||
|
||||
#define USB_MIDI_CLASS_VERSION 0x0100 // Class specification version 1.0
|
||||
|
||||
// USB MIDI Event Packet
|
||||
|
||||
// ... as clean structure:
|
||||
typedef struct { // USB MIDI Event Packet
|
||||
uint8 cin:4; // Code Index Number
|
||||
uint8 cn:4; // Cable Number
|
||||
uint8 midi[3];
|
||||
} _PACKED usb_midi_event_packet;
|
||||
|
||||
#endif // USB_MIDI_H
|
||||
@@ -1,96 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _SCREEN_H
|
||||
#define _SCREEN_H
|
||||
|
||||
|
||||
#include <Accelerant.h>
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Rect.h>
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
class BBitmap;
|
||||
class BWindow;
|
||||
|
||||
namespace BPrivate {
|
||||
class BPrivateScreen;
|
||||
}
|
||||
|
||||
class BScreen {
|
||||
public:
|
||||
BScreen(screen_id id = B_MAIN_SCREEN_ID);
|
||||
BScreen(BWindow* window);
|
||||
~BScreen();
|
||||
|
||||
bool IsValid();
|
||||
status_t SetToNext();
|
||||
|
||||
color_space ColorSpace();
|
||||
BRect Frame();
|
||||
screen_id ID();
|
||||
|
||||
status_t WaitForRetrace();
|
||||
status_t WaitForRetrace(bigtime_t timeout);
|
||||
|
||||
uint8 IndexForColor(rgb_color color);
|
||||
uint8 IndexForColor(uint8 red, uint8 green, uint8 blue,
|
||||
uint8 alpha = 255);
|
||||
rgb_color ColorForIndex(uint8 index);
|
||||
uint8 InvertIndex(uint8 index);
|
||||
|
||||
const color_map* ColorMap();
|
||||
|
||||
status_t GetBitmap(BBitmap** _bitmap, bool drawCursor = true,
|
||||
BRect* frame = NULL);
|
||||
status_t ReadBitmap(BBitmap* bitmap, bool drawCursor = true,
|
||||
BRect* frame = NULL);
|
||||
|
||||
rgb_color DesktopColor();
|
||||
rgb_color DesktopColor(uint32 index);
|
||||
void SetDesktopColor(rgb_color color, bool makeDefault = true);
|
||||
void SetDesktopColor(rgb_color color, uint32 index,
|
||||
bool makeDefault = true);
|
||||
|
||||
status_t ProposeMode(display_mode* target, const display_mode* low,
|
||||
const display_mode* high);
|
||||
status_t GetModeList(display_mode** _modeList, uint32* _count);
|
||||
status_t GetMode(display_mode* mode);
|
||||
status_t GetMode(uint32 workspace, display_mode* mode);
|
||||
status_t SetMode(display_mode* mode, bool makeDefault = false);
|
||||
status_t SetMode(uint32 workspace, display_mode* mode,
|
||||
bool makeDefault = false);
|
||||
status_t GetDeviceInfo(accelerant_device_info* info);
|
||||
status_t GetMonitorInfo(monitor_info* info);
|
||||
status_t GetPixelClockLimits(display_mode* mode, uint32* low,
|
||||
uint32* high);
|
||||
status_t GetTimingConstraints(
|
||||
display_timing_constraints* timingConstraints);
|
||||
status_t SetDPMS(uint32 state);
|
||||
uint32 DPMSState();
|
||||
uint32 DPMSCapabilites();
|
||||
|
||||
private:
|
||||
BScreen& operator=(const BScreen& other);
|
||||
BScreen(const BScreen& other);
|
||||
|
||||
// old and deprecated methods - should be faded out
|
||||
BPrivate::BPrivateScreen* private_screen();
|
||||
status_t ProposeDisplayMode(display_mode* target,
|
||||
const display_mode* low, const display_mode* high);
|
||||
void* BaseAddress();
|
||||
uint32 BytesPerRow();
|
||||
|
||||
BPrivate::BPrivateScreen* fScreen;
|
||||
};
|
||||
|
||||
|
||||
inline uint8
|
||||
BScreen::IndexForColor(rgb_color color)
|
||||
{
|
||||
return IndexForColor(color.red, color.green, color.blue, color.alpha);
|
||||
}
|
||||
|
||||
#endif // _SCREEN_H
|
||||
@@ -1,526 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005, Ingo Weinhold, [email protected].
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _DEBUGGER_H
|
||||
#define _DEBUGGER_H
|
||||
|
||||
#include <signal.h>
|
||||
|
||||
#include <image.h>
|
||||
#include <OS.h>
|
||||
|
||||
// include architecture specific definitions
|
||||
#ifdef __INTEL__
|
||||
#include <arch/x86/arch_debugger.h>
|
||||
#elif __POWERPC__
|
||||
#include <arch/ppc/arch_debugger.h>
|
||||
#endif
|
||||
|
||||
typedef struct debug_cpu_state debug_cpu_state;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern status_t install_default_debugger(port_id debuggerPort);
|
||||
extern port_id install_team_debugger(team_id team, port_id debuggerPort);
|
||||
extern status_t remove_team_debugger(team_id team);
|
||||
extern status_t debug_thread(thread_id thread);
|
||||
extern void wait_for_debugger(void);
|
||||
|
||||
// team debugging flags
|
||||
enum {
|
||||
// event mask: If a flag is set, any of the team's threads will stop when
|
||||
// the respective event occurs. All flags are enabled by default. Always
|
||||
// enabled are debugger() calls and hardware exceptions, as well as the
|
||||
// deletion of the debugged team.
|
||||
B_TEAM_DEBUG_SIGNALS = 0x00010000,
|
||||
B_TEAM_DEBUG_PRE_SYSCALL = 0x00020000,
|
||||
B_TEAM_DEBUG_POST_SYSCALL = 0x00040000,
|
||||
B_TEAM_DEBUG_TEAM_CREATION = 0x00080000,
|
||||
B_TEAM_DEBUG_THREADS = 0x00100000,
|
||||
B_TEAM_DEBUG_IMAGES = 0x00200000,
|
||||
|
||||
// new thread handling
|
||||
B_TEAM_DEBUG_STOP_NEW_THREADS = 0x01000000,
|
||||
|
||||
B_TEAM_DEBUG_USER_FLAG_MASK = 0xffff0000,
|
||||
};
|
||||
|
||||
// per-thread debugging flags
|
||||
enum {
|
||||
// event mask: If a flag is set, the thread will stop when the respective
|
||||
// event occurs. If there is a corresponding team flag, it is sufficient,
|
||||
// if either is set. Per default none of the flags is set.
|
||||
B_THREAD_DEBUG_PRE_SYSCALL = 0x00010000,
|
||||
B_THREAD_DEBUG_POST_SYSCALL = 0x00020000,
|
||||
|
||||
// child thread handling
|
||||
B_THREAD_DEBUG_STOP_CHILD_THREADS = 0x00100000,
|
||||
B_THREAD_DEBUG_SYSCALL_TRACE_CHILD_THREADS = 0x00200000,
|
||||
|
||||
B_THREAD_DEBUG_USER_FLAG_MASK = 0xffff0000,
|
||||
};
|
||||
|
||||
// in case of a B_EXCEPTION_OCCURRED event: the type of the exception
|
||||
typedef enum {
|
||||
B_NON_MASKABLE_INTERRUPT = 0,
|
||||
B_MACHINE_CHECK_EXCEPTION,
|
||||
B_SEGMENT_VIOLATION,
|
||||
B_ALIGNMENT_EXCEPTION,
|
||||
B_DIVIDE_ERROR,
|
||||
B_OVERFLOW_EXCEPTION,
|
||||
B_BOUNDS_CHECK_EXCEPTION,
|
||||
B_INVALID_OPCODE_EXCEPTION,
|
||||
B_SEGMENT_NOT_PRESENT,
|
||||
B_STACK_FAULT,
|
||||
B_GENERAL_PROTECTION_FAULT,
|
||||
B_FLOATING_POINT_EXCEPTION,
|
||||
} debug_exception_type;
|
||||
|
||||
// Value indicating how a stopped thread shall continue.
|
||||
enum {
|
||||
B_THREAD_DEBUG_HANDLE_EVENT = 0, // handle the event normally
|
||||
// (e.g. a signal is delivered, a
|
||||
// CPU fault kills the team,...)
|
||||
B_THREAD_DEBUG_IGNORE_EVENT, // ignore the event and continue as if
|
||||
// it didn't occur (e.g. a signal or
|
||||
// a CPU fault will be ignored)
|
||||
};
|
||||
|
||||
// watchpoint types (ToDo: Check PPC support.)
|
||||
enum {
|
||||
B_DATA_READ_WATCHPOINT = 0, // !x86
|
||||
B_DATA_WRITE_WATCHPOINT,
|
||||
B_DATA_READ_WRITE_WATCHPOINT,
|
||||
};
|
||||
|
||||
// how to apply signal ignore masks
|
||||
typedef enum {
|
||||
B_DEBUG_SIGNAL_MASK_AND = 0,
|
||||
B_DEBUG_SIGNAL_MASK_OR,
|
||||
B_DEBUG_SIGNAL_MASK_SET,
|
||||
} debug_signal_mask_op;
|
||||
|
||||
#define B_DEBUG_SIGNAL_TO_MASK(signal) (1ULL << ((signal) - 1))
|
||||
|
||||
// maximal number of bytes to read/write via B_DEBUG_MESSAGE_{READ,WRITE]_MEMORY
|
||||
enum {
|
||||
B_MAX_READ_WRITE_MEMORY_SIZE = 1024,
|
||||
};
|
||||
|
||||
// messages to the debug nub thread
|
||||
typedef enum {
|
||||
B_DEBUG_MESSAGE_READ_MEMORY = 0, // read from the team's memory
|
||||
B_DEBUG_MESSAGE_WRITE_MEMORY, // write to the team's memory
|
||||
B_DEBUG_MESSAGE_SET_TEAM_FLAGS, // set the team's debugging flags
|
||||
B_DEBUG_MESSAGE_SET_THREAD_FLAGS, // set a thread's debugging flags
|
||||
B_DEBUG_MESSAGE_CONTINUE_THREAD, // continue a stopped thread
|
||||
B_DEBUG_MESSAGE_SET_CPU_STATE, // change a stopped thread's CPU state
|
||||
B_DEBUG_MESSAGE_GET_CPU_STATE, // get the thread's current CPU state
|
||||
B_DEBUG_MESSAGE_SET_BREAKPOINT, // set a breakpoint
|
||||
B_DEBUG_MESSAGE_CLEAR_BREAKPOINT, // clear a breakpoint
|
||||
B_DEBUG_MESSAGE_SET_WATCHPOINT, // set a watchpoint
|
||||
B_DEBUG_MESSAGE_CLEAR_WATCHPOINT, // clear a watchpoint
|
||||
B_DEBUG_MESSAGE_SET_SIGNAL_MASKS, // set/get a thread's masks of signals
|
||||
B_DEBUG_MESSAGE_GET_SIGNAL_MASKS, // the debugger is interested in
|
||||
B_DEBUG_MESSAGE_SET_SIGNAL_HANDLER, // set/get a thread's signal handler for
|
||||
B_DEBUG_MESSAGE_GET_SIGNAL_HANDLER, // a signal
|
||||
|
||||
B_DEBUG_MESSAGE_PREPARE_HANDOVER, // prepares the debugged team for being
|
||||
// handed over to another debugger;
|
||||
// the new debugger can just invoke
|
||||
// install_team_debugger()
|
||||
} debug_nub_message;
|
||||
|
||||
// messages sent to the debugger
|
||||
typedef enum {
|
||||
B_DEBUGGER_MESSAGE_THREAD_DEBUGGED = 0, // debugger message in reaction to
|
||||
// an invocation of debug_thread()
|
||||
B_DEBUGGER_MESSAGE_DEBUGGER_CALL, // thread called debugger()
|
||||
B_DEBUGGER_MESSAGE_BREAKPOINT_HIT, // thread hit a breakpoint
|
||||
B_DEBUGGER_MESSAGE_WATCHPOINT_HIT, // thread hit a watchpoint
|
||||
B_DEBUGGER_MESSAGE_SINGLE_STEP, // thread was single-stepped
|
||||
B_DEBUGGER_MESSAGE_PRE_SYSCALL, // begin of a syscall
|
||||
B_DEBUGGER_MESSAGE_POST_SYSCALL, // end of a syscall
|
||||
B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED, // thread received a signal
|
||||
B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED, // an exception occurred
|
||||
B_DEBUGGER_MESSAGE_TEAM_CREATED, // the debugged team created a new
|
||||
// one
|
||||
B_DEBUGGER_MESSAGE_TEAM_DELETED, // the debugged team is gone
|
||||
B_DEBUGGER_MESSAGE_THREAD_CREATED, // a thread has been created
|
||||
B_DEBUGGER_MESSAGE_THREAD_DELETED, // a thread has been deleted
|
||||
B_DEBUGGER_MESSAGE_IMAGE_CREATED, // an image has been created
|
||||
B_DEBUGGER_MESSAGE_IMAGE_DELETED, // an image has been deleted
|
||||
|
||||
B_DEBUGGER_MESSAGE_HANDED_OVER, // the debugged team has been
|
||||
// handed over to another debugger
|
||||
} debug_debugger_message;
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
// #pragma mark ----- messages to the debug nub thread -----
|
||||
|
||||
// B_DEBUG_MESSAGE_READ_MEMORY
|
||||
|
||||
typedef struct {
|
||||
port_id reply_port; // port to send the reply to
|
||||
void *address; // address from which to read
|
||||
int32 size; // number of bytes to read
|
||||
} debug_nub_read_memory;
|
||||
|
||||
typedef struct {
|
||||
status_t error; // B_OK, if reading went fine
|
||||
int32 size; // the number of bytes actually read
|
||||
// > 0, iff error == B_OK
|
||||
char data[B_MAX_READ_WRITE_MEMORY_SIZE];
|
||||
// the read data
|
||||
} debug_nub_read_memory_reply;
|
||||
|
||||
// B_DEBUG_MESSAGE_WRITE_MEMORY
|
||||
|
||||
typedef struct {
|
||||
port_id reply_port; // port to send the reply to
|
||||
void *address; // address to which to write
|
||||
int32 size; // number of bytes to write
|
||||
char data[B_MAX_READ_WRITE_MEMORY_SIZE];
|
||||
// data to write
|
||||
} debug_nub_write_memory;
|
||||
|
||||
typedef struct {
|
||||
status_t error; // B_OK, if writing went fine
|
||||
int32 size; // the number of bytes actually written
|
||||
} debug_nub_write_memory_reply;
|
||||
|
||||
// B_DEBUG_MESSAGE_SET_TEAM_FLAGS
|
||||
|
||||
typedef struct {
|
||||
int32 flags; // the new team debugging flags
|
||||
} debug_nub_set_team_flags;
|
||||
|
||||
// B_DEBUG_MESSAGE_SET_THREAD_FLAGS
|
||||
|
||||
typedef struct {
|
||||
thread_id thread; // the thread
|
||||
int32 flags; // the new thread debugging flags
|
||||
} debug_nub_set_thread_flags;
|
||||
|
||||
// B_DEBUG_MESSAGE_CONTINUE_THREAD
|
||||
|
||||
typedef struct {
|
||||
thread_id thread; // the thread
|
||||
uint32 handle_event; // how to handle the occurred event
|
||||
bool single_step; // true == single step, false == run full speed
|
||||
} debug_nub_continue_thread;
|
||||
|
||||
// B_DEBUG_MESSAGE_SET_CPU_STATE
|
||||
|
||||
typedef struct {
|
||||
thread_id thread; // the thread
|
||||
debug_cpu_state cpu_state; // the new CPU state
|
||||
} debug_nub_set_cpu_state;
|
||||
|
||||
// B_DEBUG_MESSAGE_GET_CPU_STATE
|
||||
|
||||
typedef struct {
|
||||
port_id reply_port; // port to send the reply to
|
||||
thread_id thread; // the thread
|
||||
} debug_nub_get_cpu_state;
|
||||
|
||||
typedef struct {
|
||||
status_t error; // != B_OK, if something went wrong
|
||||
// (bad thread ID, thread not stopped)
|
||||
debug_debugger_message message; // the reason why the thread stopped
|
||||
debug_cpu_state cpu_state; // the thread's CPU state
|
||||
} debug_nub_get_cpu_state_reply;
|
||||
|
||||
// B_DEBUG_MESSAGE_SET_BREAKPOINT
|
||||
|
||||
typedef struct {
|
||||
port_id reply_port; // port to send the reply to
|
||||
void *address; // breakpoint address
|
||||
} debug_nub_set_breakpoint;
|
||||
|
||||
typedef struct {
|
||||
status_t error; // B_OK, if the breakpoint has been set
|
||||
// successfully
|
||||
} debug_nub_set_breakpoint_reply;
|
||||
|
||||
// B_DEBUG_MESSAGE_CLEAR_BREAKPOINT
|
||||
|
||||
typedef struct {
|
||||
void *address; // breakpoint address
|
||||
} debug_nub_clear_breakpoint;
|
||||
|
||||
// B_DEBUG_MESSAGE_SET_WATCHPOINT
|
||||
|
||||
typedef struct {
|
||||
port_id reply_port; // port to send the reply to
|
||||
void *address; // watchpoint address
|
||||
uint32 type; // watchpoint type (see type constants above)
|
||||
int32 length; // number of bytes to watch (typically 1, 2,
|
||||
// 4); architecture specific alignment
|
||||
// restrictions apply.
|
||||
} debug_nub_set_watchpoint;
|
||||
|
||||
typedef struct {
|
||||
status_t error; // B_OK, if the watchpoint has been set
|
||||
// successfully
|
||||
} debug_nub_set_watchpoint_reply;
|
||||
|
||||
// B_DEBUG_MESSAGE_CLEAR_WATCHPOINT
|
||||
|
||||
typedef struct {
|
||||
void *address; // watchpoint address
|
||||
} debug_nub_clear_watchpoint;
|
||||
|
||||
// B_DEBUG_MESSAGE_SET_SIGNAL_MASKS
|
||||
|
||||
typedef struct {
|
||||
thread_id thread; // the thread
|
||||
uint64 ignore_mask; // the mask for signals the
|
||||
// debugger wishes not to be
|
||||
// notified of
|
||||
uint64 ignore_once_mask; // the mask for signals the
|
||||
// debugger wishes not to be
|
||||
// notified of when they next
|
||||
// occur
|
||||
debug_signal_mask_op ignore_op; // what to do with ignore_mask
|
||||
debug_signal_mask_op ignore_once_op; // what to do with
|
||||
// ignore_once_mask
|
||||
} debug_nub_set_signal_masks;
|
||||
|
||||
// B_DEBUG_MESSAGE_GET_SIGNAL_MASKS
|
||||
|
||||
typedef struct {
|
||||
port_id reply_port; // port to send the reply to
|
||||
thread_id thread; // the thread
|
||||
} debug_nub_get_signal_masks;
|
||||
|
||||
typedef struct {
|
||||
status_t error; // B_OK, if the thread exists
|
||||
uint64 ignore_mask; // the mask for signals the debugger wishes
|
||||
// not to be notified of
|
||||
uint64 ignore_once_mask; // the mask for signals the debugger wishes
|
||||
// not to be notified of when they next
|
||||
// occur
|
||||
} debug_nub_get_signal_masks_reply;
|
||||
|
||||
// B_DEBUG_MESSAGE_SET_SIGNAL_HANDLER
|
||||
|
||||
typedef struct {
|
||||
thread_id thread; // the thread
|
||||
int signal; // the signal
|
||||
struct sigaction handler; // the new signal handler
|
||||
} debug_nub_set_signal_handler;
|
||||
|
||||
// B_DEBUG_MESSAGE_GET_SIGNAL_HANDLER
|
||||
|
||||
typedef struct {
|
||||
port_id reply_port; // port to send the reply to
|
||||
thread_id thread; // the thread
|
||||
int signal; // the signal
|
||||
} debug_nub_get_signal_handler;
|
||||
|
||||
typedef struct {
|
||||
status_t error; // B_OK, if the thread exists
|
||||
struct sigaction handler; // the signal handler
|
||||
} debug_nub_get_signal_handler_reply;
|
||||
|
||||
// B_DEBUG_MESSAGE_PREPARE_HANDOVER
|
||||
|
||||
// no parameters, no reply
|
||||
|
||||
// union of all messages structures sent to the debug nub thread
|
||||
typedef union {
|
||||
debug_nub_read_memory read_memory;
|
||||
debug_nub_write_memory write_memory;
|
||||
debug_nub_set_team_flags set_team_flags;
|
||||
debug_nub_set_thread_flags set_thread_flags;
|
||||
debug_nub_continue_thread continue_thread;
|
||||
debug_nub_set_cpu_state set_cpu_state;
|
||||
debug_nub_get_cpu_state get_cpu_state;
|
||||
debug_nub_set_breakpoint set_breakpoint;
|
||||
debug_nub_clear_breakpoint clear_breakpoint;
|
||||
debug_nub_set_watchpoint set_watchpoint;
|
||||
debug_nub_clear_watchpoint clear_watchpoint;
|
||||
debug_nub_set_signal_masks set_signal_masks;
|
||||
debug_nub_get_signal_masks get_signal_masks;
|
||||
debug_nub_set_signal_handler set_signal_handler;
|
||||
debug_nub_get_signal_handler get_signal_handler;
|
||||
} debug_nub_message_data;
|
||||
|
||||
|
||||
// #pragma mark -
|
||||
// #pragma mark ----- messages to the debugger -----
|
||||
|
||||
// first member of all debugger messages -- not a message by itself
|
||||
typedef struct {
|
||||
thread_id thread; // the thread being the event origin
|
||||
team_id team; // the thread's team
|
||||
port_id nub_port; // port to debug nub for this team (only set
|
||||
// for synchronous messages)
|
||||
} debug_origin;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_THREAD_DEBUGGED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
} debug_thread_debugged;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_DEBUGGER_CALL
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
void *message; // address of the message passed to
|
||||
// debugger()
|
||||
} debug_debugger_call;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_BREAKPOINT_HIT
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
debug_cpu_state cpu_state; // cpu state
|
||||
bool software; // true, if the is a software breakpoint
|
||||
// (i.e. caused by a respective trap
|
||||
// instruction)
|
||||
} debug_breakpoint_hit;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_WATCHPOINT_HIT
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
debug_cpu_state cpu_state; // cpu state
|
||||
} debug_watchpoint_hit;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_SINGLE_STEP
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
debug_cpu_state cpu_state; // cpu state
|
||||
} debug_single_step;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_PRE_SYSCALL
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
uint32 syscall; // the syscall number
|
||||
uint32 args[16]; // syscall arguments
|
||||
} debug_pre_syscall;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_POST_SYSCALL
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
bigtime_t start_time; // time of syscall start
|
||||
bigtime_t end_time; // time of syscall completion
|
||||
uint64 return_value; // the syscall's return value
|
||||
uint32 syscall; // the syscall number
|
||||
uint32 args[16]; // syscall arguments
|
||||
} debug_post_syscall;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_SIGNAL_RECEIVED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
int signal; // the signal
|
||||
struct sigaction handler; // the signal handler
|
||||
bool deadly; // true, if handling the signal will kill
|
||||
// the team
|
||||
} debug_signal_received;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
debug_exception_type exception; // the exception
|
||||
int signal; // the signal that will be sent,
|
||||
// when the thread continues
|
||||
// normally
|
||||
} debug_exception_occurred;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_TEAM_CREATED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
team_id new_team; // the newly created team
|
||||
} debug_team_created;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_TEAM_DELETED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin; // thread is < 0, team is the deleted team
|
||||
// (asynchronous message)
|
||||
} debug_team_deleted;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_THREAD_CREATED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin; // the thread that created the new thread
|
||||
team_id new_thread; // the newly created thread
|
||||
} debug_thread_created;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_THREAD_DELETED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin; // the deleted thread (asynchronous message)
|
||||
} debug_thread_deleted;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_IMAGE_CREATED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
image_info info; // info for the image
|
||||
} debug_image_created;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_IMAGE_DELETED
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin;
|
||||
image_info info; // info for the image
|
||||
} debug_image_deleted;
|
||||
|
||||
// B_DEBUGGER_MESSAGE_HANDED_OVER
|
||||
|
||||
typedef struct {
|
||||
debug_origin origin; // thread is < 0, team is the deleted team
|
||||
// (asynchronous message)
|
||||
team_id debugger; // the new debugger
|
||||
port_id debugger_port; // the port the new debugger uses
|
||||
} debug_handed_over;
|
||||
|
||||
// union of all messages structures sent to the debugger
|
||||
typedef union {
|
||||
debug_thread_debugged thread_debugged;
|
||||
debug_debugger_call debugger_call;
|
||||
debug_breakpoint_hit breakpoint_hit;
|
||||
debug_watchpoint_hit watchpoint_hit;
|
||||
debug_single_step single_step;
|
||||
debug_pre_syscall pre_syscall;
|
||||
debug_post_syscall post_syscall;
|
||||
debug_signal_received signal_received;
|
||||
debug_exception_occurred exception_occurred;
|
||||
debug_team_created team_created;
|
||||
debug_team_deleted team_deleted;
|
||||
debug_thread_created thread_created;
|
||||
debug_thread_deleted thread_deleted;
|
||||
debug_image_created image_created;
|
||||
debug_image_deleted image_deleted;
|
||||
debug_handed_over handed_over;
|
||||
|
||||
debug_origin origin; // for convenience (no real message)
|
||||
} debug_debugger_message_data;
|
||||
|
||||
|
||||
extern void get_debug_message_string(debug_debugger_message message,
|
||||
char *buffer, int32 bufferSize);
|
||||
extern void get_debug_exception_string(debug_exception_type exception,
|
||||
char *buffer, int32 bufferSize);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif // _DEBUGGER_H
|
||||
@@ -1,81 +0,0 @@
|
||||
/* Disk device iteration and information
|
||||
**
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef _FS_DEVICE_H
|
||||
#define _FS_DEVICE_H
|
||||
|
||||
|
||||
#include <Drivers.h>
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
// session flags
|
||||
enum {
|
||||
B_DATA_SESSION = 0x01, /* data session */
|
||||
B_VIRTUAL_SESSION = 0x02, /* e.g. hard disk */
|
||||
};
|
||||
|
||||
typedef struct session_info {
|
||||
off_t offset; /* offset from start of device (in bytes) */
|
||||
off_t size; /* size (in bytes) */
|
||||
int32 logical_block_size; /* logical block size (in bytes) */
|
||||
int32 index; /* session index */
|
||||
uint32 flags; /* session flags */
|
||||
} session_info;
|
||||
|
||||
// partition flags
|
||||
enum {
|
||||
B_HIDDEN_PARTITION = 0x01, /* non-file system partition */
|
||||
B_VIRTUAL_PARTITION = 0x02, /* e.g. floppy */
|
||||
B_EMPTY_PARTITION = 0x04, /* empty partition, implies
|
||||
B_HIDDEN_PARTITION */
|
||||
};
|
||||
|
||||
typedef struct extended_partition_info {
|
||||
partition_info info;
|
||||
uint32 flags; /* partition flags */
|
||||
char partition_name[B_FILE_NAME_LENGTH];
|
||||
char partition_type[B_FILE_NAME_LENGTH];
|
||||
char file_system_short_name[B_FILE_NAME_LENGTH]; /* "", if hidden */
|
||||
char file_system_long_name[B_FILE_NAME_LENGTH]; /* or unknown FS */
|
||||
char volume_name[B_FILE_NAME_LENGTH]; /* "", if hidden */
|
||||
uint32 file_system_flags; /* same as fs_info::flags */
|
||||
} extended_partition_info;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// getting infos
|
||||
status_t get_nth_session_info(int deviceFD, int32 index,
|
||||
session_info *sessionInfo);
|
||||
status_t get_nth_partition_info(int deviceFD, int32 sessionIndex,
|
||||
int32 partitionIndex,
|
||||
extended_partition_info *partitionInfo,
|
||||
char *partitionMapName);
|
||||
|
||||
// partitioning
|
||||
status_t get_partitioning_parameters(int deviceFD, int32 sessionIndex,
|
||||
const char *identifier, char *buffer,
|
||||
size_t bufferSize, size_t *actualSize);
|
||||
status_t partition_session(int deviceFD, int32 sessionIndex,
|
||||
const char *identifier, const char *parameters);
|
||||
|
||||
// initialization
|
||||
status_t get_fs_initialization_parameters(int deviceFD, int32 sessionIndex,
|
||||
int32 partitionIndex,
|
||||
const char *fileSystem, char *buffer,
|
||||
size_t bufferSize,
|
||||
size_t *actualSize);
|
||||
// TODO: Move to <unistd.h>. It fits better there.
|
||||
status_t initialize_volume(const char *where, const char *fileSystem,
|
||||
const char *volumeName, const char *parameters);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FS_DEVICE_H */
|
||||
@@ -1,40 +0,0 @@
|
||||
/* File System indices
|
||||
**
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef _FS_INDEX_H
|
||||
#define _FS_INDEX_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <dirent.h>
|
||||
|
||||
|
||||
typedef struct index_info {
|
||||
uint32 type;
|
||||
off_t size;
|
||||
time_t modification_time;
|
||||
time_t creation_time;
|
||||
uid_t uid;
|
||||
gid_t gid;
|
||||
} index_info;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int fs_create_index(dev_t device, const char *name, uint32 type, uint32 flags);
|
||||
extern int fs_remove_index(dev_t device, const char *name);
|
||||
extern int fs_stat_index(dev_t device, const char *name, struct index_info *indexInfo);
|
||||
|
||||
extern DIR *fs_open_index_dir(dev_t device);
|
||||
extern int fs_close_index_dir(DIR *indexDirectory);
|
||||
extern struct dirent *fs_read_index_dir(DIR *indexDirectory);
|
||||
extern void fs_rewind_index_dir(DIR *indexDirectory);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FS_INDEX_H */
|
||||
@@ -1,41 +0,0 @@
|
||||
/* File System attribute queries
|
||||
**
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
#ifndef _FS_QUERY_H
|
||||
#define _FS_QUERY_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
#include <dirent.h>
|
||||
|
||||
|
||||
/* Flags for fs_open_[live_]query() */
|
||||
|
||||
#define B_LIVE_QUERY 0x00000001
|
||||
// Note, if you specify B_LIVE_QUERY, you have to use fs_open_live_query();
|
||||
// it will be ignored in fs_open_query().
|
||||
#define B_QUERY_NON_INDEXED 0x00000002
|
||||
// Only enable this feature for non time-critical things, it might
|
||||
// take a long time to proceed.
|
||||
// Also, not every file system might support this feature.
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern DIR *fs_open_query(dev_t device, const char *query, uint32 flags);
|
||||
extern DIR *fs_open_live_query(dev_t device, const char *query,
|
||||
uint32 flags, port_id port, int32 token);
|
||||
extern int fs_close_query(DIR *d);
|
||||
extern struct dirent *fs_read_query(DIR *d);
|
||||
|
||||
extern status_t get_path_for_dirent(struct dirent *dent, char *buf,
|
||||
size_t len);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FS_QUERY_H */
|
||||
@@ -1,31 +0,0 @@
|
||||
/* File System volume functions
|
||||
**
|
||||
** Distributed under the terms of the Haiku License.
|
||||
*/
|
||||
#ifndef _FS_VOLUME_H
|
||||
#define _FS_VOLUME_H
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
/* mount flags */
|
||||
#define B_MOUNT_READ_ONLY 1
|
||||
#define B_MOUNT_VIRTUAL_DEVICE 2
|
||||
|
||||
/* unmount flags */
|
||||
#define B_FORCE_UNMOUNT 1
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern status_t fs_mount_volume(const char *where, const char *device,
|
||||
const char *filesystem, uint32 flags, const char *parameters);
|
||||
extern status_t fs_unmount_volume(const char *path, uint32 flags);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _FS_VOLUME_H */
|
||||
@@ -1,54 +0,0 @@
|
||||
/*****************************************************************************
|
||||
|
||||
File: scheduler.h
|
||||
|
||||
Description: Scheduling inquiry functions
|
||||
|
||||
Copyright 1998-, Be Incorporated, All Rights Reserved.
|
||||
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
#if !defined(SCHEDULER_H)
|
||||
#define SCHEDULER_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
/* To get a good thread priority, call suggest_thread_priority() with the following information: */
|
||||
/* 'what' is a bit mask describing what you're doing in the thread. */
|
||||
/* 'period' is how many times a second your thread needs to run (-1 if you're running continuously.) */
|
||||
/* 'jitter' is an estimate (in us) of how much that period can vary, as long as it stays centered on the average. */
|
||||
/* 'length' is how long (in us) you expect to run for each invocation. */
|
||||
/* "invocation" means, typically, receiving a message, dispatching it, and then returning to reading a message. */
|
||||
/* MANIPULATION means both filtering and compression/decompression. */
|
||||
/* PLAYBACK and RECORDING means threads feeding/reading ACTUAL HARDWARE ONLY. */
|
||||
/* 0 means don't care */
|
||||
enum be_task_flags { /* bitmasks for "what" */
|
||||
B_DEFAULT_MEDIA_PRIORITY = 0,
|
||||
B_OFFLINE_PROCESSING = 0x1,
|
||||
B_STATUS_RENDERING = 0x2, /* can also use this for "preview" type things */
|
||||
B_USER_INPUT_HANDLING = 0x4,
|
||||
B_LIVE_VIDEO_MANIPULATION = 0x8, /* non-live processing is OFFLINE_PROCESSING */
|
||||
B_VIDEO_PLAYBACK = 0x10, /* feeding hardware */
|
||||
B_VIDEO_RECORDING = 0x20, /* grabbing from hardware */
|
||||
B_LIVE_AUDIO_MANIPULATION = 0x40, /* non-live processing is OFFLINE_PROCESSING */
|
||||
B_AUDIO_PLAYBACK = 0x80, /* feeding hardware */
|
||||
B_AUDIO_RECORDING = 0x100, /* grabbing from hardware */
|
||||
B_LIVE_3D_RENDERING = 0x200, /* non-live rendering is OFFLINE_PROCESSING */
|
||||
B_NUMBER_CRUNCHING = 0x400,
|
||||
B_MIDI_PROCESSING = 0x800
|
||||
};
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
_IMPEXP_ROOT int32 suggest_thread_priority(uint32 task_flags = B_DEFAULT_MEDIA_PRIORITY,
|
||||
int32 period = 0, bigtime_t jitter = 0, bigtime_t length = 0);
|
||||
_IMPEXP_ROOT bigtime_t estimate_max_scheduling_latency(thread_id th = -1); /* default is current thread */
|
||||
}
|
||||
#else
|
||||
_IMPEXP_ROOT int32 suggest_thread_priority(uint32 what, int32 period, bigtime_t jitter, bigtime_t length);
|
||||
_IMPEXP_ROOT bigtime_t estimate_max_scheduling_latency(thread_id th); /* default is current thread */
|
||||
#endif
|
||||
|
||||
#endif /* SCHEDULER_H */
|
||||
|
||||
@@ -1,151 +0,0 @@
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: FilePanel.h
|
||||
/
|
||||
/ Description: BFilePanel and BRefFilter classes, and
|
||||
/ run_open_panel()/run_save_panel functions.
|
||||
/
|
||||
/ Copyright 1993-98, Be Incorporated, All Rights Reserved.
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef _FILE_PANEL_H
|
||||
#define _FILE_PANEL_H
|
||||
|
||||
#ifndef _BE_BUILD_H
|
||||
#include <BeBuild.h>
|
||||
#endif
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <Entry.h>
|
||||
#include <Directory.h>
|
||||
#include <Node.h>
|
||||
|
||||
|
||||
/*- Old fashioned, one-shot, heavily-defaulted panel functions. -*/
|
||||
|
||||
extern _IMPEXP_TRACKER void run_open_panel();
|
||||
extern _IMPEXP_TRACKER void run_save_panel();
|
||||
|
||||
|
||||
/*---BRefFilter--------------------------------------------------*/
|
||||
|
||||
/* BRefFilter is used by BFilePanel. Every time the user selects
|
||||
* an item in a file panel, the Filter() func is sent to the
|
||||
* panel's BRefFilter object. Filter()'s return value determines
|
||||
* whether the item is admitted into the panel's list of
|
||||
* displayed items. Optional.
|
||||
*/
|
||||
class BRefFilter {
|
||||
public:
|
||||
virtual bool Filter(const entry_ref *, BNode *, struct stat *,
|
||||
const char *mimetype) = 0;
|
||||
};
|
||||
|
||||
|
||||
/*---File Panel constants etc------------------------------------*/
|
||||
|
||||
enum file_panel_mode {
|
||||
B_OPEN_PANEL,
|
||||
B_SAVE_PANEL
|
||||
};
|
||||
|
||||
enum file_panel_button {
|
||||
B_CANCEL_BUTTON,
|
||||
B_DEFAULT_BUTTON
|
||||
};
|
||||
|
||||
class BWindow;
|
||||
class BMessenger;
|
||||
class BMessage;
|
||||
|
||||
/*---------------------------------------------------------------*/
|
||||
/*----BFilePanel-------------------------------------------------*/
|
||||
|
||||
/* Most of the contructor parameters can also be set through individual
|
||||
* funcs. But these can't:
|
||||
*
|
||||
* file_panel_mode mode
|
||||
* uint32 node_flavors
|
||||
* bool modal
|
||||
*/
|
||||
|
||||
class BFilePanel {
|
||||
|
||||
public:
|
||||
BFilePanel(file_panel_mode mode = B_OPEN_PANEL,
|
||||
BMessenger *target = 0,
|
||||
const entry_ref *start_directory = 0,
|
||||
uint32 node_flavors = 0,
|
||||
bool allow_multiple_selection = true,
|
||||
BMessage *message = 0,
|
||||
BRefFilter * = 0,
|
||||
bool modal = false,
|
||||
bool hide_when_done = true);
|
||||
|
||||
virtual ~BFilePanel();
|
||||
|
||||
void Show();
|
||||
void Hide();
|
||||
bool IsShowing() const;
|
||||
|
||||
virtual void WasHidden();
|
||||
virtual void SelectionChanged();
|
||||
virtual void SendMessage(const BMessenger*, BMessage*);
|
||||
|
||||
BWindow* Window() const;
|
||||
BMessenger Messenger() const;
|
||||
BRefFilter* RefFilter() const;
|
||||
void GetPanelDirectory(entry_ref *) const;
|
||||
|
||||
file_panel_mode PanelMode() const;
|
||||
|
||||
void SetTarget(BMessenger);
|
||||
void SetMessage(BMessage *msg);
|
||||
|
||||
void SetRefFilter(BRefFilter* filter);
|
||||
void SetSaveText(const char* text);
|
||||
void SetButtonLabel(file_panel_button, const char *label);
|
||||
|
||||
void SetPanelDirectory(const BEntry *new_directory);
|
||||
void SetPanelDirectory(const BDirectory *new_directory);
|
||||
void SetPanelDirectory(const entry_ref *new_directory);
|
||||
void SetPanelDirectory(const char *new_directory);
|
||||
|
||||
void SetHideWhenDone(bool);
|
||||
bool HidesWhenDone(void) const;
|
||||
|
||||
void Refresh();
|
||||
void Rewind();
|
||||
status_t GetNextSelectedRef(entry_ref*);
|
||||
|
||||
private:
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
virtual void _ReservedFilePanel1();
|
||||
virtual void _ReservedFilePanel2();
|
||||
virtual void _ReservedFilePanel3();
|
||||
virtual void _ReservedFilePanel4();
|
||||
virtual void _ReservedFilePanel5();
|
||||
virtual void _ReservedFilePanel6();
|
||||
virtual void _ReservedFilePanel7();
|
||||
virtual void _ReservedFilePanel8();
|
||||
#endif
|
||||
|
||||
BWindow *fWindow;
|
||||
|
||||
#if !_PR3_COMPATIBLE_
|
||||
uint32 _reserved[10];
|
||||
#endif
|
||||
|
||||
public:
|
||||
// deprecated calls, do not use
|
||||
BFilePanel(file_panel_mode mode, BMessenger *, entry_ref *,
|
||||
uint32 , bool, BMessage *, BRefFilter *, bool modal,
|
||||
bool hide_when_done);
|
||||
void SetPanelDirectory(BEntry*);
|
||||
void SetPanelDirectory(BDirectory*);
|
||||
void SetPanelDirectory(entry_ref*);
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,123 +0,0 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file Query.h
|
||||
BQuery interface declaration.
|
||||
*/
|
||||
|
||||
#ifndef _QUERY_H
|
||||
#define _QUERY_H
|
||||
|
||||
#include <EntryList.h>
|
||||
#include <Messenger.h>
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
class BVolume;
|
||||
struct entry_ref;
|
||||
|
||||
namespace BPrivate {
|
||||
namespace Storage {
|
||||
class QueryNode;
|
||||
class QueryStack;
|
||||
class QueryTree;
|
||||
};
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
B_INVALID_OP = 0,
|
||||
B_EQ,
|
||||
B_GT,
|
||||
B_GE,
|
||||
B_LT,
|
||||
B_LE,
|
||||
B_NE,
|
||||
B_CONTAINS,
|
||||
B_BEGINS_WITH,
|
||||
B_ENDS_WITH,
|
||||
B_AND = 0x101,
|
||||
B_OR,
|
||||
B_NOT,
|
||||
_B_RESERVED_OP_ = 0x100000
|
||||
} query_op;
|
||||
|
||||
/*!
|
||||
\class BQuery
|
||||
\brief Represents a live or non-live file system query
|
||||
|
||||
Provides an interface for creating file system queries. Implements
|
||||
the BEntryList for iterating through the found entries.
|
||||
|
||||
\author <a href='mailto:[email protected]'>Ingo Weinhold</a>
|
||||
|
||||
\version 0.0.0
|
||||
*/
|
||||
class BQuery : public BEntryList {
|
||||
public:
|
||||
BQuery();
|
||||
virtual ~BQuery();
|
||||
|
||||
status_t Clear();
|
||||
|
||||
status_t PushAttr(const char *attrName);
|
||||
status_t PushOp(query_op op);
|
||||
|
||||
status_t PushUInt32(uint32 value);
|
||||
status_t PushInt32(int32 value);
|
||||
status_t PushUInt64(uint64 value);
|
||||
status_t PushInt64(int64 value);
|
||||
status_t PushFloat(float value);
|
||||
status_t PushDouble(double value);
|
||||
status_t PushString(const char *value, bool caseInsensitive = false);
|
||||
status_t PushDate(const char *date);
|
||||
|
||||
status_t SetVolume(const BVolume *volume);
|
||||
status_t SetPredicate(const char *expression);
|
||||
status_t SetTarget(BMessenger messenger);
|
||||
|
||||
bool IsLive() const;
|
||||
|
||||
status_t GetPredicate(char *buffer, size_t length);
|
||||
status_t GetPredicate(BString *predicate);
|
||||
size_t PredicateLength();
|
||||
|
||||
dev_t TargetDevice() const;
|
||||
|
||||
status_t Fetch();
|
||||
|
||||
// BEntryList interface
|
||||
virtual status_t GetNextEntry(BEntry *entry, bool traverse = false);
|
||||
virtual status_t GetNextRef(entry_ref *ref);
|
||||
virtual int32 GetNextDirents(struct dirent *buf, size_t length,
|
||||
int32 count = INT_MAX);
|
||||
virtual status_t Rewind();
|
||||
virtual int32 CountEntries();
|
||||
|
||||
private:
|
||||
bool _HasFetched() const;
|
||||
status_t _PushNode(BPrivate::Storage::QueryNode *node, bool deleteOnError);
|
||||
status_t _SetPredicate(const char *expression);
|
||||
status_t _EvaluateStack();
|
||||
|
||||
// FBC
|
||||
virtual void _QwertyQuery1();
|
||||
virtual void _QwertyQuery2();
|
||||
virtual void _QwertyQuery3();
|
||||
virtual void _QwertyQuery4();
|
||||
virtual void _QwertyQuery5();
|
||||
virtual void _QwertyQuery6();
|
||||
|
||||
private:
|
||||
int32 _reservedData[4]; // FBC
|
||||
BPrivate::Storage::QueryStack *fStack;
|
||||
char *fPredicate;
|
||||
dev_t fDevice;
|
||||
bool fLive;
|
||||
port_id fPort;
|
||||
long fToken;
|
||||
int fQueryFd;
|
||||
};
|
||||
|
||||
#endif // _QUERY_H
|
||||
@@ -1,54 +0,0 @@
|
||||
// ----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//
|
||||
// File Name: VolumeRoster.h
|
||||
//
|
||||
// Description: BVolumeRoster class
|
||||
// ----------------------------------------------------------------------
|
||||
/*!
|
||||
\file VolumeRoster.h
|
||||
BVolumeRoster interface declarations.
|
||||
*/
|
||||
#ifndef _VOLUME_ROSTER_H
|
||||
#define _VOLUME_ROSTER_H
|
||||
|
||||
#include <Application.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Volume.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BVolume;
|
||||
class BMessenger;
|
||||
|
||||
class BVolumeRoster {
|
||||
public:
|
||||
BVolumeRoster();
|
||||
virtual ~BVolumeRoster();
|
||||
|
||||
status_t GetNextVolume(BVolume *volume);
|
||||
void Rewind();
|
||||
|
||||
status_t GetBootVolume(BVolume *volume);
|
||||
|
||||
status_t StartWatching(BMessenger messenger = be_app_messenger);
|
||||
void StopWatching();
|
||||
BMessenger Messenger() const;
|
||||
|
||||
private:
|
||||
virtual void _SeveredVRoster1();
|
||||
virtual void _SeveredVRoster2();
|
||||
|
||||
int32 fCookie;
|
||||
BMessenger *fTarget;
|
||||
uint32 _reserved[3];
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _VOLUME_ROSTER_H
|
||||
@@ -1,79 +0,0 @@
|
||||
//
|
||||
// $Id: Autolock.h 3246 2003-05-14 17:21:46Z haydentech $
|
||||
//
|
||||
// This is the BAutolock interface for OpenBeOS. It has been created to
|
||||
// be source and binary compatible with the BeOS version of BAutolock.
|
||||
// To that end, all members are inline just as with the BeOS version.
|
||||
//
|
||||
|
||||
|
||||
#ifndef _OPENBEOS_AUTOLOCK_H
|
||||
#define _OPENBEOS_AUTOLOCK_H
|
||||
|
||||
|
||||
#include <Locker.h>
|
||||
#include <Looper.h>
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BAutolock {
|
||||
public:
|
||||
inline BAutolock(BLooper *looper);
|
||||
inline BAutolock(BLocker *locker);
|
||||
inline BAutolock(BLocker &locker);
|
||||
|
||||
inline ~BAutolock();
|
||||
|
||||
inline bool IsLocked(void);
|
||||
|
||||
private:
|
||||
BLocker *fTheLocker;
|
||||
BLooper *fTheLooper;
|
||||
bool fIsLocked;
|
||||
};
|
||||
|
||||
|
||||
inline BAutolock::BAutolock(BLooper *looper) :
|
||||
fTheLocker(NULL), fTheLooper(looper), fIsLocked(looper->Lock())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline BAutolock::BAutolock(BLocker *locker) :
|
||||
fTheLocker(locker), fTheLooper(NULL), fIsLocked(locker->Lock())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline BAutolock::BAutolock(BLocker &locker) :
|
||||
fTheLocker(&locker), fTheLooper(NULL), fIsLocked(locker.Lock())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
inline BAutolock::~BAutolock()
|
||||
{
|
||||
if (fIsLocked) {
|
||||
if (fTheLooper != NULL) {
|
||||
fTheLooper->Unlock();
|
||||
} else {
|
||||
fTheLocker->Unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
inline bool BAutolock::IsLocked()
|
||||
{
|
||||
return fIsLocked;
|
||||
}
|
||||
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _OPENBEOS_LOCKER_H
|
||||
@@ -1,22 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _BEEP_H
|
||||
#define _BEEP_H
|
||||
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
// These functions are only exported for C++
|
||||
|
||||
status_t beep();
|
||||
status_t system_beep(const char* eventName);
|
||||
status_t add_system_beep_event(const char* eventName, uint32 flags = 0);
|
||||
|
||||
#endif
|
||||
|
||||
#endif // _BEEP_H
|
||||
@@ -1,24 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _CLASS_INFO_H
|
||||
#define _CLASS_INFO_H
|
||||
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
|
||||
// deprecated, use standard RTTI calls instead
|
||||
// TODO: maybe get rid of this header completely?
|
||||
|
||||
#define class_name(object) \
|
||||
((typeid(*(object))).name())
|
||||
#define cast_as(object, class) \
|
||||
(dynamic_cast<class*>(object))
|
||||
#define is_kind_of(object, class) \
|
||||
(dynamic_cast<class*>(object) != NULL)
|
||||
#define is_instance_of(object, class) \
|
||||
(typeid(*(object)) == typeid(class))
|
||||
|
||||
#endif // _CLASS_INFO_H
|
||||
@@ -1,41 +0,0 @@
|
||||
#ifndef _BLUE_STOP_WATCH_H
|
||||
#define _BLUE_STOP_WATCH_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
namespace OpenBeOS {
|
||||
#endif
|
||||
|
||||
class BStopWatch {
|
||||
public:
|
||||
BStopWatch(const char *name, bool silent = false);
|
||||
virtual ~BStopWatch();
|
||||
|
||||
void Suspend();
|
||||
void Resume();
|
||||
bigtime_t Lap();
|
||||
bigtime_t ElapsedTime() const;
|
||||
void Reset();
|
||||
const char *Name() const;
|
||||
|
||||
private:
|
||||
virtual void _ReservedStopWatch1();
|
||||
virtual void _ReservedStopWatch2();
|
||||
|
||||
bigtime_t fStart;
|
||||
bigtime_t fSuspendTime;
|
||||
bigtime_t fLaps[10];
|
||||
int32 fLap;
|
||||
const char *fName;
|
||||
uint32 _reserved[2]; // these are for fName to be initiased
|
||||
bool fSilent;
|
||||
};
|
||||
|
||||
#ifdef USE_OPENBEOS_NAMESPACE
|
||||
} // namespace OpenBeOS
|
||||
using namespace OpenBeOS;
|
||||
#endif
|
||||
|
||||
#endif /* _STOP_WATCH_H */
|
||||
@@ -1,65 +0,0 @@
|
||||
#ifndef _TLS_H
|
||||
#define _TLS_H
|
||||
/*
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
/* A maximum of 64 keys is allowed to store in TLS - the key is reserved
|
||||
* process-wide. Note that tls_allocate() will return B_NO_MEMORY if you
|
||||
* try to exceed this limit.
|
||||
*/
|
||||
#define TLS_MAX_KEYS 64
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern int32 tls_allocate(void);
|
||||
|
||||
#if !_NO_INLINE_ASM && __INTEL__ && __GNUC__
|
||||
|
||||
static inline void *
|
||||
tls_get(int32 index)
|
||||
{
|
||||
void *ret;
|
||||
__asm__ __volatile__ (
|
||||
"movl %%fs:(,%%edx, 4), %%eax \n\t"
|
||||
: "=a"(ret) : "d"(index) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void **
|
||||
tls_address(int32 index)
|
||||
{
|
||||
void **ret;
|
||||
__asm__ __volatile__ (
|
||||
"movl %%fs:0, %%eax \n\t"
|
||||
"leal (%%eax, %%edx, 4), %%eax \n\t"
|
||||
: "=a"(ret) : "d"(index) );
|
||||
return ret;
|
||||
}
|
||||
|
||||
static inline void
|
||||
tls_set(int32 index, void *value)
|
||||
{
|
||||
__asm__ __volatile__ (
|
||||
"movl %%eax, %%fs:(,%%edx, 4) \n\t"
|
||||
: : "d"(index), "a"(value) );
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
extern void *tls_get(int32 index);
|
||||
extern void **tls_address(int32 index);
|
||||
extern void tls_set(int32 index, void *value);
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _TLS_H */
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright 2007, Haiku, Inc. All Rights Reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef _UTF8_H
|
||||
#define _UTF8_H
|
||||
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
// Conversion Flavors
|
||||
enum {
|
||||
B_ISO1_CONVERSION, // ISO 8859-x
|
||||
B_ISO2_CONVERSION,
|
||||
B_ISO3_CONVERSION,
|
||||
B_ISO4_CONVERSION,
|
||||
B_ISO5_CONVERSION,
|
||||
B_ISO6_CONVERSION,
|
||||
B_ISO7_CONVERSION,
|
||||
B_ISO8_CONVERSION,
|
||||
B_ISO9_CONVERSION,
|
||||
B_ISO10_CONVERSION,
|
||||
B_MAC_ROMAN_CONVERSION, // Macintosh Roman
|
||||
B_SJIS_CONVERSION, // Shift-JIS
|
||||
B_EUC_CONVERSION, // EUC Packed Japanese
|
||||
B_JIS_CONVERSION, // JIS X 0208-1990
|
||||
B_MS_WINDOWS_CONVERSION, // Windows Latin-1 Codepage 1252
|
||||
B_UNICODE_CONVERSION, // Unicode 2.0, UCS-2
|
||||
B_KOI8R_CONVERSION, // KOI8-R
|
||||
B_MS_WINDOWS_1251_CONVERSION, // Windows Cyrillic Codepage 1251
|
||||
B_MS_DOS_866_CONVERSION, // MS-DOS Codepage 866
|
||||
B_MS_DOS_CONVERSION, // MS-DOS Codepage 437
|
||||
B_EUC_KR_CONVERSION, // EUC Korean
|
||||
B_ISO13_CONVERSION,
|
||||
B_ISO14_CONVERSION,
|
||||
B_ISO15_CONVERSION,
|
||||
B_BIG5_CONVERSION, // Chinese Big5
|
||||
B_GBK_CONVERSION, // Chinese GB18030
|
||||
};
|
||||
|
||||
|
||||
// Conversion Functions
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
status_t convert_to_utf8(uint32 sourceEncoding, const char* source,
|
||||
int32* sourceLength, char* dest, int32* destLength, int32* state,
|
||||
char substitute = B_SUBSTITUTE);
|
||||
|
||||
status_t convert_from_utf8(uint32 destEncoding, const char* source,
|
||||
int32* sourceLength, char* dest, int32* destLength, int32* state,
|
||||
char substitute = B_SUBSTITUTE);
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _UTF8_H */
|
||||
@@ -1,33 +0,0 @@
|
||||
#ifndef _PARSEDATE_H
|
||||
#define _PARSEDATE_H
|
||||
/*
|
||||
** Distributed under the terms of the OpenBeOS License.
|
||||
*/
|
||||
|
||||
|
||||
#include <time.h>
|
||||
|
||||
|
||||
/* flags that will be set in the flags field by parsedate_etc() */
|
||||
#define PARSEDATE_RELATIVE_TIME 0x0001
|
||||
// ToDo: the following flags are not part of the R5 implementation and preliminary only
|
||||
#define PARSEDATE_DAY_RELATIVE_TIME PARSEDATE_RELATIVE_TIME
|
||||
#define PARSEDATE_MINUTE_RELATIVE_TIME 0x0002
|
||||
#define PARSEDATE_INVALID_DATE 0x0100
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
extern time_t parsedate(const char *dateString, time_t now);
|
||||
extern time_t parsedate_etc(const char *dateString, time_t now, int *_storedFlags);
|
||||
|
||||
extern void set_dateformats(const char *table[]);
|
||||
extern const char **get_dateformats(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _PARSEDATE_H */
|
||||
@@ -1,26 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Erik Jaesler ([email protected])
|
||||
* Axel Dörfler, [email protected]
|
||||
*/
|
||||
#ifndef APPSERVERLINK_H
|
||||
#define APPSERVERLINK_H
|
||||
|
||||
|
||||
#include <PortLink.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class AppServerLink : public ServerLink {
|
||||
public:
|
||||
AppServerLink(void);
|
||||
~AppServerLink(void);
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif /* APPSERVERLINK_H */
|
||||
@@ -1,19 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ingo Weinhold <[email protected]>
|
||||
*/
|
||||
#ifndef _APPLICATION_PRIVATE_H
|
||||
#define _APPLICATION_PRIVATE_H
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
class BApplication::Private {
|
||||
public:
|
||||
static inline BPrivate::PortLink *ServerLink()
|
||||
{ return be_app->fServerLink; }
|
||||
};
|
||||
|
||||
#endif // _APPLICATION_PRIVATE_H
|
||||
@@ -1,78 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: AreaLink.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Helper class for managing chunks of small data in an area
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef AREALINK_H
|
||||
#define AREALINK_H
|
||||
|
||||
#include <List.h>
|
||||
#include <InterfaceDefs.h>
|
||||
#include <OS.h>
|
||||
|
||||
#define MAX_ATTACHMENT_SIZE 65535 // in bytes
|
||||
#define SIZE_SIZE 2 // size of the size records in an AreaLink area
|
||||
|
||||
class AreaLinkHeader;
|
||||
|
||||
class AreaLink
|
||||
{
|
||||
public:
|
||||
AreaLink(area_id area, bool is_arealink_area=false);
|
||||
AreaLink(void);
|
||||
~AreaLink(void);
|
||||
|
||||
void SetTarget(area_id area, bool is_arealink_area=false);
|
||||
area_id GetTarget(void) { return target; }
|
||||
|
||||
void Attach(const void *data, size_t size);
|
||||
inline void Attach(const int32 &data);
|
||||
inline void Attach(const int16 &data);
|
||||
inline void Attach(const int8 &data);
|
||||
inline void Attach(const float &data);
|
||||
inline void Attach(const bool &data);
|
||||
inline void Attach(const rgb_color &data);
|
||||
inline void Attach(const BRect &data);
|
||||
inline void Attach(const BPoint &data);
|
||||
|
||||
void MakeEmpty(void);
|
||||
void *ItemAt(int32 index) { return attachlist->ItemAt(index); }
|
||||
int32 CountAttachments(void) { return attachlist->CountItems(); }
|
||||
void *BaseAddress(void) { return (void *)baseaddress; }
|
||||
|
||||
void Lock(void);
|
||||
void Unlock(void);
|
||||
bool IsLocked(void);
|
||||
protected:
|
||||
void _ReadAttachments(void);
|
||||
|
||||
BList *attachlist;
|
||||
area_id target;
|
||||
bool area_ok;
|
||||
bool have_lock;
|
||||
int8 *baseaddress;
|
||||
AreaLinkHeader *header;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
// ClipboardPrivate.h
|
||||
|
||||
#ifndef _CLIPBOARD_PRIVATE_H
|
||||
#define _CLIPBOARD_PRIVATE_H
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
void init_clipboard();
|
||||
|
||||
};
|
||||
|
||||
#endif // _CLIPBOARD_PRIVATE_H
|
||||
@@ -1,59 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
* Pahtz <[email protected]>
|
||||
*/
|
||||
#ifndef _LINKMSGREADER_H
|
||||
#define _LINKMSGREADER_H
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class LinkReceiver {
|
||||
public:
|
||||
LinkReceiver(port_id port);
|
||||
virtual ~LinkReceiver(void);
|
||||
|
||||
void SetPort(port_id port);
|
||||
port_id Port(void) { return fReceivePort; }
|
||||
|
||||
status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
bool NeedsReply() const;
|
||||
int32 Code() const;
|
||||
|
||||
virtual status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
template <class Type> status_t Read(Type *data)
|
||||
{
|
||||
return Read(data, sizeof(Type));
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual status_t ReadFromPort(bigtime_t timeout);
|
||||
virtual status_t AdjustReplyBuffer(bigtime_t timeout);
|
||||
void ResetBuffer();
|
||||
|
||||
port_id fReceivePort;
|
||||
|
||||
char *fRecvBuffer;
|
||||
|
||||
int32 fRecvPosition; //current read position
|
||||
|
||||
int32 fRecvStart; //start of current message
|
||||
|
||||
int32 fRecvBufferSize;
|
||||
|
||||
int32 fDataSize; //size of data in recv buffer
|
||||
int32 fReplySize; //size of current reply message
|
||||
|
||||
status_t fReadError; //Read failed for current message
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif // _LINKMSGREADER_H
|
||||
@@ -1,63 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
* Pahtz <[email protected]>
|
||||
* Axel Dörfler, [email protected]
|
||||
*/
|
||||
#ifndef LINKMSGSENDER_H
|
||||
#define LINKMSGSENDER_H
|
||||
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class LinkSender {
|
||||
public:
|
||||
LinkSender(port_id sendport);
|
||||
virtual ~LinkSender(void);
|
||||
|
||||
void SetPort(port_id port);
|
||||
port_id Port() { return fPort; }
|
||||
|
||||
status_t StartMessage(int32 code, size_t minSize = 0);
|
||||
void CancelMessage(void);
|
||||
status_t EndMessage(bool needsReply = false);
|
||||
|
||||
status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false);
|
||||
|
||||
// see BPrivate::BAppServerLink which inherits from BPortLink
|
||||
//status_t FlushWithReply(int32 *code);
|
||||
|
||||
status_t Attach(const void *data, size_t size);
|
||||
status_t AttachString(const char *string, int32 length = -1);
|
||||
template <class Type> status_t Attach(const Type& data)
|
||||
{
|
||||
return Attach(&data, sizeof(Type));
|
||||
}
|
||||
|
||||
protected:
|
||||
size_t SpaceLeft() const { return fBufferSize - fCurrentEnd; }
|
||||
size_t CurrentMessageSize() const { return fCurrentEnd - fCurrentStart; }
|
||||
|
||||
status_t AdjustBuffer(size_t newBufferSize, char **_oldBuffer = NULL);
|
||||
status_t FlushCompleted(size_t newBufferSize);
|
||||
|
||||
port_id fPort;
|
||||
|
||||
char *fBuffer;
|
||||
size_t fBufferSize;
|
||||
|
||||
uint32 fCurrentEnd; // current append position
|
||||
uint32 fCurrentStart; // start of current message
|
||||
|
||||
status_t fCurrentStatus;
|
||||
};
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif /* LINKMSGSENDER_H */
|
||||
@@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
* Pahtz <[email protected]>
|
||||
* Axel Dörfler, [email protected]
|
||||
*/
|
||||
#ifndef _PORTLINK_H
|
||||
#define _PORTLINK_H
|
||||
|
||||
#include <OS.h>
|
||||
#include <LinkMsgReader.h>
|
||||
#include <LinkMsgSender.h>
|
||||
|
||||
/*
|
||||
Error checking rules: (for if you don't want to check every return code)
|
||||
|
||||
Calling EndMessage() is optional, implied by Flush() or StartMessage().
|
||||
|
||||
If you are sending just one message you only need to test Flush() == B_OK
|
||||
|
||||
If you are buffering multiple messages without calling Flush() you must
|
||||
check EndMessage() == B_OK, or the last Attach() for each message. Check
|
||||
Flush() at the end.
|
||||
|
||||
If you are reading, check the last Read() or ReadString() you perform.
|
||||
|
||||
*/
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class ServerLink {
|
||||
public:
|
||||
ServerLink();
|
||||
virtual ~ServerLink();
|
||||
|
||||
// send methods
|
||||
|
||||
void SetSenderPort(port_id port);
|
||||
port_id SenderPort();
|
||||
|
||||
status_t StartMessage(int32 code, size_t minSize = 0);
|
||||
void CancelMessage();
|
||||
status_t EndMessage();
|
||||
|
||||
status_t Flush(bigtime_t timeout = B_INFINITE_TIMEOUT, bool needsReply = false);
|
||||
status_t Attach(const void *data, ssize_t size);
|
||||
status_t AttachString(const char *string, int32 length = -1);
|
||||
status_t AttachRegion(const BRegion ®ion);
|
||||
status_t AttachShape(BShape &shape);
|
||||
status_t AttachGradient(const BGradient &gradient);
|
||||
template <class Type> status_t Attach(const Type& data);
|
||||
|
||||
// receive methods
|
||||
|
||||
void SetReceiverPort(port_id port);
|
||||
port_id ReceiverPort();
|
||||
|
||||
status_t GetNextMessage(int32 &code, bigtime_t timeout = B_INFINITE_TIMEOUT);
|
||||
bool NeedsReply() const;
|
||||
status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
status_t ReadRegion(BRegion *region);
|
||||
status_t ReadShape(BShape *shape);
|
||||
status_t ReadGradient(BGradient *gradient);
|
||||
template <class Type> status_t Read(Type *data);
|
||||
|
||||
// convenience methods
|
||||
|
||||
status_t FlushWithReply(int32 &code);
|
||||
LinkSender &Sender() { return *fSender; }
|
||||
LinkReceiver &Receiver() { return *fReceiver; }
|
||||
|
||||
protected:
|
||||
LinkSender *fSender;
|
||||
LinkReceiver *fReceiver;
|
||||
};
|
||||
|
||||
class PortLink : public ServerLink {
|
||||
public:
|
||||
PortLink(port_id sender = -1, port_id receiver = -1);
|
||||
virtual ~PortLink();
|
||||
|
||||
void SetTo(port_id sender, port_id receiver);
|
||||
};
|
||||
|
||||
|
||||
// sender inline functions
|
||||
|
||||
inline void
|
||||
ServerLink::SetSenderPort(port_id port)
|
||||
{
|
||||
fSender->SetPort(port);
|
||||
}
|
||||
|
||||
inline port_id
|
||||
ServerLink::SenderPort()
|
||||
{
|
||||
return fSender->Port();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::StartMessage(int32 code, size_t minSize)
|
||||
{
|
||||
return fSender->StartMessage(code, minSize);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::EndMessage()
|
||||
{
|
||||
return fSender->EndMessage();
|
||||
}
|
||||
|
||||
inline void
|
||||
ServerLink::CancelMessage()
|
||||
{
|
||||
fSender->CancelMessage();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::Flush(bigtime_t timeout, bool needsReply)
|
||||
{
|
||||
return fSender->Flush(timeout, needsReply);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::Attach(const void *data, ssize_t size)
|
||||
{
|
||||
return fSender->Attach(data, size);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::AttachString(const char *string, int32 length)
|
||||
{
|
||||
return fSender->AttachString(string, length);
|
||||
}
|
||||
|
||||
template<class Type> status_t
|
||||
ServerLink::Attach(const Type &data)
|
||||
{
|
||||
return Attach(&data, sizeof(Type));
|
||||
}
|
||||
|
||||
// #pragma mark - receiver inline functions
|
||||
|
||||
inline void
|
||||
ServerLink::SetReceiverPort(port_id port)
|
||||
{
|
||||
fReceiver->SetPort(port);
|
||||
}
|
||||
|
||||
inline port_id
|
||||
ServerLink::ReceiverPort()
|
||||
{
|
||||
return fReceiver->Port();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::GetNextMessage(int32 &code, bigtime_t timeout)
|
||||
{
|
||||
return fReceiver->GetNextMessage(code, timeout);
|
||||
}
|
||||
|
||||
inline bool
|
||||
ServerLink::NeedsReply() const
|
||||
{
|
||||
return fReceiver->NeedsReply();
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::Read(void *data, ssize_t size)
|
||||
{
|
||||
return fReceiver->Read(data, size);
|
||||
}
|
||||
|
||||
inline status_t
|
||||
ServerLink::ReadString(char **string)
|
||||
{
|
||||
return fReceiver->ReadString(string);
|
||||
}
|
||||
|
||||
template <class Type> status_t
|
||||
ServerLink::Read(Type *data)
|
||||
{
|
||||
return Read(data, sizeof(Type));
|
||||
}
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif /* _PORTLINK_H */
|
||||
@@ -1,82 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: PortMessage.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Package class for port messaging-based data
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef PORTMESSAGE_H_
|
||||
#define PORTMESSAGE_H_
|
||||
|
||||
#include <OS.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
class PortMessage
|
||||
{
|
||||
public:
|
||||
PortMessage(const int32 &code, const void *buffer, const ssize_t &buffersize,
|
||||
const bool ©);
|
||||
PortMessage(void);
|
||||
~PortMessage(void);
|
||||
|
||||
status_t ReadFromPort(const port_id &port, const bigtime_t &timeout=B_INFINITE_TIMEOUT);
|
||||
status_t WriteToPort(const port_id &port);
|
||||
|
||||
void SetCode(const int32 &code);
|
||||
void SetProtocol(int32 protocol) { _protocol=protocol; }
|
||||
void SetBuffer(const void *buffer, const ssize_t &size, const bool ©=false);
|
||||
|
||||
int32 Code(void) { return _code; }
|
||||
void *Buffer(void) { return _buffer; }
|
||||
ssize_t BufferSize(void) { return _buffersize; }
|
||||
int32 Protocol(void) const { return _protocol; }
|
||||
|
||||
status_t Read(void *data, ssize_t size);
|
||||
status_t ReadString(char **string);
|
||||
template <class Type> status_t Read(Type *data)
|
||||
{
|
||||
int32 size = sizeof(Type);
|
||||
|
||||
if(!data)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if( !_buffer ||
|
||||
(_buffersize < size) ||
|
||||
(_index+size > _buffer+_buffersize) )
|
||||
return B_NO_MEMORY;
|
||||
|
||||
*data=*((Type*)_index);
|
||||
_index+=size;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
void Rewind(void);
|
||||
private:
|
||||
int32 _code;
|
||||
uint8 *_buffer;
|
||||
ssize_t _buffersize;
|
||||
uint8 *_index;
|
||||
int32 _protocol;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,58 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: PortQueue.h
|
||||
// Author: DarkWyrm <[email protected]>
|
||||
// Description: Facilitation class for reading and queueing messages from ports
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef PORTQUEUE_H_
|
||||
#define PORTQUEUE_H_
|
||||
|
||||
#include <OS.h>
|
||||
#include <queue>
|
||||
|
||||
class PortMessage;
|
||||
|
||||
class PortQueue
|
||||
{
|
||||
public:
|
||||
PortQueue(const port_id &port);
|
||||
~PortQueue(void);
|
||||
bool IsInitialized(void) { return _init; }
|
||||
|
||||
bool SetPort(const port_id &port);
|
||||
port_id GetPort(void) { return _port; }
|
||||
|
||||
bool MessagesWaiting(void) { return !_q.empty(); }
|
||||
|
||||
void GetMessagesFromPort(bool wait_for_messages=false);
|
||||
PortMessage *GetMessageFromQueue(void);
|
||||
|
||||
void MakeEmpty(void);
|
||||
|
||||
private:
|
||||
std::queue<PortMessage*> _q;
|
||||
bool _init;
|
||||
port_id _port;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,45 +0,0 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file RegistrarThread.h
|
||||
RegistrarThread interface declaration
|
||||
*/
|
||||
|
||||
#ifndef REGISTRAR_THREAD_H
|
||||
#define REGISTRAR_THREAD_H
|
||||
|
||||
#include <Messenger.h>
|
||||
#include <OS.h>
|
||||
|
||||
class RegistrarThread {
|
||||
public:
|
||||
RegistrarThread(const char *name, int32 priority, BMessenger managerMessenger);
|
||||
virtual ~RegistrarThread();
|
||||
|
||||
virtual status_t InitCheck();
|
||||
status_t Run();
|
||||
|
||||
thread_id Id() const;
|
||||
const char* Name() const;
|
||||
|
||||
void AskToExit();
|
||||
bool IsFinished() const;
|
||||
|
||||
protected:
|
||||
//! The function executed in the object's thread when Run() is called
|
||||
virtual status_t ThreadFunction() = 0;
|
||||
|
||||
BMessenger fManagerMessenger;
|
||||
bool fShouldExit; // Initially false, may be set to true by AskToExit()
|
||||
bool fIsFinished; // Initially false, set to true by the thread itself upon completion
|
||||
private:
|
||||
static int32 EntryFunction(void *data);
|
||||
|
||||
status_t fStatus;
|
||||
thread_id fId;
|
||||
char fName[B_OS_NAME_LENGTH];
|
||||
};
|
||||
|
||||
#endif // REGISTRAR_THREAD_H
|
||||
@@ -1,45 +0,0 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
/*!
|
||||
\file RegistrarThreadManager.h
|
||||
RegistrarThreadManager interface declaration
|
||||
*/
|
||||
|
||||
#ifndef REGISTRAR_THREAD_MANAGER_H
|
||||
#define REGISTRAR_THREAD_MANAGER_H
|
||||
|
||||
#include <Handler.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <list>
|
||||
|
||||
class RegistrarThread;
|
||||
|
||||
class RegistrarThreadManager : public BHandler {
|
||||
public:
|
||||
RegistrarThreadManager();
|
||||
~RegistrarThreadManager();
|
||||
|
||||
// BHandler virtuals
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
// Thread management functions
|
||||
status_t LaunchThread(RegistrarThread *thread);
|
||||
status_t CleanupThreads();
|
||||
status_t ShutdownThreads();
|
||||
status_t KillThreads();
|
||||
|
||||
uint ThreadCount() const;
|
||||
|
||||
static const uint kThreadLimit = 12;
|
||||
private:
|
||||
|
||||
std::list<RegistrarThread*>::iterator& RemoveThread(std::list<RegistrarThread*>::iterator &i);
|
||||
|
||||
std::list<RegistrarThread*> fThreads;
|
||||
uint fThreadCount;
|
||||
};
|
||||
|
||||
#endif // THREAD_MANAGER_H
|
||||
@@ -1,76 +0,0 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
#ifndef _ROSTER_PRIVATE_H
|
||||
#define _ROSTER_PRIVATE_H
|
||||
|
||||
#include <Messenger.h>
|
||||
#include <Roster.h>
|
||||
|
||||
class BRoster::Private {
|
||||
public:
|
||||
Private() : fRoster(const_cast<BRoster*>(be_roster)) {}
|
||||
Private(BRoster &roster) : fRoster(&roster) {}
|
||||
Private(BRoster *roster) : fRoster(roster) {}
|
||||
|
||||
void SetTo(BMessenger mainMessenger, BMessenger mimeMessenger);
|
||||
|
||||
status_t SendTo(BMessage *message, BMessage *reply, bool mime);
|
||||
bool IsMessengerValid(bool mime) const;
|
||||
|
||||
status_t ShutDown(bool reboot, bool confirm, bool synchronous)
|
||||
{ return fRoster->ShutDown(reboot, confirm, synchronous); }
|
||||
|
||||
// needed by BApplication
|
||||
|
||||
status_t AddApplication(const char *mimeSig, const entry_ref *ref,
|
||||
uint32 flags, team_id team, thread_id thread,
|
||||
port_id port, bool fullReg, uint32 *token,
|
||||
team_id *otherTeam) const
|
||||
{ return fRoster->AddApplication(mimeSig, ref, flags, team, thread,
|
||||
port, fullReg, token, otherTeam); }
|
||||
|
||||
status_t SetSignature(team_id team, const char *mimeSig) const
|
||||
{ return fRoster->SetSignature(team, mimeSig); }
|
||||
|
||||
status_t CompleteRegistration(team_id team, thread_id thread,
|
||||
port_id port) const
|
||||
{ return fRoster->CompleteRegistration(team, thread, port); }
|
||||
|
||||
bool IsAppPreRegistered(const entry_ref *ref, team_id team,
|
||||
app_info *info) const
|
||||
{ return fRoster->IsAppPreRegistered(ref, team, info); }
|
||||
|
||||
status_t RemoveApp(team_id team) const
|
||||
{ return fRoster->RemoveApp(team); }
|
||||
|
||||
// needed by GetRecentTester
|
||||
|
||||
void AddToRecentApps(const char *appSig) const
|
||||
{ fRoster->AddToRecentApps(appSig); }
|
||||
|
||||
void ClearRecentDocuments() const
|
||||
{ fRoster->ClearRecentDocuments(); }
|
||||
|
||||
void ClearRecentFolders() const
|
||||
{ fRoster->ClearRecentFolders(); }
|
||||
|
||||
void ClearRecentApps() const
|
||||
{ fRoster->ClearRecentApps(); }
|
||||
|
||||
void LoadRecentLists(const char *file) const
|
||||
{ fRoster->LoadRecentLists(file); }
|
||||
|
||||
void SaveRecentLists(const char *file) const
|
||||
{ fRoster->SaveRecentLists(file); }
|
||||
|
||||
static void InitBeRoster();
|
||||
static void DeleteBeRoster();
|
||||
|
||||
private:
|
||||
BRoster *fRoster;
|
||||
};
|
||||
|
||||
#endif // _ROSTER_PRIVATE_H
|
||||
@@ -1,23 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Ingo Weinhold <[email protected]>
|
||||
*/
|
||||
#ifndef _SERVER_H
|
||||
#define _SERVER_H
|
||||
|
||||
#include <Application.h>
|
||||
|
||||
class BServer : public BApplication {
|
||||
public:
|
||||
BServer(const char* signature, bool initGUI, status_t *error);
|
||||
|
||||
status_t InitGUIContext();
|
||||
|
||||
private:
|
||||
bool fGUIContextInitialized;
|
||||
};
|
||||
|
||||
#endif // _SERVER_H
|
||||
@@ -1,68 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: DataIO.cpp
|
||||
// Author(s): Ingo Weinhold ([email protected])
|
||||
// Stefano Ceccherini ([email protected])
|
||||
// The Storage Team
|
||||
// Description: Pure virtual BDataIO and BPositionIO classes provide
|
||||
// the protocol for Read()/Write()/Seek().
|
||||
//
|
||||
// BMallocIO and ServerMemIO classes implement the protocol,
|
||||
// as does BFile in the Storage Kit.
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _SERVERMEM_IO_H
|
||||
#define _SERVERMEM_IO_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
#include <DataIO.h>
|
||||
#include <OS.h>
|
||||
|
||||
class ServerMemIO : public BPositionIO
|
||||
{
|
||||
public:
|
||||
ServerMemIO(size_t size);
|
||||
virtual ~ServerMemIO();
|
||||
|
||||
virtual ssize_t ReadAt(off_t position, void *buffer, size_t size);
|
||||
virtual ssize_t WriteAt(off_t position, const void *buffer, size_t size);
|
||||
|
||||
virtual off_t Seek(off_t position, uint32 seekMode);
|
||||
virtual off_t Position() const;
|
||||
|
||||
virtual status_t SetSize(off_t size);
|
||||
size_t GetSize(void) const;
|
||||
|
||||
void *GetPointer(void) const;
|
||||
|
||||
private:
|
||||
ServerMemIO(const ServerMemIO &);
|
||||
ServerMemIO &operator=(const ServerMemIO &);
|
||||
|
||||
char *fBuf;
|
||||
size_t fLen;
|
||||
size_t fPhys;
|
||||
size_t fPos;
|
||||
size_t fOffset;
|
||||
area_id fArea, fSourceArea;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,369 +0,0 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* DarkWyrm <[email protected]>
|
||||
* Jérôme Duval, [email protected]
|
||||
*/
|
||||
#ifndef _APPSERVER_PROTOCOL_
|
||||
#define _APPSERVER_PROTOCOL_
|
||||
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
// Server port names. The input port is the port which is used to receive
|
||||
// input messages from the Input Server. The other is the "main" port for
|
||||
// the server and is utilized mostly by BApplication objects.
|
||||
#define SERVER_PORT_NAME "OBappserver"
|
||||
#define SERVER_INPUT_PORT "OBinputport"
|
||||
|
||||
enum {
|
||||
// Used for quick replies from the app_server
|
||||
SERVER_TRUE = B_OK,
|
||||
SERVER_FALSE = B_ERROR,
|
||||
|
||||
AS_SERVER_BMESSAGE = 1,
|
||||
AS_SERVER_AREALINK,
|
||||
AS_SERVER_SESSION,
|
||||
AS_SERVER_PORTLINK,
|
||||
AS_CLIENT_DEAD,
|
||||
AS_GET_DESKTOP,
|
||||
|
||||
// Desktop definitions
|
||||
AS_GET_WINDOW_LIST,
|
||||
AS_GET_WINDOW_INFO,
|
||||
|
||||
// Application definitions
|
||||
AS_CREATE_APP,
|
||||
AS_DELETE_APP,
|
||||
AS_QUIT_APP,
|
||||
AS_ACTIVATE_APP,
|
||||
|
||||
AS_SET_SERVER_PORT,
|
||||
|
||||
AS_CREATE_WINDOW,
|
||||
AS_CREATE_OFFSCREEN_WINDOW,
|
||||
AS_DELETE_WINDOW,
|
||||
AS_CREATE_BITMAP,
|
||||
AS_DELETE_BITMAP,
|
||||
|
||||
AS_ACQUIRE_SERVERMEM,
|
||||
AS_RELEASE_SERVERMEM,
|
||||
AS_AREA_MESSAGE,
|
||||
|
||||
// Cursor definitions
|
||||
AS_SET_CURSOR_DATA,
|
||||
AS_SET_CURSOR_BCURSOR,
|
||||
AS_SET_CURSOR_BBITMAP,
|
||||
AS_SET_CURSOR_SYSTEM,
|
||||
|
||||
AS_SET_SYSCURSOR_DATA,
|
||||
AS_SET_SYSCURSOR_BCURSOR,
|
||||
AS_SET_SYSCURSOR_BBITMAP,
|
||||
AS_SET_SYSCURSOR_DEFAULTS,
|
||||
AS_GET_SYSCURSOR,
|
||||
|
||||
AS_SHOW_CURSOR,
|
||||
AS_HIDE_CURSOR,
|
||||
AS_OBSCURE_CURSOR,
|
||||
AS_QUERY_CURSOR_HIDDEN,
|
||||
|
||||
AS_CREATE_BCURSOR,
|
||||
AS_DELETE_BCURSOR,
|
||||
|
||||
AS_BEGIN_RECT_TRACKING,
|
||||
AS_END_RECT_TRACKING,
|
||||
|
||||
// Window definitions
|
||||
AS_SHOW_WINDOW,
|
||||
AS_HIDE_WINDOW,
|
||||
AS_QUIT_WINDOW,
|
||||
AS_SEND_BEHIND,
|
||||
AS_SET_LOOK,
|
||||
AS_SET_FEEL,
|
||||
AS_SET_FLAGS,
|
||||
AS_DISABLE_UPDATES,
|
||||
AS_ENABLE_UPDATES,
|
||||
AS_BEGIN_UPDATE,
|
||||
AS_END_UPDATE,
|
||||
AS_NEEDS_UPDATE,
|
||||
AS_SET_WINDOW_TITLE,
|
||||
AS_ADD_TO_SUBSET,
|
||||
AS_REM_FROM_SUBSET,
|
||||
AS_SET_ALIGNMENT,
|
||||
AS_GET_ALIGNMENT,
|
||||
AS_GET_WORKSPACES,
|
||||
AS_SET_WORKSPACES,
|
||||
AS_WINDOW_RESIZE,
|
||||
AS_WINDOW_MOVE,
|
||||
AS_SET_SIZE_LIMITS,
|
||||
AS_ACTIVATE_WINDOW,
|
||||
AS_WINDOW_MINIMIZE,
|
||||
AS_UPDATE_IF_NEEDED,
|
||||
_ALL_UPDATED_, // this should be moved in place of _UPDATE_IF_NEEDED_ in AppDefs.h
|
||||
|
||||
// BPicture definitions
|
||||
AS_CREATE_PICTURE,
|
||||
AS_DELETE_PICTURE,
|
||||
AS_CLONE_PICTURE,
|
||||
AS_DOWNLOAD_PICTURE,
|
||||
|
||||
// Font-related server communications
|
||||
AS_SET_SYSTEM_FONT,
|
||||
AS_QUERY_FONTS_CHANGED,
|
||||
AS_UPDATED_CLIENT_FONTLIST,
|
||||
AS_GET_FAMILY_NAME,
|
||||
AS_GET_STYLE_NAME,
|
||||
AS_GET_FAMILY_AND_STYLE,
|
||||
AS_GET_FONT_DIRECTION,
|
||||
AS_GET_FONT_BOUNDING_BOX,
|
||||
AS_GET_TUNED_COUNT,
|
||||
AS_GET_TUNED_INFO,
|
||||
AS_GET_FONT_HEIGHT,
|
||||
|
||||
AS_QUERY_FONT_FIXED,
|
||||
AS_SET_FAMILY_NAME,
|
||||
AS_SET_FAMILY_AND_STYLE,
|
||||
AS_SET_FAMILY_AND_STYLE_FROM_ID,
|
||||
AS_SET_FAMILY_AND_FACE,
|
||||
|
||||
AS_COUNT_FONT_FAMILIES,
|
||||
AS_COUNT_FONT_STYLES,
|
||||
|
||||
AS_GET_STRING_WIDTHS,
|
||||
AS_GET_EDGES,
|
||||
AS_GET_ESCAPEMENTS,
|
||||
AS_GET_ESCAPEMENTS_AS_FLOATS,
|
||||
AS_GET_BOUNDINGBOXES_CHARS,
|
||||
AS_GET_BOUNDINGBOXES_STRINGS,
|
||||
AS_GET_HAS_GLYPHS,
|
||||
AS_GET_GLYPH_SHAPES,
|
||||
AS_GET_TRUNCATED_STRINGS,
|
||||
|
||||
AS_SET_SYSFONT_PLAIN,
|
||||
AS_SET_SYSFONT_BOLD,
|
||||
AS_SET_SYSFONT_FIXED,
|
||||
|
||||
// Screen methods
|
||||
AS_SCREEN_GET_MODE,
|
||||
AS_SCREEN_SET_MODE,
|
||||
AS_PROPOSE_MODE,
|
||||
AS_GET_MODE_LIST,
|
||||
|
||||
AS_GET_PIXEL_CLOCK_LIMITS,
|
||||
AS_GET_TIMING_CONSTRAINTS,
|
||||
|
||||
AS_SCREEN_GET_COLORMAP,
|
||||
AS_GET_DESKTOP_COLOR,
|
||||
AS_SET_DESKTOP_COLOR,
|
||||
|
||||
AS_READ_BITMAP,
|
||||
|
||||
AS_GET_RETRACE_SEMAPHORE,
|
||||
AS_GET_ACCELERANT_INFO,
|
||||
|
||||
AS_SET_DPMS,
|
||||
AS_GET_DPMS_STATE,
|
||||
AS_GET_DPMS_CAPABILITIES,
|
||||
|
||||
// Global function call defs
|
||||
AS_SET_UI_COLORS,
|
||||
AS_GET_UI_COLORS,
|
||||
AS_GET_UI_COLOR,
|
||||
AS_SET_DECORATOR,
|
||||
AS_GET_DECORATOR,
|
||||
AS_R5_SET_DECORATOR,
|
||||
AS_COUNT_DECORATORS,
|
||||
AS_GET_DECORATOR_NAME,
|
||||
|
||||
AS_COUNT_WORKSPACES,
|
||||
AS_SET_WORKSPACE_COUNT,
|
||||
AS_CURRENT_WORKSPACE,
|
||||
AS_ACTIVATE_WORKSPACE,
|
||||
AS_GET_SCROLLBAR_INFO,
|
||||
AS_SET_SCROLLBAR_INFO,
|
||||
AS_GET_MENU_INFO,
|
||||
AS_SET_MENU_INFO,
|
||||
AS_IDLE_TIME,
|
||||
AS_SELECT_PRINTER_PANEL,
|
||||
AS_ADD_PRINTER_PANEL,
|
||||
AS_RUN_BE_ABOUT,
|
||||
AS_SET_MOUSE_MODE,
|
||||
AS_GET_MOUSE_MODE,
|
||||
|
||||
// Hook function messages
|
||||
AS_WORKSPACE_ACTIVATED,
|
||||
AS_WORKSPACES_CHANGED,
|
||||
AS_WINDOW_ACTIVATED,
|
||||
AS_SCREENMODE_CHANGED,
|
||||
|
||||
// Graphics calls
|
||||
// Are these TRANSACTION codes needed ?
|
||||
AS_BEGIN_TRANSACTION,
|
||||
AS_END_TRANSACTION,
|
||||
AS_SET_HIGH_COLOR,
|
||||
AS_SET_LOW_COLOR,
|
||||
AS_SET_VIEW_COLOR,
|
||||
|
||||
AS_STROKE_ARC,
|
||||
AS_STROKE_BEZIER,
|
||||
AS_STROKE_ELLIPSE,
|
||||
AS_STROKE_LINE,
|
||||
AS_STROKE_LINEARRAY,
|
||||
AS_STROKE_POLYGON,
|
||||
AS_STROKE_RECT,
|
||||
AS_STROKE_ROUNDRECT,
|
||||
AS_STROKE_SHAPE,
|
||||
AS_STROKE_TRIANGLE,
|
||||
|
||||
AS_FILL_ARC,
|
||||
AS_FILL_ARC_GRADIENT,
|
||||
AS_FILL_BEZIER,
|
||||
AS_FILL_BEZIER_GRADIENT,
|
||||
AS_FILL_ELLIPSE,
|
||||
AS_FILL_ELLIPSE_GRADIENT,
|
||||
AS_FILL_POLYGON,
|
||||
AS_FILL_POLYGON_GRADIENT,
|
||||
AS_FILL_RECT,
|
||||
AS_FILL_RECT_GRADIENT,
|
||||
AS_FILL_REGION,
|
||||
AS_FILL_REGION_GRADIENT,
|
||||
AS_FILL_ROUNDRECT,
|
||||
AS_FILL_ROUNDRECT_GRADIENT,
|
||||
AS_FILL_SHAPE,
|
||||
AS_FILL_SHAPE_GRADIENT,
|
||||
AS_FILL_TRIANGLE,
|
||||
AS_FILL_TRIANGLE_GRADIENT,
|
||||
|
||||
AS_MOVEPENBY,
|
||||
AS_MOVEPENTO,
|
||||
AS_SETPENSIZE,
|
||||
AS_DRAW_STRING,
|
||||
AS_SET_FONT,
|
||||
AS_SET_FONT_SIZE,
|
||||
|
||||
AS_FLUSH,
|
||||
AS_SYNC,
|
||||
|
||||
AS_LAYER_CREATE,
|
||||
AS_LAYER_DELETE,
|
||||
AS_LAYER_CREATE_ROOT,
|
||||
AS_LAYER_DELETE_ROOT,
|
||||
AS_LAYER_ADD_CHILD,
|
||||
AS_LAYER_REMOVE_CHILD,
|
||||
AS_LAYER_REMOVE_SELF,
|
||||
AS_LAYER_SHOW,
|
||||
AS_LAYER_HIDE,
|
||||
AS_LAYER_MOVE,
|
||||
AS_LAYER_RESIZE,
|
||||
AS_LAYER_INVALIDATE,
|
||||
AS_LAYER_DRAW,
|
||||
|
||||
AS_LAYER_GET_TOKEN,
|
||||
AS_LAYER_ADD,
|
||||
AS_LAYER_REMOVE,
|
||||
|
||||
// View/Layer definitions
|
||||
AS_LAYER_GET_COORD,
|
||||
AS_LAYER_SET_FLAGS,
|
||||
AS_LAYER_SET_ORIGIN,
|
||||
AS_LAYER_GET_ORIGIN,
|
||||
AS_LAYER_RESIZE_MODE,
|
||||
AS_LAYER_CURSOR,
|
||||
AS_LAYER_BEGIN_RECT_TRACK,
|
||||
AS_LAYER_END_RECT_TRACK,
|
||||
AS_LAYER_DRAG_RECT,
|
||||
AS_LAYER_DRAG_IMAGE,
|
||||
AS_LAYER_GET_MOUSE_COORDS,
|
||||
AS_LAYER_SCROLL,
|
||||
AS_LAYER_SET_LINE_MODE,
|
||||
AS_LAYER_GET_LINE_MODE,
|
||||
AS_LAYER_PUSH_STATE,
|
||||
AS_LAYER_POP_STATE,
|
||||
AS_LAYER_SET_SCALE,
|
||||
AS_LAYER_GET_SCALE,
|
||||
AS_LAYER_SET_DRAW_MODE,
|
||||
AS_LAYER_GET_DRAW_MODE,
|
||||
AS_LAYER_SET_BLEND_MODE,
|
||||
AS_LAYER_GET_BLEND_MODE,
|
||||
AS_LAYER_SET_PEN_LOC,
|
||||
AS_LAYER_GET_PEN_LOC,
|
||||
AS_LAYER_SET_PEN_SIZE,
|
||||
AS_LAYER_GET_PEN_SIZE,
|
||||
AS_LAYER_SET_HIGH_COLOR,
|
||||
AS_LAYER_SET_LOW_COLOR,
|
||||
AS_LAYER_SET_VIEW_COLOR,
|
||||
AS_LAYER_GET_HIGH_COLOR,
|
||||
AS_LAYER_GET_LOW_COLOR,
|
||||
AS_LAYER_GET_VIEW_COLOR,
|
||||
AS_LAYER_PRINT_ALIASING,
|
||||
AS_LAYER_CLIP_TO_PICTURE,
|
||||
AS_LAYER_GET_CLIP_REGION,
|
||||
AS_LAYER_DRAW_BITMAP_ASYNC_IN_RECT,
|
||||
AS_LAYER_DRAW_BITMAP_ASYNC_AT_POINT,
|
||||
AS_LAYER_DRAW_BITMAP_SYNC_IN_RECT,
|
||||
AS_LAYER_DRAW_BITMAP_SYNC_AT_POINT,
|
||||
AS_LAYER_SET_EVENT_MASK,
|
||||
AS_LAYER_SET_MOUSE_EVENT_MASK,
|
||||
|
||||
AS_LAYER_DRAW_STRING,
|
||||
AS_LAYER_SET_CLIP_REGION,
|
||||
AS_LAYER_LINE_ARRAY,
|
||||
AS_LAYER_BEGIN_PICTURE,
|
||||
AS_LAYER_APPEND_TO_PICTURE,
|
||||
AS_LAYER_END_PICTURE,
|
||||
AS_LAYER_COPY_BITS,
|
||||
AS_LAYER_DRAW_PICTURE,
|
||||
AS_LAYER_INVAL_RECT,
|
||||
AS_LAYER_INVAL_REGION,
|
||||
AS_LAYER_INVERT_RECT,
|
||||
AS_LAYER_MOVE_TO,
|
||||
AS_LAYER_RESIZE_TO,
|
||||
AS_LAYER_SET_STATE,
|
||||
AS_LAYER_SET_FONT_STATE,
|
||||
AS_LAYER_GET_STATE,
|
||||
AS_LAYER_SET_VIEW_IMAGE,
|
||||
AS_LAYER_SET_PATTERN,
|
||||
AS_SET_CURRENT_LAYER,
|
||||
|
||||
// BDirectWindow codes
|
||||
AS_DW_GET_SYNC_DATA,
|
||||
AS_DW_SUPPORTS_WINDOW_MODE,
|
||||
AS_DW_SET_FULLSCREEN,
|
||||
|
||||
// TODO: Move these elsewhere. They don't need to
|
||||
// be shared with libbe
|
||||
// app_server internal communication
|
||||
AS_ROOTLAYER_SHOW_WINBORDER,
|
||||
AS_ROOTLAYER_HIDE_WINBORDER,
|
||||
AS_ROOTLAYER_DO_INVALIDATE,
|
||||
AS_ROOTLAYER_DO_REDRAW,
|
||||
AS_ROOTLAYER_LAYER_MOVE,
|
||||
AS_ROOTLAYER_LAYER_RESIZE,
|
||||
AS_ROOTLAYER_LAYER_SCROLL,
|
||||
AS_ROOTLAYER_LAYER_COPYBITS,
|
||||
AS_ROOTLAYER_ADD_TO_SUBSET,
|
||||
AS_ROOTLAYER_REMOVE_FROM_SUBSET,
|
||||
AS_ROOTLAYER_WINBORDER_SET_WORKSPACES,
|
||||
AS_ROOTLAYER_DO_CHANGE_WINBORDER_FEEL
|
||||
};
|
||||
|
||||
#define AS_PATTERN_SIZE 8
|
||||
#define AS_SET_COLOR_MSG_SIZE 8+4
|
||||
#define AS_STROKE_ARC_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_STROKE_BEZIER_MSG_SIZE 8+8*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_STROKE_ELLIPSE_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_STROKE_LINE_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_STROKE_RECT_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_STROKE_ROUNDRECT_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_STROKE_TRIANGLE_MSG_SIZE 8+10*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_FILL_ARC_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_FILL_BEZIER_MSG_SIZE 8+8*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_FILL_ELLIPSE_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_FILL_RECT_MSG_SIZE 8+4*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_FILL_ROUNDRECT_MSG_SIZE 8+6*sizeof(float)+AS_PATTERN_SIZE
|
||||
#define AS_FILL_TRIANGLE_MSG_SIZE 8+10*sizeof(float)+AS_PATTERN_SIZE
|
||||
|
||||
#endif
|
||||
@@ -1,112 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: Session.h
|
||||
// Author: Adi Oanca <[email protected]>
|
||||
// Description: Stream-based messaging class
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef _SESSION_H
|
||||
#define _SESSION_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <OS.h>
|
||||
#include <Region.h>
|
||||
#include <Rect.h>
|
||||
#include <Point.h>
|
||||
#include <ServerProtocol.h>
|
||||
|
||||
#define SESSION_BUFFER_SIZE 1024
|
||||
|
||||
class BSession
|
||||
{
|
||||
public:
|
||||
BSession(port_id receivePort, port_id sendPort);
|
||||
BSession(int32, char *);
|
||||
BSession( const BSession &ses );
|
||||
virtual ~BSession(void);
|
||||
void SetSendPort( port_id port );
|
||||
void SetRecvPort( port_id port );
|
||||
port_id GetSendPort(void) const { return fSendPort; }
|
||||
port_id GetRecvPort(void) const { return fReceivePort; }
|
||||
|
||||
char *ReadString();
|
||||
void ReadBool( bool *b );
|
||||
void ReadInt8( int8 *i );
|
||||
void ReadUInt8( uint8 *i );
|
||||
void ReadInt16( int16 *i );
|
||||
void ReadUInt16( uint16 *i );
|
||||
void ReadInt32( int32 *i );
|
||||
void ReadUInt32( uint32 *i );
|
||||
void ReadInt64( int64 *i );
|
||||
void ReadUInt64( uint64 *i );
|
||||
void ReadFloat( float *f );
|
||||
void ReadFloatFromInt32( float *f );
|
||||
void ReadDouble( double *d );
|
||||
void ReadDoubleFromInt64( double *d );
|
||||
void ReadPoint( BPoint *point );
|
||||
void ReadPointFromInts( BPoint *point );
|
||||
void ReadRectCR( clipping_rect *rect );
|
||||
void ReadRect( BRect *rect );
|
||||
void ReadRectFromInts( BRect *rect );
|
||||
void ReadData( void* data, int32 size );
|
||||
|
||||
void WriteString( const char* string );
|
||||
void WriteBool( const bool& b );
|
||||
void WriteInt8( const int8& i );
|
||||
void WriteUInt8( const uint8& i );
|
||||
void WriteInt16( const int16& i );
|
||||
void WriteUInt16( const uint16& i );
|
||||
void WriteInt32( const int32& i );
|
||||
void WriteUInt32( const uint32& i );
|
||||
void WriteInt64( const int64& i );
|
||||
void WriteUInt64( const uint64& i );
|
||||
void WriteFloat(const float& f );
|
||||
void WriteFloatAsInt32( const float& f );
|
||||
void WriteDouble( const double& d );
|
||||
void WriteDoubleAsInt64( const double& d );
|
||||
void WritePoint(const BPoint& point);
|
||||
void WritePointAsInt32s(const BPoint& point);
|
||||
void WriteRect(const clipping_rect& rect);
|
||||
void WriteRect(const BRect& rect);
|
||||
void WriteRectAsInt32s(const BRect& rect);
|
||||
void WriteData(const void* data, int32 size);
|
||||
|
||||
void Sync();
|
||||
|
||||
// Deprecated. Do not use.
|
||||
void CopyToSendBuffer(void* buffer, int32 count);
|
||||
|
||||
private:
|
||||
port_id fSendPort;
|
||||
port_id fReceivePort;
|
||||
|
||||
char *fSendBuffer;
|
||||
int32 fSendPosition;
|
||||
int32 fRecvCode;
|
||||
|
||||
char *fReceiveBuffer;
|
||||
int32 fReceiveSize;
|
||||
int32 fReceivePosition;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
@@ -1,88 +0,0 @@
|
||||
/*
|
||||
* Copyright 2005, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Michael Lotz <[email protected]>
|
||||
*/
|
||||
|
||||
/* A BMallocIO similar structure but with less overhead */
|
||||
|
||||
#ifndef _SIMPLE_MALLOC_IO_H_
|
||||
#define _SIMPLE_MALLOC_IO_H_
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class BSimpleMallocIO {
|
||||
public:
|
||||
BSimpleMallocIO(size_t size)
|
||||
: fSize(size)
|
||||
{
|
||||
fBuffer = (char *)malloc(size);
|
||||
}
|
||||
|
||||
~BSimpleMallocIO()
|
||||
{
|
||||
free(fBuffer);
|
||||
}
|
||||
|
||||
void Read(void *buffer)
|
||||
{
|
||||
memcpy(buffer, fBuffer, fSize);
|
||||
}
|
||||
|
||||
void Read(void *buffer, size_t size)
|
||||
{
|
||||
memcpy(buffer, fBuffer, size);
|
||||
}
|
||||
|
||||
void ReadAt(off_t pos, void *buffer, size_t size)
|
||||
{
|
||||
memcpy(buffer, fBuffer + pos, size);
|
||||
}
|
||||
|
||||
void Write(const void *buffer)
|
||||
{
|
||||
memcpy(fBuffer, buffer, fSize);
|
||||
}
|
||||
|
||||
void Write(const void *buffer, size_t size)
|
||||
{
|
||||
memcpy(fBuffer, buffer, size);
|
||||
}
|
||||
|
||||
void WriteAt(off_t pos, const void *buffer, size_t size)
|
||||
{
|
||||
memcpy(fBuffer + pos, buffer, size);
|
||||
}
|
||||
|
||||
status_t SetSize(off_t size)
|
||||
{
|
||||
fBuffer = (char *)realloc(fBuffer, size);
|
||||
if (!fBuffer)
|
||||
return B_NO_MEMORY;
|
||||
|
||||
fSize = size;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
char *Buffer()
|
||||
{
|
||||
return fBuffer;
|
||||
}
|
||||
|
||||
size_t BufferLength()
|
||||
{
|
||||
return fSize;
|
||||
}
|
||||
|
||||
private:
|
||||
char *fBuffer;
|
||||
size_t fSize;
|
||||
};
|
||||
|
||||
} // namespace BPivate
|
||||
|
||||
#endif // _SIMPLE_MALLOC_IO_H_
|
||||
@@ -1,110 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: BMCPrivate.h
|
||||
// Author: Marc Flerackers ([email protected])
|
||||
// Description: The BMCPrivate classes are used by BMenuField.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _BMC_PRIVATE_H
|
||||
#define _BMC_PRIVATE_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <BeBuild.h>
|
||||
#include <MenuBar.h>
|
||||
#include <MenuItem.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class _BMCItem_ : public BMenuItem {
|
||||
|
||||
public:
|
||||
_BMCItem_(BMenu *menu);
|
||||
_BMCItem_(BMessage *message);
|
||||
virtual ~_BMCItem_();
|
||||
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
|
||||
void Draw();
|
||||
void GetContentSize(float *width, float *height);
|
||||
|
||||
private:
|
||||
friend class BMenuField;
|
||||
|
||||
bool fShowPopUpMarker;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
/*//------------------------------------------------------------------------------
|
||||
_BMCFilter_::_BMCFilter_(BMenuField *menuField, uint32)
|
||||
{
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
_BMCFilter_::~_BMCFilter_()
|
||||
{
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
filter_result _BMCFilter_::Filter(BMessage *message, BHandler **handler)
|
||||
{
|
||||
}
|
||||
//------------------------------------------------------------------------------
|
||||
_BMCFilter_ &_BMCFilter_::operator=(const _BMCFilter_ &)
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
//------------------------------------------------------------------------------*/
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
class _BMCMenuBar_ : public BMenuBar {
|
||||
|
||||
public:
|
||||
_BMCMenuBar_(BRect frame, bool fixed_size,
|
||||
BMenuField *menuField);
|
||||
_BMCMenuBar_(BMessage *data);
|
||||
virtual ~_BMCMenuBar_();
|
||||
|
||||
static BArchivable *Instantiate(BMessage *data);
|
||||
|
||||
virtual void AttachedToWindow();
|
||||
virtual void Draw(BRect updateRect);
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void MessageReceived(BMessage* msg);
|
||||
virtual void MakeFocus(bool focused = true);
|
||||
|
||||
private:
|
||||
_BMCMenuBar_&operator=(const _BMCMenuBar_ &);
|
||||
|
||||
BMenuField *fMenuField;
|
||||
bool fFixedSize;
|
||||
BMessageRunner *fRunner;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _BMC_PRIVATE_H
|
||||
@@ -1,25 +0,0 @@
|
||||
#ifndef CLIENT_FONT_LIST_H
|
||||
#define CLIENT_FONT_LIST_H
|
||||
|
||||
#include <Font.h> // for BFont-related definitions
|
||||
|
||||
#include <List.h>
|
||||
#include <Message.h>
|
||||
#include <OS.h>
|
||||
|
||||
class ClientFontList
|
||||
{
|
||||
public:
|
||||
ClientFontList(void);
|
||||
~ClientFontList(void);
|
||||
bool Update(bool check_only);
|
||||
int32 CountFamilies(void);
|
||||
status_t GetFamily(int32 index, font_family *name, uint32 *flags=NULL);
|
||||
int32 CountStyles(font_family f);
|
||||
status_t GetStyle(font_family family, int32 index, font_style *name,uint32 *flags=NULL, uint16 *face=NULL);
|
||||
private:
|
||||
BList *familylist;
|
||||
sem_id fontlock;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,103 +0,0 @@
|
||||
/*
|
||||
Open Tracker License
|
||||
|
||||
Terms and Conditions
|
||||
|
||||
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
|
||||
|
||||
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 applies to all licensees
|
||||
and 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 TITLE, MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BE INCORPORATED 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.
|
||||
|
||||
Except as contained in this notice, the name of Be Incorporated shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings in
|
||||
this Software without prior written authorization from Be Incorporated.
|
||||
|
||||
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
|
||||
of Be Incorporated in the United States and other countries. Other brand product
|
||||
names are registered trademarks or trademarks of their respective holders.
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: ColorTools.h
|
||||
/
|
||||
/ Description: Additional experimental color manipulation functions.
|
||||
/
|
||||
/ Copyright 2000, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _COLOR_TOOLS_H
|
||||
#define _COLOR_TOOLS_H
|
||||
|
||||
#include <GraphicsDefs.h>
|
||||
|
||||
#if B_BEOS_VERSION <= B_BEOS_VERSION_5
|
||||
|
||||
namespace BExperimental {
|
||||
|
||||
// Comparison operators.
|
||||
|
||||
inline bool operator==(const rgb_color c1, const rgb_color c2)
|
||||
{
|
||||
return (*((uint32*)&c1)) == (*((uint32*)&c2));
|
||||
}
|
||||
|
||||
inline bool operator!=(const rgb_color c1, const rgb_color c2)
|
||||
{
|
||||
return (*((uint32*)&c1)) != (*((uint32*)&c2));
|
||||
}
|
||||
|
||||
// Color creation.
|
||||
|
||||
inline rgb_color make_color(uint8 red, uint8 green, uint8 blue, uint8 alpha=255)
|
||||
{
|
||||
rgb_color c;
|
||||
c.red = red;
|
||||
c.green = green;
|
||||
c.blue = blue;
|
||||
c.alpha = alpha;
|
||||
return c;
|
||||
}
|
||||
|
||||
// Mix two colors together, ignoring their relative alpha channels.
|
||||
// If amount is 0, the result is color1; if 255, the result is color2;
|
||||
// if another value, it is somewhere in-between. The resulting alpha
|
||||
// channel is mixed exactly like the other color channels.
|
||||
rgb_color mix_color(rgb_color color1, rgb_color color2, uint8 amount);
|
||||
|
||||
// Blend two colors together, weighting by their relative alpha channels.
|
||||
// The resulting color is the same as mix_color(), except that the amount
|
||||
// used from color1 and color2's color channels is dependent on that color's
|
||||
// alpha channel. For example, if color1.alpha is 0 and color2.alpha is
|
||||
// 255, the resulting red, green, and blue values will be the same as those
|
||||
// in color2, regardless of 'amount'.
|
||||
rgb_color blend_color(rgb_color color1, rgb_color color2, uint8 amount);
|
||||
|
||||
// Return a color that is the disabled representation of 'color' when drawn
|
||||
// on a solid color 'background'.
|
||||
rgb_color disable_color(rgb_color color, rgb_color background);
|
||||
|
||||
} // namespace BExperimental
|
||||
|
||||
using namespace BExperimental;
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -1,366 +0,0 @@
|
||||
/*
|
||||
Open Tracker License
|
||||
|
||||
Terms and Conditions
|
||||
|
||||
Copyright (c) 1991-2000, Be Incorporated. All rights reserved.
|
||||
|
||||
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 applies to all licensees
|
||||
and 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 TITLE, MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
BE INCORPORATED 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.
|
||||
|
||||
Except as contained in this notice, the name of Be Incorporated shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings in
|
||||
this Software without prior written authorization from Be Incorporated.
|
||||
|
||||
Tracker(TM), Be(R), BeOS(R), and BeIA(TM) are trademarks or registered trademarks
|
||||
of Be Incorporated in the United States and other countries. Other brand product
|
||||
names are registered trademarks or trademarks of their respective holders.
|
||||
All rights reserved.
|
||||
*/
|
||||
|
||||
/*******************************************************************************
|
||||
/
|
||||
/ File: ColumnListView.h
|
||||
/
|
||||
/ Description: Experimental multi-column list view.
|
||||
/
|
||||
/ Copyright 2000+, Be Incorporated, All Rights Reserved
|
||||
/
|
||||
*******************************************************************************/
|
||||
|
||||
|
||||
#ifndef _COLUMN_LIST_VIEW_H
|
||||
#define _COLUMN_LIST_VIEW_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <View.h>
|
||||
#include <List.h>
|
||||
#include <Invoker.h>
|
||||
#include <ListView.h>
|
||||
|
||||
class BScrollBar;
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
class OutlineView;
|
||||
class TitleView;
|
||||
class BRowContainer;
|
||||
class RecursiveOutlineIterator;
|
||||
|
||||
} // ns BPrivate
|
||||
|
||||
class BField;
|
||||
class BRow;
|
||||
class BColumn;
|
||||
class BColumnListView;
|
||||
|
||||
enum LatchType {
|
||||
B_NO_LATCH,
|
||||
B_OPEN_LATCH,
|
||||
B_PRESSED_LATCH,
|
||||
B_CLOSED_LATCH
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
B_ALLOW_COLUMN_NONE = 0,
|
||||
B_ALLOW_COLUMN_MOVE = 1,
|
||||
B_ALLOW_COLUMN_RESIZE = 2,
|
||||
B_ALLOW_COLUMN_POPUP = 4,
|
||||
B_ALLOW_COLUMN_REMOVE = 8,
|
||||
} column_flags;
|
||||
|
||||
enum ColumnListViewColor {
|
||||
B_COLOR_BACKGROUND = 0,
|
||||
B_COLOR_TEXT = 1,
|
||||
B_COLOR_ROW_DIVIDER = 2,
|
||||
B_COLOR_SELECTION = 3,
|
||||
B_COLOR_SELECTION_TEXT = 4,
|
||||
B_COLOR_NON_FOCUS_SELECTION = 5,
|
||||
B_COLOR_EDIT_BACKGROUND = 6,
|
||||
B_COLOR_EDIT_TEXT = 7,
|
||||
B_COLOR_HEADER_BACKGROUND = 8,
|
||||
B_COLOR_HEADER_TEXT = 9,
|
||||
B_COLOR_SEPARATOR_LINE = 10,
|
||||
B_COLOR_SEPARATOR_BORDER = 11,
|
||||
|
||||
B_COLOR_TOTAL = 12
|
||||
};
|
||||
|
||||
enum ColumnListViewFont {
|
||||
B_FONT_ROW = 0,
|
||||
B_FONT_HEADER = 1,
|
||||
|
||||
B_FONT_TOTAL = 2
|
||||
};
|
||||
|
||||
|
||||
// A single row/column intersection in the list.
|
||||
class BField {
|
||||
public:
|
||||
BField();
|
||||
virtual ~BField();
|
||||
};
|
||||
|
||||
// A single line in the list. Each line contains a BField object
|
||||
// for each column in the list, associated by their "logical field"
|
||||
// index. Hierarchies are formed by adding other BRow objects as
|
||||
// a parent of a row, using the AddRow() function in BColumnListView().
|
||||
class BRow {
|
||||
public:
|
||||
BRow(float height = 16.0);
|
||||
virtual ~BRow();
|
||||
virtual bool HasLatch() const;
|
||||
|
||||
int32 CountFields() const;
|
||||
BField* GetField(int32 logicalFieldIndex);
|
||||
const BField* GetField(int32 logicalFieldIndex) const;
|
||||
void SetField(BField* field, int32 logicalFieldIndex);
|
||||
|
||||
float Height() const;
|
||||
bool IsExpanded() const;
|
||||
|
||||
private:
|
||||
// Blows up into the debugger if the validation fails.
|
||||
void ValidateFields() const;
|
||||
void ValidateField(const BField *field, int32 logicalFieldIndex) const;
|
||||
private:
|
||||
BList fFields;
|
||||
BPrivate::
|
||||
BRowContainer* fChildList;
|
||||
bool fIsExpanded;
|
||||
float fHeight;
|
||||
BRow* fNextSelected;
|
||||
BRow* fPrevSelected;
|
||||
BRow* fParent;
|
||||
BColumnListView* fList;
|
||||
|
||||
|
||||
friend class BColumnListView;
|
||||
friend class BPrivate::RecursiveOutlineIterator;
|
||||
friend class BPrivate::OutlineView;
|
||||
};
|
||||
|
||||
// Information about a single column in the list. A column knows
|
||||
// how to display the BField objects that occur at its location in
|
||||
// each of the list's rows. See ColumnTypes.h for particular
|
||||
// subclasses of BField and BColumn that handle common data types.
|
||||
class BColumn
|
||||
{
|
||||
public:
|
||||
BColumn(float width,
|
||||
float minWidth,
|
||||
float maxWidth,
|
||||
alignment align = B_ALIGN_LEFT);
|
||||
virtual ~BColumn();
|
||||
|
||||
float Width() const;
|
||||
void SetWidth(float width);
|
||||
float MinWidth() const;
|
||||
float MaxWidth() const;
|
||||
|
||||
virtual void DrawTitle(BRect rect, BView *targetView);
|
||||
virtual void DrawField(BField *field, BRect rect, BView *targetView);
|
||||
virtual int CompareFields(BField *field1, BField *field2);
|
||||
|
||||
virtual void MouseMoved(BColumnListView *parent, BRow *row, BField *field,
|
||||
BRect field_rect, BPoint point, uint32 buttons, int32 code);
|
||||
virtual void MouseDown(BColumnListView *parent, BRow *row, BField *field,
|
||||
BRect field_rect, BPoint point, uint32 buttons);
|
||||
virtual void MouseUp(BColumnListView *parent, BRow *row, BField *field);
|
||||
|
||||
virtual void GetColumnName(BString* into) const;
|
||||
|
||||
bool IsVisible() const;
|
||||
void SetVisible(bool);
|
||||
|
||||
bool WantsEvents() const;
|
||||
void SetWantsEvents(bool);
|
||||
|
||||
bool ShowHeading() const;
|
||||
void SetShowHeading(bool);
|
||||
|
||||
alignment Alignment() const;
|
||||
void SetAlignment(alignment);
|
||||
|
||||
int32 LogicalFieldNum() const;
|
||||
|
||||
/*!
|
||||
\param field The BField derivative to validate.
|
||||
|
||||
Implement this function on your BColumn derivatives to validate BField derivatives
|
||||
that your BColumn will be drawing/manipulating.
|
||||
|
||||
This function will be called when BFields are added to the Column, use dynamic_cast<> to
|
||||
determine if it is of a kind that your BColumn know how ot handle. return false if it is not.
|
||||
|
||||
\note The debugger will be called if you return false from here with information about
|
||||
what type of BField and BColumn and the logical field index where it occured.
|
||||
|
||||
\note Do not call the inherited version of this, it just returns true;
|
||||
*/
|
||||
virtual bool AcceptsField(const BField* field) const;
|
||||
|
||||
private:
|
||||
float fWidth;
|
||||
float fMinWidth;
|
||||
float fMaxWidth;
|
||||
bool fVisible;
|
||||
int32 fFieldID;
|
||||
BColumnListView *fList;
|
||||
bool fSortAscending;
|
||||
bool fWantsEvents;
|
||||
bool fShowHeading;
|
||||
alignment fAlignment;
|
||||
|
||||
friend class BPrivate::OutlineView;
|
||||
friend class BColumnListView;
|
||||
friend class BPrivate::TitleView;
|
||||
};
|
||||
|
||||
// The column list view class.
|
||||
class BColumnListView : public BView, public BInvoker
|
||||
{
|
||||
public:
|
||||
BColumnListView(BRect rect,
|
||||
const char *name,
|
||||
uint32 resizingMode,
|
||||
uint32 drawFlags,
|
||||
border_style = B_NO_BORDER,
|
||||
bool showHorizontalScrollbar = true);
|
||||
virtual ~BColumnListView();
|
||||
|
||||
// Interaction
|
||||
virtual bool InitiateDrag(BPoint, bool wasSelected);
|
||||
virtual void MessageDropped(BMessage*, BPoint point);
|
||||
virtual void ExpandOrCollapse(BRow *row, bool expand);
|
||||
virtual status_t Invoke(BMessage *message = NULL);
|
||||
virtual void ItemInvoked();
|
||||
virtual void SetInvocationMessage(BMessage*);
|
||||
BMessage* InvocationMessage() const;
|
||||
uint32 InvocationCommand() const;
|
||||
BRow* FocusRow() const;
|
||||
void SetFocusRow(int32 index, bool select=false);
|
||||
void SetFocusRow(BRow *row, bool select=false);
|
||||
void SetMouseTrackingEnabled(bool);
|
||||
|
||||
// Selection
|
||||
list_view_type SelectionMode() const;
|
||||
void Deselect(BRow *row);
|
||||
void AddToSelection(BRow *row);
|
||||
void DeselectAll();
|
||||
BRow* CurrentSelection(BRow *lastSelected = 0) const;
|
||||
virtual void SelectionChanged();
|
||||
virtual void SetSelectionMessage(BMessage *);
|
||||
BMessage* SelectionMessage();
|
||||
uint32 SelectionCommand() const;
|
||||
void SetSelectionMode(list_view_type); // list_view_type is defined in ListView.h.
|
||||
|
||||
// Sorting
|
||||
void SetSortingEnabled(bool);
|
||||
bool SortingEnabled() const;
|
||||
void SetSortColumn(BColumn *column, bool add, bool ascending);
|
||||
void ClearSortColumns();
|
||||
|
||||
// The status view is a little area in the lower left hand corner.
|
||||
void AddStatusView(BView *view);
|
||||
BView* RemoveStatusView();
|
||||
|
||||
// Column Manipulation
|
||||
void AddColumn(BColumn*, int32 logicalFieldIndex);
|
||||
void MoveColumn(BColumn*, int32 index);
|
||||
void RemoveColumn(BColumn*);
|
||||
int32 CountColumns() const;
|
||||
BColumn* ColumnAt(int32 index) const;
|
||||
void SetColumnVisible(BColumn*, bool isVisible);
|
||||
void SetColumnVisible(int32, bool);
|
||||
bool IsColumnVisible(int32) const;
|
||||
void SetColumnFlags(column_flags flags);
|
||||
|
||||
// Row manipulation
|
||||
const BRow* RowAt(int32 index, BRow *parent = 0) const;
|
||||
BRow* RowAt(int32 index, BRow *parent = 0);
|
||||
const BRow* RowAt(BPoint) const;
|
||||
BRow* RowAt(BPoint);
|
||||
bool GetRowRect(const BRow *row, BRect *outRect) const;
|
||||
bool FindParent(BRow *row, BRow **outs_parent, bool *out_isVisible) const;
|
||||
int32 IndexOf(BRow *row);
|
||||
int32 CountRows(BRow *parent = 0) const;
|
||||
void AddRow(BRow*, BRow *parent = 0);
|
||||
void AddRow(BRow*, int32 index, BRow *parent = 0);
|
||||
|
||||
void ScrollTo(const BRow* Row);
|
||||
|
||||
// Does not delete row or children at this time.
|
||||
// todo: Make delete row and children
|
||||
void RemoveRow(BRow*);
|
||||
|
||||
void UpdateRow(BRow*);
|
||||
void Clear();
|
||||
|
||||
// Appearance (DEPRECATED)
|
||||
void GetFont(BFont* font) const {BView::GetFont(font);}
|
||||
virtual void SetFont(const BFont *font, uint32 mask = B_FONT_ALL);
|
||||
virtual void SetHighColor(rgb_color);
|
||||
void SetSelectionColor(rgb_color);
|
||||
void SetBackgroundColor(rgb_color);
|
||||
void SetEditColor(rgb_color);
|
||||
const rgb_color SelectionColor() const;
|
||||
const rgb_color BackgroundColor() const;
|
||||
const rgb_color EditColor() const;
|
||||
|
||||
// Appearance (NEW STYLE)
|
||||
void SetColor(ColumnListViewColor color_num, rgb_color color);
|
||||
void SetFont(ColumnListViewFont font_num, const BFont* font, uint32 mask = B_FONT_ALL);
|
||||
rgb_color Color(ColumnListViewColor color_num) const;
|
||||
void GetFont(ColumnListViewFont font_num, BFont* font) const;
|
||||
|
||||
BPoint SuggestTextPosition(const BRow* row, const BColumn* column=NULL) const;
|
||||
|
||||
void SetLatchWidth(float width);
|
||||
float LatchWidth() const;
|
||||
virtual void DrawLatch(BView*, BRect, LatchType, BRow*);
|
||||
virtual void MakeFocus(bool isfocus = true);
|
||||
void SaveState(BMessage *msg);
|
||||
void LoadState(BMessage *msg);
|
||||
|
||||
BView* ScrollView() const { return (BView *)fOutlineView; }
|
||||
void SetEditMode(bool state);
|
||||
void Refresh();
|
||||
|
||||
protected:
|
||||
virtual void MessageReceived(BMessage *message);
|
||||
virtual void KeyDown(const char *bytes, int32 numBytes);
|
||||
virtual void AttachedToWindow();
|
||||
virtual void WindowActivated(bool active);
|
||||
virtual void Draw(BRect);
|
||||
|
||||
private:
|
||||
rgb_color fColorList[B_COLOR_TOTAL];
|
||||
BPrivate::TitleView* fTitleView;
|
||||
BPrivate::OutlineView* fOutlineView;
|
||||
BList fColumns;
|
||||
BScrollBar* fHorizontalScrollBar;
|
||||
BScrollBar* fVerticalScrollBar;
|
||||
BList fSortColumns;
|
||||
BView* fStatusView;
|
||||
BMessage* fSelectionMessage;
|
||||
bool fSortingEnabled;
|
||||
float fLatchWidth;
|
||||
border_style fBorderStyle;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,12 +0,0 @@
|
||||
#ifndef __MENU_PRIVATE_H
|
||||
#define __MENU_PRIVATE_H
|
||||
|
||||
|
||||
enum menu_actions {
|
||||
MENU_ACT_NONE = 0,
|
||||
MENU_ACT_CLOSE = 5
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif // __MENU_PRIVATE_H
|
||||
@@ -1,47 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2003-2004, Haiku, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: MenuWindow.h
|
||||
// Authors: Marc Flerackers ([email protected])
|
||||
// Stefano Ceccherini ([email protected])
|
||||
// Description: BMenuWindow is the custom BWindow for menus.
|
||||
//------------------------------------------------------------------------------
|
||||
#ifndef __MENUWINDOW_H
|
||||
#define __MENUWINDOW_H
|
||||
|
||||
#include <Window.h>
|
||||
|
||||
class BMenu;
|
||||
class BMenuScroller;
|
||||
|
||||
class BMenuWindow : public BWindow {
|
||||
public:
|
||||
BMenuWindow(const char *name);
|
||||
virtual ~BMenuWindow();
|
||||
|
||||
void UpdateScrollers();
|
||||
|
||||
private:
|
||||
BMenuScroller *fUpperScroller;
|
||||
BMenuScroller *fLowerScroller;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,213 +0,0 @@
|
||||
#ifndef _PICTUREPROTOCOL_H
|
||||
#define _PICTUREPROTOCOL_H
|
||||
|
||||
// BView dirty bits
|
||||
enum {
|
||||
B_PEN_SIZE_BIT = 0x00000001,
|
||||
B_PEN_LOCATION_BIT = 0x00000002,
|
||||
B_HIGH_COLOR_BIT = 0x00000004,
|
||||
B_LOW_COLOR_BIT = 0x00000008,
|
||||
B_DRAW_MODE_BIT = 0x00000010,
|
||||
B_LINE_MODE_BIT = 0x00000020,
|
||||
B_ORIGIN_BIT = 0x00000040,
|
||||
B_FONT_BIT = 0x00000080,
|
||||
B_PATTERN_BIT = 0x00000100,
|
||||
B_BLEND_MODE_BIT = 0x00000200
|
||||
};
|
||||
|
||||
// AppServer protocol
|
||||
enum {
|
||||
|
||||
// Picture instructions
|
||||
|
||||
B_PIC_MOVE_PEN_BY = 0x0010,
|
||||
B_PIC_STROKE_LINE = 0x0100,
|
||||
B_PIC_STROKE_RECT = 0x0101,
|
||||
B_PIC_FILL_RECT = 0x0102,
|
||||
B_PIC_STROKE_ROUND_RECT = 0x0103,
|
||||
B_PIC_FILL_ROUND_RECT = 0x0104,
|
||||
B_PIC_STROKE_BEZIER = 0x0105,
|
||||
B_PIC_FILL_BEZIER = 0x0106,
|
||||
B_PIC_STROKE_POLYGON = 0x010B,
|
||||
B_PIC_FILL_POLYGON = 0x010C,
|
||||
B_PIC_STROKE_SHAPE = 0x010D,
|
||||
B_PIC_FILL_SHAPE = 0x010E,
|
||||
B_PIC_DRAW_STRING = 0x010F,
|
||||
B_PIC_DRAW_PIXELS = 0x0110,
|
||||
B_PIC_DRAW_PICTURE = 0x0112,
|
||||
B_PIC_STROKE_ARC = 0x0113,
|
||||
B_PIC_FILL_ARC = 0x0114,
|
||||
B_PIC_STROKE_ELLIPSE = 0x0115,
|
||||
B_PIC_FILL_ELLIPSE = 0x0116,
|
||||
B_PIC_ENTER_STATE_CHANGE = 0x0200,
|
||||
B_PIC_SET_CLIPPING_RECTS = 0x0201,
|
||||
B_PIC_CLIP_TO_PICTURE = 0x0202,
|
||||
B_PIC_PUSH_STATE = 0x0203,
|
||||
B_PIC_POP_STATE = 0x0204,
|
||||
B_PIC_CLEAR_CLIPPING_RECTS = 0x0205,
|
||||
B_PIC_SET_ORIGIN = 0x0300,
|
||||
B_PIC_SET_PEN_LOCATION = 0x0301,
|
||||
B_PIC_SET_DRAWING_MODE = 0x0302,
|
||||
B_PIC_SET_LINE_MODE = 0x0303,
|
||||
B_PIC_SET_PEN_SIZE = 0x0304,
|
||||
B_PIC_SET_SCALE = 0x0305,
|
||||
B_PIC_SET_FORE_COLOR = 0x0306,
|
||||
B_PIC_SET_BACK_COLOR = 0x0307,
|
||||
B_PIC_SET_STIPLE_PATTERN = 0x0308,
|
||||
B_PIC_ENTER_FONT_STATE = 0x0309,
|
||||
B_PIC_SET_BLENDING_MODE = 0x030A,
|
||||
B_PIC_SET_FONT_FAMILY = 0x0380,
|
||||
B_PIC_SET_FONT_STYLE = 0x0381,
|
||||
B_PIC_SET_FONT_SPACING = 0x0382,
|
||||
B_PIC_SET_FONT_ENCODING = 0x0383,
|
||||
B_PIC_SET_FONT_FLAGS = 0x0384,
|
||||
B_PIC_SET_FONT_SIZE = 0x0385,
|
||||
B_PIC_SET_FONT_ROTATE = 0x0386,
|
||||
B_PIC_SET_FONT_SHEAR = 0x0387,
|
||||
B_PIC_SET_FONT_BPP = 0x0388,
|
||||
B_PIC_SET_FONT_FACE = 0x0389,
|
||||
|
||||
// View instructions
|
||||
|
||||
B_VIEW_CREATE = 0x0500,
|
||||
B_VIEW_MOVE_BY = 0x0501,
|
||||
// B_VIEW_MOVE_TO = 0x0502, // ????
|
||||
B_VIEW_RESIZE_BY = 0x0503,
|
||||
B_VIEW_RESIZE_TO = 0x0504,
|
||||
B_VIEW_DELETE = 0x0505,
|
||||
B_VIEW_FIND = 0x0506,
|
||||
B_VIEW_BOUNDS = 0x0507, // ????
|
||||
B_VIEW_SET_FLAGS = 0x0508,
|
||||
B_VIEW_SET_EVENT_MASK = 0x0509,
|
||||
B_VIEW_SET_MOUSE_EVENT_MASK = 0x050A,
|
||||
B_VIEW_MOVE_TO = 0x050B, // ????
|
||||
B_VIEW_SET_VIEW_CURSOR = 0x050C,
|
||||
|
||||
// Window instructions
|
||||
|
||||
// B_WINDOW_MOVE_BY = 0x0580,
|
||||
// B_WINDOW_MOVE_TO = 0x0581,
|
||||
B_WINDOW_RESIZE_BY = 0x0582,
|
||||
B_WINDOW_RESIZE_TO = 0x0583,
|
||||
B_WINDOW_ACTIVATE = 0x0584,
|
||||
B_WINDOW_SET_OWNER = 0x0585,
|
||||
B_WINDOW_SET_TITLE = 0x0587,
|
||||
B_WINDOW_IS_FRONT = 0x0589,
|
||||
B_WINDOW_HIDE = 0x058C,
|
||||
B_WINDOW_SHOW = 0x058D,
|
||||
B_WINDOW_SET_SIZE_LIMITS = 0x058E,
|
||||
B_WINDOW_IS_ACTIVE = 0x058F,
|
||||
// B_WINDOW_MINIMIZE = 0x0590, // ????
|
||||
B_WINDOW_MINIMIZE = 0x0591,
|
||||
B_WINDOW_SET_FLAGS = 0x0593,
|
||||
B_WINDOW_SEND_BEHIND = 0x0594,
|
||||
B_WINDOW_ADD_TO_SUBSET = 0x0595,
|
||||
B_WINDOW_REMOVE_FROM_SUBSET = 0x0596,
|
||||
B_WINDOW_SET_WINDOW_ALLIGNMENT = 0x0597,
|
||||
B_WINDOW_GET_WINDOW_ALLIGNMENT = 0x0598,
|
||||
B_WINDOW_SET_CURRENT_VIEW = 0x059A,
|
||||
|
||||
// Drawing instructions
|
||||
|
||||
B_MOVE_PEN_TO = 0x0600,
|
||||
B_MOVE_PEN_BY = 0x0601,
|
||||
B_STROKE_LINE = 0x0602,
|
||||
B_STROKE_LINE_TO = 0x0603,
|
||||
B_STROKE_RECT = 0x0604,
|
||||
B_FILL_RECT = 0x0605,
|
||||
B_STROKE_ARC_RECT = 0x0606,
|
||||
B_FILL_ARC_RECT = 0x0607,
|
||||
B_STROKE_ARC = 0x0608,
|
||||
B_FILL_ARC = 0x0609,
|
||||
B_STROKE_ROUND_RECT = 0x060A,
|
||||
B_FILL_ROUND_RECT = 0x060B,
|
||||
B_FILL_REGION = 0x060D,
|
||||
B_STROKE_POLYGON = 0x060E,
|
||||
B_FILL_POLYGON = 0x060F,
|
||||
B_STROKE_BEZIER = 0x0610,
|
||||
B_FILL_BEZIER = 0x0611,
|
||||
B_STROKE_ELLIPSE_RECT = 0x0612,
|
||||
B_FILL_ELLIPSE_RECT = 0x0613,
|
||||
B_STROKE_ELLIPSE = 0x0614,
|
||||
B_FILL_ELLIPSE = 0x0615,
|
||||
B_DRAW_BITMAP = 0x0616,
|
||||
B_STRETCH_BITMAP = 0x0617,
|
||||
B_STRETCH_BITMAP_SRC = 0x0618,
|
||||
B_DRAW_BITMAP_ASYNC = 0x0619,
|
||||
B_STRETCH_BITMAP_ASYNC = 0x061A,
|
||||
B_STRETCH_BITMAP_SRC_ASYNC = 0x061B,
|
||||
B_DRAW_STRING = 0x061C, // ????
|
||||
B_COPY_BITS = 0x061D,
|
||||
B_INVERT_RECT = 0x061E,
|
||||
B_DRAW_LINES = 0x061F,
|
||||
B_DRAW_PICTURE = 0x0620,
|
||||
B_STROKE_SHAPE = 0x0621,
|
||||
B_FILL_SHAPE = 0x0622,
|
||||
|
||||
// Set instructions
|
||||
|
||||
B_SET_DRAWING_MODE = 0x0700,
|
||||
B_SCROLL_TO = 0x0701,
|
||||
B_SET_PEN_SIZE = 0x0702,
|
||||
B_SET_VIEW_COLOR = 0x0703,
|
||||
B_SET_LINE_MODE = 0x0704,
|
||||
B_SET_FONT = 0x0705,
|
||||
B_SET_FORE_COLOR = 0x0706,
|
||||
B_SET_BACK_COLOR = 0x0707,
|
||||
B_CLEAR_CLIPPING_REGION = 0x0708,
|
||||
B_SET_CLIPPING_REGION = 0x0709,
|
||||
B_SET_SCALE = 0x070A,
|
||||
B_SET_ORIGIN = 0x070B,
|
||||
B_PUSH_STATE = 0x070C,
|
||||
B_POP_STATE = 0x070D,
|
||||
B_SET_PATTERN = 0x070E,
|
||||
B_SET_VIEW_BITMAP = 0x070F, // ????
|
||||
B_FORCE_FONT_ANTIALIASING = 0x0710,
|
||||
B_CLIP_TO_PICTURE = 0x0711,
|
||||
B_SET_BLENDING_MODE = 0x0712,
|
||||
|
||||
// Get instructions
|
||||
|
||||
B_PEN_SIZE = 0x0780,
|
||||
B_FORE_COLOR = 0x0781,
|
||||
B_BACK_COLOR = 0x0782,
|
||||
B_PEN_LOCATION = 0x0783,
|
||||
// B_FRAME = 0x0784, // ????
|
||||
B_DRAWING_MODE = 0x0785,
|
||||
B_CLIPPING_REGION = 0x0786,
|
||||
B_LINE_CAP_MODE = 0x0787,
|
||||
B_LINE_JOIN_MODE = 0x0788,
|
||||
B_LINE_MITER_LIMIT = 0x0789,
|
||||
// B_ORIGIN = 0x078A,
|
||||
B_BLENDING_MODE = 0x078B,
|
||||
B_FONT = 0x078C,
|
||||
B_FRAME = 0x078D,
|
||||
|
||||
// Misc instructions
|
||||
|
||||
B_CONVERT_TO = 0x0832,
|
||||
B_CONVERT_FROM = 0x0833,
|
||||
B_INVALIDATE_RECT = 0x0840,
|
||||
B_DISABLE_UPDATES = 0x0841,
|
||||
B_ENABLES_UPDATES = 0x0842,
|
||||
//???? = 0x0845,
|
||||
B_BEGIN_VIEW_TRANSACTION = 0x0846,
|
||||
B_END_VIEW_TRANSACTION = 0x0847,
|
||||
B_BEGIN_PICTURE = 0x0850,
|
||||
B_APPEND_TO_PICTURE = 0x0851,
|
||||
B_END_PICTURE = 0x0852,
|
||||
B_GET_WORKSPACES = 0x0860,
|
||||
B_SET_WORKSPACES = 0x0861,
|
||||
|
||||
// This is necessary because B_SHOW_CURSOR is defined in Accelerant.h
|
||||
B_BPIC_SHOW_CURSOR = 0x0ECD,
|
||||
B_HIDE_CURSOR = 0x0ECE,
|
||||
B_OBSCURE_CURSOR = 0x0ECF,
|
||||
|
||||
B_IS_CURSOR_HIDDEN = 0x0EDA,
|
||||
|
||||
B_SET_CURSOR = 0x0F10,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,96 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2002-2005, Haiku
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: PrivateScreen.h
|
||||
// Author: Stefano Ceccherini ([email protected])
|
||||
// Description: BPrivateScreen is the class which does the real work
|
||||
// for the proxy class BScreen (it interacts with the app server).
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __PRIVATESCREEN_H
|
||||
#define __PRIVATESCREEN_H
|
||||
|
||||
#include <Accelerant.h>
|
||||
#include <GraphicsDefs.h>
|
||||
|
||||
struct screen_desc;
|
||||
class BApplication;
|
||||
class BWindow;
|
||||
|
||||
class BPrivateScreen {
|
||||
// Constructor and destructor are private. Use the static methods
|
||||
// CheckOut() and Return() instead.
|
||||
public:
|
||||
static BPrivateScreen* CheckOut(BWindow *win);
|
||||
static BPrivateScreen* CheckOut(screen_id id);
|
||||
static void Return(BPrivateScreen *screen);
|
||||
|
||||
status_t SetToNext();
|
||||
|
||||
color_space ColorSpace();
|
||||
BRect Frame();
|
||||
screen_id ID();
|
||||
|
||||
status_t WaitForRetrace(bigtime_t timeout);
|
||||
|
||||
uint8 IndexForColor(uint8 red, uint8 green, uint8 blue, uint8 alpha);
|
||||
rgb_color ColorForIndex(const uint8 index);
|
||||
uint8 InvertIndex(uint8 index);
|
||||
|
||||
const color_map *ColorMap();
|
||||
|
||||
status_t GetBitmap(BBitmap **bitmap, bool drawCursor, BRect *bound);
|
||||
status_t ReadBitmap(BBitmap *bitmap, bool drawCursor, BRect *bound);
|
||||
|
||||
rgb_color DesktopColor(uint32 index);
|
||||
void SetDesktopColor(rgb_color, uint32, bool);
|
||||
|
||||
status_t ProposeMode(display_mode *target, const display_mode *low, const display_mode *high);
|
||||
|
||||
status_t GetModeList(display_mode **mode_list, uint32 *count);
|
||||
status_t GetMode(uint32 workspace, display_mode *mode);
|
||||
status_t SetMode(uint32 workspace, display_mode *mode, bool makeDefault);
|
||||
|
||||
status_t GetDeviceInfo(accelerant_device_info *info);
|
||||
status_t GetPixelClockLimits(display_mode *mode, uint32 *low, uint32 *high);
|
||||
status_t GetTimingConstraints(display_timing_constraints *dtc);
|
||||
|
||||
status_t SetDPMS(uint32 dpmsState);
|
||||
uint32 DPMSState();
|
||||
uint32 DPMSCapabilites();
|
||||
|
||||
void* BaseAddress();
|
||||
uint32 BytesPerRow();
|
||||
|
||||
status_t get_screen_desc(screen_desc *desc);
|
||||
|
||||
private:
|
||||
color_map *fColorMap;
|
||||
sem_id fRetraceSem;
|
||||
bool fOwnsColorMap;
|
||||
|
||||
sem_id RetraceSemaphore();
|
||||
|
||||
BPrivateScreen();
|
||||
~BPrivateScreen();
|
||||
};
|
||||
|
||||
#endif // __PRIVATESCREEN_H
|
||||
@@ -1,21 +0,0 @@
|
||||
// TODO: This file is here just to be able to use BDirectWindow
|
||||
// with BeOS R5. Remove it when we don't need it anymore
|
||||
|
||||
#ifndef _APP_SERVER_LINK_H
|
||||
#define _APP_SERVER_LINK_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <OS.h>
|
||||
#include <R5_Session.h>
|
||||
|
||||
class _BAppServerLink_ {
|
||||
|
||||
public:
|
||||
_BAppServerLink_();
|
||||
virtual ~_BAppServerLink_();
|
||||
|
||||
_BSession_ *fSession;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -1,69 +0,0 @@
|
||||
// TODO: This file is here just to be able to use BDirectWindow
|
||||
// with BeOS R5. Remove it when we don't need it anymore
|
||||
|
||||
#ifndef _SESSION_H
|
||||
#define _SESSION_H
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <SupportDefs.h>
|
||||
#include <Region.h>
|
||||
#include <Rect.h>
|
||||
#include <OS.h>
|
||||
|
||||
class _BSession_ {
|
||||
|
||||
public:
|
||||
_BSession_(port_id receivePort, port_id sendPort);
|
||||
_BSession_(int32, char *);
|
||||
virtual ~_BSession_();
|
||||
|
||||
char *sread();
|
||||
void sread_coo(float *coo);
|
||||
void sread_coo_a(float *coo);
|
||||
void sread_point(BPoint *point);
|
||||
void sread_point_a(BPoint *point);
|
||||
void sread_rect(clipping_rect *rect);
|
||||
void sread_rect(BRect *rect);
|
||||
void sread_rect_a(BRect *rect);
|
||||
void sread(int32 size, void *data);
|
||||
void sread2(int32 size, void *data);
|
||||
void sreadd(int32 size, void *data);
|
||||
|
||||
void swrite_s(int16 s);
|
||||
void swrite_l(int32 l);
|
||||
void swrite(char *string);
|
||||
void swrite_point(const BPoint *point);
|
||||
void swrite_point_a(const BPoint *point);
|
||||
void swrite_coo(float *coo);
|
||||
void swrite_coo_a(float *coo);
|
||||
void swrite_rect(const clipping_rect *rect);
|
||||
void swrite_rect(const BRect *rect);
|
||||
void swrite_rect_a(const BRect *rect);
|
||||
void swrite(int32 size, void *data);
|
||||
|
||||
// void get_other(message *);
|
||||
// void add_to_buffer(message *);
|
||||
|
||||
void recv_buffer();
|
||||
void send_buffer();
|
||||
|
||||
void sync();
|
||||
void sync_debug();
|
||||
void sclose();
|
||||
void xclose();
|
||||
|
||||
private:
|
||||
port_id fSendPort;
|
||||
port_id fReceivePort;
|
||||
|
||||
char *fSendBuffer;
|
||||
int32 fSendBufferSize;
|
||||
int32 fSendSize;
|
||||
char *fReceiveBuffer;
|
||||
int32 fReceiveSize;
|
||||
int32 fReceivePos;
|
||||
};
|
||||
|
||||
extern _IMPEXP_BE _BSession_ *main_session;
|
||||
|
||||
#endif
|
||||
@@ -1,118 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: TPicture.h
|
||||
// Author: Marc Flerackers ([email protected])
|
||||
// Description: TPicture is used to create and play picture data.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _TPICTURE_H
|
||||
#define _TPICTURE_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <GraphicsDefs.h>
|
||||
#include <Point.h>
|
||||
#include <Rect.h>
|
||||
#include <DataIO.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
// TPicture class --------------------------------------------------------------
|
||||
class TPicture {
|
||||
public:
|
||||
TPicture();
|
||||
TPicture(void *data, int32 size, BList &pictures);
|
||||
virtual ~TPicture();
|
||||
|
||||
int16 GetOp();
|
||||
bool GetBool();
|
||||
int16 GetInt8();
|
||||
int16 GetInt16();
|
||||
int32 GetInt32();
|
||||
int64 GetInt64();
|
||||
float GetFloat();
|
||||
BPoint GetCoord();
|
||||
BRect GetRect();
|
||||
rgb_color GetColor();
|
||||
//void GetString(char *);
|
||||
|
||||
void *GetData(int32);
|
||||
void GetData(void *data, int32 size);
|
||||
|
||||
void AddInt8(int8);
|
||||
void AddInt16(int16);
|
||||
void AddInt32(int32);
|
||||
void AddInt64(int64);
|
||||
void AddFloat(float);
|
||||
void AddCoord(BPoint);
|
||||
void AddRect(BRect);
|
||||
void AddColor(rgb_color);
|
||||
void AddString(char *);
|
||||
|
||||
void AddData(void *data, int32 size);
|
||||
|
||||
// SwapOp();
|
||||
// SwapInt8();
|
||||
// SwapInt16();
|
||||
// SwapInt32();
|
||||
// SwapInt64();
|
||||
// SwapFloat();
|
||||
// SwapCoord();
|
||||
// SwapRect();
|
||||
// SwapIRect();
|
||||
// SwapColor();
|
||||
// SwapString();
|
||||
|
||||
// Swap();
|
||||
|
||||
// CheckPattern();
|
||||
|
||||
void BeginOp(int32);
|
||||
void EndOp();
|
||||
|
||||
void EnterStateChange();
|
||||
void ExitStateChange();
|
||||
|
||||
void EnterFontChange();
|
||||
void ExitFontChange();
|
||||
|
||||
status_t Play(void **callBackTable, int32 tableEntries,
|
||||
void *userData);
|
||||
status_t Rewind();
|
||||
|
||||
private:
|
||||
BMemoryIO fData;
|
||||
int32 fSize;
|
||||
BList &fPictures;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//status_t do_playback(void *, long, BArray<BPicture *> &, void **, long, void *)
|
||||
|
||||
#endif // _TPICTURE_H
|
||||
@@ -1,90 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2002, OpenBeOS
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: TextInput.h
|
||||
// Author: Frans van Nispen ([email protected])
|
||||
// Description: The BTextView derivative owned by an instance of
|
||||
// BTextControl.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef _TEXT_CONTROLI_H
|
||||
#define _TEXT_CONTROLI_H
|
||||
|
||||
// Standard Includes -----------------------------------------------------------
|
||||
|
||||
// System Includes -------------------------------------------------------------
|
||||
#include <TextView.h>
|
||||
|
||||
// Project Includes ------------------------------------------------------------
|
||||
|
||||
// Local Includes --------------------------------------------------------------
|
||||
|
||||
// Local Defines ---------------------------------------------------------------
|
||||
|
||||
// Globals ---------------------------------------------------------------------
|
||||
|
||||
class BTextControl;
|
||||
|
||||
// _BTextInput_ class ----------------------------------------------------------
|
||||
class _BTextInput_ : public BTextView {
|
||||
public:
|
||||
_BTextInput_(BRect frame, BRect textRect,
|
||||
uint32 resizeMask,
|
||||
uint32 flags = B_WILL_DRAW | B_PULSE_NEEDED);
|
||||
_BTextInput_(BMessage *data);
|
||||
~_BTextInput_();
|
||||
|
||||
static BArchivable* Instantiate(BMessage *data);
|
||||
virtual status_t Archive(BMessage *data, bool deep = true) const;
|
||||
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void KeyDown(const char *bytes, int32 numBytes);
|
||||
virtual void MakeFocus(bool focusState = true);
|
||||
|
||||
void AlignTextRect();
|
||||
void SetInitialText();
|
||||
|
||||
virtual void Paste(BClipboard *clipboard);
|
||||
|
||||
protected:
|
||||
|
||||
virtual void InsertText(const char *inText, int32 inLength,
|
||||
int32 inOffset, const text_run_array *inRuns);
|
||||
virtual void DeleteText(int32 fromOffset, int32 toOffset);
|
||||
|
||||
private:
|
||||
|
||||
BTextControl *TextControl();
|
||||
|
||||
char *fPreviousText;
|
||||
bool fBool;
|
||||
};
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#endif // _TEXT_CONTROLI_H
|
||||
|
||||
/*
|
||||
* $Log $
|
||||
*
|
||||
* $Id $
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -1,145 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Copyright (c) 2001-2004, Haiku, Inc.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
// File Name: TextViewSupportBuffer.h
|
||||
// Authors Marc Flerackers ([email protected])
|
||||
// Stefano Ceccherini ([email protected])
|
||||
// Description: Template class used to implement the various BTextView
|
||||
// buffer classes.
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
#ifndef __TEXT_VIEW_SUPPORT_BUFFER__H__
|
||||
#define __TEXT_VIEW_SUPPORT_BUFFER__H__
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
// _BTextViewSupportBuffer_ class ----------------------------------------------
|
||||
template <class T>
|
||||
class _BTextViewSupportBuffer_ {
|
||||
|
||||
public:
|
||||
_BTextViewSupportBuffer_(int32 inExtraCount = 0, int32 inCount = 0);
|
||||
virtual ~_BTextViewSupportBuffer_();
|
||||
|
||||
void InsertItemsAt(int32 inNumItems, int32 inAtIndex, const T *inItem);
|
||||
void RemoveItemsAt(int32 inNumItems, int32 inAtIndex);
|
||||
|
||||
int32 ItemCount() const;
|
||||
|
||||
protected:
|
||||
int32 fExtraCount;
|
||||
int32 fItemCount;
|
||||
int32 fBufferCount;
|
||||
T* fBuffer;
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
_BTextViewSupportBuffer_<T>::_BTextViewSupportBuffer_(int32 inExtraCount,
|
||||
int32 inCount)
|
||||
: fExtraCount(inExtraCount),
|
||||
fItemCount(inCount),
|
||||
fBufferCount(fExtraCount + fItemCount),
|
||||
fBuffer(NULL)
|
||||
{
|
||||
fBuffer = (T *)calloc(fExtraCount + fItemCount, sizeof(T));
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
_BTextViewSupportBuffer_<T>::~_BTextViewSupportBuffer_()
|
||||
{
|
||||
free(fBuffer);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void
|
||||
_BTextViewSupportBuffer_<T>::InsertItemsAt(int32 inNumItems,
|
||||
int32 inAtIndex,
|
||||
const T *inItem)
|
||||
{
|
||||
if (inNumItems < 1)
|
||||
return;
|
||||
|
||||
inAtIndex = (inAtIndex > fItemCount) ? fItemCount : inAtIndex;
|
||||
inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex;
|
||||
|
||||
int32 delta = inNumItems * sizeof(T);
|
||||
int32 logSize = fItemCount * sizeof(T);
|
||||
if ((logSize + delta) >= fBufferCount) {
|
||||
fBufferCount = logSize + delta + (fExtraCount * sizeof(T));
|
||||
fBuffer = (T *)realloc(fBuffer, fBufferCount);
|
||||
if (fBuffer == NULL)
|
||||
debugger("InsertItemsAt(): reallocation failed");
|
||||
}
|
||||
|
||||
T *loc = fBuffer + inAtIndex;
|
||||
memmove(loc + inNumItems, loc, (fItemCount - inAtIndex) * sizeof(T));
|
||||
memcpy(loc, inItem, delta);
|
||||
|
||||
fItemCount += inNumItems;
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
void
|
||||
_BTextViewSupportBuffer_<T>::RemoveItemsAt(int32 inNumItems,
|
||||
int32 inAtIndex)
|
||||
{
|
||||
if (inNumItems < 1)
|
||||
return;
|
||||
|
||||
inAtIndex = (inAtIndex > fItemCount - 1) ? (fItemCount - 1) : inAtIndex;
|
||||
inAtIndex = (inAtIndex < 0) ? 0 : inAtIndex;
|
||||
|
||||
T *loc = fBuffer + inAtIndex;
|
||||
memmove(loc, loc + inNumItems,
|
||||
(fItemCount - (inNumItems + inAtIndex)) * sizeof(T));
|
||||
|
||||
int32 delta = inNumItems * sizeof(T);
|
||||
int32 logSize = fItemCount * sizeof(T);
|
||||
uint32 extraSize = fBufferCount - (logSize - delta);
|
||||
if (extraSize > (fExtraCount * sizeof(T))) {
|
||||
fBufferCount = (logSize - delta) + (fExtraCount * sizeof(T));
|
||||
fBuffer = (T *)realloc(fBuffer, fBufferCount);
|
||||
if (fBuffer == NULL)
|
||||
debugger("RemoveItemsAt(): reallocation failed");
|
||||
}
|
||||
|
||||
fItemCount -= inNumItems;
|
||||
}
|
||||
|
||||
|
||||
template<class T>
|
||||
inline int32
|
||||
_BTextViewSupportBuffer_<T>::ItemCount() const
|
||||
{
|
||||
return fItemCount;
|
||||
}
|
||||
|
||||
|
||||
#endif // __TEXT_VIEW_SUPPORT_BUFFER__H__
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user