mirror of
https://gitee.com/moluo-tech/AT-Command
synced 2025-06-17 16:07:52 +00:00
72 lines
1.4 KiB
C
72 lines
1.4 KiB
C
![]() |
/******************************************************************************
|
|||
|
* @brief atģ<EFBFBD><EFBFBD>OS<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֲ<EFBFBD>ӿ<EFBFBD>
|
|||
|
*
|
|||
|
* Copyright (c) 2020, <master_roger@sina.com>
|
|||
|
*
|
|||
|
* SPDX-License-Identifier: Apache-2.0
|
|||
|
*
|
|||
|
* Change Logs:
|
|||
|
* Date Author Notes
|
|||
|
* 2020-01-02 Morro <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
******************************************************************************/
|
|||
|
|
|||
|
#ifndef _ATUTIL_H_
|
|||
|
#define _ATUTIL_H_
|
|||
|
|
|||
|
#include "os.h"
|
|||
|
#include <stdint.h>
|
|||
|
#include <stdbool.h>
|
|||
|
|
|||
|
typedef struct os_semaphore at_sem_t; /*<2A>ź<EFBFBD><C5BA><EFBFBD>*/
|
|||
|
|
|||
|
/*
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD><EFBFBD>ǰϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|||
|
*/
|
|||
|
static inline unsigned int at_get_ms(void)
|
|||
|
{
|
|||
|
return ril_get_ms();
|
|||
|
}
|
|||
|
/*
|
|||
|
* @brief <EFBFBD><EFBFBD>ʱ<EFBFBD>ж<EFBFBD>
|
|||
|
* @retval true | false
|
|||
|
*/
|
|||
|
static inline bool at_istimeout(unsigned int start_time, unsigned int timeout)
|
|||
|
{
|
|||
|
return at_get_ms() - start_time > timeout;
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
* @brief <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|||
|
* @retval none
|
|||
|
*/
|
|||
|
static inline void at_delay(uint32_t ms)
|
|||
|
{
|
|||
|
os_delay(ms);
|
|||
|
}
|
|||
|
/*
|
|||
|
* @brief <EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval none
|
|||
|
*/
|
|||
|
static inline void at_sem_init(at_sem_t *s, int value)
|
|||
|
{
|
|||
|
os_sem_init(s, value);
|
|||
|
}
|
|||
|
/*
|
|||
|
* @brief <EFBFBD><EFBFBD>ȡ<EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval none
|
|||
|
*/
|
|||
|
static inline bool at_sem_wait(at_sem_t *s, uint32_t timeout)
|
|||
|
{
|
|||
|
return os_sem_wait(s, timeout);
|
|||
|
}
|
|||
|
|
|||
|
/*
|
|||
|
* @brief <EFBFBD>ͷ<EFBFBD><EFBFBD>ź<EFBFBD><EFBFBD><EFBFBD>
|
|||
|
* @retval none
|
|||
|
*/
|
|||
|
static inline void at_sem_post(at_sem_t *s)
|
|||
|
{
|
|||
|
os_sem_post(s);
|
|||
|
}
|
|||
|
|
|||
|
#endif
|