sys.c 876 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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 "paras.h"
  10. #include "cfg.h"
  11. #include "fs.h"
  12. #include "thread.h"
  13. ////////////////////////////////////////////////////////////////////
  14. int sys_reboot(void)
  15. {
  16. int r=0;
  17. r = system("reboot");
  18. if(r) {
  19. LOGE("sys_reboot failed!\n");
  20. return -1;
  21. }
  22. return r;
  23. }
  24. int sys_get_chip_id(int *id)
  25. {
  26. if(!id) {
  27. return -1;
  28. }
  29. return 0;
  30. }
  31. static void* poll_thread(void *arg)
  32. {
  33. thread_handle_t *h=(thread_handle_t*)arg;
  34. //wdog_init();
  35. //tmp_create();
  36. while(h->quit==0) {
  37. sleep(1);
  38. }
  39. pthread_exit(NULL);
  40. }
  41. int sys_init(void)
  42. {
  43. paras_init();
  44. //thread_start(THREAD_ID_POLL, poll_thread, NULL);
  45. return 0;
  46. }