Revision d180e1ba

View differences:

core/inc/aos_thread.h
121 121
#ifdef __cplusplus
122 122
extern "C" {
123 123
#endif
124
  void aosThdSleepUntilS(const aos_timestamp_t* t);
124
  void aosThdSleepUntilS(const aos_timestamp_t t);
125 125
#if (AMIROOS_CFG_DBG == true) && (CH_DBG_FILL_THREADS == TRUE)
126 126
  size_t aosThdGetStackPeakUtilization(thread_t* thread);
127 127
#endif
......
144 144

  
145 145
  aosSysGetUptimeX(&ut);
146 146
  ut += us;
147
  aosThdSleepUntilS(&ut);
147
  aosThdSleepUntilS(ut);
148 148

  
149 149
  return;
150 150
}
......
160 160

  
161 161
  aosSysGetUptimeX(&ut);
162 162
  ut += (aos_timestamp_t)ms * MICROSECONDS_PER_MILLISECOND;
163
  aosThdSleepUntilS(&ut);
163
  aosThdSleepUntilS(ut);
164 164

  
165 165
  return;
166 166
}
......
176 176

  
177 177
  aosSysGetUptimeX(&ut);
178 178
  ut += (aos_timestamp_t)s * MICROSECONDS_PER_SECOND;
179
  aosThdSleepUntilS(&ut);
179
  aosThdSleepUntilS(ut);
180 180

  
181 181
  return;
182 182
}
......
192 192

  
193 193
  aosSysGetUptimeX(&ut);
194 194
  ut += (aos_timestamp_t)(s * MICROSECONDS_PER_SECOND);
195
  aosThdSleepUntilS(&ut);
195
  aosThdSleepUntilS(ut);
196 196

  
197 197
  return;
198 198
}
......
258 258
 *
259 259
 * @param[in] t     Deadline until the thread will sleep.
260 260
 */
261
static inline void aosThdSleepUntil(const aos_timestamp_t* t)
261
static inline void aosThdSleepUntil(const aos_timestamp_t t)
262 262
{
263 263
  chSysLock();
264 264
  aosThdSleepUntilS(t);
core/src/aos_thread.c
55 55
 *
56 56
 * @param[in] t     Deadline until the thread will sleep.
57 57
 */
58
void aosThdSleepUntilS(const aos_timestamp_t* t)
58
void aosThdSleepUntilS(const aos_timestamp_t t)
59 59
{
60
  aosDbgCheck(t != NULL);
61

  
62 60
  aos_timestamp_t uptime;
63 61

  
64 62
  // get the current system uptime
65 63
  aosSysGetUptimeX(&uptime);
66 64

  
67 65
  // while the remaining time is too long, it must be split into multiple sleeps
68
  while ( (*t > uptime) && ((*t - uptime) > AOS_THD_MAX_SLEEP_US) ) {
66
  while ( (t > uptime) && ((t - uptime) > AOS_THD_MAX_SLEEP_US) ) {
69 67
    chThdSleepS(chTimeUS2I(AOS_THD_MAX_SLEEP_US));
70 68
    aosSysGetUptimeX(&uptime);
71 69
  }
72 70

  
73 71
  // sleep the remaining time
74
  if (*t > uptime) {
75
    sysinterval_t rest = chTimeUS2I(*t - uptime);
72
  if (t > uptime) {
73
    sysinterval_t rest = chTimeUS2I(t - uptime);
76 74
    if (rest > TIME_IMMEDIATE) {
77 75
      chThdSleepS(rest);
78 76
    }

Also available in: Unified diff