Compare commits

...

21 Commits

Author SHA1 Message Date
openharmony_ci
2a307e190c !187 fix: delete unused code
Merge pull request !187 from MGY917/citu_clean_release
2021-06-17 13:34:00 +08:00
openharmony_ci
cbf094bc51 !186 修复时区计算错误的bug
Merge pull request !186 from zhangg05283106/time
2021-06-16 09:46:31 +08:00
openharmony_ci
32b8750966 !186 修复时区计算错误的bug
Merge pull request !186 from zhangg05283106/time
2021-06-16 09:46:30 +08:00
Guangyao Ma
31efd1ec5d fix: delete unused code
Close #I3VOGX

Change-Id: I9e83ddcd304a04d86dabbb6f2a2b7b27c93212bd
Signed-off-by: Guangyao Ma <guangyao.ma@outlook.com>
2021-06-15 20:52:54 +08:00
Caoruihong
3caf86f6dc fix: calculate tm_gmtoff error
【背景】实现时区接口函数时候对tm_gmtoff参数取值计算误做了取反
【修改方案】修正计算取反的时区参数
【影响】无

Change-Id: If2e76b7da64989fb2df063ce4101d317474a7ab7
Signed-off-by: zhangguang <jean.zhangguang@huawei.com>
2021-06-15 19:12:55 +08:00
openharmony_ci
71bb445d77 !185 优化HalSetRtcTime之类接口定义及说明
Merge pull request !185 from zhangg05283106/time
2021-06-15 18:11:48 +08:00
Caoruihong
94d906094c feat: optimize Hal<Set/Get>Rtc<Time/Timezone> APIs
【背景】release分支的时间功能相关api未实现
【修改方案】实现通用的时间api接口
【影响】无

Change-Id: I2ba4b2d05c59f6c7532526fff0f2587b5b6719f0
Signed-off-by: zhangguang <jean.zhangguang@huawei.com>
2021-06-15 17:14:17 +08:00
openharmony_ci
0d403fc524 !86 style: align with first param line
Merge pull request !86 from MGY917/OpenHarmony_release_v1.1.0
2021-04-25 10:46:22 +08:00
Guangyao Ma
b91d6a3704 style: align with first param line
Change-Id: Ifc14322a05a624d5c24ef4dca25c1ad7299aeed1
2021-04-23 17:23:45 +08:00
openharmony_ci
bfb54af7bb !74 fix pthread_create timing bug
Merge pull request !74 from Caoruihong/pthread_create
2021-04-19 11:46:19 +08:00
Caoruihong
a6bacba3f7 fix pthread_create timing bug 2021-04-19 10:57:16 +08:00
openharmony_ci
a33ee3a427 !65 lwip适配内核posix接口
Merge pull request !65 from 刘建东/OpenHarmony_1.0.1_release
2021-04-16 17:45:19 +08:00
YOUR_NAME
c40329e1ea IssueNo:#I3IMWT
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-15 19:49:30 +08:00
YOUR_NAME
0cfa7bfcc2 IssueNo:#I3IMWT
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-15 19:34:45 +08:00
YOUR_NAME
e4ce40d386 IssueNo:#I3IMWT
Description:use posix instead of lwip self
Feature or Bugfix:Bugfix
Binary Source:No
2021-04-13 17:48:11 +08:00
openharmony_ci
294680f77b !59 Add issue and PR template for release
Merge pull request !59 from 马明帅/add_issus_pr_template_for_release
2021-04-11 09:46:45 +08:00
mamingshuai
af1d5bb94b add issue and pr template 2021-04-07 14:50:02 +08:00
openharmony_ci
d7789ce6a2 !48 L0 posix接口新增
Merge pull request !48 from give-me-five/noEmployeeNum_ChangeID_13439291_wuyunjie
2021-03-31 14:00:23 +08:00
openharmony_ci
a2c7a5279e !50 使用01替换YES NO的依赖
Merge pull request !50 from 刘建东/OpenHarmony_1.0.1_release
2021-03-30 12:11:01 +08:00
YOUR_NAME
4084cd0dbe IssueNo:#I3E5C3
Description:use 0 1 instead of YES NO
Sig:phone
Feature or Bugfix:Bugfix
Binary Source:No
2021-03-30 11:28:09 +08:00
openharmony_ci
7db6a2b82a !38 update ReadME.md
Merge pull request !38 from Harylee/master
2021-03-23 10:16:05 +08:00
40 changed files with 396 additions and 495 deletions

View File

@@ -0,0 +1,11 @@
### 该问题是怎么引起的?
### 重现步骤
### 报错信息

View File

@@ -0,0 +1,12 @@
### 相关的Issue
### 原因(目的、解决的问题等)
### 描述(做了什么,变更了什么)
### 测试用例(新增、改动、可能影响的功能)

View File

@@ -125,7 +125,7 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
*stackEnd = (UINTPTR)taskCB->topOfStack + taskCB->stackSize; *stackEnd = (UINTPTR)taskCB->topOfStack + taskCB->stackSize;
if ((SP < (UINTPTR)taskCB->topOfStack) || (SP >= *stackEnd)) { if ((SP < (UINTPTR)taskCB->topOfStack) || (SP >= *stackEnd)) {
PRINT_ERR("msp statck [0x%x, 0x%x], cur task stack [0x%x, 0x%x], cur sp(0x%x) is overflow!\n", PRINT_ERR("msp statck [0x%x, 0x%x], cur task stack [0x%x, 0x%x], cur sp(0x%x) is overflow!\n",
CODE_START_ADDR, CSTACK_END_ADDR, (UINTPTR)taskCB->topOfStack, *stackEnd, SP); CODE_START_ADDR, CSTACK_END_ADDR, (UINTPTR)taskCB->topOfStack, *stackEnd, SP);
return LOS_NOK; return LOS_NOK;
} }
} }
@@ -135,7 +135,7 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
*stackEnd = CSTACK_END_ADDR; *stackEnd = CSTACK_END_ADDR;
if ((*stackStart < CODE_START_ADDR) || (*stackStart >= CSTACK_END_ADDR)) { if ((*stackStart < CODE_START_ADDR) || (*stackStart >= CSTACK_END_ADDR)) {
PRINT_ERR("msp stack [0x%x, 0x%x], cur sp(0x%x) is overflow!\n", PRINT_ERR("msp stack [0x%x, 0x%x], cur sp(0x%x) is overflow!\n",
CODE_START_ADDR, CSTACK_END_ADDR, *stackStart); CODE_START_ADDR, CSTACK_END_ADDR, *stackStart);
return LOS_NOK; return LOS_NOK;
} }
PRINTK("msp, start = %x, end = %x\n", *stackStart, *stackEnd); PRINTK("msp, start = %x, end = %x\n", *stackStart, *stackEnd);
@@ -146,7 +146,7 @@ STATIC INLINE UINT32 OsStackAddrGet(UINTPTR *stackStart, UINTPTR *stackEnd, UINT
*stackEnd = (UINTPTR)taskCB->topOfStack + taskCB->stackSize; *stackEnd = (UINTPTR)taskCB->topOfStack + taskCB->stackSize;
if ((*stackStart < (UINTPTR)taskCB->topOfStack) || (*stackStart >= *stackEnd)) { if ((*stackStart < (UINTPTR)taskCB->topOfStack) || (*stackStart >= *stackEnd)) {
PRINT_ERR("psp stack [0x%x, 0x%x], cur sp(0x%x) is overflow, cur task id is %d!\n", PRINT_ERR("psp stack [0x%x, 0x%x], cur sp(0x%x) is overflow, cur task id is %d!\n",
taskCB->topOfStack, *stackEnd, *stackStart, taskID); taskCB->topOfStack, *stackEnd, *stackStart, taskID);
return LOS_NOK; return LOS_NOK;
} }
PRINTK("psp, start = %x, end = %x\n", *stackStart, *stackEnd); PRINTK("psp, start = %x, end = %x\n", *stackStart, *stackEnd);

View File

@@ -44,6 +44,7 @@
#ifdef LOSCFG_NET_LWIP_SACK #ifdef LOSCFG_NET_LWIP_SACK
#include "lwip/lwipopts.h" #include "lwip/lwipopts.h"
#include "lwip/sockets.h"
#define CONFIG_NSOCKET_DESCRIPTORS LWIP_CONFIG_NUM_SOCKETS #define CONFIG_NSOCKET_DESCRIPTORS LWIP_CONFIG_NUM_SOCKETS
#else #else
#define CONFIG_NSOCKET_DESCRIPTORS 0 #define CONFIG_NSOCKET_DESCRIPTORS 0

View File

@@ -32,19 +32,42 @@
#ifndef _LWIP_PORTING_CC_H_ #ifndef _LWIP_PORTING_CC_H_
#define _LWIP_PORTING_CC_H_ #define _LWIP_PORTING_CC_H_
#ifdef LITTLE_ENDIAN
#undef LITTLE_ENDIAN
#endif
#ifdef BIG_ENDIAN
#undef BIG_ENDIAN
#endif
#include <endian.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "securec.h" #include "securec.h"
#include "log.h" #include "memory_pool.h"
#ifdef htons #ifdef htons
#define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS #define LWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS
#endif #endif
#define LWIP_PROVIDE_ERRNO 1 #define SOCKLEN_T_DEFINED
#define __SIZEOF_POINTER__ 4 // 32位系统 #define SA_FAMILY_T_DEFINED
#define IN_PORT_T_DEFINED
#define LOS_TASK_STATUS_DETACHED 0x0100 // 预留字段 #define LWIP_TIMEVAL_PRIVATE 0
#define LWIP_ERRNO_STDINCLUDE
#define LWIP_SOCKET_STDINCLUDE
#define LWIP_DNS_API_DEFINE_ERRORS 0
#define LWIP_DNS_API_DEFINE_FLAGS 0
#define LWIP_DNS_API_DECLARE_STRUCTS 0
#define LWIP_DNS_API_DECLARE_H_ERRNO 0
#ifndef __SIZEOF_POINTER__
#define __SIZEOF_POINTER__ 4 // 32 bit system
#endif
#define LOS_TASK_STATUS_DETACHED 0x0100 // reserved
#if defined(__arm__) && defined(__ARMCC_VERSION) #if defined(__arm__) && defined(__ARMCC_VERSION)
/* Keil uVision4 tools */ /* Keil uVision4 tools */
@@ -96,7 +119,6 @@ extern void HilogPrintf(const char *fmt, ...);
#define init_waitqueue_head(...) #define init_waitqueue_head(...)
#define poll_check_waiters(...) #define poll_check_waiters(...)
#define IOCTL_CMD_CASE_HANDLER() #define IOCTL_CMD_CASE_HANDLER()
#define DF_NADDR(addr)
#define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("114.114.114.114"))) #define DNS_SERVER_ADDRESS(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("114.114.114.114")))
#define DNS_SERVER_ADDRESS_SECONDARY(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("114.114.115.115"))) #define DNS_SERVER_ADDRESS_SECONDARY(ipaddr) (ip4_addr_set_u32(ipaddr, ipaddr_addr("114.114.115.115")))

View File

@@ -33,8 +33,6 @@
#define _LWIP_PORTING_SYS_ARCH_H_ #define _LWIP_PORTING_SYS_ARCH_H_
#include <stdint.h> #include <stdint.h>
#include "memory_pool.h"
#include "los_mux.h"
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2013-2019 Huawei Technologies Co., Ltd. All rights reserved.
* Copyright (c) 2020-2021 Huawei Device Co., Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors may be used
* to endorse or promote products derived from this software without specific prior written
* permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef _LWIP_PORTING_INET_H_
#define _LWIP_PORTING_INET_H_
#include <arpa/inet.h>
#include <netinet/in.h>
#include_next <lwip/inet.h>
#if LWIP_IPV4
#define inet_addr_from_ip4addr(target_inaddr, source_ipaddr) \
((target_inaddr)->s_addr = ip4_addr_get_u32(source_ipaddr))
#define inet_addr_to_ip4addr(target_ipaddr, source_inaddr) \
(ip4_addr_set_u32(target_ipaddr, (source_inaddr)->s_addr))
/* directly map this to the lwip internal functions */
#define inet_addr(cp) ipaddr_addr(cp)
#define inet_aton(cp, addr) ip4addr_aton(cp, (ip4_addr_t*)addr)
#define inet_ntoa(addr) ip4addr_ntoa((const ip4_addr_t*)&(addr))
#define inet_ntoa_r(addr, buf, buflen) ip4addr_ntoa_r((const ip4_addr_t*)&(addr), buf, buflen)
#endif /* LWIP_IPV4 */
#if LWIP_IPV6
#define inet6_addr_from_ip6addr(target_in6addr, source_ip6addr) \
{(target_in6addr)->s6_addr32[0] = (source_ip6addr)->addr[0]; \
(target_in6addr)->s6_addr32[1] = (source_ip6addr)->addr[1]; \
(target_in6addr)->s6_addr32[2] = (source_ip6addr)->addr[2]; \
(target_in6addr)->s6_addr32[3] = (source_ip6addr)->addr[3];}
#define inet6_addr_to_ip6addr(target_ip6addr, source_in6addr) \
{(target_ip6addr)->addr[0] = (source_in6addr)->s6_addr32[0]; \
(target_ip6addr)->addr[1] = (source_in6addr)->s6_addr32[1]; \
(target_ip6addr)->addr[2] = (source_in6addr)->s6_addr32[2]; \
(target_ip6addr)->addr[3] = (source_in6addr)->s6_addr32[3]; \
ip6_addr_clear_zone(target_ip6addr);}
#endif /* LWIP_IPV6 */
#endif /* _LWIP_PORTING_INET_H_ */

View File

@@ -134,8 +134,7 @@
#define LWIP_NETIF_LOOPBACK 1 #define LWIP_NETIF_LOOPBACK 1
#define LWIP_POSIX_SOCKETS_IO_NAMES 0 #define LWIP_POSIX_SOCKETS_IO_NAMES 0
#define LWIP_RAW 1 #define LWIP_RAW 1
#define CONFIG_NFILE_DESCRIPTORS 1 #define LWIP_SOCKET_OFFSET FAT_MAX_OPEN_FILES
#define LWIP_SOCKET_OFFSET CONFIG_NFILE_DESCRIPTORS
#define LWIP_SO_RCVBUF 1 #define LWIP_SO_RCVBUF 1
#define LWIP_SO_RCVTIMEO 1 #define LWIP_SO_RCVTIMEO 1
#define LWIP_SO_SNDTIMEO 1 #define LWIP_SO_SNDTIMEO 1

View File

@@ -29,11 +29,10 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef __LITEOS_NETDB_PORTING_H__ #ifndef _LWIP_PORTING_NETDB_H_
#define __LITEOS_NETDB_PORTING_H__ #define _LWIP_PORTING_NETDB_H_
#include "lwip/netdb.h" #include <netdb.h>
#include_next <lwip/netdb.h>
struct hostent *gethostbyname(const char *name); #endif /* _LWIP_PORTING_NETDB_H_ */
#endif // __LITEOS_NETDB_PORTING_H__

View File

@@ -32,6 +32,9 @@
#ifndef _LWIP_PORTING_NETIF_H_ #ifndef _LWIP_PORTING_NETIF_H_
#define _LWIP_PORTING_NETIF_H_ #define _LWIP_PORTING_NETIF_H_
#include <net/if.h>
#include <netinet/ip.h>
#define netif_find netifapi_netif_find_by_name #define netif_find netifapi_netif_find_by_name
#if LWIP_DHCPS #if LWIP_DHCPS
@@ -39,12 +42,11 @@
LWIP_NETIF_CLIENT_DATA_INDEX_DHCPS LWIP_NETIF_CLIENT_DATA_INDEX_DHCPS
#endif #endif
#define LWIP_NETIF_FULLNAME 16
#define linkoutput linkoutput; \ #define linkoutput linkoutput; \
void (*drv_send)(struct netif *netif, struct pbuf *p); \ void (*drv_send)(struct netif *netif, struct pbuf *p); \
u8_t (*drv_set_hwaddr)(struct netif *netif, u8_t *addr, u8_t len); \ u8_t (*drv_set_hwaddr)(struct netif *netif, u8_t *addr, u8_t len); \
void (*drv_config)(struct netif *netif, u32_t config_flags, u8_t setBit); \ void (*drv_config)(struct netif *netif, u32_t config_flags, u8_t setBit); \
char full_name[LWIP_NETIF_FULLNAME]; \ char full_name[IFNAMSIZ]; \
u16_t link_layer_type u16_t link_layer_type
#include_next <lwip/netif.h> #include_next <lwip/netif.h>
#undef linkoutput #undef linkoutput
@@ -52,7 +54,7 @@
#undef LWIP_NETIF_CLIENT_DATA_INDEX_DHCP #undef LWIP_NETIF_CLIENT_DATA_INDEX_DHCP
#endif #endif
#include <lwip/etharp.h> // For ETHARP_HWADDR_LEN, by `hieth-sf src/interface.c' and `wal/wal_net.c' #include <lwip/etharp.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
@@ -60,9 +62,9 @@ extern "C" {
// redefine NETIF_NAMESIZE which was defined in netif.h // redefine NETIF_NAMESIZE which was defined in netif.h
#undef NETIF_NAMESIZE #undef NETIF_NAMESIZE
#define NETIF_NAMESIZE LWIP_NETIF_FULLNAME #define NETIF_NAMESIZE IFNAMSIZ
#define LOOPBACK_IF 0 // 772 #define LOOPBACK_IF 0
#define ETHERNET_DRIVER_IF 1 #define ETHERNET_DRIVER_IF 1
#define WIFI_DRIVER_IF 801 #define WIFI_DRIVER_IF 801
#define BT_PROXY_IF 802 #define BT_PROXY_IF 802

View File

@@ -29,51 +29,55 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#ifndef _SYS_SOCKET_PORTING_H #ifndef _LWIP_PORTING_SOCKETS_H_
#define _SYS_SOCKET_PORTING_H #define _LWIP_PORTING_SOCKETS_H_
#include "lwip/sockets.h" #include <sys/socket.h>
#include <poll.h>
#include <netinet/tcp.h>
#include <netinet/in.h>
#include <sys/ioctl.h>
#include <sys/select.h>
#include <limits.h>
#include <fcntl.h>
#include_next <lwip/sockets.h>
#include <fatfs.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
int socket (int, int, int); #if FD_SETSIZE < (LWIP_SOCKET_OFFSET + MEMP_NUM_NETCONN)
#error "external FD_SETSIZE too small for number of sockets"
#else
#define LWIP_SELECT_MAXNFDS FD_SETSIZE
#endif
int bind (int, const struct sockaddr *, socklen_t); #if IOV_MAX > 0xFFFF
int connect (int, const struct sockaddr *, socklen_t); #error "IOV_MAX larger than supported by LwIP"
int listen (int, int); #endif
int accept (int, struct sockaddr *__restrict, socklen_t *__restrict);
int getsockname (int, struct sockaddr *__restrict, socklen_t *__restrict); #if LWIP_UDP && LWIP_UDPLITE
int getpeername (int, struct sockaddr *__restrict, socklen_t *__restrict); #define UDPLITE_SEND_CSCOV 0x01 /* sender checksum coverage */
#define UDPLITE_RECV_CSCOV 0x02 /* minimal receiver checksum coverage */
#endif
ssize_t send (int, const void *, size_t, int); // For BSD 4.4 socket sa_len compatibility
ssize_t recv (int, void *, size_t, int); #define DF_NADDR(addr)
ssize_t sendto (int, const void *, size_t, int, const struct sockaddr *, socklen_t); #define SA_LEN(addr, _) (IP_IS_V4_VAL(addr) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6))
ssize_t recvfrom (int, void *__restrict, size_t, int, struct sockaddr *__restrict, socklen_t *__restrict); #define sa_len sa_data[0] * 0 + SA_LEN(naddr, _)
ssize_t sendmsg (int, const struct msghdr *, int); #define sin_len sin_zero[0]
ssize_t recvmsg (int, struct msghdr *, int); #define sin6_len sin6_addr.s6_addr[0]
int getsockopt (int, int, int, void *__restrict, socklen_t *__restrict); // for sockets.c, TCP_KEEPALIVE is not supported currently
int setsockopt (int, int, int, const void *, socklen_t); #define TCP_KEEPALIVE 0xFF
#define SIN_ZERO_LEN 8
const char *inet_ntop(int af, const void *src, char *dst, socklen_t size);
int inet_pton(int af, const char *src, void *dst);
int shutdown (int, int);
int closesocket(int sockfd); int closesocket(int sockfd);
int ioctlsocket(int s, long cmd, void *argp); int ioctlsocket(int s, long cmd, void *argp);
#if LWIP_SOCKET_SELECT
int select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset, struct timeval *timeout);
#endif
#if LWIP_SOCKET_POLL
int poll(struct pollfd *fds, nfds_t nfds, int timeout);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif
#endif
#endif /* _LWIP_PORTING_SOCKETS_H_ */

View File

@@ -29,7 +29,7 @@
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "netdb.h" #include "lwip/netdb.h"
struct hostent *gethostbyname(const char *name) struct hostent *gethostbyname(const char *name)
{ {

View File

@@ -41,15 +41,15 @@
#include <los_timer.h> #include <los_timer.h>
#include <los_config.h> #include <los_config.h>
#define YES 1 #ifndef LOSCFG_KERNEL_SMP
#define NO 0 #define LOSCFG_KERNEL_SMP 0
#define LOSCFG_KERNEL_SMP NO #endif
#if (LOSCFG_KERNEL_SMP == YES) #if (LOSCFG_KERNEL_SMP)
SPIN_LOCK_INIT(arch_protect_spin); SPIN_LOCK_INIT(arch_protect_spin);
static u32_t lwprot_thread = LOS_ERRNO_TSK_ID_INVALID; static u32_t lwprot_thread = LOS_ERRNO_TSK_ID_INVALID;
static int lwprot_count = 0; static int lwprot_count = 0;
#endif /* LOSCFG_KERNEL_SMP == YES */ #endif /* LOSCFG_KERNEL_SMP */
#define ROUND_UP_DIV(val, div) (((val) + (div) - 1) / (div)) #define ROUND_UP_DIV(val, div) (((val) + (div) - 1) / (div))
#define LWIP_LOG_BUF_SIZE 64 #define LWIP_LOG_BUF_SIZE 64
@@ -98,7 +98,7 @@ u32_t sys_now(void)
*/ */
sys_prot_t sys_arch_protect(void) sys_prot_t sys_arch_protect(void)
{ {
#if (LOSCFG_KERNEL_SMP == YES) #if (LOSCFG_KERNEL_SMP)
/* Note that we are using spinlock instead of mutex for LiteOS-SMP here: /* Note that we are using spinlock instead of mutex for LiteOS-SMP here:
* 1. spinlock is more effective for short critical region protection. * 1. spinlock is more effective for short critical region protection.
* 2. this function is called only in task context, not in interrupt handler. * 2. this function is called only in task context, not in interrupt handler.
@@ -116,14 +116,14 @@ sys_prot_t sys_arch_protect(void)
} }
#else #else
LOS_TaskLock(); LOS_TaskLock();
#endif /* LOSCFG_KERNEL_SMP == YES */ #endif /* LOSCFG_KERNEL_SMP */
return 0; /* return value is unused */ return 0; /* return value is unused */
} }
void sys_arch_unprotect(sys_prot_t pval) void sys_arch_unprotect(sys_prot_t pval)
{ {
LWIP_UNUSED_ARG(pval); LWIP_UNUSED_ARG(pval);
#if (LOSCFG_KERNEL_SMP == YES) #if (LOSCFG_KERNEL_SMP)
if (lwprot_thread == LOS_CurTaskIDGet()) { if (lwprot_thread == LOS_CurTaskIDGet()) {
lwprot_count--; lwprot_count--;
if (lwprot_count == 0) { if (lwprot_count == 0) {
@@ -133,7 +133,7 @@ void sys_arch_unprotect(sys_prot_t pval)
} }
#else #else
LOS_TaskUnlock(); LOS_TaskUnlock();
#endif /* LOSCFG_KERNEL_SMP == YES */ #endif /* LOSCFG_KERNEL_SMP */
} }
/** /**

View File

@@ -32,8 +32,10 @@
#ifndef LWIP_TEST_H #ifndef LWIP_TEST_H
#define LWIP_TEST_H #define LWIP_TEST_H
#include "lwip/arch.h"
#include "lwip/sockets.h"
#include <sys/socket.h> #include <sys/socket.h>
#include "log.h" #include <arpa/inet.h>
#include "securec.h" #include "securec.h"
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -30,14 +30,18 @@
*/ */
#include "lwip_test.h" #include "lwip_test.h"
#include "lwipopts.h"
#include <arch/sys_arch.h>
#include <lwip/sys.h>
#define MSG "Hi, I am UDP" #define MSG "Hi, I am UDP"
#define TEST_CASE 120 #define TEST_CASE 120
static char g_buf[BUF_SIZE + 1] = { 0 }; static char g_buf[BUF_SIZE + 1] = { 0 };
int UdpTest(void) void UdpTestTask(void *p)
{ {
(void)p;
LogPrintln("net_socket_test_002.c enter"); LogPrintln("net_socket_test_002.c enter");
g_testCase = TEST_CASE; g_testCase = TEST_CASE;
int sfd; int sfd;
@@ -111,6 +115,13 @@ int UdpTest(void)
/* close socket */ /* close socket */
ret = closesocket(sfd); ret = closesocket(sfd);
LWIP_ASSERT("socket invalid param.", ret != -1); LWIP_ASSERT("socket invalid param.", ret != -1);
return LWIP_TEST_RET_OK; return;
} }
int UdpTest()
{
int ret = sys_thread_new("udp_test", UdpTestTask, NULL,
STACK_TEST_SIZE, TCPIP_THREAD_PRIO);
ICUNIT_ASSERT_NOT_EQUAL(ret, -1, 23);
return ret;
}

View File

@@ -39,7 +39,6 @@
#define TEST_CASE 130 #define TEST_CASE 130
static char g_buf[BUF_SIZE + 1] = { 0 }; static char g_buf[BUF_SIZE + 1] = { 0 };
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
static int SampleTcpServer() static int SampleTcpServer()
{ {

View File

@@ -40,7 +40,6 @@ static char g_buf_temp[BUF_SIZE + 1] = { 0 };
#define SEND_UDP_COUNT 10000 // send count #define SEND_UDP_COUNT 10000 // send count
#define TEST_CASE 170 #define TEST_CASE 170
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
static void UdpTestMoreTask(void *p) static void UdpTestMoreTask(void *p)
{ {
(void)p; (void)p;

View File

@@ -41,8 +41,6 @@
static char g_serverSendBuf[BUF_SIZE + 1] = { 0 }; static char g_serverSendBuf[BUF_SIZE + 1] = { 0 };
static char g_clientRecvBuf[BUF_SIZE + 1] = { 0 }; static char g_clientRecvBuf[BUF_SIZE + 1] = { 0 };
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
static void InitMsgBuf() static void InitMsgBuf()
{ {
int i; int i;

View File

@@ -43,8 +43,6 @@
static char g_buf[BUF_SIZE + 1] = { 0 }; static char g_buf[BUF_SIZE + 1] = { 0 };
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
static int SampleTcpServer() static int SampleTcpServer()
{ {
#if LWIP_SOCKET_SELECT #if LWIP_SOCKET_SELECT

View File

@@ -43,8 +43,6 @@
#define TIME_OUT (1000 * 10) // timeout 10s #define TIME_OUT (1000 * 10) // timeout 10s
static char g_buf[BUF_SIZE + 1] = { 0 }; static char g_buf[BUF_SIZE + 1] = { 0 };
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
static int SampleTcpServer() static int SampleTcpServer()
{ {
#if LWIP_SOCKET_POLL #if LWIP_SOCKET_POLL

View File

@@ -310,8 +310,9 @@ static struct netif *CreateBtNetIf()
return btNetif; return btNetif;
} }
int UdpTestNetif(void) static void UdpTestNetifTask(void *p)
{ {
(void)p;
LogPrintln("net_socket_test_011.c enter"); LogPrintln("net_socket_test_011.c enter");
g_testCase = TEST_CASE; g_testCase = TEST_CASE;
int sfd; int sfd;
@@ -363,7 +364,15 @@ int UdpTestNetif(void)
/* close socket */ /* close socket */
ret = closesocket(sfd); ret = closesocket(sfd);
LWIP_ASSERT("socket invalid param.", ret != -1); LWIP_ASSERT("socket invalid param.", ret != -1);
return LWIP_TEST_RET_OK; return;
}
int UdpTestNetif()
{
int ret = sys_thread_new("udp_test_netif", UdpTestNetifTask, NULL,
STACK_TEST_SIZE, TCPIP_THREAD_PRIO);
ICUNIT_ASSERT_NOT_EQUAL(ret, -1, 23);
return ret;
} }
static void ArpPackageProc(struct netif *netif, struct pbuf *p) static void ArpPackageProc(struct netif *netif, struct pbuf *p)

View File

@@ -45,7 +45,6 @@ static int g_portClient = STACK_PORT_TCP_DUP_START;
static char g_bufServer[BUF_SIZE + 1] = { 0 }; static char g_bufServer[BUF_SIZE + 1] = { 0 };
static char g_bufClient[BUF_SIZE + 1] = { 0 }; static char g_bufClient[BUF_SIZE + 1] = { 0 };
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
static int SampleTcpServer() static int SampleTcpServer()
{ {

View File

@@ -38,8 +38,6 @@
#define STACK_PORT_TCP_LONG 2231 #define STACK_PORT_TCP_LONG 2231
#define TCP_LONG_BUF_SIZE (2 * 1024) #define TCP_LONG_BUF_SIZE (2 * 1024)
extern sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stackSize, int prio);
static int SampleTcpServer() static int SampleTcpServer()
{ {
int sfd, lsfd; int sfd, lsfd;

View File

@@ -119,7 +119,7 @@ static void LwipTestTimeoutCallback(void const *argument)
osTimerId_t g_lwipTestTimerId = NULL; osTimerId_t g_lwipTestTimerId = NULL;
void LwipTestStartTimer(uint32 timeout) void LwipTestStartTimer(uint32_t timeout)
{ {
osStatus_t status; osStatus_t status;
if (g_lwipTestTimerId != NULL) { if (g_lwipTestTimerId != NULL) {

View File

@@ -5,6 +5,8 @@
#define PATH_MAX 256 #define PATH_MAX 256
#define MQ_PRIO_MAX 1 #define MQ_PRIO_MAX 1
#define PTHREAD_STACK_MIN LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE #define PTHREAD_STACK_MIN LOSCFG_BASE_CORE_TSK_MIN_STACK_SIZE
#define IOV_MAX 1024
#define SSIZE_MAX LONG_MAX
#include_next <limits.h> #include_next <limits.h>
#else #else

View File

@@ -0,0 +1,9 @@
#include <netdb.h>
#undef h_errno
int h_errno;
int *__h_errno_location(void)
{
return &h_errno;
}

View File

@@ -97,7 +97,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
taskInitParam.pfnTaskEntry = PthreadEntry; taskInitParam.pfnTaskEntry = PthreadEntry;
taskInitParam.uwArg = (UINT32)(UINTPTR)pthreadData; taskInitParam.uwArg = (UINT32)(UINTPTR)pthreadData;
if (LOS_TaskCreate(&taskID, &taskInitParam) != LOS_OK) { if (LOS_TaskCreateOnly(&taskID, &taskInitParam) != LOS_OK) {
free(pthreadData); free(pthreadData);
return EINVAL; return EINVAL;
} }
@@ -105,6 +105,8 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
/* set pthread default name */ /* set pthread default name */
(void)sprintf_s(taskInitParam.pcName, PTHREAD_NAMELEN, "pthread%u", taskID); (void)sprintf_s(taskInitParam.pcName, PTHREAD_NAMELEN, "pthread%u", taskID);
(void)LOS_TaskResume(taskID);
*thread = (pthread_t)taskID; *thread = (pthread_t)taskID;
return 0; return 0;
} }

177
kal/posix/src/time.c Executable file → Normal file
View File

@@ -55,16 +55,15 @@ STATIC const UINT16 g_daysInMonth[2][13] = {
STATIC const UINT8 g_montbl[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; STATIC const UINT8 g_montbl[12] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
static UINT64 g_rtcTimeBase = 0;
static UINT64 g_systickBase = 0;
/* /*
* Time zone information, stored in minutes, * Time zone information, stored in seconds,
* negative values indicate the east of UTC, * negative values indicate the east of UTC,
* positive values indicate the west of UTC. * positive values indicate the west of UTC.
*/ */
static INT32 g_rtcTimeZone = -480; long timezone = -8 * 60 * 60; // defaults to CST: 8 hours east of the Prime Meridian
static struct tm g_tm = {0};
/* internal shared struct tm object for localtime and gmtime */
static struct tm g_tm;
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) int nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
{ {
@@ -405,33 +404,28 @@ int clock_nanosleep(clockid_t clk, int flags, const struct timespec *req, struct
clock_t clock(void) clock_t clock(void)
{ {
return HalGetExpandTick(); clock_t clk;
struct timespec hwTime;
OsGetHwTime(&hwTime);
clk = hwTime.tv_sec * CLOCKS_PER_SEC;
clk += hwTime.tv_nsec / (OS_SYS_NS_PER_SECOND / CLOCKS_PER_SEC);
return clk;
} }
time_t time(time_t *timer) time_t time(time_t *timer)
{ {
UINT64 usec = 0; struct timespec ts;
time_t sec;
INT32 rtcRet;
rtcRet = HalGetRtcTime(&usec); if (-1 == clock_gettime(CLOCK_REALTIME, &ts)) {
if (rtcRet != 0) { return (time_t)-1;
UINT64 currentTime;
UINT64 tickDelta;
UINT64 currentTick = HalGetExpandTick();
if ((g_systickBase != 0) && (currentTick > g_systickBase)) {
tickDelta = currentTick - g_systickBase;
}
currentTime = g_rtcTimeBase + tickDelta;
sec = currentTime / OS_SYS_MS_PER_SECOND;
} else {
sec = usec / OS_SYS_US_PER_SECOND;
} }
if (timer != NULL) { if (timer != NULL) {
*timer = sec; *timer = ts.tv_sec;
} }
return sec; return ts.tv_sec;
} }
/* /*
@@ -494,23 +488,23 @@ static INT32 ConvertSecs2Utc(time_t t, INT32 offset, struct tm *tp)
days -= daysInMonth[month]; days -= daysInMonth[month];
tp->tm_mon = month; tp->tm_mon = month;
tp->tm_mday = days + 1; tp->tm_mday = days + 1;
tp->__tm_gmtoff = offset;
tp->__tm_zone = NULL;
tp->tm_isdst = 0;
return 1; return 1;
} }
struct tm *gmtime_r(const time_t *timer, struct tm *tp) struct tm *gmtime_r(const time_t *timep, struct tm *result)
{ {
time_t t64; if ((timep == NULL) || (result == NULL)) {
UINT32 intSave; errno = EFAULT;
if ((timer == NULL) || (tp == NULL)) {
return NULL; return NULL;
} }
intSave = LOS_IntLock(); if (!ConvertSecs2Utc(*timep, 0, result)) {
t64 = *timer; errno = EINVAL;
if (!ConvertSecs2Utc(t64, 0, tp)) { return NULL;
tp = NULL;
} }
(void)LOS_IntRestore(intSave); return result;
return tp;
} }
struct tm *gmtime(const time_t *timer) struct tm *gmtime(const time_t *timer)
@@ -518,22 +512,17 @@ struct tm *gmtime(const time_t *timer)
return gmtime_r(timer, &g_tm); return gmtime_r(timer, &g_tm);
} }
struct tm *localtime_r(const time_t *timer, struct tm *tp) struct tm *localtime_r(const time_t *timep, struct tm *result)
{ {
UINT32 intSave; if ((timep == NULL) || (result == NULL)) {
time_t t64; errno = EFAULT;
INT32 offset;
if ((timer == NULL) || (tp == NULL)) {
return NULL; return NULL;
} }
intSave = LOS_IntLock(); if (!ConvertSecs2Utc(*timep, -timezone, result)) {
t64 = *timer; errno = EINVAL;
offset = -(g_rtcTimeZone * SECS_PER_MIN); return NULL;
if (!ConvertSecs2Utc(t64, offset, tp)) {
tp = NULL;
} }
(void)LOS_IntRestore(intSave); return result;
return tp;
} }
struct tm *localtime(const time_t *timer) struct tm *localtime(const time_t *timer)
@@ -569,78 +558,90 @@ static time_t ConvertUtc2Secs(struct tm *tm)
} }
seconds += (tm->tm_mday - 1) * SECS_PER_DAY; seconds += (tm->tm_mday - 1) * SECS_PER_DAY;
seconds += tm->tm_hour * SECS_PER_HOUR + tm->tm_min * SECS_PER_MIN + tm->tm_sec; seconds += tm->tm_hour * SECS_PER_HOUR + tm->tm_min * SECS_PER_MIN + tm->tm_sec;
seconds -= tm->__tm_gmtoff; // sub time zone to get UTC time
return seconds; return seconds;
} }
time_t mktime(struct tm *tmptr) time_t mktime(struct tm *tmptr)
{ {
struct tm tempTime;
time_t timeInSeconds; time_t timeInSeconds;
if (tmptr == NULL) { if (tmptr == NULL) {
return 0; errno = EFAULT;
return (time_t)-1;
} }
if (tmptr->tm_year < (EPOCH_YEAR - TM_YEAR_BASE)) {
return 0; /* tm_isdst is not supported and is ignored */
if (tmptr->tm_year < (EPOCH_YEAR - TM_YEAR_BASE) ||
tmptr->__tm_gmtoff > (-TIME_ZONE_MIN * SECS_PER_MIN) ||
tmptr->__tm_gmtoff < (-TIME_ZONE_MAX * SECS_PER_MIN) ||
tmptr->tm_sec > 60 || tmptr->tm_sec < 0 || /* Seconds [0-60] */
tmptr->tm_min > 59 || tmptr->tm_min < 0 || /* Minutes [0-59] */
tmptr->tm_hour > 23 || tmptr->tm_hour < 0 || /* Hours [0-23] */
tmptr->tm_mday > 31 || tmptr->tm_mday < 1 || /* Day of the month [1-31] */
tmptr->tm_mon > 11 || tmptr->tm_mon < 0) { /* Month [0-11] */
errno = EOVERFLOW;
return (time_t)-1;
} }
tempTime = *tmptr; timeInSeconds = ConvertUtc2Secs(tmptr);
timeInSeconds = ConvertUtc2Secs(&tempTime); /* normalize tm_wday and tm_yday */
timeInSeconds += g_rtcTimeZone * SECS_PER_MIN; ConvertSecs2Utc(timeInSeconds, tmptr->__tm_gmtoff, tmptr);
return timeInSeconds; return timeInSeconds;
} }
int gettimeofday(struct timeval *tv, void *ptz) int gettimeofday(struct timeval *tv, void *ptz)
{ {
INT32 rtcRet; struct timespec ts;
INT32 timeZone = 0;
UINT64 usec = 0;
UINT64 currentTime;
UINT64 tickDelta = 0;
UINT64 currentTick;
struct timezone *tz = (struct timezone *)ptz; struct timezone *tz = (struct timezone *)ptz;
if ((tv == NULL) && (tz == NULL)) {
return -1;
}
if (tv != NULL) { if (tv != NULL) {
rtcRet = HalGetRtcTime(&usec); if (-1 == clock_gettime(CLOCK_REALTIME, &ts)) {
if (rtcRet != 0) { return -1;
currentTick = HalGetExpandTick();
if ((g_systickBase != 0) && (currentTick > g_systickBase)) {
tickDelta = currentTick - g_systickBase;
}
currentTime = g_rtcTimeBase + tickDelta;
tv->tv_sec = currentTime / OS_SYS_MS_PER_SECOND;
tv->tv_usec = (currentTime % OS_SYS_MS_PER_SECOND) * OS_SYS_MS_PER_SECOND;
} else {
tv->tv_sec = usec / OS_SYS_US_PER_SECOND;
tv->tv_usec = usec % OS_SYS_US_PER_SECOND;
} }
tv->tv_sec = ts.tv_sec;
tv->tv_usec = ts.tv_nsec / OS_SYS_NS_PER_US;
} }
HalGetRtcTimeZone(&timeZone);
if (tz != NULL) { if (tz != NULL) {
tz->tz_minuteswest = timeZone; tz->tz_minuteswest = timezone / SECS_PER_MIN;
tz->tz_dsttime = 0;
} }
return 0; return 0;
} }
int settimeofday(const struct timeval *tv, const struct timezone *tz) int settimeofday(const struct timeval *tv, const struct timezone *tz)
{ {
UINT64 usec; struct timespec ts;
if ((tv == NULL) || (tz == NULL)) { INT32 rtcTimeZone = timezone;
if (tv == NULL) {
errno = EFAULT;
return -1; return -1;
} }
g_rtcTimeBase = tv->tv_sec * OS_SYS_MS_PER_SECOND + tv->tv_usec / OS_SYS_MS_PER_SECOND;
g_systickBase = HalGetExpandTick(); if (tz != NULL) {
if ((tz->tz_minuteswest > TIME_ZONE_MIN) && if ((tz->tz_minuteswest >= TIME_ZONE_MIN) &&
(tz->tz_minuteswest < TIME_ZONE_MAX)) { (tz->tz_minuteswest <= TIME_ZONE_MAX)) {
g_rtcTimeZone = tz->tz_minuteswest; rtcTimeZone = tz->tz_minuteswest * SECS_PER_MIN;
} else {
errno = EINVAL;
return -1;
}
} }
usec = tv->tv_sec * OS_SYS_US_PER_SECOND + tv->tv_usec;
HalSetRtcTime(g_rtcTimeBase, &usec); if (tv->tv_usec >= OS_SYS_US_PER_SECOND) {
HalSetRtcTimeZone(g_rtcTimeZone); errno = EINVAL;
return -1;
}
ts.tv_sec = tv->tv_sec;
ts.tv_nsec = tv->tv_usec * OS_SYS_NS_PER_US;
if (-1 == clock_settime(CLOCK_REALTIME, &ts)) {
return -1;
}
timezone = rtcTimeZone;
return 0; return 0;
} }

View File

@@ -61,8 +61,8 @@
#define DAYS_PER_NORMAL_YEAR 365 #define DAYS_PER_NORMAL_YEAR 365
#define DAYS_PER_LEAP_YEAR 366 #define DAYS_PER_LEAP_YEAR 366
#define BEGIN_WEEKDAY 4 #define BEGIN_WEEKDAY 4
#define TIME_ZONE_MAX 720 /* 12 * 60 */ #define TIME_ZONE_MAX 720 /* UTC-12:00 , the last time zone */
#define TIME_ZONE_MIN (-840) /* -14 * 60 */ #define TIME_ZONE_MIN (-840) /* UTC+14:00 , the first time zone */
/* /*
* Nonzero if YEAR is a leap year (every 4 years, * Nonzero if YEAR is a leap year (every 4 years,
@@ -72,14 +72,6 @@
#define IS_LEAP_YEAR(year) \ #define IS_LEAP_YEAR(year) \
(((year) % 4 == 0) && (((year) % 100 != 0) || ((year) % 400 == 0))) (((year) % 4 == 0) && (((year) % 100 != 0) || ((year) % 400 == 0)))
#endif #endif
/* The lowest two bytes indicate minutes of the time zone */
#ifndef OFFSET_TO_MINUTE
#define OFFSET_TO_MINUTE(time) (((time) < 0) ? (-(time)) : (time))
#endif
/* The highest 31 bytes, 1 indicates eastern time zone<6E><65>? indicates western time zone */
#ifndef TIME_ZONE_SIGN
#define TIME_ZONE_SIGN(time) ((time) >> 31)
#endif
#define DIV(a, b) (((a) / (b)) - ((a) % (b) < 0)) #define DIV(a, b) (((a) / (b)) - ((a) % (b) < 0))
#define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400)) #define LEAPS_THRU_END_OF(y) (DIV (y, 4) - DIV (y, 100) + DIV (y, 400))

View File

@@ -52,9 +52,6 @@
#error "Please use ARM Compiler Toolchain V4.0.677 or later!" #error "Please use ARM Compiler Toolchain V4.0.677 or later!"
#endif #endif
/* intrinsic void __enable_irq(); */
/* intrinsic void __disable_irq(); */
/** \brief Get Control Register /** \brief Get Control Register
This function returns the content of the Control Register. This function returns the content of the Control Register.

30
kernel/arch/arm/cortex-m3/keil/los_timer.c Executable file → Normal file
View File

@@ -223,36 +223,6 @@ VOID HalEnterSleep(LOS_SysSleepEnum sleep)
__ISB(); __ISB();
} }
WEAK VOID HalDelay(UINT32 ticks)
{
}
WEAK UINT64 HalGetExpandTick(VOID)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTime(UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTimeZone(INT32 *timeZone)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTimeZone(INT32 timeZone)
{
return LOS_OK;
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@@ -213,11 +213,6 @@ VOID HalEnterSleep(LOS_SysSleepEnum sleep)
__ISB(); __ISB();
} }
WEAK VOID HalDelay(UINT32 ticks)
{
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@@ -222,36 +222,6 @@ VOID HalEnterSleep(LOS_SysSleepEnum sleep)
__ISB(); __ISB();
} }
WEAK VOID HalDelay(UINT32 ticks)
{
return;
}
WEAK UINT64 HalGetExpandTick(VOID)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTime(UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTimeZone(INT32 *timeZone)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTimeZone(INT32 timeZone)
{
return LOS_OK;
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

30
kernel/arch/arm/cortex-m4/iar/los_timer.c Executable file → Normal file
View File

@@ -222,36 +222,6 @@ VOID HalEnterSleep(LOS_SysSleepEnum sleep)
__ISB(); __ISB();
} }
WEAK VOID HalDelay(UINT32 ticks)
{
return;
}
WEAK UINT64 HalGetExpandTick(VOID)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTime(UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTimeZone(INT32 *timeZone)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTimeZone(INT32 timeZone)
{
return LOS_OK;
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

30
kernel/arch/arm/cortex-m7/gcc/los_timer.c Executable file → Normal file
View File

@@ -222,36 +222,6 @@ VOID HalEnterSleep(LOS_SysSleepEnum sleep)
__ISB(); __ISB();
} }
WEAK VOID HalDelay(UINT32 ticks)
{
}
WEAK UINT64 HalGetExpandTick(VOID)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTime(UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTimeZone(INT32 *timeZone)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTimeZone(INT32 timeZone)
{
return LOS_OK;
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

30
kernel/arch/arm/cortex-m7/iar/los_timer.c Executable file → Normal file
View File

@@ -222,36 +222,6 @@ VOID HalEnterSleep(LOS_SysSleepEnum sleep)
__ISB(); __ISB();
} }
WEAK VOID HalDelay(UINT32 ticks)
{
}
WEAK UINT64 HalGetExpandTick(VOID)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTime(UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTimeZone(INT32 *timeZone)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTimeZone(INT32 timeZone)
{
return LOS_OK;
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

32
kernel/arch/include/los_timer.h Executable file → Normal file
View File

@@ -69,38 +69,6 @@ VOID HalEnterSleep(LOS_SysSleepEnum sleep);
VOID HalDelay(UINT32 ticks); VOID HalDelay(UINT32 ticks);
UINT64 HalGetExpandTick(VOID);
INT32 HalGetRtcTime(UINT64 *usec);
INT32 HalGetRtcTimeZone(INT32 *timeZone);
INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec);
INT32 HalSetRtcTimeZone(INT32 timeZone);
/**
* @ingroup los_timer
* @brief Configure Tick Interrupt Start.
*
* @par Description:
* This API is used to configure Tick Interrupt Start while macro LOSCFG_BASE_CORE_TICK_HW_TIME is No.
*
* @attention
* <ul>
* <li>None.</li>
* </ul>
*
* @param: None.
*
* @retval #LOS_OK 0:configure Tick Interrupt success.
* @retval #LOS_ERRNO_TICK_CFG_INVALID 0x02000400:configure Tick Interrupt failed.
*
* @par Dependency:
* <ul><li>los_config.h: the header file that contains the API declaration.</li></ul>
* @see
*/
/** /**
* @ingroup los_hwi * @ingroup los_hwi
* @brief reconfig systick, and clear SysTick_IRQn. * @brief reconfig systick, and clear SysTick_IRQn.

31
kernel/arch/risc-v/riscv32/gcc/los_timer.c Executable file → Normal file
View File

@@ -41,7 +41,6 @@ extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
#endif /* __cplusplus */ #endif /* __cplusplus */
#define NS_PER_SECOND 1000000000.0
WEAK UINT32 HalTickStart(OS_TICK_HANDLER handler) WEAK UINT32 HalTickStart(OS_TICK_HANDLER handler)
{ {
@@ -67,36 +66,6 @@ LITE_OS_SEC_TEXT_MINOR VOID HalGetCpuCycle(UINT32 *cntHi, UINT32 *cntLo)
return; return;
} }
WEAK VOID HalDelay(UINT32 ticks)
{
}
WEAK UINT64 HalGetExpandTick(VOID)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTime(UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalGetRtcTimeZone(INT32 *timeZone)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTime(UINT64 utcTime, UINT64 *usec)
{
return LOS_OK;
}
WEAK INT32 HalSetRtcTimeZone(INT32 timeZone)
{
return LOS_OK;
}
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@@ -192,14 +192,6 @@ LITE_OS_SEC_TEXT_INIT UINT32 LOS_KernelInit(VOID)
} }
#endif #endif
#ifdef LOSCFG_TEST
//ret = los_TestInit();
//if (ret != LOS_OK) {
// PRINT_ERR("los_TestInit error\n");
// return ret;
//}
#endif
#if (LOSCFG_PLATFORM_EXC == 1) #if (LOSCFG_PLATFORM_EXC == 1)
OsExcMsgDumpInit(); OsExcMsgDumpInit();
#endif #endif

View File

@@ -545,9 +545,9 @@ LITE_OS_SEC_TEXT_MINOR UINT32 OsGetAllTskInfo(VOID)
} }
PRINTK("%d %d %s 0x%x 0x%x 0x%x 0x%x 0x%x ", PRINTK("%d %d %s 0x%x 0x%x 0x%x 0x%x 0x%x ",
taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus), taskCB->taskID, taskCB->priority, OsConvertTskStatus(taskCB->taskStatus),
taskCB->stackSize, OsGetTaskWaterLine(taskCB->taskID), taskCB->stackSize, OsGetTaskWaterLine(taskCB->taskID),
(UINT32)(UINTPTR)taskCB->stackPointer, taskCB->topOfStack, taskCB->eventMask); (UINT32)(UINTPTR)taskCB->stackPointer, taskCB->topOfStack, taskCB->eventMask);
semID = (taskCB->taskSem == NULL) ? OS_NULL_SHORT : (((LosSemCB *)taskCB->taskSem)->semID); semID = (taskCB->taskSem == NULL) ? OS_NULL_SHORT : (((LosSemCB *)taskCB->taskSem)->semID);
PRINTK("0x%x ", semID); PRINTK("0x%x ", semID);