sys.c 894 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. #include <sys/types.h>
  2. #include <sys/stat.h>
  3. #include <fcntl.h>
  4. #include <unistd.h>
  5. #include <string.h>
  6. #include <limits.h>
  7. #include "log.h"
  8. #include "sys.h"
  9. #include "lock.h"
  10. #include "paras.h"
  11. #include "cfg.h"
  12. #include "fs.h"
  13. #include "thread.h"
  14. ////////////////////////////////////////////////////////////////////
  15. int sys_reboot(void)
  16. {
  17. int r=0;
  18. r = system("reboot");
  19. if(r) {
  20. LOGE("sys_reboot failed!\n");
  21. return -1;
  22. }
  23. return r;
  24. }
  25. int sys_get_chip_id(int *id)
  26. {
  27. if(!id) {
  28. return -1;
  29. }
  30. return 0;
  31. }
  32. static void* poll_thread(void *arg)
  33. {
  34. thread_handle_t *h=(thread_handle_t*)arg;
  35. //wdog_init();
  36. //tmp_create();
  37. while(h->quit==0) {
  38. sleep(1);
  39. }
  40. pthread_exit(NULL);
  41. }
  42. int sys_init(void)
  43. {
  44. paras_init();
  45. //thread_start(THREAD_ID_POLL, poll_thread, NULL);
  46. return 0;
  47. }