diff options
author | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-27 00:12:59 -0200 |
---|---|---|
committer | Paulo Cesar Pereira de Andrade <pcpa@mandriva.com.br> | 2008-11-27 00:12:59 -0200 |
commit | 87a7fb7438b70d07ebf240c530b8548a01021d48 (patch) | |
tree | e38a9c8dc0986cae89230e08acc1d5f15de6e530 | |
parent | fc708394318ed92c612e2938b335c08c1ffebb28 (diff) |
Rework code using return value of LoaderSymbol as a function pointer.
The patch removes all macros in the format
define xf86_sym ((type (*)(argument-list))LoaderSymbol("sym"))
creates a new macro in the format
define xf86_sym sym
and ensures "sym" is a "visible" symbol.
The patch doesn't add or remove features, and is source and binary
compatible with previous shared objects (with the difference that it
requires the dlloader).
These symbols are a special case, as, due to the fact that LoaderSymbol
was being used to reference them, they are not easily found by "automated"
tools that check for missing symbols. And now it also have the benefit
that the compiler/loader "knows what is going on".
-rw-r--r-- | hw/xfree86/i2c/bt829.c | 22 | ||||
-rw-r--r-- | hw/xfree86/i2c/bt829.h | 48 | ||||
-rw-r--r-- | hw/xfree86/i2c/fi1236.c | 12 | ||||
-rw-r--r-- | hw/xfree86/i2c/fi1236.h | 25 | ||||
-rw-r--r-- | hw/xfree86/i2c/i2c_def.h | 10 | ||||
-rw-r--r-- | hw/xfree86/i2c/msp3430.c | 8 | ||||
-rw-r--r-- | hw/xfree86/i2c/msp3430.h | 21 | ||||
-rw-r--r-- | hw/xfree86/i2c/tda8425.c | 8 | ||||
-rw-r--r-- | hw/xfree86/i2c/tda8425.h | 17 | ||||
-rw-r--r-- | hw/xfree86/i2c/tda9850.c | 12 | ||||
-rw-r--r-- | hw/xfree86/i2c/tda9850.h | 25 | ||||
-rw-r--r-- | hw/xfree86/i2c/tda9885.c | 10 | ||||
-rw-r--r-- | hw/xfree86/i2c/tda9885.h | 21 | ||||
-rw-r--r-- | hw/xfree86/i2c/uda1380.c | 16 | ||||
-rw-r--r-- | hw/xfree86/i2c/uda1380.h | 33 | ||||
-rw-r--r-- | hw/xfree86/i2c/xf86i2c.c | 14 | ||||
-rw-r--r-- | hw/xfree86/i2c/xf86i2c.h | 24 |
17 files changed, 163 insertions, 163 deletions
diff --git a/hw/xfree86/i2c/bt829.c b/hw/xfree86/i2c/bt829.c index 3963ecf47..5b705874a 100644 --- a/hw/xfree86/i2c/bt829.c +++ b/hw/xfree86/i2c/bt829.c @@ -456,7 +456,7 @@ static void write_all(BT829Ptr bt) /* * Public functions */ -BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr) +_X_EXPORT BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr) { BT829Ptr bt; I2CByte a; @@ -542,7 +542,7 @@ BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr) return bt; } -int bt829_ATIInit(BT829Ptr bt) +_X_EXPORT int bt829_ATIInit(BT829Ptr bt) { bt->code = 1; bt->len = 0; @@ -555,7 +555,7 @@ int bt829_ATIInit(BT829Ptr bt) return 0; } -int bt829_SetFormat(BT829Ptr bt, CARD8 format) +_X_EXPORT int bt829_SetFormat(BT829Ptr bt, CARD8 format) { if ((format < 1) || (format > 7)) return -1; if ((BTVERSION <= BT819) && @@ -571,7 +571,7 @@ int bt829_SetFormat(BT829Ptr bt, CARD8 format) return 0; } -int bt829_SetMux(BT829Ptr bt, CARD8 mux) +_X_EXPORT int bt829_SetMux(BT829Ptr bt, CARD8 mux) { if ((mux < 1) || (mux > 3)) return -1; if (mux == bt->mux) return 0; @@ -583,7 +583,7 @@ int bt829_SetMux(BT829Ptr bt, CARD8 mux) return 0; } -void bt829_SetBrightness(BT829Ptr bt, int brightness) +_X_EXPORT void bt829_SetBrightness(BT829Ptr bt, int brightness) { brightness = LIMIT(brightness,-1000,999); /* ensure -128 <= brightness <= 127 below */ brightness = (128*brightness)/1000; @@ -593,7 +593,7 @@ void bt829_SetBrightness(BT829Ptr bt, int brightness) btwrite_bright(bt); } -void bt829_SetContrast(BT829Ptr bt, int contrast) +_X_EXPORT void bt829_SetContrast(BT829Ptr bt, int contrast) { contrast = LIMIT(contrast,-1000,1000); contrast = (216*(contrast+1000))/1000; @@ -604,7 +604,7 @@ void bt829_SetContrast(BT829Ptr bt, int contrast) btwrite_contrast_lo(bt); } -void bt829_SetSaturation(BT829Ptr bt, int saturation) +_X_EXPORT void bt829_SetSaturation(BT829Ptr bt, int saturation) { CARD16 sat_u, sat_v; @@ -620,7 +620,7 @@ void bt829_SetSaturation(BT829Ptr bt, int saturation) btwrite_sat_v_lo(bt); } -void bt829_SetTint(BT829Ptr bt, int hue) +_X_EXPORT void bt829_SetTint(BT829Ptr bt, int hue) { hue = LIMIT(hue,-1000,999); /* ensure -128 <= hue <= 127 below */ hue = (128*hue)/1000; @@ -630,7 +630,7 @@ void bt829_SetTint(BT829Ptr bt, int hue) btwrite_hue(bt); } -int bt829_SetCaptSize(BT829Ptr bt, int width, int height) +_X_EXPORT int bt829_SetCaptSize(BT829Ptr bt, int width, int height) { if ((width > bt->htotal - 2 * HCROP) || (16 * width < bt->htotal - 32 * HCROP)) return -1; @@ -656,7 +656,7 @@ int bt829_SetCC(BT829Ptr bt) /* FIXME: should take ccmode as a parameter */ return 0; } -void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en) +_X_EXPORT void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en) { out_en = (out_en != 0); if (out_en == bt->out_en) return; @@ -665,7 +665,7 @@ void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en) btwrite_vpole(bt); } -void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io) +_X_EXPORT void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io) { if (p_io == bt->p_io) return; bt->p_io = p_io; diff --git a/hw/xfree86/i2c/bt829.h b/hw/xfree86/i2c/bt829.h index bca9d37de..17e6bc7bd 100644 --- a/hw/xfree86/i2c/bt829.h +++ b/hw/xfree86/i2c/bt829.h @@ -36,12 +36,15 @@ typedef struct { CARD8 svideo_mux; } BT829Rec, *BT829Ptr; -BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr); +#define xf86_bt829_Detect bt829_Detect +extern BT829Ptr bt829_Detect(I2CBusPtr b, I2CSlaveAddr addr); /* ATI card specific initialization */ #define BT829_ATI_ADDR_1 0x8A #define BT829_ATI_ADDR_2 0x88 -int bt829_ATIInit(BT829Ptr bt); + +#define xf86_bt829_ATIInit bt829_ATIInit +extern int bt829_ATIInit(BT829Ptr bt); #define BT829_NTSC 1 /* NTSC-M */ #define BT829_NTSC_JAPAN 2 /* NTSC-Japan */ @@ -50,22 +53,33 @@ int bt829_ATIInit(BT829Ptr bt); #define BT829_PAL_N 5 /* PAL-N */ #define BT829_SECAM 6 /* SECAM */ #define BT829_PAL_N_COMB 7 /* PAL-N combination */ -int bt829_SetFormat(BT829Ptr bt, CARD8 format); + +#define xf86_bt829_SetFormat bt829_SetFormat +extern int bt829_SetFormat(BT829Ptr bt, CARD8 format); #define BT829_MUX2 1 /* ATI -> composite video */ #define BT829_MUX0 2 /* ATI -> tv tuner */ #define BT829_MUX1 3 /* ATI -> s-video */ -int bt829_SetMux(BT829Ptr bt, CARD8 mux); -int bt829_SetCaptSize(BT829Ptr bt, int width, int height); +#define xf86_bt829_SetMux bt829_SetMux +extern int bt829_SetMux(BT829Ptr bt, CARD8 mux); -void bt829_SetBrightness(BT829Ptr bt, int brightness); -void bt829_SetContrast(BT829Ptr bt, int contrast); -void bt829_SetSaturation(BT829Ptr bt, int saturation); -void bt829_SetTint(BT829Ptr bt, int hue); /* Hue */ +#define xf86_bt829_SetCaptSize bt829_SetCaptSize +extern int bt829_SetCaptSize(BT829Ptr bt, int width, int height); -void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en); /* VPOLE register */ -void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io); /* P_IO register */ +#define xf86_bt829_SetBrightness bt829_SetBrightness +extern void bt829_SetBrightness(BT829Ptr bt, int brightness); +#define xf86_bt829_SetContrast bt829_SetContrast +extern void bt829_SetContrast(BT829Ptr bt, int contrast); +#define xf86_bt829_SetSaturation bt829_SetSaturation +extern void bt829_SetSaturation(BT829Ptr bt, int saturation); +#define xf86_bt829_SetTint bt829_SetTint +extern void bt829_SetTint(BT829Ptr bt, int hue); /* Hue */ + +#define xf86_bt829_SetOUT_EN bt829_SetOUT_EN +extern void bt829_SetOUT_EN(BT829Ptr bt, BOOL out_en);/* VPOLE register */ +#define xf86_bt829_SetP_IO bt829_SetP_IO +extern void bt829_SetP_IO(BT829Ptr bt, CARD8 p_io); /* P_IO register */ int bt829_SetCC(BT829Ptr bt); @@ -82,16 +96,4 @@ int bt829_SetCC(BT829Ptr bt); "bt829_SetOUT_EN", \ "bt829_SetP_IO" -#define xf86_bt829_Detect ((BT829Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("bt829_Detect")) -#define xf86_bt829_ATIInit ((int (*)(BT829Ptr))LoaderSymbol("bt829_ATIInit")) -#define xf86_bt829_SetFormat ((int (*)(BT829Ptr, CARD8))LoaderSymbol("bt829_SetFormat")) -#define xf86_bt829_SetMux ((int (*)(BT829Ptr, CARD8))LoaderSymbol("bt829_SetMux")) -#define xf86_bt829_SetCaptSize ((int (*)(BT829Ptr, int, int))LoaderSymbol("bt829_SetCaptSize")) -#define xf86_bt829_SetBrightness ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetBrightness")) -#define xf86_bt829_SetContrast ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetContrast")) -#define xf86_bt829_SetSaturation ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetSaturation")) -#define xf86_bt829_SetTint ((void (*)(BT829Ptr, int))LoaderSymbol("bt829_SetTint")) -#define xf86_bt829_SetOUT_EN ((void (*)(BT829Ptr, Bool))LoaderSymbol("bt829_SetOUT_EN")) -#define xf86_bt829_SetP_IO ((void (*)(BT829Ptr, CARD8))LoaderSymbol("bt829_SetP_IO")) - #endif diff --git a/hw/xfree86/i2c/fi1236.c b/hw/xfree86/i2c/fi1236.c index 110563ed9..950bb5b25 100644 --- a/hw/xfree86/i2c/fi1236.c +++ b/hw/xfree86/i2c/fi1236.c @@ -41,7 +41,7 @@ const FI1236_parameters tuner_parms[NUM_TUNERS] = }; -FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr) +_X_EXPORT FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr) { FI1236Ptr f; I2CByte a; @@ -394,7 +394,7 @@ return TUNER_OFF; } /* this function is for external use only */ -int TUNER_get_afc_hint(FI1236Ptr f) +_X_EXPORT int TUNER_get_afc_hint(FI1236Ptr f) { if(f->afc_timer_installed)return TUNER_STILL_TUNING; return f->last_afc_hint; @@ -465,7 +465,7 @@ for(i=0;i<3;i++){ xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "MT2032: failed to set frequency\n"); } -void FI1236_set_tuner_type(FI1236Ptr f, int type) +_X_EXPORT void FI1236_set_tuner_type(FI1236Ptr f, int type) { f->type=type; if(type>=NUM_TUNERS)type = NUM_TUNERS-1; @@ -532,7 +532,7 @@ void FI1236_tune(FI1236Ptr f, CARD32 frequency) I2C_WriteRead(&(f->d), (I2CByte *)&(f->tuner_data), 4, NULL, 0); } -void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency) +_X_EXPORT void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency) { if(frequency < f->parm.min_freq) frequency = f->parm.min_freq; if(frequency > f->parm.max_freq) frequency = f->parm.max_freq; @@ -558,7 +558,7 @@ void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency) } -int FI1236_AFC(FI1236Ptr f) +_X_EXPORT int FI1236_AFC(FI1236Ptr f) { #if 0 xf86DrvMsg(f->d.pI2CBus->scrnIndex, X_INFO, "AFC: f=%p f->count=%d f->original_frequency=%d f->afc_delta=%d\n", f, f->afc_count, f->original_frequency, f->afc_delta); @@ -601,7 +601,7 @@ int FI1236_AFC(FI1236Ptr f) return 0; /* done */ } -void fi1236_dump_status(FI1236Ptr f) +_X_EXPORT void fi1236_dump_status(FI1236Ptr f) { if(f->type==TUNER_TYPE_MT2032){ MT2032_dump_status(f); diff --git a/hw/xfree86/i2c/fi1236.h b/hw/xfree86/i2c/fi1236.h index eda1c781c..9c56e5ae2 100644 --- a/hw/xfree86/i2c/fi1236.h +++ b/hw/xfree86/i2c/fi1236.h @@ -87,24 +87,25 @@ typedef struct { #define TUNER_STILL_TUNING 5 -FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr); -void FI1236_set_tuner_type(FI1236Ptr f, int type); -void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency); void FI1236_tune(FI1236Ptr f, CARD32 frequency); -int FI1236_AFC(FI1236Ptr f); -int TUNER_get_afc_hint(FI1236Ptr f); -void fi1236_dump_status(FI1236Ptr f); #define FI1236SymbolsList \ "Detect_FI1236", \ "FI1236_set_tuner_type", \ "TUNER_set_frequency" -#define xf86_Detect_FI1236 ((FI1236Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_FI1236")) -#define xf86_FI1236_set_tuner_type ((void (*)(FI1236Ptr, int))LoaderSymbol("FI1236_set_tuner_type")) -#define xf86_TUNER_set_frequency ((void (*)(FI1236Ptr, CARD32))LoaderSymbol("TUNER_set_frequency")) -#define xf86_FI1236_AFC ((int (*)(FI1236Ptr))LoaderSymbol("FI1236_AFC")) -#define xf86_TUNER_get_afc_hint ((int (*)(FI1236Ptr))LoaderSymbol("TUNER_get_afc_hint")) -#define xf86_fi1236_dump_status ((void (*)(FI1236Ptr))LoaderSymbol("fi1236_dump_status")) +#define xf86_Detect_FI1236 Detect_FI1236 +extern FI1236Ptr Detect_FI1236(I2CBusPtr b, I2CSlaveAddr addr); +#define xf86_FI1236_set_tuner_type FI1236_set_tuner_type +extern void FI1236_set_tuner_type(FI1236Ptr f, int type); +#define xf86_TUNER_set_frequency TUNER_set_frequency +extern void TUNER_set_frequency(FI1236Ptr f, CARD32 frequency); + +#define xf86_FI1236_AFC FI1236_AFC +extern int FI1236_AFC(FI1236Ptr f); +#define xf86_TUNER_get_afc_hint TUNER_get_afc_hint +extern int TUNER_get_afc_hint(FI1236Ptr f); +#define xf86_fi1236_dump_status fi1236_dump_status +extern void fi1236_dump_status(FI1236Ptr f); #endif diff --git a/hw/xfree86/i2c/i2c_def.h b/hw/xfree86/i2c/i2c_def.h index 6e119e478..140a071d6 100644 --- a/hw/xfree86/i2c/i2c_def.h +++ b/hw/xfree86/i2c/i2c_def.h @@ -1,14 +1,6 @@ #ifndef __I2C_DEF_H__ #define __I2C_DEF_H__ -/* the following are a workaround for possible loader bug.. - WATCH function types ! */ -#define CreateI2CBusRec ((pointer (*)(void))LoaderSymbol("xf86CreateI2CBusRec")) -#define DestroyI2CBusRec ((pointer (*)(I2CBusPtr, Bool, Bool))LoaderSymbol("xf86DestroyI2CBusRec")) -#define I2CBusInit ((Bool (*)(pointer))LoaderSymbol("xf86I2CBusInit")) -#define I2C_WriteRead ((Bool (*)(I2CDevPtr, I2CByte *, int, I2CByte *, int))LoaderSymbol("xf86I2CWriteRead")) -#define CreateI2CDevRec ((pointer (*)(void))LoaderSymbol("xf86CreateI2CDevRec")) -#define I2CDevInit ((Bool (*)(I2CDevPtr))LoaderSymbol("xf86I2CDevInit")) -#define I2CProbeAddress ((Bool (*)(I2CBusPtr,I2CSlaveAddr))LoaderSymbol("xf86I2CProbeAddress")) +#include "xf86i2c.h" #endif diff --git a/hw/xfree86/i2c/msp3430.c b/hw/xfree86/i2c/msp3430.c index 4bd3a7187..e19dda3e6 100644 --- a/hw/xfree86/i2c/msp3430.c +++ b/hw/xfree86/i2c/msp3430.c @@ -129,7 +129,7 @@ void InitMSP3430(MSP3430Ptr m) | common functions for all MSP34xx chips |----------------------------------------------------------------*/ -MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr) +_X_EXPORT MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr) { MSP3430Ptr m; I2CByte a; @@ -249,7 +249,7 @@ MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr) return m; } -void ResetMSP3430(MSP3430Ptr m) +_X_EXPORT void ResetMSP3430(MSP3430Ptr m) { /* Reset the MSP3430 */ SetMSP3430Control(m, 0x00, 0x80, 0x00); @@ -262,7 +262,7 @@ void ResetMSP3430(MSP3430Ptr m) m->volume=0; } -void MSP3430SetVolume (MSP3430Ptr m, CARD8 value) +_X_EXPORT void MSP3430SetVolume (MSP3430Ptr m, CARD8 value) { CARD8 result; #if 0 @@ -287,7 +287,7 @@ void MSP3430SetVolume (MSP3430Ptr m, CARD8 value) } -void MSP3430SetSAP (MSP3430Ptr m, int mode) +_X_EXPORT void MSP3430SetSAP (MSP3430Ptr m, int mode) { xf86DrvMsg(m->d.pI2CBus->scrnIndex, X_INFO, "Put actual code to change SAP here\n"); diff --git a/hw/xfree86/i2c/msp3430.h b/hw/xfree86/i2c/msp3430.h index 1cb9b869d..500023b75 100644 --- a/hw/xfree86/i2c/msp3430.h +++ b/hw/xfree86/i2c/msp3430.h @@ -92,11 +92,16 @@ typedef struct { #define MSPMODE_B 8 /*----------------------------------------------------------*/ -void InitMSP3430(MSP3430Ptr m); -MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr); -void ResetMSP3430(MSP3430Ptr m); -void MSP3430SetVolume (MSP3430Ptr m, CARD8 value); -void MSP3430SetSAP (MSP3430Ptr m, int mode); +#define xf86_InitMSP3430 InitMSP3430 +extern void InitMSP3430(MSP3430Ptr m); +#define xf86_DetectMSP3430 DetectMSP3430 +extern MSP3430Ptr DetectMSP3430(I2CBusPtr b, I2CSlaveAddr addr); +#define xf86_ResetMSP3430 ResetMSP3430 +extern void ResetMSP3430(MSP3430Ptr m); +#define xf86_MSP3430SetVolume MSP3430SetVolume +extern void MSP3430SetVolume (MSP3430Ptr m, CARD8 value); +#define xf86_MSP3430SetSAP MSP3430SetSAP +extern void MSP3430SetSAP (MSP3430Ptr m, int mode); #define MSP3430SymbolsList \ "InitMSP3430", \ @@ -105,10 +110,4 @@ void MSP3430SetSAP (MSP3430Ptr m, int mode); "MSP3430SetVolume", \ "MSP3430SetSAP" -#define xf86_DetectMSP3430 ((MSP3430Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("DetectMSP3430")) -#define xf86_ResetMSP3430 ((void (*)(MSP3430Ptr))LoaderSymbol("ResetMSP3430")) -#define xf86_MSP3430SetVolume ((void (*)(MSP3430Ptr, CARD8))LoaderSymbol("MSP3430SetVolume")) -#define xf86_MSP3430SetSAP ((void (*)(MSP3430Ptr, int))LoaderSymbol("MSP3430SetSAP")) -#define xf86_InitMSP3430 ((void (*)(MSP3430Ptr))LoaderSymbol("InitMSP3430")) - #endif diff --git a/hw/xfree86/i2c/tda8425.c b/hw/xfree86/i2c/tda8425.c index 7631a0863..6ca10e373 100644 --- a/hw/xfree86/i2c/tda8425.c +++ b/hw/xfree86/i2c/tda8425.c @@ -13,7 +13,7 @@ I2C_WriteRead(&(t->d), data, 2, NULL, 0); \ } -TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force) +_X_EXPORT TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force) { TDA8425Ptr t; @@ -44,7 +44,7 @@ TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr, Bool force) return t; } -Bool tda8425_init(TDA8425Ptr t) +_X_EXPORT Bool tda8425_init(TDA8425Ptr t) { t->stereo = 3; /* 3 = Spacial 2 = Linear 1 = Pseudo 0 = Forced mono */ t->v_left = 0xFF; /* FF - C0 */ @@ -59,7 +59,7 @@ Bool tda8425_init(TDA8425Ptr t) return TRUE; } -void tda8425_setaudio(TDA8425Ptr t) +_X_EXPORT void tda8425_setaudio(TDA8425Ptr t) { I2CByte data[2]; @@ -71,7 +71,7 @@ void tda8425_setaudio(TDA8425Ptr t) t->mux); } -void tda8425_mute(TDA8425Ptr t, Bool mute) +_X_EXPORT void tda8425_mute(TDA8425Ptr t, Bool mute) { t->mute = mute; tda8425_setaudio(t); diff --git a/hw/xfree86/i2c/tda8425.h b/hw/xfree86/i2c/tda8425.h index 4abb4175f..636327cc6 100644 --- a/hw/xfree86/i2c/tda8425.h +++ b/hw/xfree86/i2c/tda8425.h @@ -23,10 +23,14 @@ typedef struct { of I2C protocol is not always available. Besides address there is no good way to autodetect it so we have to _know_ it is there anyway */ -TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr,Bool force); -Bool tda8425_init(TDA8425Ptr t); -void tda8425_setaudio(TDA8425Ptr t); -void tda8425_mute(TDA8425Ptr t, Bool mute); +#define xf86_Detect_tda8425 Detect_tda8425 +extern TDA8425Ptr Detect_tda8425(I2CBusPtr b, I2CSlaveAddr addr,Bool force); +#define xf86_tda8425_init tda8425_init +extern Bool tda8425_init(TDA8425Ptr t); +#define xf86_tda8425_setaudio tda8425_setaudio +extern void tda8425_setaudio(TDA8425Ptr t); +#define xf86_tda8425_mute tda8425_mute +extern void tda8425_mute(TDA8425Ptr t, Bool mute); #define TDA8425SymbolsList \ "Detect_tda8425", \ @@ -34,9 +38,4 @@ void tda8425_mute(TDA8425Ptr t, Bool mute); "tda8425_setaudio", \ "tda8425_mute" -#define xf86_Detect_tda8425 ((TDA8425Ptr (*)(I2CBusPtr, I2CSlaveAddr,Bool))LoaderSymbol("Detect_tda8425")) -#define xf86_tda8425_init ((Bool (*)(TDA8425Ptr))LoaderSymbol("tda8425_init")) -#define xf86_tda8425_setaudio ((void (*)(TDA8425Ptr))LoaderSymbol("tda8425_setaudio")) -#define xf86_tda8425_mute ((void (*)(TDA8425Ptr, Bool))LoaderSymbol("tda8425_mute")) - #endif diff --git a/hw/xfree86/i2c/tda9850.c b/hw/xfree86/i2c/tda9850.c index 5b0c581ed..7566012d7 100644 --- a/hw/xfree86/i2c/tda9850.c +++ b/hw/xfree86/i2c/tda9850.c @@ -13,7 +13,7 @@ I2C_WriteRead(&(t->d), data, 2, NULL, 0); \ } -TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr) +_X_EXPORT TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr) { TDA9850Ptr t; I2CByte a; @@ -53,7 +53,7 @@ TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr) return t; } -Bool tda9850_init(TDA9850Ptr t) +_X_EXPORT Bool tda9850_init(TDA9850Ptr t) { t->stereo = 1; t->sap = 0; @@ -63,7 +63,7 @@ Bool tda9850_init(TDA9850Ptr t) return TRUE; } -void tda9850_setaudio(TDA9850Ptr t) +_X_EXPORT void tda9850_setaudio(TDA9850Ptr t) { CARD8 data[2]; @@ -83,7 +83,7 @@ if(t->mux==2) TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0)|(t->sap_mute?0x10:0x0)); } -void tda9850_mute(TDA9850Ptr t, Bool mute) +_X_EXPORT void tda9850_mute(TDA9850Ptr t, Bool mute) { CARD8 data[2]; @@ -93,7 +93,7 @@ t->mute = mute; TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0x0)|(t->sap_mute?0x10:0x0)); } -void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute) +_X_EXPORT void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute) { CARD8 data[2]; @@ -103,7 +103,7 @@ t->sap_mute = sap_mute; TDA9850(0x06,(t->stereo<<6)|(t->sap<<7)|(t->mute?0x8:0x0)|(t->sap_mute?0x10:0x0)); } -CARD16 tda9850_getstatus(TDA9850Ptr t) +_X_EXPORT CARD16 tda9850_getstatus(TDA9850Ptr t) { CARD16 status; diff --git a/hw/xfree86/i2c/tda9850.h b/hw/xfree86/i2c/tda9850.h index d5dec36fe..b78719aa4 100644 --- a/hw/xfree86/i2c/tda9850.h +++ b/hw/xfree86/i2c/tda9850.h @@ -15,12 +15,18 @@ typedef struct { #define TDA9850_ADDR_1 0xB4 -TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr); -Bool tda9850_init(TDA9850Ptr t); -void tda9850_setaudio(TDA9850Ptr t); -void tda9850_mute(TDA9850Ptr t, Bool mute); -void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute); -CARD16 tda9850_getstatus(TDA9850Ptr t); +#define xf86_Detect_tda9850 Detect_tda9850 +extern TDA9850Ptr Detect_tda9850(I2CBusPtr b, I2CSlaveAddr addr); +#define xf86_tda9850_init tda9850_init +extern Bool tda9850_init(TDA9850Ptr t); +#define xf86_tda9850_setaudio tda9850_setaudio +extern void tda9850_setaudio(TDA9850Ptr t); +#define xf86_tda9850_mute tda9850_mute +extern void tda9850_mute(TDA9850Ptr t, Bool mute); +#define xf86_tda9850_sap_mute tda9850_sap_mute +extern void tda9850_sap_mute(TDA9850Ptr t, Bool sap_mute); +#define xf86_tda9850_getstatus tda9850_getstatus +extern CARD16 tda9850_getstatus(TDA9850Ptr t); #define TDA9850SymbolsList \ "Detect_tda9850", \ @@ -29,11 +35,4 @@ CARD16 tda9850_getstatus(TDA9850Ptr t); "tda9850_mute", \ "tda9850_sap_mute" -#define xf86_Detect_tda9850 ((TDA9850Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_tda9850")) -#define xf86_tda9850_init ((Bool (*)(TDA9850Ptr))LoaderSymbol("tda9850_init")) -#define xf86_tda9850_setaudio ((void (*)(TDA9850Ptr))LoaderSymbol("tda9850_setaudio")) -#define xf86_tda9850_mute ((void (*)(TDA9850Ptr, Bool))LoaderSymbol("tda9850_mute")) -#define xf86_tda9850_sap_mute ((void (*)(TDA9850Ptr, Bool))LoaderSymbol("tda9850_sap_mute")) -#define xf86_tda9850_getstatus ((CARD16 (*)(TDA9850Ptr))LoaderSymbol("tda9850_getstatus")) - #endif diff --git a/hw/xfree86/i2c/tda9885.c b/hw/xfree86/i2c/tda9885.c index 4147dfdd7..ad5aad1ec 100644 --- a/hw/xfree86/i2c/tda9885.c +++ b/hw/xfree86/i2c/tda9885.c @@ -8,7 +8,7 @@ #include "i2c_def.h" -TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr) +_X_EXPORT TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr) { TDA9885Ptr t; I2CByte a; @@ -51,13 +51,13 @@ TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr) return t; } -Bool tda9885_init(TDA9885Ptr t) +_X_EXPORT Bool tda9885_init(TDA9885Ptr t) { t->forced_mute_audio=1; return TRUE; } -void tda9885_getstatus(TDA9885Ptr t) +_X_EXPORT void tda9885_getstatus(TDA9885Ptr t) { CARD8 value; @@ -69,7 +69,7 @@ t->vif_level=(value >>6) & 1; t->afc_win=(value >> 7)&1; } -void tda9885_setparameters(TDA9885Ptr t) +_X_EXPORT void tda9885_setparameters(TDA9885Ptr t) { CARD8 data[4]; @@ -95,7 +95,7 @@ I2C_WriteRead(&(t->d), data, 4, NULL, 0); xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"TDA9885 setparam: B data: %x, C data: %x, E data: %x\n", data[1], data[2], data[3]); } -void tda9885_dumpstatus(TDA9885Ptr t) +_X_EXPORT void tda9885_dumpstatus(TDA9885Ptr t) { xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"TDA9885 status: after_reset=%d afc_status=%d (%3.1f kHz off) fm_carrier=%d vif_level=%d afc_win=%d %s\n", t->after_reset, t->afc_status, diff --git a/hw/xfree86/i2c/tda9885.h b/hw/xfree86/i2c/tda9885.h index 46ae9fc0d..08176ba31 100644 --- a/hw/xfree86/i2c/tda9885.h +++ b/hw/xfree86/i2c/tda9885.h @@ -39,11 +39,16 @@ typedef struct { #define TDA9885_ADDR_3 0x96 #define TDA9885_ADDR_4 0x94 -TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr); -Bool tda9885_init(TDA9885Ptr t); -void tda9885_setparameters(TDA9885Ptr t); -void tda9885_getstatus(TDA9885Ptr t); -void tda9885_dumpstatus(TDA9885Ptr t); +#define xf86_Detect_tda9885 Detect_tda9885 +extern TDA9885Ptr Detect_tda9885(I2CBusPtr b, I2CSlaveAddr addr); +#define xf86_tda9885_init tda9885_init +extern Bool tda9885_init(TDA9885Ptr t); +#define xf86_tda9885_setparameters tda9885_setparameters +extern void tda9885_setparameters(TDA9885Ptr t); +#define xf86_tda9885_getstatus tda9885_getstatus +extern void tda9885_getstatus(TDA9885Ptr t); +#define xf86_tda9885_dumpstatus tda9885_dumpstatus +extern void tda9885_dumpstatus(TDA9885Ptr t); #define TDA9885SymbolsList \ "Detect_tda9885", \ @@ -51,10 +56,4 @@ void tda9885_dumpstatus(TDA9885Ptr t); "tda9885_setaudio", \ "tda9885_mute" -#define xf86_Detect_tda9885 ((TDA9885Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_tda9885")) -#define xf86_tda9885_init ((Bool (*)(TDA9885Ptr))LoaderSymbol("tda9885_init")) -#define xf86_tda9885_setparameters ((void (*)(TDA9885Ptr))LoaderSymbol("tda9885_setparameters")) -#define xf86_tda9885_getstatus ((void (*)(TDA9885Ptr))LoaderSymbol("tda9885_getstatus")) -#define xf86_tda9885_dumpstatus ((void (*)(TDA9885Ptr))LoaderSymbol("tda9885_dumpstatus")) - #endif diff --git a/hw/xfree86/i2c/uda1380.c b/hw/xfree86/i2c/uda1380.c index defda3cdc..deb4bc9cc 100644 --- a/hw/xfree86/i2c/uda1380.c +++ b/hw/xfree86/i2c/uda1380.c @@ -31,7 +31,7 @@ #include "uda1380.h" #include "i2c_def.h" -UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr) +_X_EXPORT UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr) { UDA1380Ptr t; I2CByte a; @@ -74,7 +74,7 @@ UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr) return t; } -Bool uda1380_init(UDA1380Ptr t) +_X_EXPORT Bool uda1380_init(UDA1380Ptr t) { CARD8 data[3]; CARD16 tmp; @@ -109,7 +109,7 @@ Bool uda1380_init(UDA1380Ptr t) return TRUE; } -void uda1380_shutdown(UDA1380Ptr t) +_X_EXPORT void uda1380_shutdown(UDA1380Ptr t) { CARD8 data[3]; Bool ret; @@ -123,7 +123,7 @@ void uda1380_shutdown(UDA1380Ptr t) xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to shutdown\n"); } -void uda1380_setvolume(UDA1380Ptr t, INT32 value) +_X_EXPORT void uda1380_setvolume(UDA1380Ptr t, INT32 value) { CARD8 data[3]; /* @@ -143,7 +143,7 @@ void uda1380_setvolume(UDA1380Ptr t, INT32 value) xf86DrvMsg(t->d.pI2CBus->scrnIndex,X_INFO,"UDA1380 failed to set volume\n"); } -void uda1380_mute(UDA1380Ptr t, Bool mute) +_X_EXPORT void uda1380_mute(UDA1380Ptr t, Bool mute) { CARD8 data[3]; Bool ret; @@ -170,14 +170,14 @@ void uda1380_mute(UDA1380Ptr t, Bool mute) } } -void uda1380_getstatus(UDA1380Ptr t) +_X_EXPORT void uda1380_getstatus(UDA1380Ptr t) { } -void uda1380_setparameters(UDA1380Ptr t) +_X_EXPORT void uda1380_setparameters(UDA1380Ptr t) { } -void uda1380_dumpstatus(UDA1380Ptr t) +_X_EXPORT void uda1380_dumpstatus(UDA1380Ptr t) { } diff --git a/hw/xfree86/i2c/uda1380.h b/hw/xfree86/i2c/uda1380.h index e671d66f8..825fccd73 100644 --- a/hw/xfree86/i2c/uda1380.h +++ b/hw/xfree86/i2c/uda1380.h @@ -44,14 +44,22 @@ typedef struct { #define UDA1380_ADDR_1 0x30 #define UDA1380_ADDR_2 0x34 -UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr); -Bool uda1380_init(UDA1380Ptr t); -void uda1380_shutdown(UDA1380Ptr t); -void uda1380_setvolume(UDA1380Ptr t, INT32); -void uda1380_mute(UDA1380Ptr t, Bool); -void uda1380_setparameters(UDA1380Ptr t); -void uda1380_getstatus(UDA1380Ptr t); -void uda1380_dumpstatus(UDA1380Ptr t); +#define xf86_Detect_uda1380 Detect_uda1380 +extern UDA1380Ptr Detect_uda1380(I2CBusPtr b, I2CSlaveAddr addr); +#define xf86_uda1380_init uda1380_init +extern Bool uda1380_init(UDA1380Ptr t); +#define xf86_uda1380_shutdown uda1380_shutdown +extern void uda1380_shutdown(UDA1380Ptr t); +#define xf86_uda1380_setvolume uda1380_setvolume +extern void uda1380_setvolume(UDA1380Ptr t, INT32); +#define xf86_uda1380_mute uda1380_mute +extern void uda1380_mute(UDA1380Ptr t, Bool); +#define xf86_uda1380_setparameters uda1380_setparameters +extern void uda1380_setparameters(UDA1380Ptr t); +#define xf86_uda1380_getstatus uda1380_getstatus +extern void uda1380_getstatus(UDA1380Ptr t); +#define xf86_uda1380_dumpstatus uda1380_dumpstatus +extern void uda1380_dumpstatus(UDA1380Ptr t); #define UDA1380SymbolsList \ "Detect_uda1380", \ @@ -63,13 +71,4 @@ void uda1380_dumpstatus(UDA1380Ptr t); "uda1380_getstatus", \ "uda1380_dumpstatus" -#define xf86_Detect_uda1380 ((UDA1380Ptr (*)(I2CBusPtr, I2CSlaveAddr))LoaderSymbol("Detect_uda1380")) -#define xf86_uda1380_init ((Bool (*)(UDA1380Ptr))LoaderSymbol("uda1380_init")) -#define xf86_uda1380_shutdown ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_shutdown")) -#define xf86_uda1380_setvolume ((void (*)(UDA1380Ptr, CARD16))LoaderSymbol("uda1380_setvolume")) -#define xf86_uda1380_mute ((void (*)(UDA1380Ptr, Bool))LoaderSymbol("uda1380_mute")) -#define xf86_uda1380_setparameters ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_setparameters")) -#define xf86_uda1380_getstatus ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_getstatus")) -#define xf86_uda1380_dumpstatus ((void (*)(UDA1380Ptr))LoaderSymbol("uda1380_dumpstatus")) - #endif diff --git a/hw/xfree86/i2c/xf86i2c.c b/hw/xfree86/i2c/xf86i2c.c index 59832d6f9..30b8f6fa3 100644 --- a/hw/xfree86/i2c/xf86i2c.c +++ b/hw/xfree86/i2c/xf86i2c.c @@ -358,7 +358,7 @@ I2CAddress(I2CDevPtr d, I2CSlaveAddr addr) * Don't expect a read- or write-only device will respond otherwise. */ -Bool +_X_EXPORT Bool xf86I2CProbeAddress(I2CBusPtr b, I2CSlaveAddr addr) { int r; @@ -439,7 +439,7 @@ I2CWriteRead(I2CDevPtr d, /* wrapper - for compatibility and convinience */ -Bool +_X_EXPORT Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, I2CByte *ReadBuffer, int nRead) @@ -595,7 +595,7 @@ xf86I2CWriteVec(I2CDevPtr d, I2CByte *vec, int nValues) * the least significant bit, indicating a read or write access, to zero. */ -I2CDevPtr +_X_EXPORT I2CDevPtr xf86CreateI2CDevRec(void) { return xcalloc(1, sizeof(I2CDevRec)); @@ -640,7 +640,7 @@ xf86DestroyI2CDevRec(I2CDevPtr d, Bool unalloc) * the bus-wide defaults. The function returns TRUE on success. */ -Bool +_X_EXPORT Bool xf86I2CDevInit(I2CDevPtr d) { I2CBusPtr b; @@ -690,7 +690,7 @@ static I2CBusPtr I2CBusList; * with safe defaults. */ -I2CBusPtr +_X_EXPORT I2CBusPtr xf86CreateI2CBusRec(void) { I2CBusPtr b; @@ -716,7 +716,7 @@ xf86CreateI2CBusRec(void) * first, passing down the <unalloc> option. */ -void +_X_EXPORT void xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too) { if (b) { @@ -763,7 +763,7 @@ xf86DestroyI2CBusRec(I2CBusPtr b, Bool unalloc, Bool devs_too) * At this point there won't be any traffic on the I2C bus. */ -Bool +_X_EXPORT Bool xf86I2CBusInit(I2CBusPtr b) { /* I2C buses must be identified by a unique scrnIndex diff --git a/hw/xfree86/i2c/xf86i2c.h b/hw/xfree86/i2c/xf86i2c.h index 76d2ebf92..a3413c9c4 100644 --- a/hw/xfree86/i2c/xf86i2c.h +++ b/hw/xfree86/i2c/xf86i2c.h @@ -49,9 +49,13 @@ typedef struct _I2CBusRec { I2CByte *ReadBuffer, int nRead); } I2CBusRec; -I2CBusPtr xf86CreateI2CBusRec(void); -void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too); -Bool xf86I2CBusInit(I2CBusPtr pI2CBus); +#define CreateI2CBusRec xf86CreateI2CBusRec +extern I2CBusPtr xf86CreateI2CBusRec(void); +#define DestroyI2CBusRec xf86DestroyI2CBusRec +extern void xf86DestroyI2CBusRec(I2CBusPtr pI2CBus, Bool unalloc, Bool devs_too); +#define I2CBusInit xf86I2CBusInit +extern Bool xf86I2CBusInit(I2CBusPtr pI2CBus); + I2CBusPtr xf86I2CFindBus(int scrnIndex, char *name); int xf86I2CGetScreenBuses(int scrnIndex, I2CBusPtr **pppI2CBus); @@ -72,17 +76,23 @@ typedef struct _I2CDevRec { DevUnion DriverPrivate; } I2CDevRec; -I2CDevPtr xf86CreateI2CDevRec(void); +#define CreateI2CDevRec xf86CreateI2CDevRec +extern I2CDevPtr xf86CreateI2CDevRec(void); void xf86DestroyI2CDevRec(I2CDevPtr pI2CDev, Bool unalloc); -Bool xf86I2CDevInit(I2CDevPtr pI2CDev); +#define I2CDevInit xf86I2CDevInit +extern Bool xf86I2CDevInit(I2CDevPtr pI2CDev); I2CDevPtr xf86I2CFindDev(I2CBusPtr, I2CSlaveAddr); /* See descriptions of these functions in xf86i2c.c */ -Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr); -Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, +#define I2CProbeAddress xf86I2CProbeAddress +extern Bool xf86I2CProbeAddress(I2CBusPtr pI2CBus, I2CSlaveAddr); + +#define I2C_WriteRead xf86I2CWriteRead +extern Bool xf86I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, I2CByte *ReadBuffer, int nRead); #define xf86I2CRead(d, rb, nr) xf86I2CWriteRead(d, NULL, 0, rb, nr) + Bool xf86I2CReadStatus(I2CDevPtr d, I2CByte *pbyte); Bool xf86I2CReadByte(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte); Bool xf86I2CReadBytes(I2CDevPtr d, I2CByte subaddr, I2CByte *pbyte, int n); |