Replace NULL's with 0 as NULL is not defined by the Raw32 GOS.

ugfx_release_2.6
inmarket 2013-12-21 13:21:59 +10:00
parent 018a930d55
commit d9f02858fd
37 changed files with 112 additions and 112 deletions

View File

@ -28,12 +28,12 @@
static const PWMConfig pwmcfg = { static const PWMConfig pwmcfg = {
1000000, /* 1 MHz PWM clock frequency. */ 1000000, /* 1 MHz PWM clock frequency. */
100, /* PWM period is 100 cycles. */ 100, /* PWM period is 100 cycles. */
NULL, 0,
{ {
{PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, 0},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, 0},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, 0},
{PWM_OUTPUT_ACTIVE_HIGH, NULL} {PWM_OUTPUT_ACTIVE_HIGH, 0}
}, },
0 0
}; };
@ -44,7 +44,7 @@ static const PWMConfig pwmcfg = {
* The slave select line is the pin 4 on the port GPIOA. * The slave select line is the pin 4 on the port GPIOA.
*/ */
static const SPIConfig spi1cfg_8bit = { static const SPIConfig spi1cfg_8bit = {
NULL, 0,
/* HW dependent part.*/ /* HW dependent part.*/
GPIOA, GPIOA,
4, 4,
@ -57,7 +57,7 @@ static const SPIConfig spi1cfg_8bit = {
* The slave select line is the pin 4 on the port GPIOA. * The slave select line is the pin 4 on the port GPIOA.
*/ */
static const SPIConfig spi1cfg_16bit = { static const SPIConfig spi1cfg_16bit = {
NULL, 0,
/* HW dependent part.*/ /* HW dependent part.*/
GPIOA, GPIOA,
4, 4,

View File

@ -24,12 +24,12 @@
static const PWMConfig pwmcfg = { static const PWMConfig pwmcfg = {
100000, /* 100 kHz PWM clock frequency. */ 100000, /* 100 kHz PWM clock frequency. */
100, /* PWM period is 100 cycles. */ 100, /* PWM period is 100 cycles. */
NULL, 0,
{ {
{PWM_OUTPUT_DISABLED, NULL}, {PWM_OUTPUT_DISABLED, 0},
{PWM_OUTPUT_DISABLED, NULL}, {PWM_OUTPUT_DISABLED, 0},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, 0},
{PWM_OUTPUT_DISABLED, NULL} {PWM_OUTPUT_DISABLED, 0}
}, },
0 0
}; };
@ -61,7 +61,7 @@ static inline void init_board(GDisplay *g) {
rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0); rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0);
#if defined(GDISP_USE_DMA) #if defined(GDISP_USE_DMA)
if (dmaStreamAllocate(GDISP_DMA_STREAM, 0, NULL, NULL)) gfxExit(); if (dmaStreamAllocate(GDISP_DMA_STREAM, 0, 0, 0)) gfxExit();
dmaStreamSetMemory0(GDISP_DMA_STREAM, &GDISP_RAM); dmaStreamSetMemory0(GDISP_DMA_STREAM, &GDISP_RAM);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);
#else #else

View File

@ -112,7 +112,7 @@ static inline void write_cmd(GDisplay *g, uint8_t cmd) {
command[1] = cmd; command[1] = cmd;
i2cStart(&I2CD1, &i2cconfig); i2cStart(&I2CD1, &i2cconfig);
i2cMasterTransmitTimeout(&I2CD1, SSD1306_I2C_ADDRESS, command, 2, NULL, 0, MS2ST(10)); i2cMasterTransmitTimeout(&I2CD1, SSD1306_I2C_ADDRESS, command, 2, 0, 0, MS2ST(10));
i2cStop(&I2CD1); i2cStop(&I2CD1);
} }
@ -120,7 +120,7 @@ static inline void write_data(GDisplay *g, uint8_t* data, uint16_t length) {
(void) g; (void) g;
i2cStart(&I2CD1, &i2cconfig); i2cStart(&I2CD1, &i2cconfig);
i2cMasterTransmitTimeout(&I2CD1, SSD1306_I2C_ADDRESS, data, length, NULL, 0, MS2ST(10)); i2cMasterTransmitTimeout(&I2CD1, SSD1306_I2C_ADDRESS, data, length, 0, 0, MS2ST(10));
i2cStop(&I2CD1); i2cStop(&I2CD1);
} }

View File

@ -37,7 +37,7 @@
* The slave select line is the pin 4 on the port GPIOA. * The slave select line is the pin 4 on the port GPIOA.
*/ */
static const SPIConfig spi1config = { static const SPIConfig spi1config = {
NULL, 0,
/* HW dependent part.*/ /* HW dependent part.*/
SSD1306_MISO_PORT, SSD1306_MISO_PORT,
SSD1306_MISO_PIN, SSD1306_MISO_PIN,

View File

@ -18,7 +18,7 @@
#define _GINPUT_LLD_MOUSE_BOARD_H #define _GINPUT_LLD_MOUSE_BOARD_H
static const SPIConfig spicfg = { static const SPIConfig spicfg = {
NULL, 0,
GPIOG, GPIOG,
10, 10,
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,

View File

@ -20,7 +20,7 @@
* Note that you can tweak the SPI bus speed * Note that you can tweak the SPI bus speed
*/ */
static const SPIConfig spicfg = { static const SPIConfig spicfg = {
NULL, 0,
GPIOC, GPIOC,
4, 4,
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,

View File

@ -31,12 +31,12 @@
static const PWMConfig pwmcfg = { static const PWMConfig pwmcfg = {
1000000, /* 1 MHz PWM clock frequency. */ 1000000, /* 1 MHz PWM clock frequency. */
100, /* PWM period is 100 cycles. */ 100, /* PWM period is 100 cycles. */
NULL, 0,
{ {
{PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, 0},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, 0},
{PWM_OUTPUT_ACTIVE_HIGH, NULL}, {PWM_OUTPUT_ACTIVE_HIGH, 0},
{PWM_OUTPUT_ACTIVE_HIGH, NULL} {PWM_OUTPUT_ACTIVE_HIGH, 0}
}, },
0 0
}; };
@ -53,7 +53,7 @@ static inline void init_board(GDisplay *g) {
rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0); rccEnableAHB3(RCC_AHB3ENR_FSMCEN, 0);
#if defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM) #if defined(GDISP_USE_DMA) && defined(GDISP_DMA_STREAM)
if (dmaStreamAllocate(GDISP_DMA_STREAM, 0, NULL, NULL)) if (dmaStreamAllocate(GDISP_DMA_STREAM, 0, 0, 0))
gfxExit(); gfxExit();
dmaStreamSetMemory0(GDISP_DMA_STREAM, &GDISP_RAM); dmaStreamSetMemory0(GDISP_DMA_STREAM, &GDISP_RAM);
dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M); dmaStreamSetMode(GDISP_DMA_STREAM, STM32_DMA_CR_PL(0) | STM32_DMA_CR_PSIZE_HWORD | STM32_DMA_CR_MSIZE_HWORD | STM32_DMA_CR_DIR_M2M);

View File

@ -38,11 +38,11 @@ static void write_reg(uint8_t reg, uint8_t n, uint16_t val)
if (n == 1) { if (n == 1) {
txbuf[1] = val; txbuf[1] = val;
i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 2, NULL, 0, MS2ST(STMPE811_TIMEOUT)); i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 2, 0, 0, MS2ST(STMPE811_TIMEOUT));
} else if (n == 2) { } else if (n == 2) {
txbuf[1] = ((val & 0xFF00) >> 8); txbuf[1] = ((val & 0xFF00) >> 8);
txbuf[2] = (val & 0x00FF); txbuf[2] = (val & 0x00FF);
i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 3, NULL, 0, MS2ST(STMPE811_TIMEOUT)); i2cMasterTransmitTimeout(&I2CD1, STMPE811_ADDR, txbuf, 3, 0, 0, MS2ST(STMPE811_TIMEOUT));
} }
i2cReleaseBus(&I2CD1); i2cReleaseBus(&I2CD1);

View File

@ -9,7 +9,7 @@
#define _GINPUT_LLD_MOUSE_BOARD_H #define _GINPUT_LLD_MOUSE_BOARD_H
static const SPIConfig spicfg = { static const SPIConfig spicfg = {
NULL, 0,
GPIOC, GPIOC,
6, 6,
/* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0, /* SPI_CR1_BR_2 |*/ SPI_CR1_BR_1 | SPI_CR1_BR_0,

View File

@ -52,11 +52,11 @@ static void write_reg(uint8_t reg, uint8_t n, uint16_t val) {
if (n == 1) { if (n == 1) {
txbuf[1] = val; txbuf[1] = val;
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 2, NULL, 0, MS2ST(FT5x06_TIMEOUT)); i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 2, 0, 0, MS2ST(FT5x06_TIMEOUT));
} else if (n == 2) { } else if (n == 2) {
txbuf[1] = ((val & 0xFF00) >> 8); txbuf[1] = ((val & 0xFF00) >> 8);
txbuf[2] = (val & 0x00FF); txbuf[2] = (val & 0x00FF);
i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 3, NULL, 0, MS2ST(FT5x06_TIMEOUT)); i2cMasterTransmitTimeout(&I2CD2, FT5x06_ADDR, txbuf, 3, 0, 0, MS2ST(FT5x06_TIMEOUT));
} }
i2cReleaseBus(&I2CD2); i2cReleaseBus(&I2CD2);

View File

@ -12,7 +12,7 @@ static const unsigned short _SERIAL_FLASH_CMD_WRSR = 0x01;
static const unsigned short _SERIAL_FLASH_CMD_SER = 0xD8; //25P80 static const unsigned short _SERIAL_FLASH_CMD_SER = 0xD8; //25P80
static const SPIConfig flash_spicfg = { static const SPIConfig flash_spicfg = {
NULL, 0,
GPIOD, GPIOD,
GPIOD_FLASH_CS, GPIOD_FLASH_CS,
0 0

View File

@ -19,8 +19,8 @@
static const ADCConversionGroup adcgrpcfg = { static const ADCConversionGroup adcgrpcfg = {
FALSE, FALSE,
ADC_NUM_CHANNELS, ADC_NUM_CHANNELS,
NULL, 0,
NULL, 0,
/* HW dependent part.*/ /* HW dependent part.*/
0, 0,
ADC_CR2_SWSTART, ADC_CR2_SWSTART,
@ -37,7 +37,7 @@ static const ADCConversionGroup adcgrpcfg = {
* @notapi * @notapi
*/ */
static inline void init_board(void) { static inline void init_board(void) {
adcStart(&ADCD1, NULL); adcStart(&ADCD1, 0);
} }
/** /**

View File

@ -51,9 +51,9 @@ static volatile AT91PS_PDC pPDC = AT91C_BASE_PDC_SPI0;
static const PWMConfig pwmcfg = { static const PWMConfig pwmcfg = {
1000000, /* 1 MHz PWM clock frequency. Ignored as we are using PWM_MCK_DIV_n */ 1000000, /* 1 MHz PWM clock frequency. Ignored as we are using PWM_MCK_DIV_n */
1000, /* PWM period is 1000 cycles. */ 1000, /* PWM period is 1000 cycles. */
NULL, 0,
{ {
{PWM_MCK_DIV_1 | PWM_OUTPUT_ACTIVE_HIGH | PWM_OUTPUT_PIN1 | PWM_DISABLEPULLUP_PIN1, NULL}, {PWM_MCK_DIV_1 | PWM_OUTPUT_ACTIVE_HIGH | PWM_OUTPUT_PIN1 | PWM_DISABLEPULLUP_PIN1, 0},
}, },
}; };

View File

@ -51,9 +51,9 @@ static volatile AT91PS_PDC pPDC = AT91C_BASE_PDC_SPI0;
static const PWMConfig pwmcfg = { static const PWMConfig pwmcfg = {
1000000, /* 1 MHz PWM clock frequency. Ignored as we are using PWM_MCK_DIV_n */ 1000000, /* 1 MHz PWM clock frequency. Ignored as we are using PWM_MCK_DIV_n */
1000, /* PWM period is 1000 cycles. */ 1000, /* PWM period is 1000 cycles. */
NULL, 0,
{ {
{PWM_MCK_DIV_1 | PWM_OUTPUT_ACTIVE_HIGH | PWM_OUTPUT_PIN1 | PWM_DISABLEPULLUP_PIN1, NULL}, {PWM_MCK_DIV_1 | PWM_OUTPUT_ACTIVE_HIGH | PWM_OUTPUT_PIN1 | PWM_DISABLEPULLUP_PIN1, 0},
}, },
}; };

View File

@ -14,8 +14,8 @@
static const ADCConversionGroup adc_y_config = { static const ADCConversionGroup adc_y_config = {
FALSE, FALSE,
ADC_NUM_CHANNELS, ADC_NUM_CHANNELS,
NULL, 0,
NULL, 0,
0, 0, 0, 0,
0, 0, 0, 0,
ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS), ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
@ -26,8 +26,8 @@ static const ADCConversionGroup adc_y_config = {
static const ADCConversionGroup adc_x_config = { static const ADCConversionGroup adc_x_config = {
FALSE, FALSE,
ADC_NUM_CHANNELS, ADC_NUM_CHANNELS,
NULL, 0,
NULL, 0,
0, 0, 0, 0,
0, 0, 0, 0,
ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS), ADC_SQR1_NUM_CH(ADC_NUM_CHANNELS),
@ -36,7 +36,7 @@ static const ADCConversionGroup adc_x_config = {
}; };
static inline void init_board(void) { static inline void init_board(void) {
adcStart(&ADCD1, NULL); adcStart(&ADCD1, 0);
} }
static inline void aquire_bus(void) { static inline void aquire_bus(void) {

View File

@ -41,7 +41,7 @@ static int uitoa(unsigned int value, char * buf, int max) {
int i = 0; int i = 0;
unsigned int tmp = 0; unsigned int tmp = 0;
if (NULL == buf) if (!buf)
return -3; return -3;
if (2 > max) if (2 > max)

View File

@ -51,10 +51,10 @@ int main(void) {
gtimerInit(&GT2); gtimerInit(&GT2);
/* continious mode - callback1() called without any argument every 250ms */ /* continious mode - callback1() called without any argument every 250ms */
gtimerStart(&GT1, callback1, NULL, TRUE, 250); gtimerStart(&GT1, callback1, 0, TRUE, 250);
/* single shot mode - callback2() called without any argument once after 1s */ /* single shot mode - callback2() called without any argument once after 1s */
gtimerStart(&GT2, callback2, NULL, FALSE, 1000); gtimerStart(&GT2, callback2, 0, FALSE, 1000);
while(TRUE) { while(TRUE) {
gfxSleepMilliseconds(500); gfxSleepMilliseconds(500);

View File

@ -44,9 +44,9 @@ int main(void) {
GWindowInit wi; GWindowInit wi;
wi.show = TRUE; wi.x = 20; wi.y = 10; wi.width = 200; wi.height = 150; wi.show = TRUE; wi.x = 20; wi.y = 10; wi.width = 200; wi.height = 150;
GW1 = gwinWindowCreate(NULL, &wi); GW1 = gwinWindowCreate(0, &wi);
wi.show = TRUE; wi.x = 50; wi.y = 190; wi.width = 150; wi.height = 100; wi.show = TRUE; wi.x = 50; wi.y = 190; wi.width = 150; wi.height = 100;
GW2 = gwinWindowCreate(NULL, &wi); GW2 = gwinWindowCreate(0, &wi);
} }
/* Set fore- and background colors for both windows */ /* Set fore- and background colors for both windows */

View File

@ -49,7 +49,7 @@ static void createWidgets(void) {
wi.text = "Push Button"; wi.text = "Push Button";
// Create the actual button // Create the actual button
ghButton1 = gwinButtonCreate(NULL, &wi); ghButton1 = gwinButtonCreate(0, &wi);
} }
int main(void) { int main(void) {

View File

@ -49,7 +49,7 @@ static void createWidgets(void) {
wi.text = "Checkbox"; wi.text = "Checkbox";
// Create the actual checkbox // Create the actual checkbox
ghCheckbox1 = gwinCheckboxCreate(NULL, &wi); ghCheckbox1 = gwinCheckboxCreate(0, &wi);
} }
int main(void) { int main(void) {

View File

@ -50,11 +50,11 @@ int main(void) {
wi.show = TRUE; wi.show = TRUE;
wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2; wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2;
GW1 = gwinConsoleCreate(NULL, &wi); GW1 = gwinConsoleCreate(0, &wi);
wi.y = gdispGetHeight()/2; wi.width = gdispGetWidth()/2; wi.height = gdispGetHeight(); wi.y = gdispGetHeight()/2; wi.width = gdispGetWidth()/2; wi.height = gdispGetHeight();
GW2 = gwinConsoleCreate(NULL, &wi); GW2 = gwinConsoleCreate(0, &wi);
wi.x = gdispGetWidth()/2; wi.height = gdispGetHeight(); wi.x = gdispGetWidth()/2; wi.height = gdispGetHeight();
GW3 = gwinConsoleCreate(NULL, &wi); GW3 = gwinConsoleCreate(0, &wi);
} }
/* Use a special font for GW1 */ /* Use a special font for GW1 */

View File

@ -49,7 +49,7 @@ static void createWidgets(void) {
wi.text = "List Name"; wi.text = "List Name";
// Create the actual list // Create the actual list
ghList1 = gwinListCreate(NULL, &wi, FALSE); ghList1 = gwinListCreate(0, &wi, FALSE);
} }
int main(void) { int main(void) {

View File

@ -47,27 +47,27 @@ static void createWidgets(void) {
// create Radio11 // create Radio11
wi.g.y = 10; wi.g.x = 10; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 1"; wi.g.y = 10; wi.g.x = 10; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 1";
ghRadio11 = gwinRadioCreate(NULL, &wi, GROUP1); ghRadio11 = gwinRadioCreate(0, &wi, GROUP1);
// create Radio12 // create Radio12
wi.g.y = 50; wi.g.x = 10; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 2"; wi.g.y = 50; wi.g.x = 10; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 2";
ghRadio12 = gwinRadioCreate(NULL, &wi, GROUP1); ghRadio12 = gwinRadioCreate(0, &wi, GROUP1);
// create Radio13 // create Radio13
wi.g.y = 90; wi.g.x = 10; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 3"; wi.g.y = 90; wi.g.x = 10; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 3";
ghRadio13 = gwinRadioCreate(NULL, &wi, GROUP1); ghRadio13 = gwinRadioCreate(0, &wi, GROUP1);
// create Radio21 // create Radio21
wi.g.y = 10; wi.g.x = 120; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 1"; wi.g.y = 10; wi.g.x = 120; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 1";
ghRadio21 = gwinRadioCreate(NULL, &wi, GROUP2); ghRadio21 = gwinRadioCreate(0, &wi, GROUP2);
// create Radio22 // create Radio22
wi.g.y = 50; wi.g.x = 120; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 2"; wi.g.y = 50; wi.g.x = 120; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 2";
ghRadio22 = gwinRadioCreate(NULL, &wi, GROUP2); ghRadio22 = gwinRadioCreate(0, &wi, GROUP2);
// create Radio23 // create Radio23
wi.g.y = 90; wi.g.x = 120; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 3"; wi.g.y = 90; wi.g.x = 120; wi.g.width = 80; wi.g.height = 20; wi.text = "Radio 3";
ghRadio23 = gwinRadioCreate(NULL, &wi, GROUP2); ghRadio23 = gwinRadioCreate(0, &wi, GROUP2);
// Check the first radio buttons // Check the first radio buttons
gwinRadioPress(ghRadio11); gwinRadioPress(ghRadio11);

View File

@ -43,11 +43,11 @@ static void createWidgets(void) {
// create Slider1 // create Slider1
wi.g.y = 10; wi.g.x = 10; wi.g.width = 200; wi.g.height = 20; wi.text = "S1"; wi.g.y = 10; wi.g.x = 10; wi.g.width = 200; wi.g.height = 20; wi.text = "S1";
ghSlider1 = gwinSliderCreate(NULL, &wi); ghSlider1 = gwinSliderCreate(0, &wi);
// create Slider2 // create Slider2
wi.g.y = 40; wi.g.x = 10; wi.g.width = 20; wi.g.height = 200; wi.text = "S2"; wi.g.y = 40; wi.g.x = 10; wi.g.width = 20; wi.g.height = 200; wi.text = "S2";
ghSlider2 = gwinSliderCreate(NULL, &wi); ghSlider2 = gwinSliderCreate(0, &wi);
} }
int main(void) { int main(void) {

View File

@ -114,58 +114,58 @@ static void createWidgets(void) {
// Create the Tabs // Create the Tabs
wi.g.show = TRUE; wi.customDraw = gwinRadioDraw_Tab; wi.g.show = TRUE; wi.customDraw = gwinRadioDraw_Tab;
wi.g.width = ScrWidth/7; wi.g.height = TAB_HEIGHT; wi.g.y = 0; wi.g.width = ScrWidth/7; wi.g.height = TAB_HEIGHT; wi.g.y = 0;
wi.g.x = 0*wi.g.width; wi.text = "Buttons"; ghTabButtons = gwinRadioCreate(NULL, &wi, GROUP_TABS); wi.g.x = 0*wi.g.width; wi.text = "Buttons"; ghTabButtons = gwinRadioCreate(0, &wi, GROUP_TABS);
wi.g.x = 1*wi.g.width; wi.text = "Sliders"; ghTabSliders = gwinRadioCreate(NULL, &wi, GROUP_TABS); wi.g.x = 1*wi.g.width; wi.text = "Sliders"; ghTabSliders = gwinRadioCreate(0, &wi, GROUP_TABS);
wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; ghTabCheckboxes = gwinRadioCreate(NULL, &wi, GROUP_TABS); wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; ghTabCheckboxes = gwinRadioCreate(0, &wi, GROUP_TABS);
wi.g.x = 3*wi.g.width; wi.text = "Radios"; ghTabRadios = gwinRadioCreate(NULL, &wi, GROUP_TABS); wi.g.x = 3*wi.g.width; wi.text = "Radios"; ghTabRadios = gwinRadioCreate(0, &wi, GROUP_TABS);
wi.g.x = 4*wi.g.width; wi.text = "Lists"; ghTabLists = gwinRadioCreate(NULL, &wi, GROUP_TABS); wi.g.x = 4*wi.g.width; wi.text = "Lists"; ghTabLists = gwinRadioCreate(0, &wi, GROUP_TABS);
wi.g.x = 5*wi.g.width; wi.text = "Labels"; ghTabLabels = gwinRadioCreate(NULL, &wi, GROUP_TABS); wi.g.x = 5*wi.g.width; wi.text = "Labels"; ghTabLabels = gwinRadioCreate(0, &wi, GROUP_TABS);
wi.g.x = 6*wi.g.width; wi.text = "Images"; ghTabImages = gwinRadioCreate(NULL, &wi, GROUP_TABS); wi.g.x = 6*wi.g.width; wi.text = "Images"; ghTabImages = gwinRadioCreate(0, &wi, GROUP_TABS);
// Buttons // Buttons
wi.g.show = FALSE; wi.customDraw = 0; wi.g.show = FALSE; wi.customDraw = 0;
wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = TAB_HEIGHT+5; wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = TAB_HEIGHT+5;
wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinButtonCreate(NULL, &wi); wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinButtonCreate(0, &wi);
wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; ghButton2 = gwinButtonCreate(NULL, &wi); wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; ghButton2 = gwinButtonCreate(0, &wi);
wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; ghButton3 = gwinButtonCreate(NULL, &wi); wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; ghButton3 = gwinButtonCreate(0, &wi);
wi.g.x = 0+3*(BUTTON_WIDTH+1); wi.text = "B4"; ghButton4 = gwinButtonCreate(NULL, &wi); wi.g.x = 0+3*(BUTTON_WIDTH+1); wi.text = "B4"; ghButton4 = gwinButtonCreate(0, &wi);
// Horizontal Sliders // Horizontal Sliders
wi.g.width = ScrWidth/2-2; wi.g.height = SLIDER_WIDTH; wi.g.x = ScrWidth/2+1; wi.g.width = ScrWidth/2-2; wi.g.height = SLIDER_WIDTH; wi.g.x = ScrWidth/2+1;
wi.g.y = ScrHeight/2-2*(SLIDER_WIDTH+1); wi.text = "S1"; ghSlider1 = gwinSliderCreate(NULL, &wi); wi.g.y = ScrHeight/2-2*(SLIDER_WIDTH+1); wi.text = "S1"; ghSlider1 = gwinSliderCreate(0, &wi);
wi.g.y = ScrHeight/2-1*(SLIDER_WIDTH+1); wi.text = "S2"; ghSlider2 = gwinSliderCreate(NULL, &wi); wi.g.y = ScrHeight/2-1*(SLIDER_WIDTH+1); wi.text = "S2"; ghSlider2 = gwinSliderCreate(0, &wi);
// Vertical Sliders // Vertical Sliders
wi.g.width = SLIDER_WIDTH; wi.g.height = ScrHeight/2-2; wi.g.y = ScrHeight/2+1; wi.g.width = SLIDER_WIDTH; wi.g.height = ScrHeight/2-2; wi.g.y = ScrHeight/2+1;
wi.g.x = 0+0*(SLIDER_WIDTH+1); wi.text = "S3"; ghSlider3 = gwinSliderCreate(NULL, &wi); wi.g.x = 0+0*(SLIDER_WIDTH+1); wi.text = "S3"; ghSlider3 = gwinSliderCreate(0, &wi);
wi.g.x = 0+1*(SLIDER_WIDTH+1); wi.text = "S4"; ghSlider4 = gwinSliderCreate(NULL, &wi); wi.g.x = 0+1*(SLIDER_WIDTH+1); wi.text = "S4"; ghSlider4 = gwinSliderCreate(0, &wi);
// Checkboxes - for the 2nd checkbox we apply special drawing before making it visible // Checkboxes - for the 2nd checkbox we apply special drawing before making it visible
wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0; wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0;
wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCheckboxCreate(NULL, &wi); wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCheckboxCreate(0, &wi);
wi.customDraw = gwinCheckboxDraw_CheckOnRight; wi.customDraw = gwinCheckboxDraw_CheckOnRight;
wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCheckboxCreate(NULL, &wi); wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCheckboxCreate(0, &wi);
wi.customDraw = 0; wi.g.width = DISABLEALL_WIDTH; wi.customDraw = 0; wi.g.width = DISABLEALL_WIDTH;
wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Disable All"; ghCheckDisableAll = gwinCheckboxCreate(NULL, &wi); wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Disable All"; ghCheckDisableAll = gwinCheckboxCreate(0, &wi);
// Labels // Labels
wi.g.width = 0; wi.g.height = LABEL_HEIGHT; // dynamic width, fixed height wi.g.width = 0; wi.g.height = LABEL_HEIGHT; // dynamic width, fixed height
wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Label"; ghLabel1 = gwinLabelCreate(NULL, &wi); wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Label"; ghLabel1 = gwinLabelCreate(0, &wi);
// Radio Buttons // Radio Buttons
wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = TAB_HEIGHT+5; wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = TAB_HEIGHT+5;
wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinRadioCreate(NULL, &wi, GROUP_YESNO); wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinRadioCreate(0, &wi, GROUP_YESNO);
wi.g.x = 1*wi.g.width; wi.text = "No"; ghRadio2 = gwinRadioCreate(NULL, &wi, GROUP_YESNO); wi.g.x = 1*wi.g.width; wi.text = "No"; ghRadio2 = gwinRadioCreate(0, &wi, GROUP_YESNO);
wi.g.width = COLOR_WIDTH; wi.g.y += RADIO_HEIGHT+5; wi.g.width = COLOR_WIDTH; wi.g.y += RADIO_HEIGHT+5;
wi.g.x = 0*wi.g.width; wi.text = "Black"; ghRadioBlack = gwinRadioCreate(NULL, &wi, GROUP_COLORS); wi.g.x = 0*wi.g.width; wi.text = "Black"; ghRadioBlack = gwinRadioCreate(0, &wi, GROUP_COLORS);
wi.g.x = 1*wi.g.width; wi.text = "White"; ghRadioWhite = gwinRadioCreate(NULL, &wi, GROUP_COLORS); wi.g.x = 1*wi.g.width; wi.text = "White"; ghRadioWhite = gwinRadioCreate(0, &wi, GROUP_COLORS);
wi.g.x = 2*wi.g.width; wi.text = "Yellow"; ghRadioYellow = gwinRadioCreate(NULL, &wi, GROUP_COLORS); wi.g.x = 2*wi.g.width; wi.text = "Yellow"; ghRadioYellow = gwinRadioCreate(0, &wi, GROUP_COLORS);
gwinRadioPress(ghRadioWhite); gwinRadioPress(ghRadioWhite);
// Lists // Lists
wi.g.show = FALSE; wi.customDraw = 0; wi.g.show = FALSE; wi.customDraw = 0;
wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = TAB_HEIGHT+5; wi.g.width = LIST_WIDTH; wi.g.height = LIST_HEIGHT; wi.g.y = TAB_HEIGHT+5;
wi.g.x = 0+0*(LIST_WIDTH+1); wi.text = "L1"; ghList1 = gwinListCreate(NULL, &wi, FALSE); wi.g.x = 0+0*(LIST_WIDTH+1); wi.text = "L1"; ghList1 = gwinListCreate(0, &wi, FALSE);
gwinListAddItem(ghList1, "Item 0", FALSE); gwinListAddItem(ghList1, "Item 1", FALSE); gwinListAddItem(ghList1, "Item 0", FALSE); gwinListAddItem(ghList1, "Item 1", FALSE);
gwinListAddItem(ghList1, "Item 2", FALSE); gwinListAddItem(ghList1, "Item 3", FALSE); gwinListAddItem(ghList1, "Item 2", FALSE); gwinListAddItem(ghList1, "Item 3", FALSE);
gwinListAddItem(ghList1, "Item 4", FALSE); gwinListAddItem(ghList1, "Item 5", FALSE); gwinListAddItem(ghList1, "Item 4", FALSE); gwinListAddItem(ghList1, "Item 5", FALSE);
@ -173,7 +173,7 @@ static void createWidgets(void) {
gwinListAddItem(ghList1, "Item 8", FALSE); gwinListAddItem(ghList1, "Item 9", FALSE); gwinListAddItem(ghList1, "Item 8", FALSE); gwinListAddItem(ghList1, "Item 9", FALSE);
gwinListAddItem(ghList1, "Item 10", FALSE); gwinListAddItem(ghList1, "Item 11", FALSE); gwinListAddItem(ghList1, "Item 10", FALSE); gwinListAddItem(ghList1, "Item 11", FALSE);
gwinListAddItem(ghList1, "Item 12", FALSE); gwinListAddItem(ghList1, "Item 13", FALSE); gwinListAddItem(ghList1, "Item 12", FALSE); gwinListAddItem(ghList1, "Item 13", FALSE);
wi.g.x = 0+1*(LIST_WIDTH+1); wi.text = "L2"; ghList2 = gwinListCreate(NULL, &wi, TRUE); wi.g.x = 0+1*(LIST_WIDTH+1); wi.text = "L2"; ghList2 = gwinListCreate(0, &wi, TRUE);
gwinListAddItem(ghList2, "Item 0", FALSE); gwinListAddItem(ghList2, "Item 1", FALSE); gwinListAddItem(ghList2, "Item 0", FALSE); gwinListAddItem(ghList2, "Item 1", FALSE);
gwinListAddItem(ghList2, "Item 2", FALSE); gwinListAddItem(ghList2, "Item 3", FALSE); gwinListAddItem(ghList2, "Item 2", FALSE); gwinListAddItem(ghList2, "Item 3", FALSE);
gwinListAddItem(ghList2, "Item 4", FALSE); gwinListAddItem(ghList2, "Item 5", FALSE); gwinListAddItem(ghList2, "Item 4", FALSE); gwinListAddItem(ghList2, "Item 5", FALSE);
@ -181,7 +181,7 @@ static void createWidgets(void) {
gwinListAddItem(ghList2, "Item 8", FALSE); gwinListAddItem(ghList2, "Item 9", FALSE); gwinListAddItem(ghList2, "Item 8", FALSE); gwinListAddItem(ghList2, "Item 9", FALSE);
gwinListAddItem(ghList2, "Item 10", FALSE); gwinListAddItem(ghList2, "Item 11", FALSE); gwinListAddItem(ghList2, "Item 10", FALSE); gwinListAddItem(ghList2, "Item 11", FALSE);
gwinListAddItem(ghList2, "Item 12", FALSE); gwinListAddItem(ghList2, "Item 13", FALSE); gwinListAddItem(ghList2, "Item 12", FALSE); gwinListAddItem(ghList2, "Item 13", FALSE);
wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; ghList3 = gwinListCreate(NULL, &wi, TRUE); wi.g.x = 0+2*(LIST_WIDTH+1); wi.text = "L3"; ghList3 = gwinListCreate(0, &wi, TRUE);
gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 1", FALSE); gwinListAddItem(ghList3, "Item 0", FALSE); gwinListAddItem(ghList3, "Item 1", FALSE);
gwinListAddItem(ghList3, "Item 2", FALSE); gwinListAddItem(ghList3, "Item 3", FALSE); gwinListAddItem(ghList3, "Item 2", FALSE); gwinListAddItem(ghList3, "Item 3", FALSE);
gdispImageSetMemoryReader(&imgYesNo, image_yesno); gdispImageSetMemoryReader(&imgYesNo, image_yesno);
@ -191,14 +191,14 @@ static void createWidgets(void) {
// Image // Image
wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200; wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200;
ghImage1 = gwinImageCreate(NULL, &wi.g); ghImage1 = gwinImageCreate(0, &wi.g);
gwinImageOpenMemory(ghImage1, image_chibios); gwinImageOpenMemory(ghImage1, image_chibios);
gwinImageCache(ghImage1); gwinImageCache(ghImage1);
// Console - we apply some special colors before making it visible // Console - we apply some special colors before making it visible
wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1;
wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1; wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1;
ghConsole = gwinConsoleCreate(NULL, &wi.g); ghConsole = gwinConsoleCreate(0, &wi.g);
gwinSetColor(ghConsole, Yellow); gwinSetColor(ghConsole, Yellow);
gwinSetBgColor(ghConsole, Black); gwinSetBgColor(ghConsole, Black);
} }

View File

@ -31,7 +31,7 @@ static ADCConversionGroup acg = {
}; };
void gadc_lld_init(void) { void gadc_lld_init(void) {
adcStart(&ADCD1, NULL); adcStart(&ADCD1, 0);
} }
size_t gadc_lld_samples_per_conversion(uint32_t physdev) { size_t gadc_lld_samples_per_conversion(uint32_t physdev) {

View File

@ -160,7 +160,7 @@ LLDSPEC bool_t gdisp_lld_init(GDisplay *g) {
XInitThreads(); XInitThreads();
#endif #endif
dis = XOpenDisplay(NULL); dis = XOpenDisplay(0);
scr = DefaultScreen(dis); scr = DefaultScreen(dis);
cxt = XUniqueContext(); cxt = XUniqueContext();
XSetIOErrorHandler(FatalXIOError); XSetIOErrorHandler(FatalXIOError);

View File

@ -65,7 +65,7 @@ extern "C" {
#define gfxHalt(msg) { chDbgPanic(msg); chSysHalt(); } #define gfxHalt(msg) { chDbgPanic(msg); chSysHalt(); }
#define gfxExit() chSysHalt() #define gfxExit() chSysHalt()
#define gfxAlloc(sz) chHeapAlloc(NULL, sz) #define gfxAlloc(sz) chHeapAlloc(0, sz)
#define gfxFree(ptr) chHeapFree(ptr) #define gfxFree(ptr) chHeapFree(ptr)
#define gfxYield() chThdYield() #define gfxYield() chThdYield()
#define gfxSystemTicks() chTimeNow() #define gfxSystemTicks() chTimeNow()

View File

@ -68,14 +68,14 @@ typedef HANDLE gfxThreadHandle;
#define gfxYield() Sleep(0) #define gfxYield() Sleep(0)
#define gfxSystemTicks() GetTickCount() #define gfxSystemTicks() GetTickCount()
#define gfxMillisecondsToTicks(ms) (ms) #define gfxMillisecondsToTicks(ms) (ms)
#define gfxMutexInit(pmutex) *(pmutex) = CreateMutex(NULL, FALSE, NULL) #define gfxMutexInit(pmutex) *(pmutex) = CreateMutex(0, FALSE, 0)
#define gfxMutexDestory(pmutex) CloseHandle(*(pmutex)) #define gfxMutexDestory(pmutex) CloseHandle(*(pmutex))
#define gfxMutexEnter(pmutex) WaitForSingleObject(*(pmutex), INFINITE) #define gfxMutexEnter(pmutex) WaitForSingleObject(*(pmutex), INFINITE)
#define gfxMutexExit(pmutex) ReleaseMutex(*(pmutex)) #define gfxMutexExit(pmutex) ReleaseMutex(*(pmutex))
#define gfxSemInit(psem, val, limit) *(psem) = CreateSemaphore(NULL, val, limit, NULL) #define gfxSemInit(psem, val, limit) *(psem) = CreateSemaphore(0, val, limit, 0)
#define gfxSemDestory(psem) CloseHandle(*(psem)) #define gfxSemDestory(psem) CloseHandle(*(psem))
#define gfxSemSignal(psem) ReleaseSemaphore(*(psem), 1, NULL) #define gfxSemSignal(psem) ReleaseSemaphore(*(psem), 1, 0)
#define gfxSemSignalI(psem) ReleaseSemaphore(*(psem), 1, NULL) #define gfxSemSignalI(psem) ReleaseSemaphore(*(psem), 1, 0)
#define gfxSemCounterI(psem) gfxSemCounter(psem) #define gfxSemCounterI(psem) gfxSemCounter(psem)
#define gfxThreadMe() GetCurrentThread() #define gfxThreadMe() GetCurrentThread()
#define gfxThreadClose(thread) CloseHandle(thread) #define gfxThreadClose(thread) CloseHandle(thread)

View File

@ -344,7 +344,7 @@ void gadcHighSpeedInit(uint32_t physdev, uint32_t frequency, adcsample_t *buffer
#if GFX_USE_GEVENT #if GFX_USE_GEVENT
GSourceHandle gadcHighSpeedGetSource(void) { GSourceHandle gadcHighSpeedGetSource(void) {
if (!gtimerIsActive(&HighSpeedGTimer)) if (!gtimerIsActive(&HighSpeedGTimer))
gtimerStart(&HighSpeedGTimer, HighSpeedGTimerCallback, NULL, TRUE, TIME_INFINITE); gtimerStart(&HighSpeedGTimer, HighSpeedGTimerCallback, 0, TRUE, TIME_INFINITE);
hs.flags |= GADC_FLG_GTIMER; hs.flags |= GADC_FLG_GTIMER;
return (GSourceHandle)&HighSpeedGTimer; return (GSourceHandle)&HighSpeedGTimer;
} }
@ -393,7 +393,7 @@ void gadcLowSpeedGet(uint32_t physdev, adcsample_t *buffer) {
gfxSemInit(&mysem, 1, 1); gfxSemInit(&mysem, 1, 1);
gfxMutexEnter(&gadcmutex); gfxMutexEnter(&gadcmutex);
if (!gtimerIsActive(&LowSpeedGTimer)) if (!gtimerIsActive(&LowSpeedGTimer))
gtimerStart(&LowSpeedGTimer, LowSpeedGTimerCallback, NULL, TRUE, TIME_INFINITE); gtimerStart(&LowSpeedGTimer, LowSpeedGTimerCallback, 0, TRUE, TIME_INFINITE);
gfxMutexExit(&gadcmutex); gfxMutexExit(&gadcmutex);
while(1) { while(1) {
@ -430,7 +430,7 @@ bool_t gadcLowSpeedStart(uint32_t physdev, adcsample_t *buffer, GADCCallbackFunc
/* Start the Low Speed Timer */ /* Start the Low Speed Timer */
gfxMutexEnter(&gadcmutex); gfxMutexEnter(&gadcmutex);
if (!gtimerIsActive(&LowSpeedGTimer)) if (!gtimerIsActive(&LowSpeedGTimer))
gtimerStart(&LowSpeedGTimer, LowSpeedGTimerCallback, NULL, TRUE, TIME_INFINITE); gtimerStart(&LowSpeedGTimer, LowSpeedGTimerCallback, 0, TRUE, TIME_INFINITE);
/* Find a slot */ /* Find a slot */
for(p = ls; p < &ls[GADC_MAX_LOWSPEED_DEVICES]; p++) { for(p = ls; p < &ls[GADC_MAX_LOWSPEED_DEVICES]; p++) {

View File

@ -119,7 +119,7 @@ bool_t gaudinInit(uint16_t channel, uint32_t frequency, audin_sample_t *buffer,
#if GFX_USE_GEVENT #if GFX_USE_GEVENT
GSourceHandle gaudinGetSource(void) { GSourceHandle gaudinGetSource(void) {
if (!gtimerIsActive(&AudGTimer)) if (!gtimerIsActive(&AudGTimer))
gtimerStart(&AudGTimer, AudGTimerCallback, NULL, TRUE, TIME_INFINITE); gtimerStart(&AudGTimer, AudGTimerCallback, 0, TRUE, TIME_INFINITE);
audFlags |= AUDFLG_USE_EVENTS; audFlags |= AUDFLG_USE_EVENTS;
return (GSourceHandle)&aud; return (GSourceHandle)&aud;
} }

View File

@ -74,7 +74,7 @@ void gdispCloseFont(font_t font) {
struct mf_font_s *dfont = (struct mf_font_s *)font; struct mf_font_s *dfont = (struct mf_font_s *)font;
/* Make sure that no-one can successfully use font after closing */ /* Make sure that no-one can successfully use font after closing */
dfont->render_character = NULL; dfont->render_character = 0;
/* Release the allocated memory */ /* Release the allocated memory */
gfxFree(dfont); gfxFree(dfont);

View File

@ -106,7 +106,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
} }
if (!stacksz) if (!stacksz)
return NULL; return 0;
return chThdCreateStatic(stackarea, stacksz, prio, fn, param); return chThdCreateStatic(stackarea, stacksz, prio, fn, param);
} }

View File

@ -149,7 +149,7 @@ bool_t gfxSemWait(gfxSem *pSem, delaytime_t ms) {
struct timeval now; struct timeval now;
struct timespec tm; struct timespec tm;
gettimeofday(&now, NULL); gettimeofday(&now, 0);
tm.tv_sec = now.tv_sec + ms / 1000; tm.tv_sec = now.tv_sec + ms / 1000;
tm.tv_nsec = (now.tv_usec + ms % 1000) * 1000; tm.tv_nsec = (now.tv_usec + ms % 1000) * 1000;
while (!pSem->cnt) { while (!pSem->cnt) {

View File

@ -57,7 +57,7 @@ void gfxSleepMicroseconds(delaytime_t ms) {
void gfxSystemLock(void) { void gfxSystemLock(void) {
if (!SystemMutex) if (!SystemMutex)
SystemMutex = CreateMutex(NULL, FALSE, NULL); SystemMutex = CreateMutex(0, FALSE, 0);
WaitForSingleObject(SystemMutex, INFINITE); WaitForSingleObject(SystemMutex, INFINITE);
} }
@ -87,7 +87,7 @@ semcount_t gfxSemCounter(gfxSem *pSem) {
if (!NtQuerySemaphore) if (!NtQuerySemaphore)
NtQuerySemaphore = (_NtQuerySemaphore)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtQuerySemaphore"); NtQuerySemaphore = (_NtQuerySemaphore)GetProcAddress(GetModuleHandle("ntdll.dll"), "NtQuerySemaphore");
NtQuerySemaphore(*pSem, 0, &BasicInfo, sizeof(BasicInfo), NULL); NtQuerySemaphore(*pSem, 0, &BasicInfo, sizeof(BasicInfo), 0);
return BasicInfo.CurrentCount; return BasicInfo.CurrentCount;
} }
@ -96,7 +96,7 @@ gfxThreadHandle gfxThreadCreate(void *stackarea, size_t stacksz, threadpriority_
(void) stackarea; (void) stackarea;
HANDLE thd; HANDLE thd;
if (!(thd = CreateThread(NULL, stacksz, fn, param, CREATE_SUSPENDED, NULL))) if (!(thd = CreateThread(0, stacksz, fn, param, CREATE_SUSPENDED, 0)))
return FALSE; return FALSE;
SetThreadPriority(thd, prio); SetThreadPriority(thd, prio);

View File

@ -83,7 +83,7 @@
} }
bool_t gfxQueueASyncIsEmpty(gfxQueueASync *pqueue) { bool_t gfxQueueASyncIsEmpty(gfxQueueASync *pqueue) {
return pqueue->head == NULL; return pqueue->head == 0;
} }
bool_t gfxQueueASyncIsIn(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem) { bool_t gfxQueueASyncIsIn(gfxQueueASync *pqueue, const gfxQueueASyncItem *pitem) {
@ -176,7 +176,7 @@
} }
bool_t gfxQueueGSyncIsEmpty(gfxQueueGSync *pqueue) { bool_t gfxQueueGSyncIsEmpty(gfxQueueGSync *pqueue) {
return pqueue->head == NULL; return pqueue->head == 0;
} }
bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem) { bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, const gfxQueueGSyncItem *pitem) {
@ -282,7 +282,7 @@
} }
bool_t gfxQueueFSyncIsEmpty(gfxQueueFSync *pqueue) { bool_t gfxQueueFSyncIsEmpty(gfxQueueFSync *pqueue) {
return pqueue->head == NULL; return pqueue->head == 0;
} }
bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) { bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, const gfxQueueFSyncItem *pitem) {

View File

@ -132,8 +132,8 @@ void gtimerStart(GTimer *pt, GTimerFunction fn, void *param, bool_t periodic, de
// Start our thread if not already going // Start our thread if not already going
if (!hThread) { if (!hThread) {
hThread = gfxThreadCreate(waTimerThread, sizeof(waTimerThread), GTIMER_THREAD_PRIORITY, GTimerThreadHandler, NULL); hThread = gfxThreadCreate(waTimerThread, sizeof(waTimerThread), GTIMER_THREAD_PRIORITY, GTimerThreadHandler, 0);
if (hThread) gfxThreadClose(hThread); // We never really need the handle again if (hThread) {gfxThreadClose(hThread);} // We never really need the handle again
} }
// Is this already scheduled? // Is this already scheduled?