| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <fcntl.h>
- #include <unistd.h>
- #include <string.h>
- #include <limits.h>
- #include <rtdevice.h>
- #include "log.h"
- #include "sys.h"
- #include "lock.h"
- #include "paras.h"
- #include "cfg.h"
- #include "fs.h"
- #include "thread.h"
- ////////////////////////////////////////////////////////////////////
- int sys_reboot(void)
- {
- int r=0;
- r = system("reboot");
- if(r) {
- LOGE("sys_reboot failed!\n");
- return -1;
- }
- return r;
- }
- int sys_get_chip_id(int *id)
- {
- if(!id) {
- return -1;
- }
-
- return 0;
- }
- static void* poll_thread(void *arg)
- {
- thread_handle_t *h=(thread_handle_t*)arg;
- //wdog_init();
- //tmp_create();
- while(h->quit==0) {
- sleep(1);
- }
- pthread_exit(NULL);
- }
- static int sd_mount(void)
- {
- int r=1,n=0;
- while(n<10) {
- r = mmcsd_wait_cd_changed(500);
- if(r==MMCSD_HOST_PLUGED) {
- r = fs_mount("sd", 1);
- }
- else if(r==MMCSD_HOST_UNPLUGED) {
- r = fs_mount("sd", 0);
- }
-
- if(r<=0) break;
- n++;
- }
- return r;
- }
- int sys_init(void)
- {
- sd_mount();
- paras_init();
-
- //thread_start(THREAD_ID_POLL, poll_thread, NULL);
- return 0;
- }
|