Skip to content

Commit

Permalink
modify makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasVon2021 authored and shangbinbin committed Jan 29, 2023
1 parent 5b8b600 commit fd44691
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 13 deletions.
5 changes: 2 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ INCLUDE_PATH += ./
INCLUDE_PATH += ./include

ifeq ($(PLAT),x86)
INCLUDE_PATH += ./extern
SOURCE_FILES += ./extern/softPwm_mock.c
SOURCE_FILES += ./extern/wiringPi_mock.c
else
Expand All @@ -21,7 +20,7 @@ SOURCE_FILES += ./blikvm_server.c
SOURCE_FILES += ./kvmd/blikvm_fan/blikvm_fan.c
SOURCE_FILES += ./kvmd/blikvm_atx/blikvm_atx.c
SOURCE_FILES += ./kvmd/blikvm_switch/blikvm_switch.c
# SOURCE_FILES += ./kvmd/blikvm_oled/blikvm_oled.c
#SOURCE_FILES += ./kvmd/blikvm_oled/blikvm_oled.c

CC = g++

Expand All @@ -42,6 +41,6 @@ CFLAGS = ${IFLAGS} ${OFLAGS}
all:clean kvmd-main
# $(SOURCE_FILES)
kvmd-main:demo.c $(SOURCE_FILES)
$(CC) ${CFLAGS} $^ -o $@ -Wl,-rpath=./lib -Llib ${LIBS}
$(CC) ${CFLAGS} $^ -o $@ ${LIBS}
clean:
@rm -f kvmd-main
19 changes: 17 additions & 2 deletions src/blikvm_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,24 @@ blikvm_int8_t blikvm_init( blikvm_config_t *config)
blikvm_log_init(&config->log);

//2、init fan moudle
blikvm_fan_init();
if( blikvm_fan_init() == 0)
{
BLILOG_D(TAG,"init fan success\n");
}
else
{
BLILOG_E(TAG,"init fan failed\n");
}

//3、init atx moudle
blikvm_atx_init();
if(blikvm_atx_init() == 0)
{
BLILOG_D(TAG,"init atx success\n");
}
else
{
BLILOG_E(TAG,"init atx failed\n");
}

//4. init switch mouudle
blikvm_switch_init();
Expand Down
2 changes: 1 addition & 1 deletion src/config/package.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version": "1.0.7", "version_int": 107, "md5value": "5adbb69a2ba992af1637f5301f281b33", "oled_type": 0}
{"version": "1.0.8", "version_int": 108, "md5value": "1dec6c9efa9f9173d446c4c9e2e253fb", "oled_type": 0}
2 changes: 1 addition & 1 deletion src/demo.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int main(int argc, char *argv[])
blikvm_start();
while (1)
{
usleep(100*1000);
usleep(10000*1000);
}

return 0;
Expand Down
18 changes: 12 additions & 6 deletions src/kvmd/blikvm_atx/blikvm_atx.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ blikvm_int8_t blikvm_atx_init()
if(wiringPiSetupGpio() == -1)
{
BLILOG_E(TAG,"atx init gpio failed\n");
break;
}
pinMode(PIN_POWER, OUTPUT);
pinMode(PIN_RESET, OUTPUT);
pinMode(PIN_LED_PWR, INPUT);
pinMode(PIN_LED_HDD, INPUT);

if(access("/dev/shm/blikvm/",R_OK) != 0)
{
BLILOG_E(TAG,"not exit /dev/shm/blikvm/ will creat this dir\n");
Expand All @@ -76,7 +82,7 @@ blikvm_int8_t blikvm_atx_init()
}
else
{
blikvm_int8_t state[1];
blikvm_uint8_t state[1];
state[0] = blikvm_read_atx_state();
fwrite(state, sizeof(state) , 1, g_atx.fp );
fflush(g_atx.fp);
Expand Down Expand Up @@ -108,11 +114,6 @@ blikvm_int8_t blikvm_atx_init()
break;
}
g_atx.socket_addr.send_addr_len = sizeof(g_atx.socket_addr.send_addr);

pinMode(PIN_POWER, OUTPUT);
pinMode(PIN_RESET, OUTPUT);
pinMode(PIN_LED_PWR, INPUT);
pinMode(PIN_LED_HDD, INPUT);
g_atx.init = 1;
ret =0;
} while (0>1);
Expand All @@ -127,6 +128,11 @@ blikvm_int8_t blikvm_atx_start()
pthread_t blikvm_monitor_thread;
do
{
if(g_atx.init != 1U)
{
BLILOG_E(TAG,"not init\n");
break;
}
blikvm_int8_t thread_ret = pthread_create(&blikvm_atx_thread, NULL, blikvm_atx_loop, NULL);
if(thread_ret != 0)
{
Expand Down
5 changes: 5 additions & 0 deletions src/kvmd/blikvm_fan/blikvm_fan.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ blikvm_int8_t blikvm_fan_start()
pthread_t blikvm_fan_thread_monitor;
do
{
if(g_fan.init != 1)
{
BLILOG_E(TAG,"not init\n");
break;
}
blikvm_int8_t thread_ret = pthread_create(&blikvm_fan_thread, NULL, blikvm_fan_loop, NULL);
if(thread_ret != 0)
{
Expand Down

0 comments on commit fd44691

Please sign in to comment.