system.c 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. /*****************************************************************************/
  2. /* ここから */
  3. /*****************************************************************************/
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include "wonx/system.h"
  7. #include "WonX.h"
  8. /*****************************************************************************/
  9. /* 互換関数の定義 */
  10. /*****************************************************************************/
  11. /*
  12. * Xサーバとの同期の整合性がとれなくなるなどの問題が考えられるので,
  13. * 互換関数の内部は UNIXTimer_Pause(), UNIXTimer_Unpause() でくくり,
  14. * タイマ割り込みを一時停止して処理を行う.また,unpause するまえに,
  15. * かならず sync するようにする.
  16. */
  17. /*
  18. * タイマの一時停止の2重解除の問題が出てくるので,
  19. * 互換関数から互換関数を呼んではいけない.
  20. * (一時停止はネストされるが,いちおう)
  21. * 似たような処理をする関数の場合は,必ず static な別関数に処理をまとめ,
  22. * そっちを呼び出すようにすること.
  23. * 引数の表示の問題もあるしね.
  24. */
  25. void sys_interrupt_set_hook(int type, intvector_t * vector,
  26. intvector_t * old_vector)
  27. {
  28. WWInterrupt ww_interrupt;
  29. if (!WonX_IsCreated()) WonX_Create();
  30. /* タイマを一時停止する */
  31. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  32. printf("call : sys_interrupt_set_hook() : type = %d, vector = %p, old_vector = %p\n", type, vector, old_vector);
  33. fflush(stdout);
  34. ww_interrupt = WonXSystem_GetWWInterrupt(WonX_GetWonXSystem());
  35. old_vector->callback = WWInterrupt_GetCallback(ww_interrupt, type);
  36. old_vector->cs = WWInterrupt_GetCS(ww_interrupt, type);
  37. old_vector->ds = WWInterrupt_GetDS(ww_interrupt, type);
  38. WWInterrupt_SetCallback(ww_interrupt, type, vector->callback);
  39. WWInterrupt_SetCS(ww_interrupt, type, vector->cs);
  40. WWInterrupt_SetDS(ww_interrupt, type, vector->ds);
  41. printf("call : sys_interrupt_set_hook() : return value = none\n");
  42. fflush(stdout);
  43. /* タイマをもとに戻す */
  44. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  45. return;
  46. }
  47. void sys_interrupt_reset_hook(int type, intvector_t * old_vector)
  48. {
  49. WWInterrupt ww_interrupt;
  50. if (!WonX_IsCreated()) WonX_Create();
  51. /* タイマを一時停止する */
  52. UNIXTimer_Pause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  53. printf("call : sys_interrupt_reset_hook() : type = %d, old_vector = %p\n", type, old_vector);
  54. fflush(stdout);
  55. ww_interrupt = WonXSystem_GetWWInterrupt(WonX_GetWonXSystem());
  56. WWInterrupt_SetCallback(ww_interrupt, type, old_vector->callback);
  57. WWInterrupt_SetCS(ww_interrupt, type, old_vector->cs);
  58. WWInterrupt_SetDS(ww_interrupt, type, old_vector->ds);
  59. printf("call : sys_interrupt_reset_hook() : return value = none\n");
  60. fflush(stdout);
  61. /* タイマをもとに戻す */
  62. UNIXTimer_Unpause(WonXSystem_GetUNIXTimer(WonX_GetWonXSystem()));
  63. return;
  64. }
  65. void sys_wait(unsigned int wait_time)
  66. {
  67. }
  68. unsigned long int sys_get_tick_count(void)
  69. {
  70. return (0);
  71. }
  72. void sys_sleep(void)
  73. {
  74. }
  75. void sys_set_sleep_time(int sleep_time)
  76. {
  77. }
  78. int sys_get_sleep_time(void)
  79. {
  80. return (0);
  81. }
  82. void sys_set_awake_key(int pattern)
  83. {
  84. }
  85. int sys_get_awake_key(void)
  86. {
  87. return (0);
  88. }
  89. void sys_set_keepalive_int(int pattern)
  90. {
  91. }
  92. void sys_get_ownerinfo(int size, char * buffer)
  93. {
  94. }
  95. int sys_suspend(int core)
  96. {
  97. return (0);
  98. }
  99. void sys_resume(int core)
  100. {
  101. }
  102. void sys_set_remote(int remote)
  103. {
  104. }
  105. unsigned int sys_get_remote(void)
  106. {
  107. return (0);
  108. }
  109. void * sys_alloc_iram(void * p, unsigned int size)
  110. {
  111. return (NULL);
  112. }
  113. void sys_free_iram(void * p)
  114. {}
  115. void * sys_get_my_iram(void)
  116. {
  117. return (NULL);
  118. }
  119. unsigned int sys_get_version(void)
  120. {
  121. return (0);
  122. }
  123. int sys_swap(int core)
  124. {
  125. return (0);
  126. }
  127. void sys_set_resume(unsigned int flags)
  128. {
  129. }
  130. unsigned int sys_get_resume(void)
  131. {
  132. return (0);
  133. }
  134. /*****************************************************************************/
  135. /* ここまで */
  136. /*****************************************************************************/
  137. /*****************************************************************************/
  138. /* End of File. */
  139. /*****************************************************************************/