Upgrade to version 4.1 of radeon driver.
Includes some common routines which may be used by other drivers. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8405 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
Copyright (c) 2002, Thomas Kurschel
|
||||
|
||||
|
||||
Part of Radeon driver
|
||||
|
||||
Benaphore definition
|
||||
*/
|
||||
|
||||
|
||||
#ifndef _BENAPHORE_H
|
||||
#define _BENAPHORE_H
|
||||
|
||||
|
||||
typedef struct {
|
||||
sem_id sem;
|
||||
int32 ben;
|
||||
} benaphore;
|
||||
|
||||
|
||||
#define INIT_BEN(x, prefix) ( (x).ben = 0, (x).sem = create_sem(0, #prefix " benaphore"), (x).sem )
|
||||
#define ACQUIRE_BEN(x) if((atomic_add(&(x.ben), 1)) >= 1) acquire_sem(x.sem);
|
||||
#define RELEASE_BEN(x) if((atomic_add(&(x.ben), -1)) > 1) release_sem(x.sem);
|
||||
#define DELETE_BEN(x) delete_sem(x.sem);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,62 @@
|
||||
#ifndef BENDIAN_BITFIELD_H
|
||||
#define BENDIAN_BITFIELD_H
|
||||
|
||||
#include <ByteOrder.h>
|
||||
|
||||
#if B_HOST_IS_LENDIAN
|
||||
|
||||
#define BBITFIELD8_2(b1,b2) uint8 b2,b1
|
||||
#define BBITFIELD8_3(b1,b2,b3) uint8 b3,b2,b1
|
||||
#define BBITFIELD8_4(b1,b2,b3,b4) uint8 b4,b3,b2,b1
|
||||
#define BBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b5,b4,b3,b2,b1
|
||||
#define BBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b7,b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b8,b7,b6,b5,b4,b3,b2,b1
|
||||
|
||||
|
||||
#define BBITFIELD16_2(b1,b2) uint16 b2,b1
|
||||
#define BBITFIELD16_3(b1,b2,b3) uint16 b3,b2,b1
|
||||
#define BBITFIELD16_4(b1,b2,b3,b4) uint16 b4,b3,b2,b1
|
||||
#define BBITFIELD16_5(b1,b2,b3,b4,b5) uint16 b5,b4,b3,b2,b1
|
||||
#define BBITFIELD16_6(b1,b2,b3,b4,b5,b6) uint16 b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD16_7(b1,b2,b3,b4,b5,b6,b7) uint16 b7,b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD16_8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD16_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD16_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD16_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define BBITFIELD16_12(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 BBITFIELD16_13(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 BBITFIELD16_14(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 BBITFIELD16_15(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 BBITFIELD16_16(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_BENDIAN
|
||||
|
||||
#define BBITFIELD8_2(b1,b2) uint8 b1,b2
|
||||
#define BBITFIELD8_3(b1,b2,b3) uint8 b1,b2,b3
|
||||
#define BBITFIELD8_4(b1,b2,b3,b4) uint8 b1,b2,b3,b4
|
||||
#define BBITFIELD8_5(b1,b2,b3,b4,b5) uint8 b1,b2,b3,b4,b5
|
||||
#define BBITFIELD8_6(b1,b2,b3,b4,b5,b6) uint8 b1,b2,b3,b4,b5,b6
|
||||
#define BBITFIELD8_7(b1,b2,b3,b4,b5,b6,b7) uint8 b1,b2,b3,b4,b5,b6,b7
|
||||
#define BBITFIELD8_8(b1,b2,b3,b4,b5,b6,b7,b8) uint8 b1,b2,b3,b4,b5,b6,b7,b8
|
||||
|
||||
#define BBITFIELD16_2(b1,b2) uint16 b1,b2
|
||||
#define BBITFIELD16_3(b1,b2,b3) uint16 b1,b2,b3
|
||||
#define BBITFIELD16_4(b1,b2,b3,b4) uint16 b1,b2,b3,b4
|
||||
#define BBITFIELD16_5(b1,b2,b3,b4,b5) uint16 b1,b2,b3,b4,b5
|
||||
#define BBITFIELD16_6(b1,b2,b3,b4,b5,b6) uint16 b1,b2,b3,b4,b5,b6
|
||||
#define BBITFIELD16_7(b1,b2,b3,b4,b5,b6,b7) uint16 b1,b2,b3,b4,b5,b6,b7
|
||||
#define BBITFIELD16_8(b1,b2,b3,b4,b5,b6,b7,b8) uint16 b1,b2,b3,b4,b5,b6,b7,b8
|
||||
#define BBITFIELD16_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9
|
||||
#define BBITFIELD16_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10
|
||||
#define BBITFIELD16_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint16 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11
|
||||
#define BBITFIELD16_12(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 BBITFIELD16_13(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 BBITFIELD16_14(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 BBITFIELD16_15(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 BBITFIELD16_16(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 /* BENDIAN_BITFIELD_H */
|
||||
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
Copyright (c) 2003, Thomas Kurschel
|
||||
|
||||
|
||||
Part of DDC driver
|
||||
|
||||
Main DDC communication
|
||||
*/
|
||||
|
||||
#ifndef _DDC_H
|
||||
#define _DDC_H
|
||||
|
||||
#include "i2c.h"
|
||||
#include "edid.h"
|
||||
|
||||
// read EDID and VDIF from monitor via ddc2
|
||||
// (currently, *vdif and *vdif_len is always set to null)
|
||||
status_t ddc2_read_edid1( const i2c_bus *bus, edid1_info *edid,
|
||||
void **vdif, size_t *vdif_len );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
Copyright (c) 2002, Thomas Kurschel
|
||||
|
||||
|
||||
Part of Radeon driver
|
||||
|
||||
Extended debugging functions
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __DEBUG_EXT_H__
|
||||
#define __DEBUG_EXT_H__
|
||||
|
||||
// this is a dprintf wrapper
|
||||
//
|
||||
// there are three kinds of messages:
|
||||
// flow: used to trace execution
|
||||
// info: tells things that are important but not an error
|
||||
// error: used if something has gone wrong
|
||||
//
|
||||
// common usage is
|
||||
// SHOW_{FLOW,INFO,ERROR}( seriousness, format string, parameters... );
|
||||
// SHOW_{FLOW,INFO,ERROR}0( seriousness, string );
|
||||
//
|
||||
// with
|
||||
// seriousness: the smaller the more serious (0..3)
|
||||
// format string, parameters: normal printf stuff
|
||||
//
|
||||
// to specify the module that created the message you have
|
||||
// to define a string called
|
||||
// DEBUG_MSG_PREFIX
|
||||
// you dynamically speficify the maximum seriousness level by defining
|
||||
// the following variables/macros
|
||||
// debug_level_flow
|
||||
// debug_level_info
|
||||
// debug_level_error
|
||||
//
|
||||
// you _can_ statically specify the maximum seriuosness level by defining
|
||||
// DEBUG_MAX_LEVEL_FLOW
|
||||
// DEBUG_MAX_LEVEL_INFO
|
||||
// DEBUG_MAX_LEVEL_ERRROR
|
||||
//
|
||||
// you _can_ ask to delay execution after each printed message
|
||||
// by defining the duration (in ms) via
|
||||
// DEBUG_WAIT_ON_MSG (for flow and info)
|
||||
// DEBUG_WAIT_ON_ERROR (for error)
|
||||
|
||||
#ifdef DEBUG_WAIT_ON_MSG
|
||||
#define DEBUG_WAIT snooze( DEBUG_WAIT_ON_MSG );
|
||||
#else
|
||||
#define DEBUG_WAIT
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_WAIT_ON_ERROR
|
||||
#define DEBUG_WAIT_ERROR snooze( DEBUG_WAIT_ON_ERROR );
|
||||
#else
|
||||
#define DEBUG_WAIT_ERROR
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_MAX_LEVEL_FLOW
|
||||
#define DEBUG_MAX_LEVEL_FLOW 4
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_MAX_LEVEL_INFO
|
||||
#define DEBUG_MAX_LEVEL_INFO 4
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_MAX_LEVEL_ERROR
|
||||
#define DEBUG_MAX_LEVEL_ERROR 4
|
||||
#endif
|
||||
|
||||
#ifndef DEBUG_MSG_PREFIX
|
||||
#error you need to define DEBUG_MSG_PREFIX with the module name
|
||||
#endif
|
||||
|
||||
#define FUNC_NAME DEBUG_MSG_PREFIX __FUNCTION__ ": "
|
||||
|
||||
#define SHOW_FLOW(seriousness, format, param...) \
|
||||
do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \
|
||||
dprintf( "%s"##format"\n", FUNC_NAME, param ); DEBUG_WAIT \
|
||||
}} while( 0 )
|
||||
|
||||
#define SHOW_FLOW0(seriousness, format) \
|
||||
do { if( seriousness <= debug_level_flow && seriousness <= DEBUG_MAX_LEVEL_FLOW ) { \
|
||||
dprintf( "%s"##format"\n", FUNC_NAME); DEBUG_WAIT \
|
||||
}} while( 0 )
|
||||
|
||||
#define SHOW_INFO(seriousness, format, param...) \
|
||||
do { if( seriousness <= debug_level_info && seriousness <= DEBUG_MAX_LEVEL_INFO ) { \
|
||||
dprintf( "%s"##format"\n", FUNC_NAME, param ); DEBUG_WAIT \
|
||||
}} while( 0 )
|
||||
|
||||
#define SHOW_INFO0(seriousness, format) \
|
||||
do { if( seriousness <= debug_level_info && seriousness <= DEBUG_MAX_LEVEL_INFO ) { \
|
||||
dprintf( "%s"##format"\n", FUNC_NAME); DEBUG_WAIT \
|
||||
}} while( 0 )
|
||||
|
||||
#define SHOW_ERROR(seriousness, format, param...) \
|
||||
do { if( seriousness <= debug_level_error && seriousness <= DEBUG_MAX_LEVEL_ERROR ) { \
|
||||
dprintf( "%s"##format"\n", FUNC_NAME, param ); DEBUG_WAIT_ERROR \
|
||||
}} while( 0 )
|
||||
|
||||
#define SHOW_ERROR0(seriousness, format) \
|
||||
do { if( seriousness <= debug_level_error && seriousness <= DEBUG_MAX_LEVEL_ERROR ) { \
|
||||
dprintf( "%s"##format"\n", FUNC_NAME); DEBUG_WAIT_ERROR \
|
||||
}} while( 0 )
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,146 @@
|
||||
/*
|
||||
Copyright (c) 2003, Thomas Kurschel
|
||||
|
||||
|
||||
Part of DDC driver
|
||||
|
||||
EDID handling, including decoded EDID data block definitin.
|
||||
*/
|
||||
|
||||
#ifndef _EDID_H
|
||||
#define _EDID_H
|
||||
|
||||
#include "edid_raw.h"
|
||||
|
||||
// vendor info
|
||||
typedef struct {
|
||||
char manufacturer[4];
|
||||
uint16 prod_id;
|
||||
uint32 serial;
|
||||
uint8 week;
|
||||
uint16 year;
|
||||
} edid1_vendor;
|
||||
|
||||
|
||||
// version info
|
||||
typedef struct {
|
||||
uint8 version;
|
||||
uint8 revision;
|
||||
} edid1_version;
|
||||
|
||||
|
||||
// display info
|
||||
typedef struct {
|
||||
BBITFIELD8_7 (
|
||||
input_type : 1, // 1 : digital
|
||||
input_voltage : 2, // 0=0.7V/0.3V, 1=0.714V/0.286,
|
||||
// 2=1V/0.4V, 3=0.7V/0V
|
||||
setup : 1, // true if voltage configurable
|
||||
sep_sync : 1,
|
||||
comp_sync : 1,
|
||||
sync_on_green : 1,
|
||||
sync_serr : 1
|
||||
);
|
||||
uint8 h_size;
|
||||
uint8 v_size;
|
||||
uint8 gamma; // (x+100)/100
|
||||
BBITFIELD8_7 (
|
||||
dpms_standby : 1,
|
||||
dpms_suspend : 1,
|
||||
dpms_off : 1,
|
||||
display_type : 2, // 0=mono, 1=rgb, 2=multicolour
|
||||
// since EDID version 1.1
|
||||
std_colour_space : 1,
|
||||
preferred_timing_mode : 1,
|
||||
gtf_supported : 1
|
||||
);
|
||||
uint16 red_x; // all colours are 0.10 fixed point
|
||||
uint16 red_y;
|
||||
uint16 green_x;
|
||||
uint16 green_y;
|
||||
uint16 blue_x;
|
||||
uint16 blue_y;
|
||||
uint16 white_x;
|
||||
uint16 white_y;
|
||||
} edid1_display;
|
||||
|
||||
|
||||
// standard timing data
|
||||
typedef struct {
|
||||
uint16 h_size;
|
||||
uint16 v_size;
|
||||
uint16 id;
|
||||
uint8 ratio;
|
||||
uint8 refresh;
|
||||
} edid1_std_timing;
|
||||
|
||||
|
||||
// additional whitepoint
|
||||
typedef struct {
|
||||
uint8 index;
|
||||
uint16 white_x;
|
||||
uint16 white_y;
|
||||
uint8 gamma; // (x+100)/100
|
||||
} edid1_whitepoint;
|
||||
|
||||
|
||||
// detailed timing description
|
||||
typedef struct {
|
||||
uint16 pixel_clock; // in 10 kHz
|
||||
uint16 h_active;
|
||||
uint16 h_blank;
|
||||
uint16 v_active;
|
||||
uint16 v_blank;
|
||||
uint16 h_sync_off;
|
||||
uint16 h_sync_width;
|
||||
uint16 v_sync_off;
|
||||
uint16 v_sync_width;
|
||||
uint16 h_size;
|
||||
uint16 v_size;
|
||||
uint16 h_border;
|
||||
uint16 v_border;
|
||||
BBITFIELD8_4 (
|
||||
interlaced : 1,
|
||||
stereo : 2, // upper bit set - left on sync
|
||||
// lower bit set - right on sync
|
||||
sync : 2,
|
||||
misc : 2
|
||||
);
|
||||
} edid1_detailed_timing;
|
||||
|
||||
|
||||
// detailed monitor description
|
||||
typedef struct {
|
||||
uint8 monitor_desc_type;
|
||||
union {
|
||||
char serial_number[EDID1_EXTRA_STRING_LEN];
|
||||
char ascii_data[EDID1_EXTRA_STRING_LEN];
|
||||
edid1_monitor_range monitor_range;
|
||||
char monitor_name[EDID1_EXTRA_STRING_LEN];
|
||||
edid1_whitepoint whitepoint[EDID1_NUM_EXTRA_WHITEPOINTS];
|
||||
edid1_std_timing std_timing[EDID1_NUM_EXTRA_STD_TIMING];
|
||||
edid1_detailed_timing detailed_timing;
|
||||
} data;
|
||||
} edid1_detailed_monitor;
|
||||
|
||||
|
||||
// EDID data block
|
||||
typedef struct{
|
||||
edid1_vendor vendor;
|
||||
edid1_version version;
|
||||
edid1_display display;
|
||||
edid1_established_timing established_timing;
|
||||
edid1_std_timing std_timing[EDID1_NUM_STD_TIMING];
|
||||
|
||||
// since EDID version 1.2
|
||||
edid1_detailed_monitor detailed_monitor[EDID1_NUM_DETAILED_MONITOR_DESC];
|
||||
|
||||
uint8 num_sections;
|
||||
} edid1_info;
|
||||
|
||||
// decode raw EDID info into usuable EDID info
|
||||
void edid_decode( edid1_info *edid, const edid1_raw *raw );
|
||||
// dump EDID info to syslog
|
||||
void edid_dump( edid1_info *edid );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,278 @@
|
||||
/*
|
||||
Copyright (c) 2003, Thomas Kurschel
|
||||
|
||||
|
||||
Part of DDC driver
|
||||
|
||||
Raw EDID data block.
|
||||
|
||||
Raw data are packed in a really weird way. Never even
|
||||
think about using it directly, instead translate it via decode_edidpixel_clock
|
||||
first. I did my best to make the code endian-independant, but
|
||||
I cannot guarantee that I haven't missed something.
|
||||
*/
|
||||
|
||||
#ifndef _EDID_RAW_H
|
||||
#define _EDID_RAW_H
|
||||
|
||||
#include "bendian_bitfield.h"
|
||||
|
||||
#define EDID1_NUM_DETAILED_MONITOR_DESC 4
|
||||
#define EDID1_NUM_STD_TIMING 8
|
||||
#define EDID1_NUM_EXTRA_STD_TIMING 6
|
||||
#define EDID1_EXTRA_STRING_LEN 13
|
||||
#define EDID1_NUM_EXTRA_WHITEPOINTS 2
|
||||
|
||||
|
||||
// header
|
||||
typedef struct _PACKED {
|
||||
int8 pad[8]; // contains 0, -1, -1, -1, -1, -1, -1, 0
|
||||
} edid1_header_raw;
|
||||
|
||||
|
||||
// vendor info
|
||||
typedef struct _PACKED {
|
||||
BBITFIELD8_3 ( // manufacturer
|
||||
pad : 1,
|
||||
c1 : 5, // add '@' to get ascii
|
||||
c2_high : 2
|
||||
);
|
||||
BBITFIELD8_2 (
|
||||
c2_low : 3,
|
||||
c3 : 5
|
||||
);
|
||||
uint16 prod_id;
|
||||
uint32 serial;
|
||||
uint8 week;
|
||||
uint8 year; // x+1990
|
||||
} edid1_vendor_raw;
|
||||
|
||||
|
||||
// version info
|
||||
typedef struct _PACKED {
|
||||
uint8 version;
|
||||
uint8 revision;
|
||||
} edid1_version_raw;
|
||||
|
||||
|
||||
// display info
|
||||
typedef struct _PACKED {
|
||||
BBITFIELD8_7 (
|
||||
input_type : 1, // 1 : digital
|
||||
input_voltage : 2, // 0=0.7V/0.3V, 1=0.714V/0.286,
|
||||
// 2=1V/0.4V, 3=0.7V/0V
|
||||
setup : 1, // true if voltage configurable
|
||||
sep_sync : 1,
|
||||
comp_sync : 1,
|
||||
sync_on_green : 1,
|
||||
sync_serr : 1
|
||||
);
|
||||
uint8 h_size;
|
||||
uint8 v_size;
|
||||
uint8 gamma; // (x+100)/100
|
||||
BBITFIELD8_7 (
|
||||
dpms_standby : 1,
|
||||
dpms_suspend : 1,
|
||||
dpms_off : 1,
|
||||
display_type : 2, // 0=mono, 1=rgb, 2=multicolour
|
||||
// since EDID version 1.1
|
||||
std_colour_space : 1,
|
||||
preferred_timing_mode : 1,
|
||||
gtf_supported : 1
|
||||
);
|
||||
BBITFIELD8_4 ( // low bits of red_x etc.
|
||||
red_x_low : 2,
|
||||
red_y_low : 2,
|
||||
green_x_low : 2,
|
||||
green_y_low : 2
|
||||
);
|
||||
BBITFIELD8_4 (
|
||||
blue_x_low : 2,
|
||||
blue_y_low : 2,
|
||||
white_x_low : 2,
|
||||
white_y_low : 2
|
||||
);
|
||||
uint8 red_x; // all colours are 0.10 fixed point
|
||||
uint8 red_y;
|
||||
uint8 green_x;
|
||||
uint8 green_y;
|
||||
uint8 blue_x;
|
||||
uint8 blue_y;
|
||||
uint8 white_x;
|
||||
uint8 white_y;
|
||||
} edid1_display_raw;
|
||||
|
||||
|
||||
// raw standard timing data
|
||||
typedef union _PACKED {
|
||||
struct _PACKED {
|
||||
uint8 h_size; // (x+31)*8
|
||||
BBITFIELD8_2 (
|
||||
ratio : 2, // 0=1:1, 1=3/4, 2=4/5, 3=9/16
|
||||
refresh : 6 // (x+60)
|
||||
);
|
||||
} timing;
|
||||
uint16 id;
|
||||
} edid1_std_timing_raw;
|
||||
|
||||
|
||||
// list of supported fixed timings
|
||||
typedef struct _PACKED {
|
||||
BBITFIELD8_8 (
|
||||
res_720x400x70 : 1,
|
||||
res_720x400x88 : 1,
|
||||
res_640x480x60 : 1,
|
||||
res_640x480x67 : 1,
|
||||
res_640x480x72 : 1,
|
||||
res_640x480x75 : 1,
|
||||
res_800x600x56 : 1,
|
||||
res_800x600x60 : 1
|
||||
);
|
||||
BBITFIELD8_8 (
|
||||
res_800x600x72 : 1,
|
||||
res_800x600x75 : 1,
|
||||
res_832x624x75 : 1,
|
||||
res_1024x768x87i : 1,
|
||||
res_1024x768x60 : 1,
|
||||
res_1024x768x70 : 1,
|
||||
res_1024x768x75 : 1,
|
||||
res_1280x1024x75 : 1
|
||||
);
|
||||
BBITFIELD8_2 (
|
||||
res_1152x870x75 : 1,
|
||||
pad : 7
|
||||
);
|
||||
} edid1_established_timing;
|
||||
|
||||
|
||||
// types of detailed monitor description
|
||||
enum {
|
||||
edid1_serial_number = 0xff,
|
||||
edid1_ascii_data = 0xfe,
|
||||
edid1_monitor_ranges = 0xfd,
|
||||
edid1_monitor_name = 0xfc,
|
||||
edid1_add_colour_pointer = 0xfb,
|
||||
edid1_add_std_timing = 0xfa,
|
||||
edid1_is_detailed_timing = 1
|
||||
};
|
||||
|
||||
|
||||
// monitor frequency range
|
||||
typedef struct _PACKED {
|
||||
uint8 min_v;
|
||||
uint8 max_v;
|
||||
uint8 min_h;
|
||||
uint8 max_h;
|
||||
uint8 max_clock; // in 10 MHz (!)
|
||||
} edid1_monitor_range;
|
||||
|
||||
|
||||
// additional whitepoint
|
||||
typedef struct _PACKED {
|
||||
uint8 index1;
|
||||
BBITFIELD8_3 (
|
||||
pad1 : 4,
|
||||
white_x1_low : 2,
|
||||
white_y1_low : 2
|
||||
);
|
||||
uint8 white_x1;
|
||||
uint8 white_y1;
|
||||
uint8 gamma1; // (x+100)/100
|
||||
uint8 index2;
|
||||
BBITFIELD8_3 (
|
||||
pad2 : 4,
|
||||
white_x2_low : 2,
|
||||
white_y2_low : 2
|
||||
);
|
||||
uint8 white_x2;
|
||||
uint8 white_y2;
|
||||
uint8 gamma2; // (x+100)/100
|
||||
} edid1_whitepoint_raw;
|
||||
|
||||
|
||||
// detailed timing description
|
||||
typedef struct _PACKED {
|
||||
uint16 pixel_clock; // in 10 kHz (!)
|
||||
uint8 h_active;
|
||||
uint8 h_blank;
|
||||
BBITFIELD8_2 (
|
||||
h_active_high : 4,
|
||||
h_blank_high : 4
|
||||
);
|
||||
uint8 v_active;
|
||||
uint8 v_blank;
|
||||
BBITFIELD8_2 (
|
||||
v_active_high : 4,
|
||||
v_blank_high : 4
|
||||
);
|
||||
uint8 h_sync_off;
|
||||
uint8 h_sync_width;
|
||||
BBITFIELD8_2 (
|
||||
v_sync_off : 4,
|
||||
v_sync_width : 4
|
||||
);
|
||||
BBITFIELD8_4 (
|
||||
h_sync_off_high : 2,
|
||||
h_sync_width_high : 2,
|
||||
v_sync_off_high : 2,
|
||||
v_sync_width_high : 2
|
||||
);
|
||||
uint8 h_size;
|
||||
uint8 v_size;
|
||||
BBITFIELD8_2 (
|
||||
h_size_high : 4,
|
||||
v_size_high : 4
|
||||
);
|
||||
uint8 h_border;
|
||||
uint8 v_border;
|
||||
BBITFIELD8_4 (
|
||||
interlaced : 1,
|
||||
stereo : 2, // upper bit set - left on sync
|
||||
// lower bit set - right on sync
|
||||
sync : 2,
|
||||
misc : 2
|
||||
);
|
||||
} edid1_detailed_timing_raw;
|
||||
|
||||
|
||||
// detailed monitor description
|
||||
typedef union _PACKED {
|
||||
edid1_detailed_timing_raw detailed_timing;
|
||||
struct _PACKED {
|
||||
uint8 zero_0[3];
|
||||
uint8 monitor_desc_type;
|
||||
uint8 zero_4;
|
||||
union _PACKED {
|
||||
uint8 serial_number[EDID1_EXTRA_STRING_LEN];
|
||||
uint8 ascii_data[EDID1_EXTRA_STRING_LEN];
|
||||
uint8 monitor_name[EDID1_EXTRA_STRING_LEN];
|
||||
edid1_monitor_range monitor_range;
|
||||
edid1_whitepoint_raw whitepoint;
|
||||
edid1_std_timing_raw std_timing[EDID1_NUM_EXTRA_STD_TIMING];
|
||||
|
||||
} data;
|
||||
} extra;
|
||||
} edid1_detailed_monitor_raw;
|
||||
|
||||
|
||||
// raw EDID data
|
||||
// everything is packed data, mixture of little endian and big endian
|
||||
// and a bit brain dead overall - nothing your dad would be proud of
|
||||
typedef struct _PACKED {
|
||||
edid1_header_raw header; // 8 bytes
|
||||
edid1_vendor_raw vendor; // 10 bytes
|
||||
edid1_version_raw version; // 2 bytes
|
||||
edid1_display_raw display; // 15 bytes
|
||||
edid1_established_timing established_timing; // 3 bytes
|
||||
edid1_std_timing_raw std_timing[EDID1_NUM_STD_TIMING];
|
||||
// 8 a 2 bytes -> 16 bytes
|
||||
|
||||
// since EDID version 1.2
|
||||
edid1_detailed_monitor_raw detailed_monitor[EDID1_NUM_DETAILED_MONITOR_DESC];
|
||||
// 4 a 18 bytes -> 72 bytes
|
||||
|
||||
uint8 num_sections; // 1 byte
|
||||
uint8 check_sum; // 1 byte
|
||||
} edid1_raw; // total: 128 bytes
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
Copyright (c) 2003, Thomas Kurschel
|
||||
|
||||
|
||||
Part of DDC driver
|
||||
|
||||
I2C protocoll
|
||||
*/
|
||||
|
||||
#ifndef _I2C_H
|
||||
#define _I2C_H
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
// timing for i2c bus
|
||||
typedef struct i2c_timing {
|
||||
// general timing as defined by standard
|
||||
// (in microseconds for 100kHz/400kHz mode)
|
||||
int buf; // bus free between start and stop (4.7/1.3)
|
||||
int hd_sta; // hold time start condition (4.0/0.6)
|
||||
int low; // low period of clock (4.7/1.3)
|
||||
int high; // high period of clock (4.0/0.6)
|
||||
int su_sta; // setup time of repeated start condition (4.7/0.6)
|
||||
int hd_dat; // hold time data (5.0/- for CBUS, 0/0 for I2C)
|
||||
int su_dat; // setup time data (0.250/0.100)
|
||||
int r; // maximum raise time of clock and data signal (1.0/0.3)
|
||||
int f; // maximum fall time of clock and data signal (0.3/0.3)
|
||||
int su_sto; // setup time for stop condition (4.0/0.6)
|
||||
|
||||
// clock stretching limits, not part of i2c standard
|
||||
int start_timeout; // max. delay of start condition
|
||||
int byte_timeout; // max. delay of first bit of byte
|
||||
int bit_timeout; // max. delay of one bit within a byte transmission
|
||||
int ack_start_timeout; // max. delay of acknowledge start
|
||||
|
||||
// other timeouts, not part of i2c standard
|
||||
int ack_timeout; // timeout of waiting for acknowledge
|
||||
} i2c_timing;
|
||||
|
||||
|
||||
// set signals on bus
|
||||
typedef status_t (*i2c_set_signals)( void *cookie, int scl, int sda );
|
||||
// read signals from bus
|
||||
typedef status_t (*i2c_get_signals)( void *cookie, int *scl, int *sda );
|
||||
|
||||
|
||||
// i2c bus definition
|
||||
typedef struct i2c_bus {
|
||||
void *cookie; // user-defined cookie
|
||||
i2c_set_signals set_signals; // callback to set signals
|
||||
i2c_get_signals get_signals; // callback to detect signals
|
||||
} i2c_bus;
|
||||
|
||||
|
||||
// send and receive data via i2c bus
|
||||
status_t i2c_send_receive( const i2c_bus *bus, const i2c_timing *timing,
|
||||
int slave_address,
|
||||
const uint8 *write_buffer, size_t write_len,
|
||||
uint8 *read_buffer, size_t read_len );
|
||||
|
||||
|
||||
// fill <timing> with standard 100kHz bus timing
|
||||
void i2c_get100k_timing( i2c_timing *timing );
|
||||
|
||||
// fill <timing> with standard 400kHz bus timing
|
||||
// (as timing resolution is 1 microsecond, we cannot reach full speed!)
|
||||
void i2c_get400k_timing( i2c_timing *timing );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,95 @@
|
||||
#ifndef LENDIAN_BITFIELD_H
|
||||
#define LENDIAN_BITFIELD_H
|
||||
|
||||
#include <ByteOrder.h>
|
||||
|
||||
#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
|
||||
|
||||
#define LBITFIELD32_2(b1,b2) uint32 b2,b1
|
||||
#define LBITFIELD32_3(b1,b2,b3) uint32 b3,b2,b1
|
||||
#define LBITFIELD32_4(b1,b2,b3,b4) uint32 b4,b3,b2,b1
|
||||
#define LBITFIELD32_5(b1,b2,b3,b4,b5) uint32 b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_6(b1,b2,b3,b4,b5,b6) uint32 b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_7(b1,b2,b3,b4,b5,b6,b7) uint32 b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_8(b1,b2,b3,b4,b5,b6,b7,b8) uint32 b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint32 b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint32 b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint32 b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint32 b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint32 b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint32 b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint32 b15,b14,b13,b12,b11,b10,b9,b8,b7,b6,b5,b4,b3,b2,b1
|
||||
#define LBITFIELD32_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint32 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
|
||||
|
||||
#define LBITFIELD32_2(b1,b2) uint32 b1,b2
|
||||
#define LBITFIELD32_3(b1,b2,b3) uint32 b1,b2,b3
|
||||
#define LBITFIELD32_4(b1,b2,b3,b4) uint32 b1,b2,b3,b4
|
||||
#define LBITFIELD32_5(b1,b2,b3,b4,b5) uint32 b1,b2,b3,b4,b5
|
||||
#define LBITFIELD32_6(b1,b2,b3,b4,b5,b6) uint32 b1,b2,b3,b4,b5,b6
|
||||
#define LBITFIELD32_7(b1,b2,b3,b4,b5,b6,b7) uint32 b1,b2,b3,b4,b5,b6,b7
|
||||
#define LBITFIELD32_8(b1,b2,b3,b4,b5,b6,b7,b8) uint32 b1,b2,b3,b4,b5,b6,b7,b8
|
||||
#define LBITFIELD32_9(b1,b2,b3,b4,b5,b6,b7,b8,b9) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9
|
||||
#define LBITFIELD32_10(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10
|
||||
#define LBITFIELD32_11(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11
|
||||
#define LBITFIELD32_12(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12
|
||||
#define LBITFIELD32_13(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13
|
||||
#define LBITFIELD32_14(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14
|
||||
#define LBITFIELD32_15(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15) uint32 b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15
|
||||
#define LBITFIELD32_16(b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13,b14,b15,b16) uint32 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 */
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
Copyright (c) 2002, Thomas Kurschel
|
||||
|
||||
|
||||
Part of Radeon driver
|
||||
|
||||
Fast logger
|
||||
|
||||
As syslog is very slow and tends to loose
|
||||
data if its buffer overflows (which occurs much
|
||||
too often), this module provides a fast (and memory-
|
||||
wasting) logging mechanism. You need a seperate
|
||||
application to retrieve the log.
|
||||
|
||||
Everything is thread-safe.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef __LOG_COLL_H__
|
||||
#define __LOG_COLL_H__
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
// by undefining this flag, all logging functions
|
||||
// are resolved to empty space, so don't add
|
||||
// extra tests in your code
|
||||
#undef ENABLE_LOGGING
|
||||
//#define ENABLE_LOGGING
|
||||
|
||||
|
||||
// add log entry with 0..3 (uint32) data
|
||||
#define LOG( li, what ) log( li, what, 0 )
|
||||
#define LOG1( li, what, arg1 ) log( li, what, 1, arg1 );
|
||||
#define LOG2( li, what, arg1, arg2 ) log( li, what, 2, arg1, arg2 );
|
||||
#define LOG3( li, what, arg1, arg2, arg3 ) log( li, what, 3, arg1, arg2, arg3 );
|
||||
|
||||
|
||||
// one log entry
|
||||
typedef struct log_entry_t {
|
||||
uint64 tsc;
|
||||
uint16 what;
|
||||
uint8 num_args;
|
||||
uint32 args[1];
|
||||
} log_entry;
|
||||
|
||||
struct log_info_t;
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef ENABLE_LOGGING
|
||||
void log( struct log_info_t *li, uint16 what, const uint8 num_args, ... );
|
||||
#else
|
||||
#define log( a, b, c... )
|
||||
#endif
|
||||
|
||||
|
||||
// define LOG_INCLUDE_STARTUP in your device driver
|
||||
#ifdef LOG_INCLUDE_STARTUP
|
||||
|
||||
uint32 log_getsize( struct log_info_t *li );
|
||||
void log_getcopy( struct log_info_t *li, void *dest, uint32 max_size );
|
||||
|
||||
#ifdef ENABLE_LOGGING
|
||||
|
||||
struct log_info_t *log_init( uint32 size );
|
||||
void log_exit( struct log_info_t *li );
|
||||
|
||||
#else
|
||||
|
||||
#define log_init( a ) NULL
|
||||
#define log_exit( a )
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
Copyright (c) 2002, Thomas Kurschel
|
||||
|
||||
|
||||
Part of Radeon kernel driver
|
||||
|
||||
Memory manager used for graphics mem
|
||||
*/
|
||||
|
||||
#ifndef _MEMMGR_H
|
||||
#define _MEMMGR_H
|
||||
|
||||
#include <OS.h>
|
||||
|
||||
|
||||
// allocated memory block
|
||||
typedef struct mem_block {
|
||||
struct mem_block *prev, *next;
|
||||
uint32 base;
|
||||
uint32 size;
|
||||
void *tag;
|
||||
bool alloced;
|
||||
} mem_block;
|
||||
|
||||
|
||||
// memory heap
|
||||
typedef struct mem_info {
|
||||
mem_block *first;
|
||||
uint32 block_size;
|
||||
sem_id lock;
|
||||
mem_block *heap;
|
||||
mem_block *unused;
|
||||
uint32 heap_entries;
|
||||
} mem_info;
|
||||
|
||||
|
||||
mem_info *mem_init( uint32 start, uint32 len, uint32 block_size, uint32 heap_entries );
|
||||
void mem_destroy( mem_info *mem );
|
||||
status_t mem_alloc( mem_info *mem, uint32 size, void *tag, uint32 *block, uint32 *offset );
|
||||
status_t mem_free( mem_info *mem, uint32 block_id, void *tag );
|
||||
void mem_freetag( mem_info *mem, void *tag );
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,36 @@
|
||||
/* ++++++++++
|
||||
File: perfmon_kernel.h
|
||||
Description: kernel mode interface to performance counters and time stamp
|
||||
registers of 586 and 686 CPUs
|
||||
|
||||
DO NOT use these functions in the production code !!!
|
||||
This interface WILL BE CHANGED in the next releases.
|
||||
|
||||
Copyright (c) 1998 by Be Incorporated. All Rights Reserved.
|
||||
+++++ */
|
||||
|
||||
|
||||
#ifndef _PERFMON_KERNEL_H
|
||||
#define _PERFMON_KERNEL_H
|
||||
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if __INTEL__
|
||||
|
||||
extern _IMPEXP_KERNEL uint64 read_msr(uint32 msr);
|
||||
extern _IMPEXP_KERNEL void write_msr(uint32 msr, uint64 val);
|
||||
extern _IMPEXP_KERNEL uint64 read_pmc(uint32 pmc);
|
||||
extern _IMPEXP_KERNEL uint64 read_tsc(void);
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user