rt.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /******************************************************************************
  2. 版权所有:
  3. 文件名称: rt.h
  4. 文件版本: 01.01
  5. 创建作者: sunxi
  6. 创建日期: 2020-06-18
  7. 功能说明: 实时微系统头文件
  8. 其它说明:
  9. 修改记录:
  10. */
  11. #ifndef _RT_H
  12. #define _RT_H
  13. /*------------------------------- 头文件 --------------------------------------
  14. */
  15. //#include "my_include/watchdog_os.h"
  16. #include <unistd.h>
  17. #include <stdio.h>
  18. #include <string.h>
  19. #include <stdlib.h>
  20. #include <time.h>
  21. #include <sys/types.h>
  22. #include <sys/stat.h>
  23. #include <fcntl.h>
  24. #include <sys/types.h> /* See NOTES */
  25. #include <sys/socket.h>
  26. #include <netinet/in.h>
  27. #include <net/if.h>
  28. #include <arpa/inet.h>
  29. #include <linux/sockios.h>
  30. #include <sys/ioctl.h>
  31. #include <linux/types.h>
  32. #include <asm-generic/errno.h>
  33. #include "rt_types.h"
  34. #include "rt_fifo.h"
  35. #include "rt_printf.h"
  36. #include "rt_console.h"
  37. #include "rt_stat.h"
  38. #include "rt_clib.h"
  39. #include "rt_file.h"
  40. #include "rt_socket.h"
  41. #include "rt_error.h"
  42. #include "rt_log.h"
  43. #include "rt_env.h"
  44. /*------------------------------- 宏定义 --------------------------------------
  45. */
  46. static inline int is_power_of_2(unsigned long n)
  47. {
  48. return (n != 0 && ((n & (n - 1)) == 0));
  49. }
  50. static inline void msleep(unsigned int ms)
  51. {
  52. usleep(ms * 1000);
  53. }
  54. extern int g_clock_mode;
  55. extern int g_clock_mode_gps;
  56. /*------------------------------ 类型结构 -------------------------------------
  57. */
  58. /*------------------------------ 函数声明 -------------------------------------
  59. */
  60. int rt_init(void);
  61. int rt_exit(void);
  62. #define rt_malloc malloc
  63. #define rt_free free
  64. #define min(a,b) (a>b?b:a)
  65. //#define rt_printf printf
  66. #define sys_newstat stat
  67. #define clk_time_get(ts) clock_gettime(CLOCK_REALTIME, ts); ((struct timespec*)(ts))->tv_sec += 8*60*60;
  68. #define rt_save_flags(x) do{}while(0)//asm volatile ("movew %%sr,%0":"=d" (x) : : "memory")
  69. #define rt_irq_disable() do{}while(0) \
  70. /*asm volatile ( "move %/sr,%%d0\n\t" \
  71. "ori.l #0x0700,%%d0\n\t" \
  72. "move %%d0,%/sr\n" \
  73. : : : "cc", "%d0", "memory")
  74. */
  75. #define rt_irq_restore(x) do{}while(0)//asm volatile ("movew %0,%%sr": :"d" (x) : "memory")
  76. #define rt_irq_save(x) do{}while(0)//({ rt_save_flags(x); rt_irq_disable(); })
  77. #define rt_free_irq(x) do{}while(0)
  78. #define rt_request_irq(...) do{}while(0)//(113, 6, fec2_enet_interrupt, "fec2(TXF)");
  79. #define rt_irq_level(x); do{}while(0)
  80. #define simple_strtoul strtoul
  81. #endif //_RT_H
  82. /*------------------------------ 文件结束 -------------------------------------
  83. */