From 73a7b66116a099d0e21064924f88d6b8113b950f Mon Sep 17 00:00:00 2001 From: mamingshuai Date: Thu, 11 Mar 2021 18:43:57 +0800 Subject: [PATCH] update openharmony 1.0.1 --- .gitee/ISSUE_TEMPLATE.zh-CN.md | 13 - .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md | 15 - .gitignore | 2 - BUILD.gn | 150 +- Kconfig | 108 +- LICENSE | 6 +- Makefile | 65 +- README.md | 96 + README_zh.md | 96 + apps/Makefile | 6 +- apps/config.mk | 4 +- apps/init/Makefile | 10 +- apps/init/src/init.c | 34 +- apps/module.mk | 8 +- apps/shell/Makefile | 4 +- apps/shell/builtin/cd.c | 4 +- apps/shell/include/shcmd.h | 4 +- apps/shell/include/shcmdparse.h | 4 +- apps/shell/include/shell.h | 4 +- apps/shell/include/shell_list.h | 4 +- apps/shell/include/shell_pri.h | 4 +- apps/shell/include/sherr.h | 4 +- apps/shell/include/shmsg.h | 4 +- apps/shell/include/show.h | 4 +- apps/shell/src/main.c | 6 +- apps/shell/src/shcmd.c | 6 +- apps/shell/src/shcmdparse.c | 4 +- apps/shell/src/shmsg.c | 23 +- apps/tftp/Makefile | 77 + .../lwip => apps/tftp/include}/tftpc.h | 13 +- apps/tftp/include/types_adapt.h | 88 + apps/tftp/src/main.c | 160 + .../enhancement => apps/tftp}/src/tftpc.c | 34 +- arch/Kconfig | 0 arch/arm/arm.mk | 4 +- arch/arm/arm/Makefile | 4 +- arch/arm/arm/include/arch_config.h | 4 +- arch/arm/arm/include/arm.h | 4 +- arch/arm/arm/include/arm_user_copy.h | 4 +- arch/arm/arm/include/arm_user_get.h | 4 +- arch/arm/arm/include/arm_user_put.h | 4 +- arch/arm/arm/include/los_arch_mmu.h | 4 +- arch/arm/arm/include/los_asid.h | 4 +- arch/arm/arm/include/los_atomic.h | 4 +- arch/arm/arm/include/los_hw_cpu.h | 4 +- arch/arm/arm/include/los_mmu_descriptor_v6.h | 14 +- arch/arm/arm/include/los_pte_ops.h | 4 +- arch/arm/arm/include/los_tlb_v6.h | 4 +- arch/arm/arm/src/armv7a/cache.S | 4 +- arch/arm/arm/src/hw_user_get.S | 4 +- arch/arm/arm/src/hw_user_put.S | 4 +- arch/arm/arm/src/include/asm.h | 4 +- arch/arm/arm/src/include/los_exc_pri.h | 7 +- arch/arm/arm/src/include/los_hw_pri.h | 4 +- arch/arm/arm/src/include/los_hwi_pri.h | 4 +- arch/arm/arm/src/jmp.S | 4 +- arch/arm/arm/src/los_arch_mmu.c | 106 +- arch/arm/arm/src/los_asid.c | 6 +- arch/arm/arm/src/los_dispatch.S | 56 +- arch/arm/arm/src/los_exc.c | 107 +- arch/arm/arm/src/los_hw.c | 4 +- arch/arm/arm/src/los_hw_exc.S | 4 +- arch/arm/arm/src/los_hw_runstop.S | 4 +- arch/arm/arm/src/los_hw_tick.c | 4 +- arch/arm/arm/src/los_hwi.c | 22 +- arch/arm/arm/src/startup/reset_vector_mp.S | 79 +- arch/arm/arm/src/startup/reset_vector_up.S | 53 +- arch/arm/arm/src/strncpy_from_user.c | 4 +- arch/arm/arm/src/strnlen_user.c | 4 +- arch/arm/arm/src/user_copy.c | 4 +- arch/arm/include/in_cksum.h | 4 +- arch/arm/include/los_exc.h | 484 +-- arch/arm/include/los_hw.h | 4 +- arch/arm/include/los_hw_arch.h | 4 +- arch/arm/include/los_hw_tick_pri.h | 4 +- arch/arm/include/los_hwi.h | 21 +- arch/arm/include/los_strncpy_from_user.h | 4 +- arch/arm/include/los_strnlen_user.h | 4 +- arch/arm/include/los_sys_stack_pri.h | 4 +- arch/arm/include/los_user_get.h | 4 +- arch/arm/include/los_user_put.h | 4 +- arch/arm/include/user_copy.h | 4 +- arch/cpu.mk | 4 +- bsd/Kconfig | 0 bsd/Makefile | 4 +- bsd/compat/linuxkpi/Makefile | 4 +- bsd/dev/usb/Kconfig | 0 bsd/dev/usb/Makefile | 19 +- build.sh | 30 +- compat/posix/Kconfig | 0 compat/posix/Makefile | 4 +- compat/posix/include/mqueue.h | 23 +- compat/posix/include/time_posix.h | 4 +- compat/posix/src/map_error.c | 4 +- compat/posix/src/map_error.h | 4 +- compat/posix/src/misc.c | 4 +- compat/posix/src/mqueue.c | 325 +- compat/posix/src/posix_memalign.c | 4 +- compat/posix/src/pprivate.h | 4 +- compat/posix/src/pthread.c | 5 +- compat/posix/src/pthread_attr.c | 4 +- compat/posix/src/pthread_cond.c | 4 +- compat/posix/src/pthread_mutex.c | 4 +- compat/posix/src/sched.c | 4 +- compat/posix/src/semaphore.c | 4 +- compat/posix/src/socket.c | 4 +- compat/posix/src/time.c | 45 +- config.mk | 4 +- drivers/char/mem/Kconfig | 6 + drivers/char/mem/Makefile | 36 + .../char/mem/include/los_dev_mem.h | 22 +- .../char/mem/src/mem.c | 195 +- drivers/char/quickstart/Makefile | 36 + .../char/quickstart/include/los_quick_start.h | 51 + .../quickstart/include/los_quick_start_pri.h | 39 +- drivers/char/quickstart/src/qucikstart.c | 117 + drivers/char/random/Kconfig | 12 + drivers/char/random/Makefile | 45 + .../char/random/include/los_random.h | 56 +- drivers/char/random/src/random.c | 128 + drivers/char/random/src/random_hw.c | 127 + drivers/char/video/Kconfig | 6 + .../tickless => drivers/char/video}/Makefile | 11 +- ...0\346\236\266\346\236\204\345\233\276.png" | Bin 0 -> 30887 bytes ...the-openharmony-liteos-cortex-a-kernel.png | Bin 0 -> 24752 bytes fs/fat/Kconfig | 0 fs/fat/Makefile | 9 +- fs/fat/os_adapt/dirop_fat.c | 274 ++ fs/fat/os_adapt/dirop_fat.h | 195 ++ fs/fat/os_adapt/fat_shellcmd.c | 4 +- fs/fat/os_adapt/fatfs.c | 91 +- fs/fat/os_adapt/fatfs.h | 100 + fs/fat/os_adapt/format.c | 99 + fs/fat/virpart/Makefile | 7 +- fs/fat/virpart/include/virpart.h | 4 +- fs/fat/virpart/include/virpartff.h | 4 +- fs/fat/virpart/src/virpart.c | 4 +- fs/fat/virpart/src/virpartff.c | 4 +- fs/include/disk.h | 6 +- fs/include/fs/fd_table.h | 8 +- fs/include/fs/fs_operation.h | 4 +- fs/include/vfs_config.h | 20 +- fs/jffs2/Kconfig | 7 + fs/jffs2/Makefile | 16 +- fs/nfs/Makefile | 4 +- fs/proc/BUILD.gn | 47 + fs/proc/Kconfig | 6 + fs/proc/Makefile | 38 + .../proc/include/internal.h | 56 +- fs/proc/include/proc_file.h | 184 + fs/proc/include/proc_fs.h | 270 ++ fs/proc/os_adapt/kernel_trace_proc.c | 68 + fs/proc/os_adapt/mounts_proc.c | 100 + fs/proc/os_adapt/proc_init.c | 63 + fs/proc/os_adapt/process_proc.c | 58 + fs/proc/os_adapt/uptime_proc.c | 87 + fs/proc/os_adapt/vfs_proc.c | 432 +++ fs/proc/os_adapt/vmm_proc.c | 114 + fs/proc/src/proc_file.c | 685 ++++ fs/proc/src/proc_shellcmd.c | 100 + fs/ramfs/Makefile | 4 +- fs/vfs/Makefile | 4 +- fs/vfs/bcache/Makefile | 4 +- fs/vfs/bcache/src/bcache.c | 24 +- fs/vfs/bch/Makefile | 4 +- fs/vfs/disk/Makefile | 4 +- fs/vfs/disk/disk.c | 103 +- fs/vfs/disk/disk_shellcmd.c | 4 +- fs/vfs/include/bcache/bcache.h | 8 +- fs/vfs/include/disk/disk_pri.h | 4 +- fs/vfs/include/driver/blockproxy.h | 4 +- fs/vfs/include/driver/driver.h | 4 +- fs/vfs/include/driver/mtd_dev.h | 4 +- fs/vfs/include/driver/mtd_list.h | 4 +- .../include/multi_partition/mtd_partition.h | 6 +- fs/vfs/include/operation/fs_file.h | 4 +- fs/vfs/include/operation/fs_other.h | 4 +- fs/vfs/include/operation/fs_poll_pri.h | 4 +- fs/vfs/multi_partition/Makefile | 8 +- fs/vfs/multi_partition/src/mtd_partition.c | 86 +- fs/vfs/multi_partition/src/mtd_shellcmd.c | 23 +- fs/vfs/operation/fs_chattr.c | 4 +- fs/vfs/operation/fs_check.c | 4 +- fs/vfs/operation/fs_fallocate.c | 4 +- fs/vfs/operation/fs_fallocate64.c | 4 +- fs/vfs/operation/fs_file.c | 6 +- fs/vfs/operation/fs_file_mapping.c | 5 +- fs/vfs/operation/fs_getlabel.c | 4 +- fs/vfs/operation/fs_init.c | 5 +- fs/vfs/operation/fs_other.c | 26 +- fs/vfs/operation/fs_preadv.c | 4 +- fs/vfs/operation/fs_pwritev.c | 4 +- fs/vfs/operation/fs_readv.c | 4 +- fs/vfs/operation/fs_utime.c | 4 +- fs/vfs/operation/fs_virstatfs.c | 4 +- fs/vfs/operation/fs_writev.c | 4 +- fs/vfs/operation/fullpath.c | 4 +- fs/vfs/vfs_cmd/vfs_shellcmd.c | 69 +- fs/zpfs/BUILD.gn | 42 + fs/zpfs/Kconfig | 6 + fs/zpfs/Makefile | 44 + fs/zpfs/vfs_zpfs.c | 458 +++ fs/zpfs/vfs_zpfs.h | 76 + fs/zpfs/zpfs.c | 464 +++ kernel/BUILD.gn | 113 +- kernel/Kconfig | 16 +- kernel/base/BUILD.gn | 160 +- kernel/base/Makefile | 9 +- kernel/base/core/los_bitmap.c | 4 +- kernel/base/core/los_process.c | 346 +- kernel/base/core/los_sortlink.c | 325 +- kernel/base/core/los_swtmr.c | 157 +- kernel/base/core/los_sys.c | 32 +- kernel/base/core/los_task.c | 497 +-- kernel/base/core/los_tick.c | 31 +- kernel/base/include/los_base_pri.h | 4 +- kernel/base/include/los_binarytree_pri.h | 4 +- kernel/base/include/los_err_pri.h | 4 +- kernel/base/include/los_event_pri.h | 4 +- kernel/base/include/los_futex_pri.h | 16 +- kernel/base/include/los_heap_pri.h | 253 -- kernel/base/include/los_ipcdebug_pri.h | 4 +- kernel/base/include/los_membox_pri.h | 4 +- kernel/base/include/los_memory_pri.h | 10 +- kernel/base/include/los_memstat_pri.h | 4 +- kernel/base/include/los_mux_pri.h | 4 +- kernel/base/include/los_oom.h | 4 +- kernel/base/include/los_percpu_pri.h | 28 +- kernel/base/include/los_pmm.h | 4 +- kernel/base/include/los_printf_pri.h | 4 +- kernel/base/include/los_priqueue_pri.h | 245 -- kernel/base/include/los_process_pri.h | 77 +- kernel/base/include/los_queue_debug_pri.h | 4 +- kernel/base/include/los_queue_pri.h | 4 +- kernel/base/include/los_rwlock_pri.h | 66 + kernel/base/include/los_sched_pri.h | 120 +- kernel/base/include/los_sem_debug_pri.h | 4 +- kernel/base/include/los_sem_pri.h | 4 +- kernel/base/include/los_signal.h | 4 +- kernel/base/include/los_sortlink_pri.h | 70 +- kernel/base/include/los_stackinfo_pri.h | 4 +- kernel/base/include/los_stat_pri.h | 19 +- kernel/base/include/los_swtmr_pri.h | 4 +- kernel/base/include/los_sys_pri.h | 34 +- kernel/base/include/los_task_pri.h | 232 +- kernel/base/include/los_tick_pri.h | 16 +- kernel/base/include/los_typedef_pri.h | 4 +- kernel/base/include/los_vm_boot.h | 4 +- kernel/base/include/los_vm_common.h | 4 +- kernel/base/include/los_vm_dump.h | 4 +- kernel/base/include/los_vm_fault.h | 4 +- kernel/base/include/los_vm_filemap.h | 4 +- kernel/base/include/los_vm_iomap.h | 10 +- kernel/base/include/los_vm_lock.h | 4 +- kernel/base/include/los_vm_map.h | 24 +- kernel/base/include/los_vm_page.h | 5 +- kernel/base/include/los_vm_phys.h | 4 +- kernel/base/include/los_vm_shm_pri.h | 4 +- kernel/base/include/los_vm_syscall.h | 4 +- kernel/base/include/los_vm_zone.h | 18 +- kernel/base/ipc/los_event.c | 13 +- kernel/base/ipc/los_futex.c | 214 +- kernel/base/ipc/los_ipcdebug.c | 4 +- kernel/base/ipc/los_mux.c | 86 +- kernel/base/ipc/los_queue.c | 11 +- kernel/base/ipc/los_queue_debug.c | 4 +- kernel/base/ipc/los_rwlock.c | 474 +++ kernel/base/ipc/los_sem.c | 25 +- kernel/base/ipc/los_sem_debug.c | 4 +- kernel/base/ipc/los_signal.c | 19 +- kernel/base/mem/bestfit/los_memory.c | 2971 ----------------- kernel/base/mem/bestfit_little/los_heap.c | 424 --- kernel/base/mem/common/los_memstat.c | 6 +- .../mem/common/memrecord/los_binarytree.c | 260 -- .../base/mem/common/memrecord/los_memrecord.c | 356 -- kernel/base/mem/membox/los_membox.c | 4 +- kernel/base/mem/tlsf/los_memory.c | 1995 +++++++++++ kernel/base/misc/kill_shellcmd.c | 16 +- kernel/base/misc/los_misc.c | 4 +- kernel/base/misc/los_stackinfo.c | 5 +- kernel/base/misc/mempt_shellcmd.c | 64 +- kernel/base/misc/panic_shellcmd.c | 131 + kernel/base/misc/swtmr_shellcmd.c | 4 +- kernel/base/misc/sysinfo_shellcmd.c | 4 +- kernel/base/misc/task_shellcmd.c | 273 +- kernel/base/misc/vm_shellcmd.c | 6 +- kernel/base/mp/los_lockdep.c | 36 +- kernel/base/mp/los_mp.c | 4 +- kernel/base/mp/los_percpu.c | 4 +- kernel/base/mp/los_spinlock.c | 115 + kernel/base/mp/los_stat.c | 4 +- kernel/base/om/los_err.c | 4 +- kernel/base/sched/sched_sq/los_priqueue.c | 235 -- kernel/base/sched/sched_sq/los_sched.c | 1094 +++++- kernel/base/vm/los_vm_boot.c | 17 +- kernel/base/vm/los_vm_dump.c | 18 +- kernel/base/vm/los_vm_fault.c | 25 +- kernel/base/vm/los_vm_filemap.c | 10 +- kernel/base/vm/los_vm_iomap.c | 4 +- kernel/base/vm/los_vm_map.c | 109 +- kernel/base/vm/los_vm_page.c | 30 +- kernel/base/vm/los_vm_phys.c | 77 +- kernel/base/vm/los_vm_scan.c | 4 +- kernel/base/vm/los_vm_syscall.c | 103 +- kernel/base/vm/oom.c | 9 +- kernel/base/vm/shm.c | 194 +- kernel/common/Kconfig | 29 + kernel/common/Makefile | 4 +- kernel/common/console.c | 61 +- kernel/common/console.h | 9 +- kernel/common/hwi_shell.c | 60 +- kernel/common/los_builddef.h | 4 +- kernel/common/los_cir_buf.c | 4 +- kernel/common/los_cir_buf_pri.h | 4 +- kernel/common/los_config.c | 93 +- kernel/common/los_config.h | 27 +- kernel/common/los_exc_interaction.c | 4 +- kernel/common/los_exc_interaction_pri.h | 4 +- kernel/common/los_excinfo.c | 4 +- kernel/common/los_excinfo_pri.h | 4 +- kernel/common/los_hilog.c | 19 +- kernel/common/los_hilog.h | 4 +- kernel/common/los_magickey.c | 4 +- kernel/common/los_magickey.h | 4 +- kernel/common/los_printf.c | 29 +- kernel/common/los_rootfs.c | 71 +- kernel/common/los_rootfs.h | 23 +- kernel/common/los_seq_buf.c | 4 +- kernel/common/los_seq_buf.h | 4 +- kernel/common/los_timer_pri.h | 4 +- kernel/common/patchfs/Kconfig | 6 + kernel/common/patchfs/Makefile | 13 + kernel/common/patchfs/los_partition_utils.c | 235 ++ .../patchfs/los_partition_utils.h} | 71 +- kernel/common/patchfs/los_patchfs.c | 101 + kernel/common/patchfs/los_patchfs.h | 66 + kernel/common/sys_config.h | 8 +- kernel/common/virtual_serial.c | 5 +- kernel/common/virtual_serial.h | 4 +- kernel/extended/cppsupport/Makefile | 4 +- kernel/extended/cppsupport/los_cppsupport.c | 4 +- kernel/extended/cpup/Makefile | 4 +- kernel/extended/cpup/cpup_shellcmd.c | 4 +- kernel/extended/cpup/los_cpup.c | 572 ++-- kernel/extended/dynload/Makefile | 7 +- .../dynload/include/los_elf_auxvec_pri.h | 4 +- .../extended/dynload/include/los_exec_elf.h | 4 +- .../extended/dynload/include/los_ld_elf_pri.h | 4 +- .../extended/dynload/include/los_load_elf.h | 21 +- kernel/extended/dynload/src/los_exec_elf.c | 25 +- kernel/extended/dynload/src/los_load_elf.c | 249 +- kernel/extended/include/los_cpup_pri.h | 40 +- kernel/extended/include/los_trace_pri.h | 128 +- kernel/extended/liteipc/Makefile | 4 +- kernel/extended/liteipc/hm_liteipc.c | 140 +- kernel/extended/liteipc/hm_liteipc.h | 41 +- kernel/extended/{pipe => pipes} | 0 kernel/extended/tickless/los_tickless.c | 201 -- kernel/extended/trace/Makefile | 4 +- kernel/extended/trace/los_trace.c | 772 +++-- kernel/extended/trace/los_trace_frame.c | 132 + kernel/extended/trace/los_trace_frame.h | 120 + kernel/extended/vdso/include/los_vdso.h | 4 +- .../extended/vdso/include/los_vdso_datapage.h | 4 +- kernel/extended/vdso/include/los_vdso_pri.h | 4 +- kernel/extended/vdso/src/Makefile | 4 +- kernel/extended/vdso/src/los_vdso.c | 4 +- kernel/extended/vdso/src/los_vdso_text.S | 4 +- kernel/extended/vdso/usr/Makefile | 4 +- kernel/extended/vdso/usr/los_vdso.ld | 0 kernel/extended/vdso/usr/los_vdso_sys.c | 4 +- kernel/include/los_base.h | 4 +- kernel/include/los_bitmap.h | 4 +- kernel/include/los_cppsupport.h | 4 +- kernel/include/los_cpup.h | 146 +- kernel/include/los_err.h | 4 +- kernel/include/los_errno.h | 4 +- kernel/include/los_event.h | 4 +- kernel/include/{los_tickless.h => los_hash.h} | 94 +- kernel/include/los_ld_elflib.h | 4 +- kernel/include/los_list.h | 4 +- kernel/include/los_lockdep.h | 4 +- kernel/include/los_membox.h | 4 +- kernel/include/los_memory.h | 409 +-- kernel/include/los_mp.h | 4 +- kernel/include/los_mux.h | 4 +- kernel/include/los_printf.h | 8 +- kernel/include/los_process.h | 8 +- kernel/include/los_queue.h | 4 +- kernel/include/los_rwlock.h | 286 ++ kernel/include/los_sem.h | 4 +- kernel/include/los_spinlock.h | 99 +- kernel/include/los_swtmr.h | 9 +- kernel/include/los_sys.h | 4 +- kernel/include/los_tables.h | 4 +- kernel/include/los_task.h | 40 +- kernel/include/los_tick.h | 4 +- kernel/include/los_toolchain.h | 4 +- kernel/include/los_trace.h | 182 +- kernel/include/los_typedef.h | 4 +- kernel/user/Makefile | 4 +- kernel/user/include/los_user_init.h | 4 +- kernel/user/src/los_user_init.c | 8 +- kernel_test.sources | 1 + lib/Kconfig | 0 lib/libc/Makefile | 201 +- lib/libc/musl | 1 + lib/libc/optimization/arm/memchr.S | 1 + lib/libc/optimization/arm/memcpy.S | 1 + lib/libc/optimization/arm/strcmp.S | 1 + lib/libc/optimization/arm/strcpy.c | 1 + lib/libc/optimization/arm/strlen.S | 1 + lib/libc/optimization/asmdefs.h | 1 + lib/libscrew/include/los_crc32.h | 4 +- lib/libscrew/include/los_rbtree.h | 6 +- lib/libscrew/src/los_crc32.c | 4 +- lib/libscrew/src/los_rbtree.c | 7 +- lib/libsec/Makefile | 0 net/Kconfig | 4 + net/lwip-2.1/Makefile | 4 +- .../enhancement/include/lwip/api_shell.h | 4 +- net/lwip-2.1/enhancement/include/lwip/dhcps.h | 4 +- net/lwip-2.1/enhancement/include/lwip/fixme.h | 5 +- net/lwip-2.1/enhancement/src/api_shell.c | 147 +- net/lwip-2.1/enhancement/src/dhcps.c | 5 +- net/lwip-2.1/enhancement/src/fixme.c | 6 +- net/lwip-2.1/porting/include/arch/cc.h | 4 +- net/lwip-2.1/porting/include/arch/perf.h | 4 +- net/lwip-2.1/porting/include/arch/sys_arch.h | 4 +- net/lwip-2.1/porting/include/lwip/dhcp.h | 4 +- net/lwip-2.1/porting/include/lwip/inet.h | 4 +- net/lwip-2.1/porting/include/lwip/lwipopts.h | 5 +- net/lwip-2.1/porting/include/lwip/netif.h | 4 +- net/lwip-2.1/porting/include/lwip/netifapi.h | 4 +- net/lwip-2.1/porting/include/lwip/pbuf.h | 4 +- .../porting/include/lwip/priv/api_msg.h | 4 +- .../porting/include/lwip/priv/sockets_priv.h | 4 +- net/lwip-2.1/porting/include/lwip/sockets.h | 4 +- net/lwip-2.1/porting/include/lwipopts.h | 4 +- net/lwip-2.1/porting/src/driverif.c | 4 +- net/lwip-2.1/porting/src/sockets.c | 4 +- net/lwip-2.1/porting/src/sys_arch.c | 4 +- net/mac/los_mac.h | 4 +- net/telnet/Makefile | 4 +- net/telnet/include/telnet_dev.h | 4 +- net/telnet/include/telnet_loop.h | 4 +- net/telnet/include/telnet_pri.h | 4 +- net/telnet/src/telnet_dev.c | 5 +- net/telnet/src/telnet_loop.c | 4 +- platform/Kconfig | 39 +- platform/Makefile | 8 +- platform/board.ld.S | 6 +- platform/bsp.mk | 21 +- platform/hw/arm/interrupt/gic/gic_v2.c | 4 +- platform/hw/arm/interrupt/gic/gic_v3.c | 4 +- .../arm/timer/arm_generic/arm_generic_timer.c | 33 +- .../arm/timer/arm_private/arm_private_timer.c | 14 +- platform/hw/hisoc/hrtimer/hrtimer.c | 5 +- platform/hw/hisoc/timer/timer.c | 23 +- platform/hw/include/gic_common.h | 6 +- platform/hw/include/gic_v3.h | 6 +- platform/include/hal_hwi.h | 4 +- platform/include/hal_timer.h | 6 +- platform/main.c | 18 +- platform/uart/amba-pl011-lagacy/uart.c | 4 +- platform/uart/amba_pl011/amba_pl011.c | 12 +- platform/uart/amba_pl011/amba_pl011.h | 4 +- platform/uart/dw-3.0.8a/uart.c | 4 +- platform/usb/usb3.0_hi3516dv300/usb_board.c | 325 -- platform/usb/usb3.0_hi3518ev300/usb_board.c | 391 --- readme.md | 3 - security/Makefile | 4 +- security/cap/Makefile | 4 +- security/cap/capability.c | 33 +- security/cap/capability_api.h | 6 +- security/cap/capability_type.h | 4 +- security/vid/vid.c | 4 +- security/vid/vid_api.h | 4 +- security/vid/vid_type.h | 4 +- shell/BUILD.gn | 84 +- shell/Makefile | 4 +- shell/full/include/dmesg.h | 6 +- shell/full/include/dmesg_pri.h | 4 +- shell/full/include/shcmd.h | 4 +- shell/full/include/shcmdparse.h | 4 +- shell/full/include/shell.h | 4 +- shell/full/include/shell_lk.h | 4 +- shell/full/include/shell_pri.h | 4 +- shell/full/include/shmsg.h | 4 +- shell/full/include/show.h | 4 +- shell/full/src/base/shcmd.c | 5 +- shell/full/src/base/shcmdparse.c | 4 +- shell/full/src/base/shell_lk.c | 4 +- shell/full/src/base/shmsg.c | 5 +- shell/full/src/base/show.c | 9 +- shell/full/src/cmds/date_shell.c | 4 +- shell/full/src/cmds/dmesg.c | 7 +- shell/full/src/cmds/excinfo_shell.c | 4 +- shell/full/src/cmds/shell_shellcmd.c | 4 +- shell/full/src/cmds/watch_shell.c | 4 +- syscall/Makefile | 5 +- syscall/fs_syscall.c | 150 +- syscall/ipc_syscall.c | 31 +- syscall/los_syscall.c | 4 +- syscall/los_syscall.h | 12 +- syscall/misc_syscall.c | 20 +- syscall/net_syscall.c | 351 +- syscall/process_syscall.c | 235 +- syscall/syscall_lookup.h | 29 +- .../syscall_pub.c | 136 +- syscall/syscall_pub.h | 242 ++ syscall/time_syscall.c | 24 +- syscall/vm_syscall.c | 6 +- tools/build/config.mk | 4 +- tools/build/config/debug/hi3516dv300.config | 190 -- .../config/debug/hi3516dv300_clang.config | 192 -- tools/build/config/debug/hi3518ev300.config | 183 - .../config/debug/hi3518ev300_clang.config | 185 - tools/build/config/debug/hispark_aries.config | 33 + .../config/debug/hispark_aries_clang.config | 33 + .../build/config/debug/hispark_taurus.config | 43 + .../config/debug/hispark_taurus_clang.config | 43 + .../debug/hispark_taurus_clang_tee.config | 44 + .../debug/ipcamera_hi3516dv300_liteos.config | 41 + .../ipcamera_hi3516dv300_liteos_clang.config | 39 + ...camera_hi3516dv300_liteos_clang_tee.config | 41 + .../debug/ipcamera_hi3518ev300_liteos.config | 33 + .../ipcamera_hi3518ev300_liteos_clang.config | 31 + .../debug/qemu_arm_virt_ca7_clang.config | 148 - .../config/hi3516dv300_clang_release.config | 175 - .../config/hi3516dv300_debug_shell.config | 190 -- tools/build/config/hi3516dv300_release.config | 173 - .../config/hi3518ev300_clang_release.config | 168 - .../config/hi3518ev300_debug_shell.config | 183 - tools/build/config/hi3518ev300_release.config | 166 - .../config/hispark_aries_clang_release.config | 30 + .../config/hispark_aries_debug_shell.config | 33 + .../build/config/hispark_aries_release.config | 29 + .../hispark_taurus_clang_release.config | 40 + .../hispark_taurus_clang_release_tee.config | 42 + .../config/hispark_taurus_debug_shell.config | 43 + .../hispark_taurus_debug_shell_tee.config | 45 + .../config/hispark_taurus_release.config | 39 + .../config/hispark_taurus_release_tee.config | 41 + ...ra_hi3516dv300_liteos_clang_release.config | 34 + ...i3516dv300_liteos_clang_release_tee.config | 36 + ...mera_hi3516dv300_liteos_debug_shell.config | 42 + ..._hi3516dv300_liteos_debug_shell_tee.config | 43 + ...ipcamera_hi3516dv300_liteos_release.config | 38 + ...mera_hi3516dv300_liteos_release_tee.config | 38 + ...ra_hi3518ev300_liteos_clang_release.config | 26 + ...mera_hi3518ev300_liteos_debug_shell.config | 34 + ...ipcamera_hi3518ev300_liteos_release.config | 29 + .../config/qemu_arm_virt_debug_shell.config | 18 + tools/build/liteos.ld | 0 tools/build/liteos_llvm.ld | 0 tools/build/mk/bepbuildtime.conf | 0 tools/build/mk/dynload.mk | 4 +- tools/build/mk/get_compiler_path.sh | 59 + tools/build/mk/get_llvm_compiler_path.sh | 16 +- tools/build/mk/liteos_tables_ldflags.mk | 15 +- tools/build/mk/los_config.mk | 130 +- tools/build/mk/module.mk | 4 +- tools/fsimage/MakeVersion.sh | 4 +- tools/fsimage/win-x86/cygz.dll | Bin 0 -> 85011 bytes tools/fsimage/win-x86/doc_loadbios.exe | Bin 0 -> 175488 bytes tools/fsimage/win-x86/docfdisk.exe | Bin 0 -> 180912 bytes tools/fsimage/win-x86/flash_erase.exe | Bin 0 -> 307156 bytes tools/fsimage/win-x86/flash_eraseall | 4 + tools/fsimage/win-x86/flash_lock.exe | Bin 0 -> 177229 bytes tools/fsimage/win-x86/flash_otp_dump.exe | Bin 0 -> 170289 bytes tools/fsimage/win-x86/flash_otp_info.exe | Bin 0 -> 171319 bytes tools/fsimage/win-x86/flash_otp_lock.exe | Bin 0 -> 172723 bytes tools/fsimage/win-x86/flash_otp_write.exe | Bin 0 -> 173747 bytes tools/fsimage/win-x86/flash_unlock.exe | Bin 0 -> 177229 bytes tools/fsimage/win-x86/flashcp.exe | Bin 0 -> 209311 bytes tools/fsimage/win-x86/ftl_check.exe | Bin 0 -> 178518 bytes tools/fsimage/win-x86/ftl_format.exe | Bin 0 -> 185806 bytes tools/fsimage/win-x86/jffs2dump.exe | Bin 0 -> 274938 bytes tools/fsimage/win-x86/jffs2reader.exe | Bin 0 -> 227278 bytes tools/fsimage/win-x86/lsmtd.exe | Bin 0 -> 425385 bytes tools/fsimage/win-x86/mkfs.jffs2.exe | Bin 0 -> 371969 bytes tools/fsimage/win-x86/mtd_debug.exe | Bin 0 -> 188752 bytes tools/fsimage/win-x86/mtdinfo.exe | Bin 0 -> 346944 bytes tools/fsimage/win-x86/mtdpart.exe | Bin 0 -> 178033 bytes tools/fsimage/win-x86/nanddump.exe | Bin 0 -> 319680 bytes tools/fsimage/win-x86/nandtest.exe | Bin 0 -> 185794 bytes tools/fsimage/win-x86/nandwrite.exe | Bin 0 -> 324100 bytes tools/fsimage/win-x86/nftl_format.exe | Bin 0 -> 195394 bytes tools/fsimage/win-x86/nftldump.exe | Bin 0 -> 178670 bytes tools/fsimage/win-x86/recv_image.exe | Bin 0 -> 241942 bytes tools/fsimage/win-x86/rfddump.exe | Bin 0 -> 181454 bytes tools/fsimage/win-x86/rfdformat.exe | Bin 0 -> 173273 bytes tools/fsimage/win-x86/serve_image.exe | Bin 0 -> 224165 bytes tools/fsimage/win-x86/sumtool.exe | Bin 0 -> 243080 bytes tools/fsimage/win-x86/ubiattach.exe | Bin 0 -> 275038 bytes tools/fsimage/win-x86/ubiblock.exe | Bin 0 -> 257551 bytes tools/fsimage/win-x86/ubicrc32.exe | Bin 0 -> 176838 bytes tools/fsimage/win-x86/ubidetach.exe | Bin 0 -> 260561 bytes tools/fsimage/win-x86/ubiformat.exe | Bin 0 -> 474919 bytes tools/fsimage/win-x86/ubimkvol.exe | Bin 0 -> 277086 bytes tools/fsimage/win-x86/ubinfo.exe | Bin 0 -> 285888 bytes tools/fsimage/win-x86/ubinize.exe | Bin 0 -> 289385 bytes tools/fsimage/win-x86/ubirename.exe | Bin 0 -> 256519 bytes tools/fsimage/win-x86/ubirmvol.exe | Bin 0 -> 260968 bytes tools/fsimage/win-x86/ubirsvol.exe | Bin 0 -> 275445 bytes tools/fsimage/win-x86/ubiupdatevol.exe | Bin 0 -> 271187 bytes tools/scripts/make_rootfs/releaseinfo.sh | 4 +- tools/scripts/make_rootfs/rootfs.sh | 4 +- tools/scripts/make_rootfs/rootfsdir.sh | 4 +- tools/scripts/make_rootfs/rootfsimg.sh | 12 +- 611 files changed, 17899 insertions(+), 13999 deletions(-) delete mode 100644 .gitee/ISSUE_TEMPLATE.zh-CN.md delete mode 100644 .gitee/PULL_REQUEST_TEMPLATE.zh-CN.md mode change 100644 => 100755 BUILD.gn mode change 100644 => 100755 Kconfig mode change 100644 => 100755 Makefile create mode 100644 README.md create mode 100644 README_zh.md mode change 100644 => 100755 apps/Makefile mode change 100644 => 100755 apps/config.mk mode change 100644 => 100755 apps/init/Makefile mode change 100644 => 100755 apps/init/src/init.c mode change 100644 => 100755 apps/module.mk mode change 100644 => 100755 apps/shell/Makefile mode change 100644 => 100755 apps/shell/builtin/cd.c mode change 100644 => 100755 apps/shell/include/shcmd.h mode change 100644 => 100755 apps/shell/include/shell.h mode change 100644 => 100755 apps/shell/include/shmsg.h mode change 100644 => 100755 apps/shell/include/show.h mode change 100644 => 100755 apps/shell/src/main.c mode change 100644 => 100755 apps/shell/src/shcmd.c mode change 100644 => 100755 apps/shell/src/shcmdparse.c mode change 100644 => 100755 apps/shell/src/shmsg.c create mode 100644 apps/tftp/Makefile rename {net/lwip-2.1/enhancement/include/lwip => apps/tftp/include}/tftpc.h (97%) create mode 100644 apps/tftp/include/types_adapt.h create mode 100644 apps/tftp/src/main.c rename {net/lwip-2.1/enhancement => apps/tftp}/src/tftpc.c (99%) mode change 100644 => 100755 arch/Kconfig mode change 100644 => 100755 arch/arm/arm/Makefile mode change 100644 => 100755 arch/arm/arm/include/arch_config.h mode change 100644 => 100755 arch/arm/arm/include/arm.h mode change 100644 => 100755 arch/arm/arm/include/arm_user_copy.h mode change 100644 => 100755 arch/arm/arm/include/arm_user_get.h mode change 100644 => 100755 arch/arm/arm/include/arm_user_put.h mode change 100644 => 100755 arch/arm/arm/include/los_hw_cpu.h mode change 100644 => 100755 arch/arm/arm/include/los_mmu_descriptor_v6.h mode change 100644 => 100755 arch/arm/arm/src/hw_user_get.S mode change 100644 => 100755 arch/arm/arm/src/hw_user_put.S mode change 100644 => 100755 arch/arm/arm/src/include/asm.h mode change 100644 => 100755 arch/arm/arm/src/include/los_hw_pri.h mode change 100644 => 100755 arch/arm/arm/src/los_arch_mmu.c mode change 100644 => 100755 arch/arm/arm/src/los_dispatch.S mode change 100644 => 100755 arch/arm/arm/src/los_exc.c mode change 100644 => 100755 arch/arm/arm/src/los_hw.c mode change 100644 => 100755 arch/arm/arm/src/los_hw_exc.S mode change 100644 => 100755 arch/arm/arm/src/startup/reset_vector_mp.S mode change 100644 => 100755 arch/arm/arm/src/startup/reset_vector_up.S mode change 100644 => 100755 arch/arm/arm/src/strncpy_from_user.c mode change 100644 => 100755 arch/arm/arm/src/strnlen_user.c mode change 100644 => 100755 arch/arm/arm/src/user_copy.c mode change 100644 => 100755 arch/arm/include/in_cksum.h mode change 100644 => 100755 arch/arm/include/los_exc.h mode change 100644 => 100755 arch/arm/include/los_hw.h mode change 100644 => 100755 arch/arm/include/los_hwi.h mode change 100644 => 100755 arch/arm/include/los_strncpy_from_user.h mode change 100644 => 100755 arch/arm/include/los_strnlen_user.h mode change 100644 => 100755 arch/arm/include/los_user_get.h mode change 100644 => 100755 arch/arm/include/los_user_put.h mode change 100644 => 100755 arch/arm/include/user_copy.h mode change 100644 => 100755 bsd/Kconfig mode change 100644 => 100755 bsd/compat/linuxkpi/Makefile mode change 100644 => 100755 bsd/dev/usb/Kconfig mode change 100644 => 100755 bsd/dev/usb/Makefile mode change 100644 => 100755 compat/posix/Kconfig mode change 100644 => 100755 compat/posix/include/mqueue.h mode change 100644 => 100755 compat/posix/include/time_posix.h mode change 100644 => 100755 compat/posix/src/misc.c mode change 100644 => 100755 compat/posix/src/mqueue.c mode change 100644 => 100755 compat/posix/src/pthread.c mode change 100644 => 100755 compat/posix/src/pthread_cond.c mode change 100644 => 100755 compat/posix/src/pthread_mutex.c mode change 100644 => 100755 compat/posix/src/semaphore.c mode change 100644 => 100755 compat/posix/src/time.c mode change 100644 => 100755 config.mk create mode 100644 drivers/char/mem/Kconfig create mode 100644 drivers/char/mem/Makefile rename kernel/extended/include/los_tickless_pri.h => drivers/char/mem/include/los_dev_mem.h (72%) rename kernel/base/mem/common/memrecord/los_interto64radix.c => drivers/char/mem/src/mem.c (51%) create mode 100644 drivers/char/quickstart/Makefile create mode 100644 drivers/char/quickstart/include/los_quick_start.h rename kernel/base/include/los_timeslice_pri.h => drivers/char/quickstart/include/los_quick_start_pri.h (67%) create mode 100644 drivers/char/quickstart/src/qucikstart.c create mode 100644 drivers/char/random/Kconfig create mode 100644 drivers/char/random/Makefile rename kernel/base/include/los_memrecord_pri.h => drivers/char/random/include/los_random.h (63%) create mode 100644 drivers/char/random/src/random.c create mode 100644 drivers/char/random/src/random_hw.c create mode 100644 drivers/char/video/Kconfig rename {kernel/extended/tickless => drivers/char/video}/Makefile (83%) create mode 100644 "figures/OpenHarmony-LiteOS-A\345\206\205\346\240\270\346\236\266\346\236\204\345\233\276.png" create mode 100644 figures/architecture-of-the-openharmony-liteos-cortex-a-kernel.png mode change 100644 => 100755 fs/fat/Kconfig mode change 100644 => 100755 fs/fat/Makefile create mode 100755 fs/fat/os_adapt/dirop_fat.c create mode 100755 fs/fat/os_adapt/dirop_fat.h mode change 100644 => 100755 fs/fat/os_adapt/fatfs.c create mode 100755 fs/fat/os_adapt/fatfs.h create mode 100755 fs/fat/os_adapt/format.c mode change 100644 => 100755 fs/fat/virpart/Makefile mode change 100644 => 100755 fs/include/disk.h mode change 100644 => 100755 fs/include/fs/fs_operation.h mode change 100644 => 100755 fs/include/vfs_config.h mode change 100644 => 100755 fs/jffs2/Kconfig create mode 100755 fs/proc/BUILD.gn create mode 100644 fs/proc/Kconfig create mode 100644 fs/proc/Makefile rename kernel/base/core/los_timeslice.c => fs/proc/include/internal.h (67%) mode change 100644 => 100755 create mode 100755 fs/proc/include/proc_file.h create mode 100755 fs/proc/include/proc_fs.h create mode 100755 fs/proc/os_adapt/kernel_trace_proc.c create mode 100755 fs/proc/os_adapt/mounts_proc.c create mode 100755 fs/proc/os_adapt/proc_init.c create mode 100755 fs/proc/os_adapt/process_proc.c create mode 100755 fs/proc/os_adapt/uptime_proc.c create mode 100755 fs/proc/os_adapt/vfs_proc.c create mode 100755 fs/proc/os_adapt/vmm_proc.c create mode 100755 fs/proc/src/proc_file.c create mode 100644 fs/proc/src/proc_shellcmd.c mode change 100644 => 100755 fs/vfs/Makefile mode change 100644 => 100755 fs/vfs/bcache/src/bcache.c mode change 100644 => 100755 fs/vfs/bch/Makefile mode change 100644 => 100755 fs/vfs/disk/disk.c mode change 100644 => 100755 fs/vfs/include/bcache/bcache.h mode change 100644 => 100755 fs/vfs/include/driver/blockproxy.h mode change 100644 => 100755 fs/vfs/include/driver/driver.h mode change 100644 => 100755 fs/vfs/include/driver/mtd_dev.h mode change 100644 => 100755 fs/vfs/include/driver/mtd_list.h mode change 100644 => 100755 fs/vfs/include/multi_partition/mtd_partition.h mode change 100644 => 100755 fs/vfs/include/operation/fs_file.h mode change 100644 => 100755 fs/vfs/include/operation/fs_other.h mode change 100644 => 100755 fs/vfs/multi_partition/src/mtd_partition.c mode change 100644 => 100755 fs/vfs/multi_partition/src/mtd_shellcmd.c mode change 100644 => 100755 fs/vfs/operation/fs_chattr.c mode change 100644 => 100755 fs/vfs/operation/fs_check.c mode change 100644 => 100755 fs/vfs/operation/fs_fallocate.c mode change 100644 => 100755 fs/vfs/operation/fs_fallocate64.c mode change 100644 => 100755 fs/vfs/operation/fs_file.c mode change 100644 => 100755 fs/vfs/operation/fs_file_mapping.c mode change 100644 => 100755 fs/vfs/operation/fs_getlabel.c mode change 100644 => 100755 fs/vfs/operation/fs_init.c mode change 100644 => 100755 fs/vfs/operation/fs_other.c mode change 100644 => 100755 fs/vfs/operation/fs_preadv.c mode change 100644 => 100755 fs/vfs/operation/fs_pwritev.c mode change 100644 => 100755 fs/vfs/operation/fs_readv.c mode change 100644 => 100755 fs/vfs/operation/fs_utime.c mode change 100644 => 100755 fs/vfs/operation/fs_virstatfs.c mode change 100644 => 100755 fs/vfs/operation/fs_writev.c mode change 100644 => 100755 fs/vfs/operation/fullpath.c mode change 100644 => 100755 fs/vfs/vfs_cmd/vfs_shellcmd.c create mode 100644 fs/zpfs/BUILD.gn create mode 100644 fs/zpfs/Kconfig create mode 100644 fs/zpfs/Makefile create mode 100755 fs/zpfs/vfs_zpfs.c create mode 100644 fs/zpfs/vfs_zpfs.h create mode 100644 fs/zpfs/zpfs.c mode change 100644 => 100755 kernel/BUILD.gn mode change 100644 => 100755 kernel/Kconfig mode change 100644 => 100755 kernel/base/BUILD.gn mode change 100644 => 100755 kernel/base/Makefile mode change 100644 => 100755 kernel/base/core/los_bitmap.c mode change 100644 => 100755 kernel/base/core/los_process.c mode change 100644 => 100755 kernel/base/core/los_sortlink.c mode change 100644 => 100755 kernel/base/core/los_swtmr.c mode change 100644 => 100755 kernel/base/core/los_sys.c mode change 100644 => 100755 kernel/base/core/los_task.c mode change 100644 => 100755 kernel/base/core/los_tick.c mode change 100644 => 100755 kernel/base/include/los_event_pri.h mode change 100644 => 100755 kernel/base/include/los_futex_pri.h delete mode 100644 kernel/base/include/los_heap_pri.h mode change 100644 => 100755 kernel/base/include/los_memory_pri.h mode change 100644 => 100755 kernel/base/include/los_mux_pri.h mode change 100644 => 100755 kernel/base/include/los_oom.h mode change 100644 => 100755 kernel/base/include/los_percpu_pri.h delete mode 100644 kernel/base/include/los_priqueue_pri.h mode change 100644 => 100755 kernel/base/include/los_process_pri.h create mode 100755 kernel/base/include/los_rwlock_pri.h mode change 100644 => 100755 kernel/base/include/los_sched_pri.h mode change 100644 => 100755 kernel/base/include/los_sem_pri.h mode change 100644 => 100755 kernel/base/include/los_signal.h mode change 100644 => 100755 kernel/base/include/los_sortlink_pri.h mode change 100644 => 100755 kernel/base/include/los_stat_pri.h mode change 100644 => 100755 kernel/base/include/los_sys_pri.h mode change 100644 => 100755 kernel/base/include/los_task_pri.h mode change 100644 => 100755 kernel/base/include/los_vm_boot.h mode change 100644 => 100755 kernel/base/include/los_vm_common.h mode change 100644 => 100755 kernel/base/include/los_vm_filemap.h mode change 100644 => 100755 kernel/base/include/los_vm_iomap.h mode change 100644 => 100755 kernel/base/include/los_vm_map.h mode change 100644 => 100755 kernel/base/include/los_vm_phys.h mode change 100644 => 100755 kernel/base/ipc/los_event.c mode change 100644 => 100755 kernel/base/ipc/los_futex.c mode change 100644 => 100755 kernel/base/ipc/los_mux.c mode change 100644 => 100755 kernel/base/ipc/los_queue.c create mode 100755 kernel/base/ipc/los_rwlock.c mode change 100644 => 100755 kernel/base/ipc/los_sem.c mode change 100644 => 100755 kernel/base/ipc/los_sem_debug.c mode change 100644 => 100755 kernel/base/ipc/los_signal.c delete mode 100644 kernel/base/mem/bestfit/los_memory.c delete mode 100644 kernel/base/mem/bestfit_little/los_heap.c mode change 100644 => 100755 kernel/base/mem/common/los_memstat.c delete mode 100644 kernel/base/mem/common/memrecord/los_binarytree.c delete mode 100644 kernel/base/mem/common/memrecord/los_memrecord.c create mode 100755 kernel/base/mem/tlsf/los_memory.c mode change 100644 => 100755 kernel/base/misc/kill_shellcmd.c mode change 100644 => 100755 kernel/base/misc/los_stackinfo.c mode change 100644 => 100755 kernel/base/misc/mempt_shellcmd.c create mode 100755 kernel/base/misc/panic_shellcmd.c mode change 100644 => 100755 kernel/base/misc/task_shellcmd.c mode change 100644 => 100755 kernel/base/misc/vm_shellcmd.c create mode 100644 kernel/base/mp/los_spinlock.c mode change 100644 => 100755 kernel/base/mp/los_stat.c mode change 100644 => 100755 kernel/base/om/los_err.c delete mode 100644 kernel/base/sched/sched_sq/los_priqueue.c mode change 100644 => 100755 kernel/base/sched/sched_sq/los_sched.c mode change 100644 => 100755 kernel/base/vm/los_vm_boot.c mode change 100644 => 100755 kernel/base/vm/los_vm_dump.c mode change 100644 => 100755 kernel/base/vm/los_vm_fault.c mode change 100644 => 100755 kernel/base/vm/los_vm_filemap.c mode change 100644 => 100755 kernel/base/vm/los_vm_map.c mode change 100644 => 100755 kernel/base/vm/los_vm_page.c mode change 100644 => 100755 kernel/base/vm/los_vm_phys.c mode change 100644 => 100755 kernel/base/vm/los_vm_scan.c mode change 100644 => 100755 kernel/base/vm/los_vm_syscall.c mode change 100644 => 100755 kernel/base/vm/oom.c mode change 100644 => 100755 kernel/base/vm/shm.c mode change 100644 => 100755 kernel/common/Kconfig mode change 100644 => 100755 kernel/common/Makefile mode change 100644 => 100755 kernel/common/console.c mode change 100644 => 100755 kernel/common/console.h mode change 100644 => 100755 kernel/common/los_config.c mode change 100644 => 100755 kernel/common/los_config.h mode change 100644 => 100755 kernel/common/los_hilog.c mode change 100644 => 100755 kernel/common/los_hilog.h mode change 100644 => 100755 kernel/common/los_printf.c mode change 100644 => 100755 kernel/common/los_rootfs.c mode change 100644 => 100755 kernel/common/los_rootfs.h mode change 100644 => 100755 kernel/common/los_seq_buf.c mode change 100644 => 100755 kernel/common/los_seq_buf.h create mode 100644 kernel/common/patchfs/Kconfig create mode 100644 kernel/common/patchfs/Makefile create mode 100644 kernel/common/patchfs/los_partition_utils.c rename kernel/{base/include/los_multipledlinkhead_pri.h => common/patchfs/los_partition_utils.h} (54%) create mode 100755 kernel/common/patchfs/los_patchfs.c create mode 100644 kernel/common/patchfs/los_patchfs.h mode change 100644 => 100755 kernel/common/sys_config.h mode change 100644 => 100755 kernel/common/virtual_serial.c mode change 100644 => 100755 kernel/extended/cppsupport/los_cppsupport.c mode change 100644 => 100755 kernel/extended/cpup/cpup_shellcmd.c mode change 100644 => 100755 kernel/extended/cpup/los_cpup.c mode change 100644 => 100755 kernel/extended/dynload/include/los_elf_auxvec_pri.h mode change 100644 => 100755 kernel/extended/dynload/include/los_exec_elf.h mode change 100644 => 100755 kernel/extended/dynload/include/los_ld_elf_pri.h mode change 100644 => 100755 kernel/extended/dynload/include/los_load_elf.h mode change 100644 => 100755 kernel/extended/dynload/src/los_exec_elf.c mode change 100644 => 100755 kernel/extended/dynload/src/los_load_elf.c mode change 100644 => 100755 kernel/extended/include/los_cpup_pri.h mode change 100644 => 100755 kernel/extended/include/los_trace_pri.h mode change 100644 => 100755 kernel/extended/liteipc/Makefile mode change 100644 => 100755 kernel/extended/liteipc/hm_liteipc.c mode change 100644 => 100755 kernel/extended/liteipc/hm_liteipc.h rename kernel/extended/{pipe => pipes} (100%) delete mode 100644 kernel/extended/tickless/los_tickless.c mode change 100644 => 100755 kernel/extended/trace/Makefile mode change 100644 => 100755 kernel/extended/trace/los_trace.c create mode 100755 kernel/extended/trace/los_trace_frame.c create mode 100755 kernel/extended/trace/los_trace_frame.h mode change 100644 => 100755 kernel/extended/vdso/include/los_vdso.h mode change 100644 => 100755 kernel/extended/vdso/include/los_vdso_datapage.h mode change 100644 => 100755 kernel/extended/vdso/include/los_vdso_pri.h mode change 100644 => 100755 kernel/extended/vdso/src/los_vdso.c mode change 100644 => 100755 kernel/extended/vdso/usr/Makefile mode change 100644 => 100755 kernel/extended/vdso/usr/los_vdso.ld mode change 100644 => 100755 kernel/extended/vdso/usr/los_vdso_sys.c mode change 100644 => 100755 kernel/include/los_base.h mode change 100644 => 100755 kernel/include/los_bitmap.h mode change 100644 => 100755 kernel/include/los_cppsupport.h mode change 100644 => 100755 kernel/include/los_err.h rename kernel/include/{los_tickless.h => los_hash.h} (58%) mode change 100644 => 100755 kernel/include/los_list.h mode change 100644 => 100755 kernel/include/los_lockdep.h mode change 100644 => 100755 kernel/include/los_memory.h mode change 100644 => 100755 kernel/include/los_mux.h mode change 100644 => 100755 kernel/include/los_process.h create mode 100755 kernel/include/los_rwlock.h mode change 100644 => 100755 kernel/include/los_spinlock.h mode change 100644 => 100755 kernel/include/los_swtmr.h mode change 100644 => 100755 kernel/include/los_tables.h mode change 100644 => 100755 kernel/include/los_task.h mode change 100644 => 100755 kernel/include/los_trace.h mode change 100644 => 100755 kernel/include/los_typedef.h mode change 100644 => 100755 kernel/user/Makefile mode change 100644 => 100755 kernel/user/include/los_user_init.h mode change 100644 => 100755 kernel/user/src/los_user_init.c create mode 100755 kernel_test.sources mode change 100644 => 100755 lib/Kconfig mode change 100644 => 100755 lib/libc/Makefile create mode 120000 lib/libc/musl create mode 120000 lib/libc/optimization/arm/memchr.S create mode 120000 lib/libc/optimization/arm/memcpy.S create mode 120000 lib/libc/optimization/arm/strcmp.S create mode 120000 lib/libc/optimization/arm/strcpy.c create mode 120000 lib/libc/optimization/arm/strlen.S create mode 120000 lib/libc/optimization/asmdefs.h mode change 100644 => 100755 lib/libscrew/src/los_rbtree.c mode change 100644 => 100755 lib/libsec/Makefile mode change 100644 => 100755 net/lwip-2.1/enhancement/include/lwip/api_shell.h mode change 100644 => 100755 net/lwip-2.1/porting/include/lwip/lwipopts.h mode change 100644 => 100755 net/lwip-2.1/porting/src/sockets.c mode change 100644 => 100755 net/telnet/include/telnet_dev.h mode change 100644 => 100755 net/telnet/include/telnet_loop.h mode change 100644 => 100755 net/telnet/src/telnet_dev.c mode change 100644 => 100755 platform/Kconfig mode change 100644 => 100755 platform/Makefile mode change 100644 => 100755 platform/bsp.mk mode change 100644 => 100755 platform/hw/arm/interrupt/gic/gic_v2.c mode change 100644 => 100755 platform/hw/arm/interrupt/gic/gic_v3.c mode change 100644 => 100755 platform/hw/arm/timer/arm_generic/arm_generic_timer.c mode change 100644 => 100755 platform/hw/include/gic_v3.h mode change 100644 => 100755 platform/uart/amba_pl011/amba_pl011.c delete mode 100644 platform/usb/usb3.0_hi3516dv300/usb_board.c delete mode 100644 platform/usb/usb3.0_hi3518ev300/usb_board.c delete mode 100644 readme.md mode change 100644 => 100755 security/Makefile mode change 100644 => 100755 security/cap/Makefile mode change 100644 => 100755 security/cap/capability.c mode change 100644 => 100755 security/cap/capability_api.h mode change 100644 => 100755 security/cap/capability_type.h mode change 100644 => 100755 security/vid/vid.c mode change 100644 => 100755 security/vid/vid_api.h mode change 100644 => 100755 security/vid/vid_type.h mode change 100644 => 100755 shell/BUILD.gn mode change 100644 => 100755 shell/Makefile mode change 100644 => 100755 shell/full/include/dmesg.h mode change 100644 => 100755 shell/full/include/shcmd.h mode change 100644 => 100755 shell/full/include/shmsg.h mode change 100644 => 100755 shell/full/include/show.h mode change 100644 => 100755 shell/full/src/base/shcmd.c mode change 100644 => 100755 shell/full/src/base/shcmdparse.c mode change 100644 => 100755 shell/full/src/base/shell_lk.c mode change 100644 => 100755 shell/full/src/base/shmsg.c mode change 100644 => 100755 shell/full/src/base/show.c mode change 100644 => 100755 shell/full/src/cmds/date_shell.c mode change 100644 => 100755 shell/full/src/cmds/dmesg.c mode change 100644 => 100755 shell/full/src/cmds/excinfo_shell.c mode change 100644 => 100755 shell/full/src/cmds/watch_shell.c mode change 100644 => 100755 syscall/Makefile mode change 100644 => 100755 syscall/fs_syscall.c mode change 100644 => 100755 syscall/ipc_syscall.c mode change 100644 => 100755 syscall/los_syscall.c mode change 100644 => 100755 syscall/los_syscall.h mode change 100644 => 100755 syscall/misc_syscall.c mode change 100644 => 100755 syscall/net_syscall.c mode change 100644 => 100755 syscall/process_syscall.c mode change 100644 => 100755 syscall/syscall_lookup.h rename kernel/base/mem/bestfit/los_multipledlinkhead.c => syscall/syscall_pub.c (56%) create mode 100644 syscall/syscall_pub.h mode change 100644 => 100755 syscall/time_syscall.c mode change 100644 => 100755 syscall/vm_syscall.c delete mode 100644 tools/build/config/debug/hi3516dv300.config delete mode 100644 tools/build/config/debug/hi3516dv300_clang.config delete mode 100644 tools/build/config/debug/hi3518ev300.config delete mode 100644 tools/build/config/debug/hi3518ev300_clang.config create mode 100755 tools/build/config/debug/hispark_aries.config create mode 100755 tools/build/config/debug/hispark_aries_clang.config create mode 100755 tools/build/config/debug/hispark_taurus.config create mode 100755 tools/build/config/debug/hispark_taurus_clang.config create mode 100755 tools/build/config/debug/hispark_taurus_clang_tee.config create mode 100755 tools/build/config/debug/ipcamera_hi3516dv300_liteos.config create mode 100755 tools/build/config/debug/ipcamera_hi3516dv300_liteos_clang.config create mode 100755 tools/build/config/debug/ipcamera_hi3516dv300_liteos_clang_tee.config create mode 100755 tools/build/config/debug/ipcamera_hi3518ev300_liteos.config create mode 100755 tools/build/config/debug/ipcamera_hi3518ev300_liteos_clang.config delete mode 100644 tools/build/config/debug/qemu_arm_virt_ca7_clang.config delete mode 100644 tools/build/config/hi3516dv300_clang_release.config delete mode 100644 tools/build/config/hi3516dv300_debug_shell.config delete mode 100644 tools/build/config/hi3516dv300_release.config delete mode 100644 tools/build/config/hi3518ev300_clang_release.config delete mode 100644 tools/build/config/hi3518ev300_debug_shell.config delete mode 100644 tools/build/config/hi3518ev300_release.config create mode 100755 tools/build/config/hispark_aries_clang_release.config create mode 100755 tools/build/config/hispark_aries_debug_shell.config create mode 100755 tools/build/config/hispark_aries_release.config create mode 100755 tools/build/config/hispark_taurus_clang_release.config create mode 100755 tools/build/config/hispark_taurus_clang_release_tee.config create mode 100755 tools/build/config/hispark_taurus_debug_shell.config create mode 100755 tools/build/config/hispark_taurus_debug_shell_tee.config create mode 100755 tools/build/config/hispark_taurus_release.config create mode 100755 tools/build/config/hispark_taurus_release_tee.config create mode 100755 tools/build/config/ipcamera_hi3516dv300_liteos_clang_release.config create mode 100755 tools/build/config/ipcamera_hi3516dv300_liteos_clang_release_tee.config create mode 100755 tools/build/config/ipcamera_hi3516dv300_liteos_debug_shell.config create mode 100755 tools/build/config/ipcamera_hi3516dv300_liteos_debug_shell_tee.config create mode 100755 tools/build/config/ipcamera_hi3516dv300_liteos_release.config create mode 100755 tools/build/config/ipcamera_hi3516dv300_liteos_release_tee.config create mode 100755 tools/build/config/ipcamera_hi3518ev300_liteos_clang_release.config create mode 100755 tools/build/config/ipcamera_hi3518ev300_liteos_debug_shell.config create mode 100755 tools/build/config/ipcamera_hi3518ev300_liteos_release.config create mode 100755 tools/build/config/qemu_arm_virt_debug_shell.config mode change 100644 => 100755 tools/build/liteos.ld mode change 100644 => 100755 tools/build/liteos_llvm.ld mode change 100644 => 100755 tools/build/mk/bepbuildtime.conf mode change 100644 => 100755 tools/build/mk/dynload.mk create mode 100755 tools/build/mk/get_compiler_path.sh mode change 100644 => 100755 tools/build/mk/liteos_tables_ldflags.mk mode change 100644 => 100755 tools/build/mk/los_config.mk mode change 100644 => 100755 tools/build/mk/module.mk create mode 100755 tools/fsimage/win-x86/cygz.dll create mode 100755 tools/fsimage/win-x86/doc_loadbios.exe create mode 100755 tools/fsimage/win-x86/docfdisk.exe create mode 100755 tools/fsimage/win-x86/flash_erase.exe create mode 100755 tools/fsimage/win-x86/flash_eraseall create mode 100755 tools/fsimage/win-x86/flash_lock.exe create mode 100755 tools/fsimage/win-x86/flash_otp_dump.exe create mode 100755 tools/fsimage/win-x86/flash_otp_info.exe create mode 100755 tools/fsimage/win-x86/flash_otp_lock.exe create mode 100755 tools/fsimage/win-x86/flash_otp_write.exe create mode 100755 tools/fsimage/win-x86/flash_unlock.exe create mode 100755 tools/fsimage/win-x86/flashcp.exe create mode 100755 tools/fsimage/win-x86/ftl_check.exe create mode 100755 tools/fsimage/win-x86/ftl_format.exe create mode 100755 tools/fsimage/win-x86/jffs2dump.exe create mode 100755 tools/fsimage/win-x86/jffs2reader.exe create mode 100755 tools/fsimage/win-x86/lsmtd.exe create mode 100755 tools/fsimage/win-x86/mkfs.jffs2.exe create mode 100755 tools/fsimage/win-x86/mtd_debug.exe create mode 100755 tools/fsimage/win-x86/mtdinfo.exe create mode 100755 tools/fsimage/win-x86/mtdpart.exe create mode 100755 tools/fsimage/win-x86/nanddump.exe create mode 100755 tools/fsimage/win-x86/nandtest.exe create mode 100755 tools/fsimage/win-x86/nandwrite.exe create mode 100755 tools/fsimage/win-x86/nftl_format.exe create mode 100755 tools/fsimage/win-x86/nftldump.exe create mode 100755 tools/fsimage/win-x86/recv_image.exe create mode 100755 tools/fsimage/win-x86/rfddump.exe create mode 100755 tools/fsimage/win-x86/rfdformat.exe create mode 100755 tools/fsimage/win-x86/serve_image.exe create mode 100755 tools/fsimage/win-x86/sumtool.exe create mode 100755 tools/fsimage/win-x86/ubiattach.exe create mode 100755 tools/fsimage/win-x86/ubiblock.exe create mode 100755 tools/fsimage/win-x86/ubicrc32.exe create mode 100755 tools/fsimage/win-x86/ubidetach.exe create mode 100755 tools/fsimage/win-x86/ubiformat.exe create mode 100755 tools/fsimage/win-x86/ubimkvol.exe create mode 100755 tools/fsimage/win-x86/ubinfo.exe create mode 100755 tools/fsimage/win-x86/ubinize.exe create mode 100755 tools/fsimage/win-x86/ubirename.exe create mode 100755 tools/fsimage/win-x86/ubirmvol.exe create mode 100755 tools/fsimage/win-x86/ubirsvol.exe create mode 100755 tools/fsimage/win-x86/ubiupdatevol.exe diff --git a/.gitee/ISSUE_TEMPLATE.zh-CN.md b/.gitee/ISSUE_TEMPLATE.zh-CN.md deleted file mode 100644 index f09d98dd..00000000 --- a/.gitee/ISSUE_TEMPLATE.zh-CN.md +++ /dev/null @@ -1,13 +0,0 @@ -### 该问题是怎么引起的? - - - -### 重现步骤 - - - -### 报错信息 - - - - diff --git a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md b/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md deleted file mode 100644 index 33948fdc..00000000 --- a/.gitee/PULL_REQUEST_TEMPLATE.zh-CN.md +++ /dev/null @@ -1,15 +0,0 @@ -### 相关的Issue - - -### 原因(目的、解决的问题等) - - -### 描述(做了什么,变更了什么) - - -### 测试用例(新增、改动、可能影响的功能) - - - - - diff --git a/.gitignore b/.gitignore index cf00b530..77dbb6a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /out -/fs/proc /test /include .config* @@ -22,4 +21,3 @@ platform/include/menuconfig.h platform/board.ld apps/init/init apps/shell/shell -lib/libc/musl diff --git a/BUILD.gn b/BUILD.gn old mode 100644 new mode 100755 index a7e30ac3..ad48b121 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,68 +1,82 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, 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. - -import("//build/lite/config/subsystem/lite_subsystem.gni") - -declare_args() { - enable_ohos_kernel_liteos_a_ext_build = true - LOSCFG_TEST_APPS = false -} - -lite_subsystem("kernel") { - subsystem_components = [] - - if (enable_ohos_kernel_liteos_a_ext_build == false) { - subsystem_components += [ - "//kernel/liteos_a/kernel", - "//kernel/liteos_a/net", - "//kernel/liteos_a/lib", - "//kernel/liteos_a/compat", - "//kernel/liteos_a/fs", - "//kernel/liteos_a/arch:platform_cpu", - ] - if (LOSCFG_SHELL) { - subsystem_components += [ "//kernel/liteos_a/shell" ] - } - } else { - deps = [":make"] - } -} - -action("make") { - script = "//build/lite/build_ext_components.py" - outputs = [ "$target_gen_dir/liteos_a_build_log.txt" ] - exec_path = rebase_path(rebase_path(".", root_build_dir)) - outdir = rebase_path(get_path_info(".", "out_dir")) - command = "make clean OUTDIR=$outdir && make rootfs VERSION=\"${ohos_version}\" -j 16 OUTDIR=$outdir" - args = [ - "--path=$exec_path", - "--prebuilts=sh build.sh ${board_name} ${ohos_build_compiler} ${ohos_build_type}", - "--command=${command}" - ] -} +# 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. + +import("//build/lite/config/component/lite_component.gni") +import("//build/lite/config/subsystem/lite_subsystem.gni") + +generate_notice_file("kernel_notice_file") { + module_name = "kernel" + module_source_dir_list = [ + "//third_party/FreeBSD", + "//third_party/musl", + "//third_party/zlib", + "//third_party/FatFs", + "//third_party/Linux_Kernel", + "//third_party/lwip", + "//third_party/NuttX", + "//third_party/mtd-utils", + ] +} + +declare_args() { + enable_ohos_kernel_liteos_a_ext_build = true + LOSCFG_TEST_APPS = false + tee_enable = "" +} + +lite_subsystem("kernel") { + subsystem_components = [] + + if (enable_ohos_kernel_liteos_a_ext_build == false) { + subsystem_components += [ + "//kernel/liteos_a/kernel", + "//kernel/liteos_a/net", + "//kernel/liteos_a/lib", + "//kernel/liteos_a/compat", + "//kernel/liteos_a/fs", + "//kernel/liteos_a/arch:platform_cpu", + ] + if (LOSCFG_SHELL) { + subsystem_components += [ "//kernel/liteos_a/shell" ] + } + } else { + deps = [ ":make" ] + } +} + +build_ext_component("make") { + exec_path = rebase_path(".", root_build_dir) + tee_enable = "false" + if (board_name == "hi3516dv300" && enable_tee_ree) { + tee_enable = "tee" + } + prebuilts = "sh build.sh ${board_name} ${ohos_build_compiler} ${root_build_dir} ${ohos_build_type} ${tee_enable} \"${device_company}\" \"${product_path}\"" + outdir = rebase_path(get_path_info(".", "out_dir")) + command = "make clean OUTDIR=$outdir && make rootfs VERSION=\"${ohos_version}\" -j 16 OUTDIR=$outdir" +} diff --git a/Kconfig b/Kconfig old mode 100644 new mode 100755 index a47e793f..77380a27 --- a/Kconfig +++ b/Kconfig @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -61,6 +61,15 @@ source "../../kernel/liteos_a/arch/Kconfig" ######################### config options of rootfs ##################### source "../../kernel/liteos_a/kernel/common/Kconfig" +######################### config options of patchfs ##################### +source "../../kernel/liteos_a/kernel/common/patchfs/Kconfig" + +config QUICK_START + bool "Enable QUICK_START" + default n + depends on DRIVERS && FS_VFS + help + Answer Y to enable LiteOS support quick start. endmenu ######################### config options of kernel ##################### @@ -84,6 +93,12 @@ source "../../kernel/liteos_a/fs/ramfs/Kconfig" source "../../kernel/liteos_a/fs/nfs/Kconfig" source "../../kernel/liteos_a/fs/proc/Kconfig" source "../../kernel/liteos_a/fs/jffs2/Kconfig" +source "../../kernel/liteos_a/fs/zpfs/Kconfig" +config ENABLE_READ_BUFFER + bool "Enable read buffer Option" + default n + help + Answer Y to add enable read buffer Option. endmenu ######################## config options of net ############################ @@ -197,6 +212,13 @@ config EXC_INTERACTION Answer Y to enable exception interaction for LiteOS, when the system enter exception, user can also interact with system by shell command like readreg, writereg,task,hwi. +config SCHED_DEBUG + bool "Enable sched debug Feature" + default n + depends on DEBUG_VERSION + help + If you wish to build LiteOS with support for sched debug. + config USER_INIT_DEBUG bool "Enable user init Debug" default n @@ -221,30 +243,6 @@ config MEM_DEBUG help Answer Y to enable LiteOS support mem debug. -config MEM_MUL_MODULE - bool "Enable Memory module statistics" - default n - depends on MEM_DEBUG - help - Answer Y to enable LiteOS support memory statistics depend on different module -config MEM_MUL_POOL - bool "Enable Memory multi-pool control" - default y - depends on DEBUG_VERSION && MEM_DEBUG - help - Answer Y to enable LiteOS support memory multi-pool control -config MEM_HEAD_BACKUP - bool "Enable Node Head Backup" - default 0 - depends on DEBUG_VERSION && MEM_DEBUG - help - Answer Y to enable node head backup -config MEM_RECORDINFO - bool "Enable Mem Record" - default n - depends on DEBUG_VERSION && MEM_DEBUG - help - Answer Y to enable mem record config MEM_LEAKCHECK bool "Enable Function call stack of Mem operation recorded" default n @@ -255,14 +253,10 @@ config BASE_MEM_NODE_INTEGRITY_CHECK bool "Enable integrity check or not " default n depends on DEBUG_VERSION && MEM_DEBUG -config BASE_MEM_NODE_SIZE_CHECK - bool "Enable size check or not" +config MEM_WATERLINE + bool "Enable memory pool waterline or not" default n depends on DEBUG_VERSION && MEM_DEBUG -config SLAB_INFO_STATISTIC - bool "Enable SLAB Statistic" - default n - depends on DEBUG_VERSION && KERNEL_MEM_SLAB && MEM_DEBUG config VM_OVERLAP_CHECK bool "Enable VM overlap check or not" @@ -278,19 +272,6 @@ config NULL_ADDRESS_PROTECT help Answer Y to set mem address 0~1M prohibit to access, read or write will trigger exception. -choice - prompt "Enable Uart" - default DRIVERS_HDF_PLATFORM_UART - help - Enable simple uart (without vfs) only for litekernel. - Enable general uart (with vfs) for full code. -source "../../vendor/hisi/hi35xx/platform/uart/Kconfig" -config PLATFORM_UART_WITHOUT_VFS - bool "Simple Uart" -config PLATFORM_NO_UART - bool "NO Uart" - -endchoice endmenu ######################## config options os drivers ######################## @@ -301,42 +282,13 @@ config DRIVERS help Answer Y to enable LiteOS support driver. -source "../../vendor/hisi/hi35xx/platform/hiedmac/Kconfig" source "../../kernel/liteos_a/bsd/dev/usb/Kconfig" -source "../../drivers/hdf/lite/Kconfig" - -config DRIVERS_NETDEV - bool "Enable Net Device" - default y - depends on DRIVERS && NET_LWIP_SACK - help - Answer Y to enable LiteOS support net device. - -choice - depends on DRIVERS_NETDEV - prompt "MAC" - default n - help - Enable higmac for hi3516a hi3519 hi3559a_cortex-a53_aarch64. - Enable hieth-sf for hi3516cv300 hi3516ev200 and hi3518ev200. -source "../../vendor/hisi/hi35xx/platform/hieth-sf/Kconfig" -endchoice - -source "../../drivers/liteos/mem/Kconfig" -source "../../vendor/hisi/hi35xx/platform/mmc/Kconfig" - - -config DRIVERS_MTD - bool "Enable MTD" - default y - depends on DRIVERS && FS_VFS - help - Answer Y to enable LiteOS support jffs2 multipartion. +source "../../drivers/adapter/khdf/liteos/Kconfig" -source "../../vendor/hisi/hi35xx/platform/mtd/spi_nor/Kconfig" -source "../../drivers/liteos/random/Kconfig" +source "drivers/char/mem/Kconfig" +source "drivers/char/random/Kconfig" source "../../drivers/liteos/tzdriver/Kconfig" -source "../../drivers/liteos/video/Kconfig" +source "drivers/char/video/Kconfig" source "../../drivers/liteos/hievent/Kconfig" endmenu diff --git a/LICENSE b/LICENSE index 61fa69e3..208b4cd3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,5 +1,5 @@ -Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +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: @@ -25,4 +25,4 @@ 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. \ No newline at end of file +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index b7f3d045..27dda5e6 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -38,8 +38,6 @@ LITEOSTHIRDPARTY := $(LITEOSTOPDIR)/../../third_party export LITEOSTOPDIR export LITEOSTHIRDPARTY --include $(LITEOSTOPDIR)/tools/build/config.mk - RM = -rm -rf MAKE = make __LIBS = libs @@ -53,14 +51,33 @@ LITEOS_MENUCONFIG_H = $(LITEOSTOPDIR)/include/generated/autoconf.h LITEOS_PLATFORM_BASE = $(LITEOSTOPDIR)/platform LITEOS_PLATFORM_MENUCONFIG_H = $(LITEOS_PLATFORM_BASE)/include/menuconfig.h -ifeq ($(LOSCFG_PLATFORM_HI3518EV300), y) +export CONFIG_=LOSCFG_ +MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig +KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig + +ifeq ($(OS), Linux) +MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/mconf +MENUCONFIG_CONF := $(MENUCONFIG_PATH)/conf +else +MENUCONFIG_MCONF := $(MENUCONFIG_PATH)/kconfig-mconf.exe +MENUCONFIG_CONF := $(MENUCONFIG_PATH)/kconfig-conf.exe +endif + +$(shell env CONFIG_=$(CONFIG_) $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH)) + +-include $(LITEOSTOPDIR)/tools/build/config.mk + +ifeq ($(LOSCFG_STORAGE_SPINOR), y) FSTYPE = jffs2 endif -ifeq ($(LOSCFG_PLATFORM_HI3516DV300), y) +ifeq ($(LOSCFG_STORAGE_EMMC), y) FSTYPE = vfat endif +ifeq ($(LOSCFG_STORAGE_SPINAND), y) +FSTYPE = yaffs2 +endif ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y) -FSTYPE = vfat +FSTYPE = jffs2 endif ROOTFS_DIR = $(OUT)/rootfs ROOTFS_ZIP = $(OUT)/rootfs.zip @@ -100,21 +117,14 @@ endif ##### make dynload ##### -include $(LITEOS_MK_PATH)/dynload.mk -ifeq ($(findstring y, $(LOSCFG_PLATFORM_HI3518EV300)$(LOSCFG_PLATFORM_HI3516DV300)), y) -VENDOR_BOARD_INCLUDE := $(LITEOSTOPDIR)/../../vendor/hisi/hi35xx/$(LITEOS_PLATFORM)/config/board -else ifeq ($(LOSCFG_PLATFORM_QEMU_ARM_VIRT_CA7), y) -VENDOR_BOARD_INCLUDE := $(LITEOSTOPDIR)/../../device/qemu/arm/$(LITEOS_PLATFORM)/config/board -else -$(error "No VENDOR_BOARD_INCLUDE defined") -endif #-----need move when make version-----# ##### make lib ##### $(__LIBS): $(OUT) $(CXX_INCLUDE) $(OUT): $(LITEOS_MENUCONFIG_H) $(HIDE)mkdir -p $(OUT)/lib - $(HIDE)$(CC) -I$(LITEOS_PLATFORM_BASE)/include -I$(VENDOR_BOARD_INCLUDE) \ - -E $(LITEOS_PLATFORM_BASE)/board.ld.S \ + $(HIDE)$(CC) -I$(LITEOSTOPDIR)/kernel/base/include -I$(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH) \ + -I$(LITEOS_PLATFORM_BASE)/include -E $(LITEOS_PLATFORM_BASE)/board.ld.S \ -o $(LITEOS_PLATFORM_BASE)/board.ld -P $(BUILD): @@ -127,14 +137,10 @@ $(LITEOS_LIBS_TARGET): $(__LIBS) $(HIDE)echo "=============== make lib done ===============" ##### make menuconfig ##### -export CONFIG_=LOSCFG_ -MENUCONFIG_PATH = $(LITEOSTOPDIR)/tools/menuconfig -KCONFIG_FILE_PATH = $(LITEOSTOPDIR)/Kconfig - -menuconfig:$(MENUCONFIG_PATH)/mconf +menuconfig:$(MENUCONFIG_MCONF) $< $(KCONFIG_FILE_PATH) -genconfig:$(MENUCONFIG_PATH)/conf +genconfig:$(MENUCONFIG_CONF) $(HIDE)mkdir -p include/config include/generated $< --olddefconfig $(KCONFIG_FILE_PATH) $< --silentoldconfig $(KCONFIG_FILE_PATH) @@ -185,6 +191,7 @@ $(ROOTFS): $(ROOTFSDIR) $(HIDE)$(LITEOSTOPDIR)/tools/scripts/make_rootfs/rootfsimg.sh $(ROOTFS_DIR) $(FSTYPE) $(HIDE)cd $(ROOTFS_DIR)/.. && zip -r $(ROOTFS_ZIP) $(ROOTFS) ifneq ($(OUT), $(LITEOS_TARGET_DIR)) + rm -rf $(LITEOS_TARGET_DIR)rootfs $(HIDE)mv $(ROOTFS_DIR) $(LITEOS_TARGET_DIR)rootfs endif @@ -193,7 +200,7 @@ clean: do $(MAKE) -C $$dir clean|| exit 1; \ done $(HIDE)$(MAKE) -C apps clean - $(HIDE)$(RM) $(__OBJS) $(LITEOS_TARGET) $(OUT) $(BUILD) $(LITEOS_MENUCONFIG_H) *.bak *~ + $(HIDE)$(RM) $(__OBJS) $(LITEOS_TARGET) $(BUILD) $(LITEOS_MENUCONFIG_H) *.bak *~ $(HIDE)$(RM) $(LITEOS_PLATFORM_MENUCONFIG_H) $(HIDE)$(RM) include $(HIDE)$(MAKE) cleanrootfs @@ -210,4 +217,14 @@ cleanrootfs: $(HIDE)$(RM) $(OUT)/rootfs.zip $(HIDE)$(RM) $(OUT)/rootfs.img -.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help +update_all_config: + $(HIDE)shopt -s globstar && for f in tools/build/config/**/*.config ; \ + do \ + echo updating $$f; \ + test -f $$f && cp $$f .config && $(MENUCONFIG_CONF) -s --olddefconfig $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig $$f $(KCONFIG_FILE_PATH); \ + done + +%.config: + $(HIDE)test -f tools/build/config/$@ && cp tools/build/config/$@ .config && $(MENUCONFIG_MCONF) $(KCONFIG_FILE_PATH) && $(MENUCONFIG_CONF) --savedefconfig tools/build/config/$@ $(KCONFIG_FILE_PATH) + +.PHONY: all lib clean cleanall $(LITEOS_TARGET) debug release help update_all_config diff --git a/README.md b/README.md new file mode 100644 index 00000000..7997be41 --- /dev/null +++ b/README.md @@ -0,0 +1,96 @@ +# LiteOS Cortex-A + +- [Introduction](#section11660541593) +- [Directory Structure](#section161941989596) +- [Constraints](#section119744591305) +- [Usage](#section741617511812) + - [Preparations](#section1579912573329) + - [Source Code Acquisition](#section11443189655) + - [Compilation and Building](#section2081013992812) + +- [Repositories Involved](#section1371113476307) + +## Introduction + +The OpenHarmony LiteOS Cortex-A is a new-generation kernel developed based on the Huawei LiteOS kernel. Huawei LiteOS is a lightweight operating system \(OS\) built for the Internet of Things \(IoT\) field. With the rapid development of the IoT industry, OpenHarmony LiteOS Cortex-A brings small-sized, low-power, and high-performance experience and builds a unified and open ecosystem for developers. In addition, it provides rich kernel mechanisms, more comprehensive Portable Operating System Interface \(POSIX\), and a unified driver framework, Hardware Driver Foundation \(HDF\), which offers unified access for device developers and friendly development experience for application developers. [Figure1](#fig27311582210) shows the architecture of the OpenHarmony LiteOS Cortex-A kernel. + +**Figure 1** Architecture of the OpenHarmony LiteOS Cortex-A kernel +![](figures/architecture-of-the-openharmony-liteos-cortex-a-kernel.png "architecture-of-the-openharmony-liteos-cortex-a-kernel") + +## Directory Structure + +``` +/kernel/liteos_a +├── apps # User-space init and shell application programs +├── arch # System architecture, such as ARM +│ └── arm # Code for ARM architecture +├── bsd # Code of the driver and adaptation layer module related to the FreeBSD, such as the USB module +├── compat # Kernel API compatibility +│ └── posix # POSIX APIs +├── drivers # Kernel driver +│ └── char # Character device +│ ├── mem # Driver for accessing physical input/output (I/O) devices +│ ├── quickstart # APIs for quick start of the system +│ ├── random # Driver for random number generators +│ └── video # Framework of the framebuffer driver +├── fs # File system module, which mainly derives from the NuttX open-source project +│ ├── fat # FAT file system +│ ├── jffs2 # JFFS2 file system +│ ├── include # Header files exposed externally +│ ├── nfs # NFS file system +│ ├── proc # proc file system +│ ├── ramfs # RAMFS file system +│ └── vfs # VFS layer +├── kernel # Kernel modules including the process, memory, and IPC modules +│ ├── base # Basic kernel modules including the scheduling and memory modules +│ ├── common # Common components used by the kernel +│ ├── extended # Extended kernel modules including the dynamic loading, vDSO, and LiteIPC modules +│ ├── include # Header files exposed externally +│ └── user # Init process loading +├── lib # Kernel library +├── net # Network module, which mainly derives from the lwIP open-source project +├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300 +│ ├── hw # Logic code related to clocks and interupts +│ ├── include # Header files exposed externally +│ └── uart # Logic code related to the serial port +├── platform # Code for supporting different systems on a chip (SOCs), such as Hi3516D V300 +├── security # Code related to security features, including process permission management and virtual ID mapping management +├── syscall # System calling +└── tools # Building tools as well as related configuration and code +``` + +## Constraints + +- Programming languages: C and C++ +- Applicable development boards: Hi3518E V300 and Hi3516D V300 +- Hi3518E V300 uses the JFFS2 file system by default, and Hi3516D V300 uses the FAT file system by default. + +## Usage + +OpenHarmony LiteOS Cortex-A supports the [Hi3518E V300](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/introduction-to-the-hi3518-development-board.md) and [Hi3516D V300](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/introduction-to-the-hi3516-development-board.md). You can develop and run your applications based on both development boards. + +### Preparations + +You need to set up the compilation environment on Linux. + +- For Hi3518E V300, see [Setting Up the Hi3518 Development Environment](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/setting-up-the-hi3518-development-environment.md). +- For Hi3516D V300, see [Setting Up the Hi3516 Development Environment](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/setting-up-the-hi3516-development-environment.md). + +### Source Code Acquisition + +Download and decompress a set of source code on a Linux server to acquire the [source code](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz). For more acquisition methods, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/master/docs-en/get-code/source-code-acquisition.md). + +### Compilation and Building + +For details about how to develop the first application, see: + +- [Developing the First Example Program Running on Hi3518](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/developing-the-first-example-program-running-on-hi3518.md) + +- [Developing the First Example Program Running on Hi3516](https://gitee.com/openharmony/docs/blob/master/docs-en/quick-start/developing-the-first-example-program-running-on-hi3516.md) + +## Repositories Involved + +[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos) + +**[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a)** + diff --git a/README_zh.md b/README_zh.md new file mode 100644 index 00000000..61bcf073 --- /dev/null +++ b/README_zh.md @@ -0,0 +1,96 @@ +# LiteOS-A内核 + +- [简介](#section11660541593) +- [目录](#section161941989596) +- [约束](#section119744591305) +- [使用说明](#section741617511812) + - [准备](#section1579912573329) + - [获取源码](#section11443189655) + - [编译构建](#section2081013992812) + +- [相关仓](#section1371113476307) + +## 简介 + +OpenHarmony LiteOS-A内核是基于Huawei LiteOS内核演进发展的新一代内核,Huawei LiteOS是面向IoT领域构建的轻量级物联网操作系统。在IoT产业高速发展的潮流中,OpenHarmony LiteOS-A内核能够带给用户小体积、低功耗、高性能的体验以及统一开放的生态系统能力,新增了丰富的内核机制、更加全面的POSIX标准接口以及统一驱动框架**HDF**(OpenHarmony Driver Foundation)等,为设备厂商提供了更统一的接入方式,为OpenHarmony的应用开发者提供了更友好的开发体验。图1为OpenHarmony LiteOS-A内核架构图: + +**图 1** OpenHarmony LiteOS-A内核架构图 +![](figures/OpenHarmony-LiteOS-A内核架构图.png "OpenHarmony-LiteOS-A内核架构图") + +## 目录 + +``` +/kernel/liteos_a +├── apps # 用户态的init和shell应用程序 +├── arch # 体系架构的目录,如arm等 +│ └── arm # arm架构代码 +├── bsd # freebsd相关的驱动和适配层模块代码引入,例如USB等 +├── compat # 内核接口兼容性目录 +│ └── posix # posix相关接口 +├── drivers # 内核驱动 +│ └── char # 字符设备 +│ ├── mem # 访问物理IO设备驱动 +│ ├── quickstart # 系统快速启动接口目录 +│ ├── random # 随机数设备驱动 +│ └── video # framebuffer驱动框架 +├── fs # 文件系统模块,主要来源于NuttX开源项目 +│ ├── fat # fat文件系统 +│ ├── jffs2 # jffs2文件系统 +│ ├── include # 对外暴露头文件存放目录 +│ ├── nfs # nfs文件系统 +│ ├── proc # proc文件系统 +│ ├── ramfs # ramfs文件系统 +│ └── vfs # vfs层 +├── kernel # 进程、内存、IPC等模块 +│ ├── base # 基础内核,包括调度、内存等模块 +│ ├── common # 内核通用组件 +│ ├── extended # 扩展内核,包括动态加载、vdso、liteipc等模块 +│ ├── include # 对外暴露头文件存放目录 +│ └── user # 加载init进程 +├── lib # 内核的lib库 +├── net # 网络模块,主要来源于lwip开源项目 +├── platform # 支持不同的芯片平台代码,如Hi3516DV300等 +│ ├── hw # 时钟与中断相关逻辑代码 +│ ├── include # 对外暴露头文件存放目录 +│ └── uart # 串口相关逻辑代码 +├── platform # 支持不同的芯片平台代码,如Hi3516DV300等 +├── security # 安全特性相关的代码,包括进程权限管理和虚拟id映射管理 +├── syscall # 系统调用 +└── tools # 构建工具及相关配置和代码 +``` + +## 约束 + +- 开发语言:C/C++; +- 适用于Hi3518EV300、Hi3516DV300单板; +- Hi3518EV300默认使用jffs2文件系统,Hi3516DV300默认使用FAT文件系统。 + +## 使用说明 + +OpenHarmony LiteOS-A内核支持Hi3518EV300([介绍](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3518%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md))、Hi3516DV300([介绍](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3516%E5%BC%80%E5%8F%91%E6%9D%BF%E4%BB%8B%E7%BB%8D.md))单板,开发者可基于两种单板开发运行自己的应用程序。 + +### 准备 + +开发者需要在Linux上搭建编译环境: + +- Hi3518EV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3518%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md); +- Hi3516DV300单板:参考[环境搭建](https://gitee.com/openharmony/docs/blob/master/quick-start/Hi3516%E6%90%AD%E5%BB%BA%E7%8E%AF%E5%A2%83.md)。 + +### 获取源码 + +在Linux服务器上下载并解压一套源代码,获取源码([下载链接](https://repo.huaweicloud.com/harmonyos/os/1.0/code-1.0.tar.gz))。更多源码获取方式,参考[源码获取](https://gitee.com/openharmony/docs/blob/master/get-code/%E6%BA%90%E7%A0%81%E8%8E%B7%E5%8F%96.md)。 + +### 编译构建 + +开发者开发第一个应用程序可参考: + +- [helloworld for Hi3518EV300](https://gitee.com/openharmony/docs/blob/master/quick-start/%E5%BC%80%E5%8F%91Hi3518%E7%AC%AC%E4%B8%80%E4%B8%AA%E7%A4%BA%E4%BE%8B%E7%A8%8B%E5%BA%8F.md); + +- [helloworld for Hi3516DV300](https://gitee.com/openharmony/docs/blob/master/quick-start/%E5%BC%80%E5%8F%91Hi3516%E7%AC%AC%E4%B8%80%E4%B8%AA%E5%BA%94%E7%94%A8%E7%A8%8B%E5%BA%8F%E7%A4%BA%E4%BE%8B.md)。 + +## 相关仓 + +[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos) + +**[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a)** + diff --git a/apps/Makefile b/apps/Makefile old mode 100644 new mode 100755 index e5857242..631b955c --- a/apps/Makefile +++ b/apps/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -38,7 +38,7 @@ all: $(APPS) # Make $(APPS): ifneq ($(APP_SUBDIRS), ) - $(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir ; done + $(HIDE) for dir in $(APP_SUBDIRS); do $(MAKE) -C $$dir || exit 1; done endif clean: diff --git a/apps/config.mk b/apps/config.mk old mode 100644 new mode 100755 index 8e4c95f9..5f6efe06 --- a/apps/config.mk +++ b/apps/config.mk @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/apps/init/Makefile b/apps/init/Makefile old mode 100644 new mode 100755 index 82017e7e..96eba811 --- a/apps/init/Makefile +++ b/apps/init/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -43,6 +43,12 @@ ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses -Wnonnull $(LLVM_SYSROOT) LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT) endif + +ifeq ($(LOSCFG_QUICK_START), y) +LDCFLAGS += --static +CFLAGS += -DLOSCFG_QUICK_START +endif + INITNAME := init all: $(INITNAME) diff --git a/apps/init/src/init.c b/apps/init/src/init.c old mode 100644 new mode 100755 index 882219df..7cab38a8 --- a/apps/init/src/init.c +++ b/apps/init/src/init.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -35,11 +35,41 @@ #include #include +#ifdef LOSCFG_QUICK_START +#include +#include +#include +#include +#include + +#define QUICKSTART_IOC_MAGIC 'T' +#define QUICKSTART_INITSTEP2 _IO(QUICKSTART_IOC_MAGIC, 0) +#define WAIT_FOR_SAMPLE 300000 // wait 300ms for sample +#endif int main(int argc, char * const *argv) { int ret; const char *shellPath = "/bin/shell"; +#ifdef LOSCFG_QUICK_START + const char *samplePath = "/dev/shm/sample_quickstart"; + + ret = fork(); + if (ret < 0) { + printf("Failed to fork for sample_quickstart\n"); + } else if (ret == 0) { + (void)execve(samplePath, NULL, NULL); + exit(0); + } + + usleep(WAIT_FOR_SAMPLE); + + int fd = open("/dev/quickstart", O_RDONLY); + if (fd != -1) { + ioctl(fd, QUICKSTART_INITSTEP2); + close(fd); + } +#endif ret = fork(); if (ret < 0) { printf("Failed to fork for shell\n"); diff --git a/apps/module.mk b/apps/module.mk old mode 100644 new mode 100755 index 1cd7ae11..520f3393 --- a/apps/module.mk +++ b/apps/module.mk @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -38,3 +38,7 @@ endif ifeq ($(LOSCFG_USER_INIT_DEBUG), y) APP_SUBDIRS += init endif + +ifeq ($(LOSCFG_NET_LWIP_SACK_TFTP), y) +APP_SUBDIRS += tftp +endif diff --git a/apps/shell/Makefile b/apps/shell/Makefile old mode 100644 new mode 100755 index 857cb136..23024cac --- a/apps/shell/Makefile +++ b/apps/shell/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/apps/shell/builtin/cd.c b/apps/shell/builtin/cd.c old mode 100644 new mode 100755 index 56d6897e..6fdd41d3 --- a/apps/shell/builtin/cd.c +++ b/apps/shell/builtin/cd.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/shcmd.h b/apps/shell/include/shcmd.h old mode 100644 new mode 100755 index d664a4bd..f5485a2a --- a/apps/shell/include/shcmd.h +++ b/apps/shell/include/shcmd.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/shcmdparse.h b/apps/shell/include/shcmdparse.h index e3206220..a6ec6197 100644 --- a/apps/shell/include/shcmdparse.h +++ b/apps/shell/include/shcmdparse.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/shell.h b/apps/shell/include/shell.h old mode 100644 new mode 100755 index 48fa3093..d23b9e1b --- a/apps/shell/include/shell.h +++ b/apps/shell/include/shell.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/shell_list.h b/apps/shell/include/shell_list.h index 91b5bbd3..020c1711 100644 --- a/apps/shell/include/shell_list.h +++ b/apps/shell/include/shell_list.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/shell_pri.h b/apps/shell/include/shell_pri.h index b8e75c1c..8e5ab6f6 100644 --- a/apps/shell/include/shell_pri.h +++ b/apps/shell/include/shell_pri.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/sherr.h b/apps/shell/include/sherr.h index 6122fd2c..a560a740 100644 --- a/apps/shell/include/sherr.h +++ b/apps/shell/include/sherr.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/shmsg.h b/apps/shell/include/shmsg.h old mode 100644 new mode 100755 index fb683559..ee90ec6c --- a/apps/shell/include/shmsg.h +++ b/apps/shell/include/shmsg.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/include/show.h b/apps/shell/include/show.h old mode 100644 new mode 100755 index 95c56b12..2bb94865 --- a/apps/shell/include/show.h +++ b/apps/shell/include/show.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/src/main.c b/apps/shell/src/main.c old mode 100644 new mode 100755 index 54c0bf9f..ef57ca00 --- a/apps/shell/src/main.c +++ b/apps/shell/src/main.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -98,6 +98,8 @@ int main() int ret = SH_NOK; ShellCB *shellCB = NULL; + setbuf(stdout, NULL); + shellCB = (ShellCB *)malloc(sizeof(ShellCB)); if (shellCB == NULL) { goto ERR_OUT1; diff --git a/apps/shell/src/shcmd.c b/apps/shell/src/shcmd.c old mode 100644 new mode 100755 index 06845ac8..a4930a90 --- a/apps/shell/src/shcmd.c +++ b/apps/shell/src/shcmd.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -406,7 +406,7 @@ unsigned int OsCmdKeyShift(const char *cmdKey, char *cmdOut, unsigned int size) } output = (char *)malloc(len + 1); if (output == NULL) { - printf("malloc failure in %s[%d]", __FUNCTION__, __LINE__); + printf("malloc failure in %s[%d]\n", __FUNCTION__, __LINE__); return (unsigned int)SH_ERROR; } diff --git a/apps/shell/src/shcmdparse.c b/apps/shell/src/shcmdparse.c old mode 100644 new mode 100755 index 1a9bc75e..97891747 --- a/apps/shell/src/shcmdparse.c +++ b/apps/shell/src/shcmdparse.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/apps/shell/src/shmsg.c b/apps/shell/src/shmsg.c old mode 100644 new mode 100755 index 34b7537b..d8c17c09 --- a/apps/shell/src/shmsg.c +++ b/apps/shell/src/shmsg.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -61,9 +61,19 @@ char *GetCmdline(ShellCB *shellCB) } cmdNode = SH_LIST_ENTRY(cmdkey->list.pstNext, CmdKeyLink, list); + if (cmdNode == NULL) { + (void)pthread_mutex_unlock(&shellCB->keyMutex); + return NULL; + } + SH_ListDelete(&(cmdNode->list)); (void)pthread_mutex_unlock(&shellCB->keyMutex); + if (strlen(cmdNode->cmdString) == 0) { + free(cmdNode); + return NULL; + } + return cmdNode->cmdString; } @@ -73,7 +83,8 @@ static void ShellSaveHistoryCmd(char *string, ShellCB *shellCB) CmdKeyLink *cmdkey = SH_LIST_ENTRY(string, CmdKeyLink, cmdString); CmdKeyLink *cmdNxt = NULL; - if ((string == NULL) || (*string == '\n') || (strlen(string) == 0)) { + if (*string == '\n') { + free(cmdkey); return; } @@ -87,7 +98,7 @@ static void ShellSaveHistoryCmd(char *string, ShellCB *shellCB) } } - if (cmdHistory->count == CMD_HISTORY_LEN) { + if (cmdHistory->count >= CMD_HISTORY_LEN) { cmdNxt = SH_LIST_ENTRY(cmdHistory->list.pstNext, CmdKeyLink, list); SH_ListDelete(&(cmdNxt->list)); SH_ListTailInsert(&(cmdHistory->list), &(cmdkey->list)); @@ -595,10 +606,6 @@ void *ShellEntry(void *argv) } while (1) { - /* is console ready for shell ? */ - if (ret != SH_OK) - break; - n = read(0, &ch, 1); if (n == 1) { ShellCmdLineParse(ch, (OutputFunc)printf, shellCB); diff --git a/apps/tftp/Makefile b/apps/tftp/Makefile new file mode 100644 index 00000000..37cf594c --- /dev/null +++ b/apps/tftp/Makefile @@ -0,0 +1,77 @@ +# 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. + +ROOT_DIR := $(dir $(shell pwd))/tftp/ + +ifeq ($(APPSTOPDIR), ) +APPSTOPDIR := $(shell pwd)/../ +LITEOSTOPDIR = $(APPSTOPDIR)/../ +endif +include $(ROOT_DIR)/../config.mk +APPS_OUT := $(OUT)/bin + +SECUREC_DIR := $(LITEOSTHIRDPARTY)/bounds_checking_function + +LOCAL_SRCS = $(wildcard src/*.c) +LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncpy_s.c) +LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memcpy_s.c) +LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/memset_s.c) +LOCAL_SRCS += $(wildcard $(SECUREC_DIR)/src/strncat_s.c) +LOCAL_OBJ := $(LOCAL_SRCS:.c=.o) + +LOCAL_INCLUDE := \ + -I $(ROOT_DIR)/include/ \ + -I $(SECUREC_DIR)/include/\ + +LOCAL_FLAGS += $(CFLAGS) + +LDPATH := -L$(ROOT_DIR)/ +ifeq ($(LOSCFG_COMPILER_CLANG_LLVM), y) +LOCAL_FLAGS += -Wno-shift-op-parentheses -Wno-bitwise-op-parentheses $(LLVM_SYSROOT) +LDCFLAGS += $(LLVM_EXTRA_LD_OPTS) $(LLVM_SYSROOT) +endif + +TARGETNAME := tftp + +all: $(TARGETNAME) + +$(LOCAL_OBJ): %.o : %.c + $(HIDE) $(CC) $(LOCAL_FLAGS) -fPIE $(LOCAL_INCLUDE) -c $< -o $@ + +$(TARGETNAME): $(LOCAL_OBJ) + $(HIDE) $(CC) -pie -s $(LDPATH) $(BASE_OPTS) -o $(TARGETNAME) $^ $(LDCFLAGS) + $(HIDE) mkdir -p $(APPS_OUT) + $(HIDE) $(MV) $(TARGETNAME) $(APPS_OUT) + $(HIDE) $(RM) $(LOCAL_OBJ) + +clean: + $(HIDE) $(RM) $(LOCAL_OBJ) + $(HIDE) $(RM) $(TARGETNAME) + +.PHONY: all $(TARGETNAME) clean diff --git a/net/lwip-2.1/enhancement/include/lwip/tftpc.h b/apps/tftp/include/tftpc.h similarity index 97% rename from net/lwip-2.1/enhancement/include/lwip/tftpc.h rename to apps/tftp/include/tftpc.h index 49ff2930..3d0bf568 100644 --- a/net/lwip-2.1/enhancement/include/lwip/tftpc.h +++ b/apps/tftp/include/tftpc.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -29,11 +29,10 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef LWIP_HDR_TFTPC_H -#define LWIP_HDR_TFTPC_H +#ifndef TFTPC_H +#define TFTPC_H -#include "lwip/opt.h" -#include "lwip/sockets.h" +#include "types_adapt.h" #if LWIP_TFTP /* don't build if not configured for use in lwipopts.h */ @@ -307,4 +306,4 @@ u32_t lwip_tftp_get_file_by_filename_to_rawmem(u32_t ulHostAddr, #endif /* LWIP_TFTP */ -#endif /* LWIP_HDR_TFTPC_H */ +#endif /* TFTPC_H */ diff --git a/apps/tftp/include/types_adapt.h b/apps/tftp/include/types_adapt.h new file mode 100644 index 00000000..5634495f --- /dev/null +++ b/apps/tftp/include/types_adapt.h @@ -0,0 +1,88 @@ +/* + * 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 TYPES_ADAPT_H +#define TYPES_ADAPT_H + +#include +#include +#include + +#define LWIP_TFTP 1 +#define LOSCFG_NET_LWIP_SACK_TFTP 1 +#define LOSCFG_SHELL_CMD_DEBUG 1 + +#define u8_t uint8_t +#define s8_t int8_t +#define u16_t uint16_t +#define s16_t int16_t +#define u32_t uint32_t +#define s32_t int32_t + +#define X8_F "02" PRIx8 +#define U16_F PRIu16 +#define S16_F PRId16 +#define X16_F PRIx16 +#define U32_F PRIu32 +#define S32_F PRId32 +#define X32_F PRIx32 +#define SZT_F PRIuPTR + +#define PRINTK(fmt, ...) printf(fmt, ##__VA_ARGS__) +#define LWIP_ASSERT(msg, expr) assert(expr) +#define LWIP_DEBUGF(module, msg) PRINTK msg + +#define LOS_OK 0 +#define LOS_NOK 1 +#define ERR_OK 0 +#define EOK 0 + +#define mem_malloc malloc +#define mem_free free +#define lwip_socket socket +#define lwip_ioctl ioctl +#define lwip_close close +#define lwip_bind bind +#define lwip_sendto sendto +#define lwip_recvfrom recvfrom + +#define IPADDR_NONE INADDR_NONE +#define DEFFILEMODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) + +#define SHELLCMD_ENTRY(l, cmdType, cmdKey, paraNum, cmdHook) \ +int main(int argc, const char **argv) \ +{ \ + return (int)cmdHook(argc, argv); \ +} + +typedef u32_t (*CmdCallBackFunc)(u32_t argc, const char **argv); + +#endif /* TYPES_ADAPT_H */ diff --git a/apps/tftp/src/main.c b/apps/tftp/src/main.c new file mode 100644 index 00000000..4a476c74 --- /dev/null +++ b/apps/tftp/src/main.c @@ -0,0 +1,160 @@ +/* + * 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. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include "tftpc.h" + +#ifdef LOSCFG_NET_LWIP_SACK_TFTP +static int tcpip_init_finish = 1; +static char *TftpError[] = { + "TFTP transfer finish\n", + "Error while creating UDP socket\n", + "Error while binding to the UDP socket\n", + "Error returned by select() system call\n", + "Error while receiving data from the peer\n", + "Error while sending data to the peer\n", + "Requested file is not found\n", + "This is the error sent by the server when hostname cannot be resolved\n", + "Input paramters passed to TFTP interfaces are invalid\n", + "Error detected in TFTP packet or the error received from the TFTP server\n", + "Error during packet synhronization while sending or unexpected packet is received\n", + "File size limit crossed, Max block can be 0xFFFF, each block containing 512 bytes\n", + "File name lenght greater than 256\n", + "Hostname IP is not valid\n", + "TFTP server returned file access error\n", + "TFTP server returned error signifying that the DISK is full to write\n", + "TFTP server returned error signifying that the file exist\n", + "The source file name do not exisits\n", + "Memory allocaion failed in TFTP client\n", + "File open failed\n", + "File read error\n", + "File create error\n", + "File write error\n", + "Max time expired while waiting for file to be recived\n", + "Error when the received packet is less than 4bytes(error lenght) or greater than 512bytes\n", + "Returned by TFTP server for protocol user error\n", + "The destination file path length greater than 256\n", + "Returned by TFTP server for undefined transfer ID\n", + "IOCTL fucntion failed at TFTP client while setting the socket to non-block\n", +}; + +#ifndef ARRAY_SIZE +#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) +#endif + +u32_t osShellTftp(int argc, const char **argv) +{ + u32_t ulRemoteAddr = IPADDR_NONE; + const u16_t usTftpServPort = 69; + u8_t ucTftpGet = 0; + s8_t *szLocalFileName = NULL; + s8_t *szRemoteFileName = NULL; + u32_t ret; + + int i = 1; + if (argc < 1 || argv == NULL) { + goto usage; + } + + if (!tcpip_init_finish) { + PRINTK("%s: tcpip_init have not been called\n", __FUNCTION__); + return LOS_NOK; + } + + while (i < argc) { + if (strcmp(argv[i], "-p") == 0) { + ucTftpGet = 0; + i++; + continue; + } + + if (strcmp(argv[i], "-g") == 0) { + ucTftpGet = 1; + i++; + continue; + } + + if (strcmp(argv[i], "-l") == 0 && ((i + 1) < argc)) { + szLocalFileName = (s8_t *)argv[i + 1]; + i += 2; + continue; + } + + if (strcmp(argv[i], "-r") == 0 && ((i + 1) < argc)) { + szRemoteFileName = (s8_t *)argv[i + 1]; + i += 2; + continue; + } + + if ((i + 1) == argc) { + ulRemoteAddr = inet_addr(argv[i]); + break; + } + + goto usage; + } + + if (ulRemoteAddr == IPADDR_NONE || szLocalFileName == NULL || szRemoteFileName == NULL) { + goto usage; + } + + if (ucTftpGet) { + ret = lwip_tftp_get_file_by_filename(ntohl(ulRemoteAddr), usTftpServPort, + TRANSFER_MODE_BINARY, szRemoteFileName, szLocalFileName); + } else { + ret = lwip_tftp_put_file_by_filename(ntohl(ulRemoteAddr), usTftpServPort, + TRANSFER_MODE_BINARY, szLocalFileName, szRemoteFileName); + } + + LWIP_ASSERT("TFTP UNKNOW ERROR!", ret < ARRAY_SIZE(TftpError)); + PRINTK("%s", TftpError[ret]); + if (ret) { + return LOS_NOK; + } else { + return LOS_OK; + } +usage: + PRINTK("usage:\nTransfer a file from/to tftp server\n"); + PRINTK("tftp <-g/-p> -l FullPathLocalFile -r RemoteFile Host\n"); + return LOS_NOK; +} + +#ifdef LOSCFG_SHELL_CMD_DEBUG +SHELLCMD_ENTRY(tftp_shellcmd, CMD_TYPE_EX, "tftp", XARGS, (CmdCallBackFunc)(uintptr_t)osShellTftp); +#endif /* LOSCFG_SHELL_CMD_DEBUG */ +#endif /* LOSCFG_NET_LWIP_SACK_TFTP */ diff --git a/net/lwip-2.1/enhancement/src/tftpc.c b/apps/tftp/src/tftpc.c similarity index 99% rename from net/lwip-2.1/enhancement/src/tftpc.c rename to apps/tftp/src/tftpc.c index 16c14928..b78bd45f 100644 --- a/net/lwip-2.1/enhancement/src/tftpc.c +++ b/apps/tftp/src/tftpc.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -31,29 +31,24 @@ /* TFTP Client utility */ -#include "lwip/opt.h" +#include "tftpc.h" #if LWIP_TFTP /* don't build if not configured for use in lwipopts.h */ -#include "lwip/tcpip.h" -#include "lwip/netif.h" -#include "lwip/mem.h" -#include "lwip/err.h" -#include "lwip/inet.h" -#include "netif/etharp.h" -#include "lwip/ip_addr.h" -#include "lwip/sockets.h" -#include "lwip/udp.h" -#include "lwip/ip_addr.h" -#include "lwip/netif.h" -#include "lwip/def.h" -#include "lwip/tftpc.h" -#include "fcntl.h" +#include #include #include - +#include +#include +#include #include - +#include +#include +#include +#include +#include +#include +#include /* Function Declarations */ #ifdef LOSCFG_NET_LWIP_SACK_TFTP @@ -1088,7 +1083,6 @@ u32_t lwip_tftp_put_file_by_filename(u32_t ulHostAddr, u16_t usTftpServPort, u8_ &stServerAddr, pstSendBuf); (void)lwip_close(iSockNum); - close(fp); mem_free(pucBuffer); ulErrCode = TFTPC_FILEOPEN_ERROR; diff --git a/arch/Kconfig b/arch/Kconfig old mode 100644 new mode 100755 diff --git a/arch/arm/arm.mk b/arch/arm/arm.mk index 923518c9..6e765e9e 100644 --- a/arch/arm/arm.mk +++ b/arch/arm/arm.mk @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/arch/arm/arm/Makefile b/arch/arm/arm/Makefile old mode 100644 new mode 100755 index 648fe5c7..d105536e --- a/arch/arm/arm/Makefile +++ b/arch/arm/arm/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/arch/arm/arm/include/arch_config.h b/arch/arm/arm/include/arch_config.h old mode 100644 new mode 100755 index 09de16a4..53f09d02 --- a/arch/arm/arm/include/arch_config.h +++ b/arch/arm/arm/include/arch_config.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/arm.h b/arch/arm/arm/include/arm.h old mode 100644 new mode 100755 index bde38793..c8a10ade --- a/arch/arm/arm/include/arm.h +++ b/arch/arm/arm/include/arm.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/arm_user_copy.h b/arch/arm/arm/include/arm_user_copy.h old mode 100644 new mode 100755 index ac82b958..b86e37c4 --- a/arch/arm/arm/include/arm_user_copy.h +++ b/arch/arm/arm/include/arm_user_copy.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/arm_user_get.h b/arch/arm/arm/include/arm_user_get.h old mode 100644 new mode 100755 index 53532107..43843e02 --- a/arch/arm/arm/include/arm_user_get.h +++ b/arch/arm/arm/include/arm_user_get.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/arm_user_put.h b/arch/arm/arm/include/arm_user_put.h old mode 100644 new mode 100755 index cacae1b2..c5c475d3 --- a/arch/arm/arm/include/arm_user_put.h +++ b/arch/arm/arm/include/arm_user_put.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/los_arch_mmu.h b/arch/arm/arm/include/los_arch_mmu.h index c501b219..93b2fd34 100644 --- a/arch/arm/arm/include/los_arch_mmu.h +++ b/arch/arm/arm/include/los_arch_mmu.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/los_asid.h b/arch/arm/arm/include/los_asid.h index eb343611..613982db 100644 --- a/arch/arm/arm/include/los_asid.h +++ b/arch/arm/arm/include/los_asid.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/los_atomic.h b/arch/arm/arm/include/los_atomic.h index d007b66e..702ea78e 100644 --- a/arch/arm/arm/include/los_atomic.h +++ b/arch/arm/arm/include/los_atomic.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/los_hw_cpu.h b/arch/arm/arm/include/los_hw_cpu.h old mode 100644 new mode 100755 index 5585eebc..45ecb23e --- a/arch/arm/arm/include/los_hw_cpu.h +++ b/arch/arm/arm/include/los_hw_cpu.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/los_mmu_descriptor_v6.h b/arch/arm/arm/include/los_mmu_descriptor_v6.h old mode 100644 new mode 100755 index d8744100..6f93de03 --- a/arch/arm/arm/include/los_mmu_descriptor_v6.h +++ b/arch/arm/arm/include/los_mmu_descriptor_v6.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -104,6 +104,8 @@ extern "C" { ((x) << MMU_DESCRIPTOR_L1_TEX_SHIFT) /* type extension */ #define MMU_DESCRIPTOR_L1_TYPE_STRONGLY_ORDERED \ (MMU_DESCRIPTOR_L1_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_NON_CACHEABLE) +#define MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE \ + (MMU_DESCRIPTOR_L1_TEX(MMU_DESCRIPTOR_TEX_1) | MMU_DESCRIPTOR_NON_CACHEABLE) #define MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED \ (MMU_DESCRIPTOR_L1_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_WRITE_BACK_ALLOCATE) #define MMU_DESCRIPTOR_L1_TYPE_DEVICE_NON_SHARED \ @@ -141,6 +143,8 @@ extern "C" { ((x) << MMU_DESCRIPTOR_L2_TEX_SHIFT) /* type extension */ #define MMU_DESCRIPTOR_L2_TYPE_STRONGLY_ORDERED \ (MMU_DESCRIPTOR_L2_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_NON_CACHEABLE) +#define MMU_DESCRIPTOR_L2_TYPE_NORMAL_NOCACHE \ + (MMU_DESCRIPTOR_L2_TEX(MMU_DESCRIPTOR_TEX_1) | MMU_DESCRIPTOR_NON_CACHEABLE) #define MMU_DESCRIPTOR_L2_TYPE_DEVICE_SHARED \ (MMU_DESCRIPTOR_L2_TEX(MMU_DESCRIPTOR_TEX_0) | MMU_DESCRIPTOR_WRITE_BACK_ALLOCATE) #define MMU_DESCRIPTOR_L2_TYPE_DEVICE_NON_SHARED \ @@ -208,6 +212,12 @@ extern "C" { MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT | \ MMU_DESCRIPTOR_L1_AP_P_RW_U_NA) +#define MMU_INITIAL_MAP_NORMAL_NOCACHE \ + (MMU_DESCRIPTOR_L1_TYPE_SECTION | \ + MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE | \ + MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT | \ + MMU_DESCRIPTOR_L1_AP_P_RW_U_NA) + #define MMU_INITIAL_MAP_DEVICE \ (MMU_DESCRIPTOR_L1_TYPE_SECTION | \ MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED | \ diff --git a/arch/arm/arm/include/los_pte_ops.h b/arch/arm/arm/include/los_pte_ops.h index 5d6c2b74..6d1bee53 100644 --- a/arch/arm/arm/include/los_pte_ops.h +++ b/arch/arm/arm/include/los_pte_ops.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/include/los_tlb_v6.h b/arch/arm/arm/include/los_tlb_v6.h index 5ccacaf5..7257babe 100644 --- a/arch/arm/arm/include/los_tlb_v6.h +++ b/arch/arm/arm/include/los_tlb_v6.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/armv7a/cache.S b/arch/arm/arm/src/armv7a/cache.S index cdcbee06..0970d453 100644 --- a/arch/arm/arm/src/armv7a/cache.S +++ b/arch/arm/arm/src/armv7a/cache.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/hw_user_get.S b/arch/arm/arm/src/hw_user_get.S old mode 100644 new mode 100755 index 820d48ec..32711f60 --- a/arch/arm/arm/src/hw_user_get.S +++ b/arch/arm/arm/src/hw_user_get.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/hw_user_put.S b/arch/arm/arm/src/hw_user_put.S old mode 100644 new mode 100755 index 941efe7e..d79e509c --- a/arch/arm/arm/src/hw_user_put.S +++ b/arch/arm/arm/src/hw_user_put.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/include/asm.h b/arch/arm/arm/src/include/asm.h old mode 100644 new mode 100755 index 796e14c0..96ea07ad --- a/arch/arm/arm/src/include/asm.h +++ b/arch/arm/arm/src/include/asm.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/include/los_exc_pri.h b/arch/arm/arm/src/include/los_exc_pri.h index 4031217b..e1e9c487 100644 --- a/arch/arm/arm/src/include/los_exc_pri.h +++ b/arch/arm/arm/src/include/los_exc_pri.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -52,7 +52,8 @@ STATIC INLINE VOID OsSetCurrCpuSp(UINTPTR regSp) extern UINT32 OsGetSystemStatus(VOID); extern VOID BackTraceSub(UINTPTR regFP); extern VOID OsExcInit(VOID); -extern VOID OsKillUserProcess(UINTPTR sp); +extern BOOL OsSystemExcIsReset(VOID); + #ifdef __cplusplus #if __cplusplus } diff --git a/arch/arm/arm/src/include/los_hw_pri.h b/arch/arm/arm/src/include/los_hw_pri.h old mode 100644 new mode 100755 index 5d470b34..052da990 --- a/arch/arm/arm/src/include/los_hw_pri.h +++ b/arch/arm/arm/src/include/los_hw_pri.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/include/los_hwi_pri.h b/arch/arm/arm/src/include/los_hwi_pri.h index ea1726b6..ad8e589c 100644 --- a/arch/arm/arm/src/include/los_hwi_pri.h +++ b/arch/arm/arm/src/include/los_hwi_pri.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/jmp.S b/arch/arm/arm/src/jmp.S index 209b4e8a..14dd05a3 100644 --- a/arch/arm/arm/src/jmp.S +++ b/arch/arm/arm/src/jmp.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/los_arch_mmu.c b/arch/arm/arm/src/los_arch_mmu.c old mode 100644 new mode 100755 index ec6111f7..3e046193 --- a/arch/arm/arm/src/los_arch_mmu.c +++ b/arch/arm/arm/src/los_arch_mmu.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -91,11 +91,6 @@ STATIC INT32 OsMapParamCheck(UINT32 flags, VADDR_T vaddr, PADDR_T paddr) } #endif - if (!(flags & VM_MAP_REGION_FLAG_PERM_READ)) { - VM_ERR("miss read flag"); - return LOS_ERRNO_VM_INVALID_ARGS; - } - /* paddr and vaddr must be aligned */ if (!MMU_DESCRIPTOR_IS_L2_SIZE_ALIGNED(vaddr) || !MMU_DESCRIPTOR_IS_L2_SIZE_ALIGNED(paddr)) { return LOS_ERRNO_VM_INVALID_ARGS; @@ -114,6 +109,9 @@ STATIC VOID OsCvtPte2AttsToFlags(PTE_T l1Entry, PTE_T l2Entry, UINT32 *flags) switch (l2Entry & MMU_DESCRIPTOR_L2_TEX_TYPE_MASK) { case MMU_DESCRIPTOR_L2_TYPE_STRONGLY_ORDERED: + *flags |= VM_MAP_REGION_FLAG_STRONGLY_ORDERED; + break; + case MMU_DESCRIPTOR_L2_TYPE_NORMAL_NOCACHE: *flags |= VM_MAP_REGION_FLAG_UNCACHED; break; case MMU_DESCRIPTOR_L2_TYPE_DEVICE_SHARED: @@ -208,10 +206,10 @@ STATIC VOID OsTryUnmapL1PTE(const LosArchMmu *archMmu, vaddr_t vaddr, UINT32 sca } } -/* convert user level mmu flags to L1 descriptors flags */ -STATIC UINT32 OsCvtSecFlagsToAttrs(UINT32 flags) +STATIC UINT32 OsCvtSecCacheFlagsToMMUFlags(UINT32 flags) { - UINT32 mmuFlags = MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT; + UINT32 mmuFlags = 0; + switch (flags & VM_MAP_REGION_FLAG_CACHE_MASK) { case VM_MAP_REGION_FLAG_CACHED: mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_NORMAL_WRITE_BACK_ALLOCATE; @@ -219,33 +217,63 @@ STATIC UINT32 OsCvtSecFlagsToAttrs(UINT32 flags) mmuFlags |= MMU_DESCRIPTOR_L1_SECTION_SHAREABLE; #endif break; - case VM_MAP_REGION_FLAG_WRITE_COMBINING: - case VM_MAP_REGION_FLAG_UNCACHED: + case VM_MAP_REGION_FLAG_STRONGLY_ORDERED: mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_STRONGLY_ORDERED; break; + case VM_MAP_REGION_FLAG_UNCACHED: + mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE; + break; case VM_MAP_REGION_FLAG_UNCACHED_DEVICE: mmuFlags |= MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED; break; default: return LOS_ERRNO_VM_INVALID_ARGS; } + return mmuFlags; +} - switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE)) { +STATIC UINT32 OsCvtSecAccessFlagsToMMUFlags(UINT32 flags) +{ + UINT32 mmuFlags = 0; + + switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE)) { case 0: + mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_NA_U_NA; + break; + case VM_MAP_REGION_FLAG_PERM_READ: + case VM_MAP_REGION_FLAG_PERM_USER: mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RO_U_NA; break; + case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ: + mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RO_U_RO; + break; case VM_MAP_REGION_FLAG_PERM_WRITE: + case VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE: mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RW_U_NA; break; - case VM_MAP_REGION_FLAG_PERM_USER: - mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RO_U_RO; - break; case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE: + case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE: mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_RW_U_RW; break; default: break; } + return mmuFlags; +} + +/* convert user level mmu flags to L1 descriptors flags */ +STATIC UINT32 OsCvtSecFlagsToAttrs(UINT32 flags) +{ + UINT32 mmuFlags; + + mmuFlags = OsCvtSecCacheFlagsToMMUFlags(flags); + if (mmuFlags == LOS_ERRNO_VM_INVALID_ARGS) { + return mmuFlags; + } + + mmuFlags |= MMU_DESCRIPTOR_L1_SMALL_DOMAIN_CLIENT; + + mmuFlags |= OsCvtSecAccessFlagsToMMUFlags(flags); if (!(flags & VM_MAP_REGION_FLAG_PERM_EXECUTE)) { mmuFlags |= MMU_DESCRIPTOR_L1_SECTION_XN; @@ -271,6 +299,9 @@ STATIC VOID OsCvtSecAttsToFlags(PTE_T l1Entry, UINT32 *flags) switch (l1Entry & MMU_DESCRIPTOR_L1_TEX_TYPE_MASK) { case MMU_DESCRIPTOR_L1_TYPE_STRONGLY_ORDERED: + *flags |= VM_MAP_REGION_FLAG_STRONGLY_ORDERED; + break; + case MMU_DESCRIPTOR_L1_TYPE_NORMAL_NOCACHE: *flags |= VM_MAP_REGION_FLAG_UNCACHED; break; case MMU_DESCRIPTOR_L1_TYPE_DEVICE_SHARED: @@ -494,8 +525,7 @@ STATIC VOID OsMapL1PTE(LosArchMmu *archMmu, PTE_T *pte1Ptr, vaddr_t vaddr, UINT3 OsSavePte1(OsGetPte1Ptr(archMmu->virtTtb, vaddr), *pte1Ptr); } -/* convert user level mmu flags to L2 descriptors flags */ -STATIC UINT32 OsCvtPte2FlagsToAttrs(uint32_t flags) +STATIC UINT32 OsCvtPte2CacheFlagsToMMUFlags(UINT32 flags) { UINT32 mmuFlags = 0; @@ -506,33 +536,61 @@ STATIC UINT32 OsCvtPte2FlagsToAttrs(uint32_t flags) #endif mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_NORMAL_WRITE_BACK_ALLOCATE; break; - case VM_MAP_REGION_FLAG_WRITE_COMBINING: - case VM_MAP_REGION_FLAG_UNCACHED: + case VM_MAP_REGION_FLAG_STRONGLY_ORDERED: mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_STRONGLY_ORDERED; break; + case VM_MAP_REGION_FLAG_UNCACHED: + mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_NORMAL_NOCACHE; + break; case VM_MAP_REGION_FLAG_UNCACHED_DEVICE: mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_DEVICE_SHARED; break; default: return LOS_ERRNO_VM_INVALID_ARGS; } + return mmuFlags; +} - switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE)) { +STATIC UINT32 OsCvtPte2AccessFlagsToMMUFlags(UINT32 flags) +{ + UINT32 mmuFlags = 0; + + switch (flags & (VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE)) { case 0: + mmuFlags |= MMU_DESCRIPTOR_L1_AP_P_NA_U_NA; + break; + case VM_MAP_REGION_FLAG_PERM_READ: + case VM_MAP_REGION_FLAG_PERM_USER: mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RO_U_NA; break; + case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ: + mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RO_U_RO; + break; case VM_MAP_REGION_FLAG_PERM_WRITE: + case VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE: mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RW_U_NA; break; - case VM_MAP_REGION_FLAG_PERM_USER: - mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RO_U_RO; - break; case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_WRITE: + case VM_MAP_REGION_FLAG_PERM_USER | VM_MAP_REGION_FLAG_PERM_READ | VM_MAP_REGION_FLAG_PERM_WRITE: mmuFlags |= MMU_DESCRIPTOR_L2_AP_P_RW_U_RW; break; default: break; } + return mmuFlags; +} + +/* convert user level mmu flags to L2 descriptors flags */ +STATIC UINT32 OsCvtPte2FlagsToAttrs(UINT32 flags) +{ + UINT32 mmuFlags; + + mmuFlags = OsCvtPte2CacheFlagsToMMUFlags(flags); + if (mmuFlags == LOS_ERRNO_VM_INVALID_ARGS) { + return mmuFlags; + } + + mmuFlags |= OsCvtPte2AccessFlagsToMMUFlags(flags); if (!(flags & VM_MAP_REGION_FLAG_PERM_EXECUTE)) { mmuFlags |= MMU_DESCRIPTOR_L2_TYPE_SMALL_PAGE_XN; diff --git a/arch/arm/arm/src/los_asid.c b/arch/arm/arm/src/los_asid.c index 72b4d709..b92dae27 100644 --- a/arch/arm/arm/src/los_asid.c +++ b/arch/arm/arm/src/los_asid.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -34,8 +34,8 @@ * @ingroup kernel */ -#include "los_typedef.h" #include "los_asid.h" +#include "los_bitmap.h" #include "los_spinlock.h" #include "los_mmu_descriptor_v6.h" diff --git a/arch/arm/arm/src/los_dispatch.S b/arch/arm/arm/src/los_dispatch.S old mode 100644 new mode 100755 index add17d0f..1f9c2469 --- a/arch/arm/arm/src/los_dispatch.S +++ b/arch/arm/arm/src/los_dispatch.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -32,20 +32,11 @@ #include "asm.h" #include "arch_config.h" -#ifdef LOSCFG_KERNEL_SMP_LOCKDEP - .extern OsLockDepCheckOut -#endif - .extern g_taskSpin - .extern g_percpu - .global OsStartToRun + .extern OsSchedToUserReleaseLock .global OsTaskSchedule + .global OsTaskContextLoad .global OsIrqHandler - .global ArchSpinUnlock - .global OsSchedToUserSpinUnlock - .equ OS_TASK_STATUS_RUNNING, 0x0010U - .equ OS_PERCPU_STRUCT_SIZE, 0x28U - .equ OS_PERCPU_TASK_LOCK_OFFSET, 0x14U .fpu vfpv4 /* macros to align and unalign the stack on 8 byte boundary for ABI compliance */ @@ -88,26 +79,6 @@ #endif .endm -/* R0: new task */ -OsStartToRun: - - MSR CPSR_c, #(CPSR_INT_DISABLE | CPSR_SVC_MODE) - - LDRH R1, [R0, #4] - ORR R1, #OS_TASK_STATUS_RUNNING - STRH R1, [R0, #4] - - /* R0 is new task, save it on tpidrprw */ - MCR p15, 0, R0, c13, c0, 4 - ISB - - VPUSH {S0} /* fpu */ - VPOP {S0} - VPUSH {D0} - VPOP {D0} - - B OsTaskContextLoad - /* * R0: new task * R1: run task @@ -152,24 +123,11 @@ OsTaskContextLoad: BNE OsKernelTaskLoad #ifdef LOSCFG_KERNEL_SMP -#ifdef LOSCFG_KERNEL_SMP_LOCKDEP /* 8 bytes stack align */ SUB SP, SP, #4 - LDR R0, =g_taskSpin - BL OsLockDepCheckOut + BL OsSchedToUserReleaseLock ADD SP, SP, #4 #endif - /* R0 = &g_taskSpin.rawLock */ - LDR R0, =g_taskSpin - BL ArchSpinUnlock - LDR R2, =g_percpu - MRC P15, 0, R3, C0, C0, 5 - UXTB R3, R3 - MOV R1, #OS_PERCPU_STRUCT_SIZE - MLA R3, R1, R3, R2 - MOV R2, #0 - STR R2, [R3, #OS_PERCPU_TASK_LOCK_OFFSET] -#endif MVN R3, #CPSR_INT_DISABLE AND R4, R4, R3 @@ -245,9 +203,7 @@ OsIrqFromKernel: /* process pending signals */ BL OsTaskProcSignal - /* check if needs to schedule */ - CMP R0, #0 - BLNE OsSchedPreempt + BL OsSchedIrqEndCheckNeedSched MOV R0,SP MOV R1,R7 diff --git a/arch/arm/arm/src/los_exc.c b/arch/arm/arm/src/los_exc.c old mode 100644 new mode 100755 index 7b431478..de57d93c --- a/arch/arm/arm/src/los_exc.c +++ b/arch/arm/arm/src/los_exc.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -341,7 +341,7 @@ STATIC VOID OsExcSysInfo(UINT32 excType, const ExcContext *excBufAddr) excBufAddr->SP); } - PrintExcInfo("fp = 0x%x\n", excBufAddr->R11); + PrintExcInfo("\nfp = 0x%x\n", excBufAddr->R11); } STATIC VOID OsExcRegsInfo(const ExcContext *excBufAddr) @@ -422,7 +422,7 @@ STATIC VOID OsDumpExcVaddrRegion(LosVmSpace *space, LosVmMapRegion *region) mmuFlag = FALSE; } PrintExcInfo(" 0x%08x 0x%08x 0x%08x\n", - startVaddr, LOS_PaddrToKVaddr(startPaddr), pageCount << PAGE_SHIFT); + startVaddr, LOS_PaddrToKVaddr(startPaddr), (UINT32)pageCount << PAGE_SHIFT); pageCount = 0; startPaddr = 0; } @@ -544,6 +544,7 @@ STATIC VOID OsUserExcHandle(ExcContext *excBufAddr) OsProcessExitCodeCoreDumpSet(runProcess); #endif OsProcessExitCodeSignalSet(runProcess, SIGUSR2); + /* kill user exc process */ LOS_Exit(OS_PRO_EXIT_OK); @@ -784,9 +785,9 @@ VOID OsBackTrace(VOID) { UINT32 regFP = Get_Fp(); LosTaskCB *runTask = OsCurrTaskGet(); - PRINTK("OsBackTrace fp = 0x%x\n", regFP); - PRINTK("runTask->taskName = %s\n", runTask->taskName); - PRINTK("runTask->taskID = %u\n", runTask->taskID); + PrintExcInfo("OsBackTrace fp = 0x%x\n", regFP); + PrintExcInfo("runTask->taskName = %s\n", runTask->taskName); + PrintExcInfo("runTask->taskID = %u\n", runTask->taskID); BackTrace(regFP); } @@ -1005,6 +1006,35 @@ LITE_OS_SEC_TEXT VOID STATIC OsExcPriorDisposal(ExcContext *excBufAddr) #endif } } + +#if (LOSCFG_KERNEL_SMP == YES) +#ifdef LOSCFG_FS_VFS + /* Wait for the end of the Console task to avoid multicore printing code */ + OsWaitConsoleSendTaskPend(OsCurrTaskGet()->taskID); +#endif +#endif +} + +LITE_OS_SEC_TEXT_INIT STATIC VOID OsPrintExcHead(UINT32 far) +{ +#ifdef LOSCFG_DEBUG_VERSION + LosVmSpace *space = NULL; + VADDR_T vaddr; +#endif + + /* You are not allowed to add any other print information before this exception information */ + if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) { +#ifdef LOSCFG_DEBUG_VERSION + vaddr = ROUNDDOWN(far, PAGE_SIZE); + space = LOS_SpaceGet(vaddr); + if (space != NULL) { + LOS_DumpMemRegion(vaddr); + } +#endif + PrintExcInfo("##################excFrom: User!####################\n"); + } else { + PrintExcInfo("##################excFrom: kernel!###################\n"); + } } /* @@ -1021,19 +1051,7 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd OsExcPriorDisposal(excBufAddr); -#if (LOSCFG_KERNEL_SMP == YES) -#ifdef LOSCFG_FS_VFS - /* Wait for the end of the Console task to avoid multicore printing code */ - OsWaitConsoleSendTaskPend(OsCurrTaskGet()->taskID); -#endif -#endif - - /* You are not allowed to add any other print information before this exception information */ - if (g_excFromUserMode[ArchCurrCpuid()] == TRUE) { - PrintExcInfo("##################excFrom: User!####################\n"); - } else { - PrintExcInfo("##################excFrom: kernel###################!\n"); - } + OsPrintExcHead(far); #if (LOSCFG_KERNEL_SMP == YES) OsAllCpuStatusOutput(); @@ -1070,6 +1088,15 @@ LITE_OS_SEC_TEXT_INIT VOID OsExcHandleEntry(UINT32 excType, ExcContext *excBufAd #ifdef LOSCFG_EXC_INTERACTION OsExcInteractionTaskKeep(); #endif + +#ifdef LOSCFG_SHELL_CMD_DEBUG + SystemRebootFunc rebootHook = OsGetRebootHook(); + if ((OsSystemExcIsReset() == TRUE) && (rebootHook != NULL)) { + LOS_Mdelay(3000); /* 3000: System dead, delay 3 seconds after system restart */ + rebootHook(); + } +#endif + while (1) {} } @@ -1092,6 +1119,46 @@ VOID __stack_chk_fail(VOID) __builtin_return_address(0)); } +VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCount) +{ + UINT32 count = 0; + UINT32 index = 0; + UINT32 stackStart, stackEnd; + LosTaskCB *taskCB = NULL; + UINTPTR framePtr, tmpFramePtr, linkReg; + + if (LR == NULL) { + return; + } + /* if LR array is not enough,just record LRSize. */ + if (LRSize < recordCount) { + recordCount = LRSize; + } + + taskCB = OsCurrTaskGet(); + stackStart = taskCB->topOfStack; + stackEnd = stackStart + taskCB->stackSize; + + framePtr = Get_Fp(); + while ((framePtr > stackStart) && (framePtr < stackEnd) && IS_ALIGNED(framePtr, sizeof(CHAR *))) { + tmpFramePtr = framePtr; + linkReg = *(UINTPTR *)framePtr; + if (index >= jumpCount) { + LR[count++] = linkReg; + if (count == recordCount) { + break; + } + } + index++; + framePtr = *(UINTPTR *)(tmpFramePtr - sizeof(UINTPTR)); + } + + /* if linkReg is not enough,clean up the last of the effective LR as the end. */ + if (count < recordCount) { + LR[count] = 0; + } +} + #ifdef __cplusplus #if __cplusplus } diff --git a/arch/arm/arm/src/los_hw.c b/arch/arm/arm/src/los_hw.c old mode 100644 new mode 100755 index dbc24d2c..800bf1b9 --- a/arch/arm/arm/src/los_hw.c +++ b/arch/arm/arm/src/los_hw.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/los_hw_exc.S b/arch/arm/arm/src/los_hw_exc.S old mode 100644 new mode 100755 index 1dc3cf52..5dd00c78 --- a/arch/arm/arm/src/los_hw_exc.S +++ b/arch/arm/arm/src/los_hw_exc.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/los_hw_runstop.S b/arch/arm/arm/src/los_hw_runstop.S index 032e9af1..b8f8cf74 100644 --- a/arch/arm/arm/src/los_hw_runstop.S +++ b/arch/arm/arm/src/los_hw_runstop.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/los_hw_tick.c b/arch/arm/arm/src/los_hw_tick.c index b52f346c..b53bdfa2 100644 --- a/arch/arm/arm/src/los_hw_tick.c +++ b/arch/arm/arm/src/los_hw_tick.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/los_hwi.c b/arch/arm/arm/src/los_hwi.c index 733fc010..5bac5895 100644 --- a/arch/arm/arm/src/los_hwi.c +++ b/arch/arm/arm/src/los_hwi.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -31,11 +31,11 @@ #include "los_hwi.h" #include "los_memory.h" -#include "los_tickless_pri.h" #include "los_spinlock.h" #ifdef LOSCFG_KERNEL_CPUP #include "los_cpup_pri.h" #endif +#include "los_sched_pri.h" #ifdef __cplusplus #if __cplusplus @@ -68,6 +68,11 @@ CHAR *OsGetHwiFormName(UINT32 index) return g_hwiFormName[index]; } +UINT32 LOS_GetSystemHwiMaximum(VOID) +{ + return OS_HWI_MAX_NUM; +} + typedef VOID (*HWI_PROC_FUNC0)(VOID); typedef VOID (*HWI_PROC_FUNC2)(INT32, VOID *); VOID OsInterrupt(UINT32 intNum) @@ -75,16 +80,16 @@ VOID OsInterrupt(UINT32 intNum) HwiHandleForm *hwiForm = NULL; UINT32 *intCnt = NULL; + /* Must keep the operation at the beginning of the interface */ intCnt = &g_intCount[ArchCurrCpuid()]; *intCnt = *intCnt + 1; + OsSchedIrqStartTime(); + #ifdef LOSCFG_CPUP_INCLUDE_IRQ OsCpupIrqStart(); #endif -#ifdef LOSCFG_KERNEL_TICKLESS - OsTicklessUpdate(intNum); -#endif hwiForm = (&g_hwiForm[intNum]); #ifndef LOSCFG_NO_SHARED_IRQ while (hwiForm->pstNext != NULL) { @@ -107,10 +112,13 @@ VOID OsInterrupt(UINT32 intNum) #endif ++g_hwiFormCnt[intNum]; - *intCnt = *intCnt - 1; #ifdef LOSCFG_CPUP_INCLUDE_IRQ OsCpupIrqEnd(intNum); #endif + OsSchedIrqUpdateUsedTime(); + + /* Must keep the operation at the end of the interface */ + *intCnt = *intCnt - 1; } STATIC HWI_ARG_T OsHwiCpIrqParam(const HwiIrqParam *irqParam) diff --git a/arch/arm/arm/src/startup/reset_vector_mp.S b/arch/arm/arm/src/startup/reset_vector_mp.S old mode 100644 new mode 100755 index dc08b6dc..cec87786 --- a/arch/arm/arm/src/startup/reset_vector_mp.S +++ b/arch/arm/arm/src/startup/reset_vector_mp.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -112,6 +112,20 @@ __exception_handlers: /* Startup code which will get the machine into supervisor mode */ .global reset_vector .type reset_vector,function + +#ifdef LOSCFG_QUICK_START +__quickstart_args_start: + .fill 512,1,0 +__quickstart_args_end: + +.global OsGetArgsAddr +.type OsGetArgsAddr,function + +OsGetArgsAddr: + ldr r0, =__quickstart_args_start + bx lr +#endif + reset_vector: /* clear register TPIDRPRW */ mov r0, #0 @@ -122,6 +136,20 @@ reset_vector: bic r0, #(1<<2 | 1<<0) mcr p15, 0, r0, c1, c0, 0 + /* enable fpu+neon */ +#ifndef LOSCFG_TEE_ENABLE + MRC p15, 0, r0, c1, c1, 2 + ORR r0, r0, #0xC00 + BIC r0, r0, #0xC000 + MCR p15, 0, r0, c1, c1, 2 + + LDR r0, =(0xF << 20) + MCR p15, 0, r0, c1, c0, 2 + ISB +#endif + MOV r3, #0x40000000 + VMSR FPEXC, r3 + /* r11: delta of physical address and virtual address */ adr r11, pa_va_offset ldr r0, [r11] @@ -156,10 +184,13 @@ reloc_img_to_bottom_loop: reloc_img_to_bottom_done: ldr r4, =g_firstPageTable /* r4: physical address of translation table and clear it */ add r4, r4, r11 - bl page_table_clear + mov r0, r4 + mov r1, #0 + mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS + bl memset PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS - PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED + PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_NORMAL_NOCACHE PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_DEVICE_BASE, PERIPH_DEVICE_SIZE, MMU_INITIAL_MAP_DEVICE PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_CACHED_BASE, PERIPH_CACHED_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_UNCACHED_BASE, PERIPH_UNCACHED_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED @@ -169,7 +200,6 @@ reloc_img_to_bottom_done: add r4, r4, r11 ldr r4, [r4] add r4, r4, r11 /* r4: jump pagetable paddr */ - bl page_table_clear /* build 1M section mapping, in order to jump va during turing on mmu:pa == pa, va == pa */ mov r6, pc @@ -233,20 +263,6 @@ warm_reset: sub r0, r0, r2 mov sp, r0 - /* enable fpu+neon */ -#ifndef LOSCFG_TEE_ENABLE - MRC p15, 0, r0, c1, c1, 2 - ORR r0, r0, #0xC00 - BIC r0, r0, #0xC000 - MCR p15, 0, r0, c1, c1, 2 - - LDR r0, =(0xF << 20) - MCR p15, 0, r0, c1, c0, 2 -#endif - - MOV r3, #0x40000000 - VMSR FPEXC, r3 - LDR r0, =__exception_handlers MCR p15, 0, r0, c12, c0, 0 @@ -254,14 +270,11 @@ warm_reset: bne cpu_start clear_bss: - ldr r1, =__bss_start + ldr r0, =__bss_start ldr r2, =__bss_end - mov r0, #0 - -bss_loop: - cmp r1, r2 - strlo r0, [r1], #4 - blo bss_loop + mov r1, #0 + sub r2, r2, r0 + bl memset #if defined(LOSCFG_CC_STACKPROTECTOR_ALL) || \ defined(LOSCFG_CC_STACKPROTECTOR_STRONG) || \ @@ -371,20 +384,6 @@ sp_set: mov sp, r2 bx lr /* set sp */ -/* - * r4: page table base address - * r5 and r6 will be used as variable - */ -page_table_clear: - mov r5, #0 - mov r6, #0 -0: - str r5, [r4, r6, lsl #2] - add r6, #1 - cmp r6, #0x1000 /* r6 < 4096 */ - blt 0b - bx lr - /* * r4: page table base address * r6: physical address diff --git a/arch/arm/arm/src/startup/reset_vector_up.S b/arch/arm/arm/src/startup/reset_vector_up.S old mode 100644 new mode 100755 index d7de4777..63ac5764 --- a/arch/arm/arm/src/startup/reset_vector_up.S +++ b/arch/arm/arm/src/startup/reset_vector_up.S @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -53,7 +53,6 @@ .extern __bss_start .extern __bss_end .extern hal_clock_initialize_start - .extern los_bss_init .extern _osExceptFiqHdl .extern _osExceptAddrAbortHdl .extern _osExceptDataAbortHdl @@ -119,6 +118,20 @@ reset_vector: bic r0, #(1<<2 | 1<<0) mcr p15, 0, r0, c1, c0, 0 + /* enable fpu+neon */ +#ifndef LOSCFG_TEE_ENABLE + MRC p15, 0, r0, c1, c1, 2 + ORR r0, r0, #0xC00 + BIC r0, r0, #0xC000 + MCR p15, 0, r0, c1, c1, 2 + + LDR r0, =(0xF << 20) + MCR p15, 0, r0, c1, c0, 2 + ISB +#endif + MOV r3, #0x40000000 + VMSR FPEXC, r3 + /* r11: delta of physical address and virtual address */ adr r11, pa_va_offset ldr r0, [r11] @@ -148,10 +161,14 @@ reloc_img_to_bottom_loop: reloc_img_to_bottom_done: ldr r4, =g_firstPageTable /* r4: physical address of translation table and clear it */ add r4, r4, r11 - bl page_table_clear + mov r0, r4 + mov r1, #0 + mov r2, #MMU_DESCRIPTOR_L1_SMALL_ENTRY_NUMBERS + bl memset + PAGE_TABLE_SET SYS_MEM_BASE, KERNEL_VMM_BASE, KERNEL_VMM_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS - PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED + PAGE_TABLE_SET SYS_MEM_BASE, UNCACHED_VMM_BASE, UNCACHED_VMM_SIZE, MMU_INITIAL_MAP_NORMAL_NOCACHE PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_DEVICE_BASE, PERIPH_DEVICE_SIZE, MMU_INITIAL_MAP_DEVICE PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_CACHED_BASE, PERIPH_CACHED_SIZE, MMU_DESCRIPTOR_KERNEL_L1_PTE_FLAGS PAGE_TABLE_SET PERIPH_PMM_BASE, PERIPH_UNCACHED_BASE, PERIPH_UNCACHED_SIZE, MMU_INITIAL_MAP_STRONGLY_ORDERED @@ -161,7 +178,6 @@ reloc_img_to_bottom_done: add r4, r4, r11 ldr r4, [r4] add r4, r4, r11 /* r4: jump pagetable paddr */ - bl page_table_clear /* build 1M section mapping, in order to jump va during turing on mmu:pa == pa, va == pa */ mov r6, pc @@ -246,14 +262,11 @@ warm_reset: bne cpu_start clear_bss: - ldr r1, =__bss_start + ldr r0, =__bss_start ldr r2, =__bss_end - mov r0, #0 - -bss_loop: - cmp r1, r2 - strlo r0, [r1], #4 - blo bss_loop + mov r1, #0 + sub r2, r2, r0 + bl memset #if defined(LOSCFG_CC_STACKPROTECTOR_ALL) || \ defined(LOSCFG_CC_STACKPROTECTOR_STRONG) || \ @@ -339,20 +352,6 @@ sp_set: mov sp, r2 bx lr /* set sp */ -/* - * r4: page table base address - * r5 and r6 will be used as variable - */ -page_table_clear: - mov r5, #0 - mov r6, #0 -0: - str r5, [r4, r6, lsl #2] - add r6, #1 - cmp r6, #0x1000 /* r6 < 4096 */ - blt 0b - bx lr - /* * r4: page table base address * r6: physical address diff --git a/arch/arm/arm/src/strncpy_from_user.c b/arch/arm/arm/src/strncpy_from_user.c old mode 100644 new mode 100755 index 0e307f64..352b9310 --- a/arch/arm/arm/src/strncpy_from_user.c +++ b/arch/arm/arm/src/strncpy_from_user.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/strnlen_user.c b/arch/arm/arm/src/strnlen_user.c old mode 100644 new mode 100755 index b34d090b..4da0bf49 --- a/arch/arm/arm/src/strnlen_user.c +++ b/arch/arm/arm/src/strnlen_user.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/arm/src/user_copy.c b/arch/arm/arm/src/user_copy.c old mode 100644 new mode 100755 index 13e23baa..f1016f00 --- a/arch/arm/arm/src/user_copy.c +++ b/arch/arm/arm/src/user_copy.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/in_cksum.h b/arch/arm/include/in_cksum.h old mode 100644 new mode 100755 index 8920b1df..e86c4966 --- a/arch/arm/include/in_cksum.h +++ b/arch/arm/include/in_cksum.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_exc.h b/arch/arm/include/los_exc.h old mode 100644 new mode 100755 index 62cbe6ff..807bcb2f --- a/arch/arm/include/los_exc.h +++ b/arch/arm/include/los_exc.h @@ -1,233 +1,251 @@ -/* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, 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. - */ - -/** - * @defgroup los_exc Exception handling - * @ingroup kernel - */ -#ifndef _LOS_EXC_H -#define _LOS_EXC_H - -#include "los_typedef.h" -#include "arch_config.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -/** - * @ingroup los_exc - * Register information structure - * - * Description: register information stored when an exception occurs on an LPC2458 platform. - * - * Note: The following register names without uw are the register names used in the chip manual. - */ -#ifdef LOSCFG_ARCH_ARM_AARCH64 -#define EXC_GEN_REGS_NUM 30 -typedef struct { - UINT64 X[EXC_GEN_REGS_NUM]; /**< Register X0-X29 */ - UINT64 LR; /**< Program returning address. X30 */ - UINT64 SP; - UINT64 regELR; - UINT64 SPSR; -} ExcContext; -#else -typedef struct { - UINT32 USP; /**< User mode stack pointer */ - UINT32 ULR; /**< User mode program returning address */ - UINT32 regCPSR; /**< Current program status register (CPSR) */ - UINT32 R0; /**< Register R0 */ - UINT32 R1; /**< Register R1 */ - UINT32 R2; /**< Register R2 */ - UINT32 R3; /**< Register R3 */ - UINT32 R4; /**< Register R4 */ - UINT32 R5; /**< Register R5 */ - UINT32 R6; /**< Register R6 */ - UINT32 R7; /**< Register R7 */ - UINT32 R8; /**< Register R8 */ - UINT32 R9; /**< Register R9 */ - UINT32 R10; /**< Register R10 */ - UINT32 R11; /**< Register R11 */ - UINT32 R12; /**< Register R12 */ - UINT32 SP; /**< Stack pointer */ - UINT32 LR; /**< Program returning address. */ - UINT32 PC; /**< PC pointer of the exceptional function */ -} ExcContext; -#endif - -/** - * @ingroup los_exc - * Exception information structure - * - * Description: exception information stored when an exception occurs on an LPC2458 platform. - * - */ -typedef struct { - UINT16 phase; /**< Phase in which an exception occurs */ - UINT16 type; /**< Exception type */ - UINT16 nestCnt; /**< Count of nested exception */ - UINT16 reserved; /**< Reserved for alignment */ - ExcContext *context; /**< Hardware context when an exception occurs */ -} ExcInfo; - -/** - * @ingroup los_exc - * @brief Kernel FP Register address obtain function. - * - * @par Description: - * The API is used to obtain the FP Register address. - * @attention None. - * - * @param None. - * - * @retval #UINTPTR The FP Register address. - * - * @par Dependency: - * los_exc.h: the header file that contains the API declaration. - * @see None. - */ -STATIC INLINE UINTPTR Get_Fp(VOID) -{ - UINTPTR regFp; - -#ifdef LOSCFG_ARCH_ARM_AARCH64 - __asm__ __volatile__("mov %0, X29" : "=r"(regFp)); -#else - __asm__ __volatile__("mov %0, fp" : "=r"(regFp)); -#endif - - return regFp; -} - -/** - * @ingroup los_exc - * @brief Define an exception handling function hook. - * - * @par Description: - * This API is used to define the exception handling function hook based on the type of - * the exception handling function and record exceptions. - * @attention None. - * - * @param None. - * - * @retval None. - * - * @par Dependency: - * los_exc.h: the header file that contains the API declaration. - * @see None. - */ -typedef VOID (*EXC_PROC_FUNC)(UINT32, ExcContext *, UINT32, UINT32); - -/** - * @ingroup los_exc - * @brief Register an exception handling hook. - * - * @par Description: - * This API is used to register an exception handling hook. - * @attention If the hook is registered for multiple times, the hook registered at the last time is effective. - * @attention The hook can be registered as NULL, indicating that the hook registration is canceled. - * @param excHook [IN] Type #EXC_PROC_FUNC: hook function. - * - * @retval #LOS_OK The exception handling hook is successfully registered. - * - * @par Dependency: - * los_exc.h: the header file that contains the API declaration. - * @see None. - */ -extern UINT32 LOS_ExcRegHook(EXC_PROC_FUNC excHook); - -/** - * @ingroup los_exc - * @brief Kernel panic function. - * - * @par Description: - * Stack function that prints kernel panics. - * @attention After this function is called and stack information is printed, the system will fail to respond. - * @attention The input parameter can be NULL. - * @param fmt [IN] Type #CHAR* : variadic argument. - * - * @retval #None. - * - * @par Dependency: - * los_exc.h: the header file that contains the API declaration. - * @see None. - */ -VOID LOS_Panic(const CHAR *fmt, ...); - -/** - * @ingroup los_exc - * @brief Kernel backtrace function. - * - * @par Description: - * Backtrace function that prints task call stack information traced from the running task. - * @attention None. - * - * @param None. - * - * @retval #None. - * - * @par Dependency: - * los_exc.h: the header file that contains the API declaration. - * @see None. - */ -extern VOID OsBackTrace(VOID); - -/** - * @ingroup los_exc - * @brief Kernel task backtrace function. - * - * @par Description: - * Backtrace function that prints task call stack information traced from the input task. - * @attention - *
    - *
  • The input taskID should be valid.
  • - *
- * - * @param taskID [IN] Type #UINT32 Task ID. - * - * @retval #None. - * - * @par Dependency: - * los_exc.h: the header file that contains the API declaration. - * @see None. - */ -extern VOID OsTaskBackTrace(UINT32 taskID); - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -#endif /* _LOS_EXC_H */ +/* + * 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. + */ + +/** + * @defgroup los_exc Exception handling + * @ingroup kernel + */ +#ifndef _LOS_EXC_H +#define _LOS_EXC_H + +#include "los_typedef.h" +#include "arch_config.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +/** + * @ingroup los_exc + * Register information structure + * + * Description: register information stored when an exception occurs on an LPC2458 platform. + * + * Note: The following register names without uw are the register names used in the chip manual. + */ +#ifdef LOSCFG_ARCH_ARM_AARCH64 +#define EXC_GEN_REGS_NUM 30 +typedef struct { + UINT64 X[EXC_GEN_REGS_NUM]; /**< Register X0-X29 */ + UINT64 LR; /**< Program returning address. X30 */ + UINT64 SP; + UINT64 regELR; + UINT64 SPSR; +} ExcContext; +#else +typedef struct { + UINT32 USP; /**< User mode stack pointer */ + UINT32 ULR; /**< User mode program returning address */ + UINT32 regCPSR; /**< Current program status register (CPSR) */ + UINT32 R0; /**< Register R0 */ + UINT32 R1; /**< Register R1 */ + UINT32 R2; /**< Register R2 */ + UINT32 R3; /**< Register R3 */ + UINT32 R4; /**< Register R4 */ + UINT32 R5; /**< Register R5 */ + UINT32 R6; /**< Register R6 */ + UINT32 R7; /**< Register R7 */ + UINT32 R8; /**< Register R8 */ + UINT32 R9; /**< Register R9 */ + UINT32 R10; /**< Register R10 */ + UINT32 R11; /**< Register R11 */ + UINT32 R12; /**< Register R12 */ + UINT32 SP; /**< Stack pointer */ + UINT32 LR; /**< Program returning address. */ + UINT32 PC; /**< PC pointer of the exceptional function */ +} ExcContext; +#endif + +/** + * @ingroup los_exc + * Exception information structure + * + * Description: exception information stored when an exception occurs on an LPC2458 platform. + * + */ +typedef struct { + UINT16 phase; /**< Phase in which an exception occurs */ + UINT16 type; /**< Exception type */ + UINT16 nestCnt; /**< Count of nested exception */ + UINT16 reserved; /**< Reserved for alignment */ + ExcContext *context; /**< Hardware context when an exception occurs */ +} ExcInfo; + +/** + * @ingroup los_exc + * @brief Kernel FP Register address obtain function. + * + * @par Description: + * The API is used to obtain the FP Register address. + * @attention None. + * + * @param None. + * + * @retval #UINTPTR The FP Register address. + * + * @par Dependency: + * los_exc.h: the header file that contains the API declaration. + * @see None. + */ +STATIC INLINE UINTPTR Get_Fp(VOID) +{ + UINTPTR regFp; + +#ifdef LOSCFG_ARCH_ARM_AARCH64 + __asm__ __volatile__("mov %0, X29" : "=r"(regFp)); +#else + __asm__ __volatile__("mov %0, fp" : "=r"(regFp)); +#endif + + return regFp; +} + +/** + * @ingroup los_exc + * @brief Define an exception handling function hook. + * + * @par Description: + * This API is used to define the exception handling function hook based on the type of + * the exception handling function and record exceptions. + * @attention None. + * + * @param None. + * + * @retval None. + * + * @par Dependency: + * los_exc.h: the header file that contains the API declaration. + * @see None. + */ +typedef VOID (*EXC_PROC_FUNC)(UINT32, ExcContext *, UINT32, UINT32); + +/** + * @ingroup los_exc + * @brief Register an exception handling hook. + * + * @par Description: + * This API is used to register an exception handling hook. + * @attention If the hook is registered for multiple times, the hook registered at the last time is effective. + * @attention The hook can be registered as NULL, indicating that the hook registration is canceled. + * @param excHook [IN] Type #EXC_PROC_FUNC: hook function. + * + * @retval #LOS_OK The exception handling hook is successfully registered. + * + * @par Dependency: + * los_exc.h: the header file that contains the API declaration. + * @see None. + */ +extern UINT32 LOS_ExcRegHook(EXC_PROC_FUNC excHook); + +/** + * @ingroup los_exc + * @brief Kernel panic function. + * + * @par Description: + * Stack function that prints kernel panics. + * @attention After this function is called and stack information is printed, the system will fail to respond. + * @attention The input parameter can be NULL. + * @param fmt [IN] Type #CHAR* : variadic argument. + * + * @retval #None. + * + * @par Dependency: + * los_exc.h: the header file that contains the API declaration. + * @see None. + */ +VOID LOS_Panic(const CHAR *fmt, ...); + +/** + * @ingroup los_exc + * @brief record LR function. + * + * @par Description: + * @attention + * @param LR [IN] Type #UINTPTR * LR buffer. + * @param recordCount [IN] Type UINT32 record LR lay number. + * @param jumpCount [IN] Type UINT32 ignore LR lay number. + * + * @retval #None. + * + * @par Dependency: + * los_exc.h: the header file that contains the API declaration. + * @see None. + */ +VOID LOS_RecordLR(UINTPTR *LR, UINT32 LRSize, UINT32 recordCount, UINT32 jumpCount); + +/** + * @ingroup los_exc + * @brief Kernel backtrace function. + * + * @par Description: + * Backtrace function that prints task call stack information traced from the running task. + * @attention None. + * + * @param None. + * + * @retval #None. + * + * @par Dependency: + * los_exc.h: the header file that contains the API declaration. + * @see None. + */ +extern VOID OsBackTrace(VOID); + +/** + * @ingroup los_exc + * @brief Kernel task backtrace function. + * + * @par Description: + * Backtrace function that prints task call stack information traced from the input task. + * @attention + *
    + *
  • The input taskID should be valid.
  • + *
+ * + * @param taskID [IN] Type #UINT32 Task ID. + * + * @retval #None. + * + * @par Dependency: + * los_exc.h: the header file that contains the API declaration. + * @see None. + */ +extern VOID OsTaskBackTrace(UINT32 taskID); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif /* _LOS_EXC_H */ diff --git a/arch/arm/include/los_hw.h b/arch/arm/include/los_hw.h old mode 100644 new mode 100755 index c9d5825c..ad30d5a1 --- a/arch/arm/include/los_hw.h +++ b/arch/arm/include/los_hw.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_hw_arch.h b/arch/arm/include/los_hw_arch.h index f7bd812a..3539d928 100644 --- a/arch/arm/include/los_hw_arch.h +++ b/arch/arm/include/los_hw_arch.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_hw_tick_pri.h b/arch/arm/include/los_hw_tick_pri.h index 98a7296b..1b893176 100644 --- a/arch/arm/include/los_hw_tick_pri.h +++ b/arch/arm/include/los_hw_tick_pri.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_hwi.h b/arch/arm/include/los_hwi.h old mode 100644 new mode 100755 index b8bcadb9..cee783dc --- a/arch/arm/include/los_hwi.h +++ b/arch/arm/include/los_hwi.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -339,6 +339,23 @@ STATIC INLINE VOID LOS_IntRestore(UINT32 intSave) ArchIntRestore(intSave); } +/** + * @ingroup los_hwi + * @brief Gets the maximum number of interrupts supported by the system. + * + * @par Description: + *
    + *
  • This API is used to gets the maximum number of interrupts supported by the system.
  • + *
+ * + * @param None. + * + * @retval None. + * @par Dependency: + *
  • los_hwi.h: the header file that contains the API declaration.
+ */ +extern UINT32 LOS_GetSystemHwiMaximum(VOID); + /** * @ingroup los_hwi * @brief Create a hardware interrupt. diff --git a/arch/arm/include/los_strncpy_from_user.h b/arch/arm/include/los_strncpy_from_user.h old mode 100644 new mode 100755 index 764be8a2..58d68d9b --- a/arch/arm/include/los_strncpy_from_user.h +++ b/arch/arm/include/los_strncpy_from_user.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_strnlen_user.h b/arch/arm/include/los_strnlen_user.h old mode 100644 new mode 100755 index 5c90d590..29c3e679 --- a/arch/arm/include/los_strnlen_user.h +++ b/arch/arm/include/los_strnlen_user.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_sys_stack_pri.h b/arch/arm/include/los_sys_stack_pri.h index 0dbc46d1..e45e4a66 100644 --- a/arch/arm/include/los_sys_stack_pri.h +++ b/arch/arm/include/los_sys_stack_pri.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_user_get.h b/arch/arm/include/los_user_get.h old mode 100644 new mode 100755 index 883d299e..2ce55a01 --- a/arch/arm/include/los_user_get.h +++ b/arch/arm/include/los_user_get.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/los_user_put.h b/arch/arm/include/los_user_put.h old mode 100644 new mode 100755 index bec15dae..c0251623 --- a/arch/arm/include/los_user_put.h +++ b/arch/arm/include/los_user_put.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/arm/include/user_copy.h b/arch/arm/include/user_copy.h old mode 100644 new mode 100755 index 955634ec..293d4e34 --- a/arch/arm/include/user_copy.h +++ b/arch/arm/include/user_copy.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/arch/cpu.mk b/arch/cpu.mk index c1af11ac..856099ef 100644 --- a/arch/cpu.mk +++ b/arch/cpu.mk @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/bsd/Kconfig b/bsd/Kconfig old mode 100644 new mode 100755 diff --git a/bsd/Makefile b/bsd/Makefile index 9540092d..a5c0d1ff 100644 --- a/bsd/Makefile +++ b/bsd/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/bsd/compat/linuxkpi/Makefile b/bsd/compat/linuxkpi/Makefile old mode 100644 new mode 100755 index be7ffc70..1b270ae1 --- a/bsd/compat/linuxkpi/Makefile +++ b/bsd/compat/linuxkpi/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/bsd/dev/usb/Kconfig b/bsd/dev/usb/Kconfig old mode 100644 new mode 100755 diff --git a/bsd/dev/usb/Makefile b/bsd/dev/usb/Makefile old mode 100644 new mode 100755 index 5eaa4120..a0fb6e88 --- a/bsd/dev/usb/Makefile +++ b/bsd/dev/usb/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -28,6 +28,7 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. include $(LITEOSTOPDIR)/config.mk +include $(LITEOSTOPDIR)/../../drivers/adapter/khdf/liteos/lite.mk MODULE_NAME := usb_base @@ -120,12 +121,20 @@ ifeq ($(LOSCFG_DRIVERS_USB_MASS_STORAGE), y) LOCAL_SRCS += $(STORAGE_SRC)/umass.c endif -ifeq ($(LOSCFG_DRIVERS_USB_HID_CLASS), y) +ifeq ($(LOSCFG_DRIVERS_USB_HID_CLASS)_$(LOSCFG_DRIVERS_HDF_INPUT), y_y) +LOCAL_FLAGS += -I$(LITEOSTOPDIR)/../../drivers/framework/model/input/driver \ + -I$(LITEOSTOPDIR)/../../drivers/framework/include/core \ + -I$(LITEOSTOPDIR)/../../drivers/framework/core/common/include/host \ + -I$(LITEOSTOPDIR)/../../drivers/framework/utils \ + -I$(LITEOSTOPDIR)/../../drivers/framework/osal \ + -I$(LITEOSTOPDIR)/../../drivers/framework/ability/sbuf/include \ + -I$(LITEOSTOPDIR)/../../drivers/framework/include/osal \ + -I$(LITEOSTOPDIR)/../../third_party/FreeBSD/sys/dev/evdev + LOCAL_SRCS += $(INPUT_SRC)/uhid.c \ $(CORE_SRC)/usb_hid.c endif LOCAL_FLAGS += $(LITEOS_GCOV_OPTS) -include $(MODULE) - +include $(HDF_DRIVER) diff --git a/build.sh b/build.sh index bcdf9009..6ad37db5 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,7 @@ #!/bin/bash # -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -30,20 +30,26 @@ # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. set -e -echo "sh param:$1,$2,$3" -source="tools/build/config/$1_release.config" +echo "sh param:$1,$2,$3,$4,$5,$6,$7" destination=".config" +tee="" +outdir="../..$3/test_info/gen/kernel/test" +if [ "$5" = "tee" ]; then + tee="_tee" +fi +productName="$(basename $7)" +source="tools/build/config/${productName}_release.config" if [ "$2" = "clang" ]; then - if [ "$3" = "debug" ]; then - source="tools/build/config/debug/$1_$2.config" + if [ "$4" = "debug" ]; then + source="tools/build/config/debug/${productName}_$2$tee.config" else - source="tools/build/config/$1_$2_release.config" + source="tools/build/config/${productName}_$2_release$tee.config" fi elif [ "$2" = "gcc" ]; then - if [ "$3" = "debug" ]; then - source="tools/build/config/$1_debug_shell.config" + if [ "$4" = "debug" ]; then + source="tools/build/config/${productName}_debug_shell$tee.config" else - source="tools/build/config/$1_release.config" + source="tools/build/config/${productName}_release$tee.config" fi fi if [ -d "./out" ]; then @@ -53,3 +59,7 @@ if [ -f "$destination" ]; then rm -rf $destination fi cp $source $destination + +mkdir -p $outdir +cp kernel_test.sources $outdir + diff --git a/compat/posix/Kconfig b/compat/posix/Kconfig old mode 100644 new mode 100755 diff --git a/compat/posix/Makefile b/compat/posix/Makefile index 02c6cc9f..c9cd39b0 100644 --- a/compat/posix/Makefile +++ b/compat/posix/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/compat/posix/include/mqueue.h b/compat/posix/include/mqueue.h old mode 100644 new mode 100755 index c32b158d..eb58bd06 --- a/compat/posix/include/mqueue.h +++ b/compat/posix/include/mqueue.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -43,6 +43,9 @@ #include "limits.h" #include "los_typedef.h" #include "time.h" +#include +#include +#include #include "los_queue_pri.h" @@ -71,11 +74,23 @@ extern "C" { /* not suppurt prio */ #define MQ_PRIO_MAX 1 +typedef union send_receive_t { + unsigned oth : 3; + unsigned grp : 6; + unsigned usr : 9; + short data; +} mode_s; + /* TYPE DEFINITIONS */ struct mqarray { UINT32 mq_id : 31; UINT32 unlinkflag : 1; char *mq_name; + UINT32 unlink_ref; + mode_s mode_data; /* mode data of mqueue */ + uid_t euid; /* euid of mqueue */ + gid_t egid; /* egid of mqueue */ + fd_set mq_fdset; /* mqueue sysFd bit map */ LosQueueCB *mqcb; struct mqpersonal *mq_personal; }; @@ -84,7 +99,9 @@ struct mqpersonal { struct mqarray *mq_posixdes; struct mqpersonal *mq_next; int mq_flags; + int mq_mode; /* Mode of mqueue */ UINT32 mq_status; + UINT32 mq_refcount; }; /** @@ -400,6 +417,8 @@ extern int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, extern ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int *msgPrio, const struct timespec *absTimeout); +extern void mqueue_refer(int sysFd); + #ifdef __cplusplus #if __cplusplus } diff --git a/compat/posix/include/time_posix.h b/compat/posix/include/time_posix.h old mode 100644 new mode 100755 index 0665d21b..6f8f537d --- a/compat/posix/include/time_posix.h +++ b/compat/posix/include/time_posix.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/map_error.c b/compat/posix/src/map_error.c index d2cdf013..31435f7d 100644 --- a/compat/posix/src/map_error.c +++ b/compat/posix/src/map_error.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/map_error.h b/compat/posix/src/map_error.h index 4731a32c..935b2d5e 100644 --- a/compat/posix/src/map_error.h +++ b/compat/posix/src/map_error.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/misc.c b/compat/posix/src/misc.c old mode 100644 new mode 100755 index 98152931..3e623674 --- a/compat/posix/src/misc.c +++ b/compat/posix/src/misc.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/mqueue.c b/compat/posix/src/mqueue.c old mode 100644 new mode 100755 index 0aa2705d..588ae112 --- a/compat/posix/src/mqueue.c +++ b/compat/posix/src/mqueue.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -36,6 +36,8 @@ #include "time_posix.h" #include "los_memory.h" #include "los_vm_map.h" +#include "los_process_pri.h" +#include "fs_file.h" #include "user_copy.h" #ifdef __cplusplus @@ -46,9 +48,14 @@ extern "C" { #define FNONBLOCK O_NONBLOCK +#ifndef MAX_MQ_FD +#define MAX_MQ_FD CONFIG_NQUEUE_DESCRIPTORS +#endif + /* GLOBALS */ STATIC struct mqarray g_queueTable[LOSCFG_BASE_IPC_QUEUE_LIMIT]; STATIC pthread_mutex_t g_mqueueMutex = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP; +STATIC struct mqpersonal *g_mqPrivBuf[MAX_MQ_FD]; /* LOCAL FUNCTIONS */ STATIC INLINE INT32 MqNameCheck(const CHAR *mqName) @@ -100,7 +107,6 @@ STATIC INLINE struct mqarray *GetMqueueCBByName(const CHAR *name) return &(g_queueTable[index]); } } - return NULL; } @@ -114,6 +120,10 @@ STATIC INT32 DoMqueueDelete(struct mqarray *mqueueCB) } mqueueCB->mqcb = NULL; + /* When mqueue-list head node needed free ,reset the mode_data */ + mqueueCB->mode_data.data = 0; + mqueueCB->euid = -1; + mqueueCB->egid = -1; ret = LOS_QueueDelete(mqueueCB->mq_id); switch (ret) { @@ -152,7 +162,7 @@ STATIC int SaveMqueueName(const CHAR *mqName, struct mqarray *mqueueCB) return LOS_OK; } -STATIC struct mqpersonal *DoMqueueCreate(const struct mq_attr *attr, const CHAR *mqName, INT32 openFlag) +STATIC struct mqpersonal *DoMqueueCreate(const struct mq_attr *attr, const CHAR *mqName, INT32 openFlag, UINT32 mode) { struct mqarray *mqueueCB = NULL; UINT32 mqueueID; @@ -191,10 +201,13 @@ STATIC struct mqpersonal *DoMqueueCreate(const struct mq_attr *attr, const CHAR } mqueueCB->unlinkflag = FALSE; + mqueueCB->unlink_ref = 0; mqueueCB->mq_personal->mq_status = MQ_USE_MAGIC; mqueueCB->mq_personal->mq_next = NULL; mqueueCB->mq_personal->mq_posixdes = mqueueCB; mqueueCB->mq_personal->mq_flags = (INT32)((UINT32)openFlag | ((UINT32)attr->mq_flags & (UINT32)FNONBLOCK)); + mqueueCB->mq_personal->mq_mode = mode; + mqueueCB->mq_personal->mq_refcount = 0; return mqueueCB->mq_personal; ERROUT: @@ -228,6 +241,7 @@ STATIC struct mqpersonal *DoMqueueOpen(struct mqarray *mqueueCB, INT32 openFlag) privateMqPersonal->mq_posixdes = mqueueCB; privateMqPersonal->mq_flags = openFlag; privateMqPersonal->mq_status = MQ_USE_MAGIC; + privateMqPersonal->mq_refcount = 0; return privateMqPersonal; @@ -235,14 +249,226 @@ ERROUT: return (struct mqpersonal *)-1; } +/* Translate a sysFd into privateMqPersonal */ +STATIC struct mqpersonal *MqGetPrivDataBuff(mqd_t personal) +{ + INT32 sysFd = (INT32)personal; + INT32 id = sysFd - MQUEUE_FD_OFFSET; + + /* Filter illegal id */ + if ((id < 0) || (id >= MAX_MQ_FD)) { + errno = EBADF; + return NULL; + } + return g_mqPrivBuf[id]; +} + +/** + * Alloc sysFd, storage mq private data, set using bit. + * + * @param maxfdp: Maximum allowed application of mqueue sysFd. + * @param fdset: Mqueue sysFd bit map. + * @param privateMqPersonal: Private data. + * @return the index of the new fd; -1 on error + */ +STATIC INT32 MqAllocSysFd(int maxfdp, struct mqpersonal *privateMqPersonal) +{ + INT32 i; + struct mqarray *mqueueCB = privateMqPersonal->mq_posixdes; + fd_set *fdset = &mqueueCB->mq_fdset; + for (i = 0; i < maxfdp; i++) { + /* sysFd: used bit setting, and get the index of swtmrID buffer */ + if (!(fdset && FD_ISSET(i + MQUEUE_FD_OFFSET, fdset))) { + FD_SET(i + MQUEUE_FD_OFFSET, fdset); + if (!g_mqPrivBuf[i]) { + g_mqPrivBuf[i] = mqueueCB->mq_personal; + return i + MQUEUE_FD_OFFSET; + } + } + } + /* there are no more mq sysFd to use, free the personal */ + LOS_MemFree(OS_SYS_MEM_ADDR, privateMqPersonal); + privateMqPersonal = NULL; + mqueueCB->mq_personal = NULL; + return -1; +} + +STATIC VOID MqFreeSysFd(struct mqarray *mqueueCB, mqd_t personal) +{ + INT32 sysFd = (INT32)personal; + fd_set *fdset = &mqueueCB->mq_fdset; + if (fdset && FD_ISSET(sysFd, fdset)) { + FD_CLR(sysFd, fdset); + g_mqPrivBuf[sysFd - MQUEUE_FD_OFFSET] = NULL; + } +} + +/* Mqueue fd reference count */ +void mqueue_refer(int sysFd) +{ + struct mqarray *mqueueCB = NULL; + struct mqpersonal *privateMqPersonal = NULL; + + (VOID)pthread_mutex_lock(&g_mqueueMutex); + /* Get the personal sysFd and reset personal fd -1 */ + privateMqPersonal = MqGetPrivDataBuff((mqd_t)sysFd); + if (privateMqPersonal == NULL) { + goto OUT_UNLOCK; + } + mqueueCB = privateMqPersonal->mq_posixdes; + if (mqueueCB == NULL) { + goto OUT_UNLOCK; + } + privateMqPersonal->mq_refcount++; + mqueueCB->unlink_ref++; +OUT_UNLOCK: + (VOID)pthread_mutex_unlock(&g_mqueueMutex); +} + +STATIC INT32 MqTryClose(struct mqpersonal *privateMqPersonal) +{ + struct mqarray *mqueueCB = NULL; + mqueueCB = privateMqPersonal->mq_posixdes; + if (mqueueCB == NULL) { + errno = ENFILE; + return false; + } + + if (privateMqPersonal->mq_refcount == 0) { + return TRUE; + } + privateMqPersonal->mq_refcount--; + return FALSE; +} + +STATIC INT32 MqTryUnlink(struct mqarray *mqueueCB) +{ + if (mqueueCB->unlink_ref == 0) { + return TRUE; + } + mqueueCB->unlink_ref--; + return FALSE; +} + +/* Set the mode data bit,for consumer's mode comparing. */ +STATIC INT32 MqueueModeAnalysisSet(struct mqpersonal *privateMqPersonal) +{ + UINT32 mode; + UINT32 intSave; + User *user = NULL; + struct mqarray *mqueueCB = NULL; + + if ((INT32)(UINTPTR)privateMqPersonal < 0) { + return -1; + } + /* Get mqueueCB of first time creating mqueue */ + mqueueCB = privateMqPersonal->mq_posixdes; + if (mqueueCB == NULL) { + errno = ENFILE; + return -1; + } + + mode = mqueueCB->mq_personal->mq_mode; + /* Set mqueue gid uid */ + SCHEDULER_LOCK(intSave); + user = OsCurrUserGet(); + mqueueCB->euid = user->effUserID; + mqueueCB->egid = user->effGid; + SCHEDULER_UNLOCK(intSave); + + /* Set mode data bit */ + if (mode & S_IRUSR) { + mqueueCB->mode_data.usr |= S_IRUSR; + } + if (mode & S_IWUSR) { + mqueueCB->mode_data.usr |= S_IWUSR; + } + if (mode & S_IRGRP) { + mqueueCB->mode_data.grp |= S_IRGRP; + } + if (mode & S_IWGRP) { + mqueueCB->mode_data.grp |= S_IWGRP; + } + if (mode & S_IROTH) { + mqueueCB->mode_data.oth |= S_IROTH; + } + if (mode & S_IWOTH) { + mqueueCB->mode_data.oth |= S_IWOTH; + } + return 0; +} + +STATIC INT32 GetPermissionOfVisitor(struct mqarray *mqueueCB) +{ + uid_t euid; + gid_t egid; + UINT32 intSave; + User *user = NULL; + + if (mqueueCB == NULL) { + errno = ENOENT; + return -EPERM; + } + + /* Get the visitor process euid and egid */ + SCHEDULER_LOCK(intSave); + user = OsCurrUserGet(); + euid = user->effUserID; + egid = user->effGid; + SCHEDULER_UNLOCK(intSave); + + /* root */ + if (euid == 0) { + return ENOERR; + } + if (euid == mqueueCB->euid) { /* usr */ + if (!((mqueueCB->mode_data.usr & S_IRUSR) || (mqueueCB->mode_data.usr & S_IWUSR))) { + errno = EACCES; + goto ERR_OUT; + } + } else if (egid == mqueueCB->egid) { /* grp */ + if (!((mqueueCB->mode_data.grp & S_IRGRP) || (mqueueCB->mode_data.grp & S_IWGRP))) { + errno = EACCES; + goto ERR_OUT; + } + } else { /* oth */ + if (!((mqueueCB->mode_data.oth & S_IROTH) || (mqueueCB->mode_data.oth & S_IWOTH))) { + errno = EACCES; + goto ERR_OUT; + } + } + return ENOERR; + +ERR_OUT: + return -EPERM; +} + +STATIC INT32 GetMqueueAttr(struct mq_attr *defaultAttr, struct mq_attr *attr) +{ + if (attr != NULL) { + if (LOS_ArchCopyFromUser(defaultAttr, attr, sizeof(struct mq_attr))) { + errno = EFAULT; + return -1; + } + if ((defaultAttr->mq_maxmsg < 0) || (defaultAttr->mq_maxmsg > (long int)USHRT_MAX) || + (defaultAttr->mq_msgsize < 0) || (defaultAttr->mq_msgsize > (long int)(USHRT_MAX - sizeof(UINT32)))) { + errno = EINVAL; + return -1; + } + } + return 0; +} + mqd_t mq_open(const char *mqName, int openFlag, ...) { struct mqarray *mqueueCB = NULL; struct mqpersonal *privateMqPersonal = (struct mqpersonal *)-1; struct mq_attr *attr = NULL; struct mq_attr defaultAttr = { 0, MQ_MAX_MSG_NUM, MQ_MAX_MSG_LEN, 0 }; - int retVal; va_list ap; + int sysFd; + mqd_t mqFd = -1; + unsigned int mode = 0; if (MqNameCheck(mqName) == -1) { return (mqd_t)-1; @@ -259,56 +485,62 @@ mqd_t mq_open(const char *mqName, int openFlag, ...) privateMqPersonal = DoMqueueOpen(mqueueCB, openFlag); } else { va_start(ap, openFlag); - (VOID)va_arg(ap, int); + mode = va_arg(ap, unsigned int); attr = va_arg(ap, struct mq_attr *); va_end(ap); - if (attr != NULL) { - retVal = LOS_ArchCopyFromUser(&defaultAttr, attr, sizeof(struct mq_attr)); - if (retVal != 0) { - errno = EFAULT; - goto OUT; - } - if ((defaultAttr.mq_maxmsg < 0) || (defaultAttr.mq_maxmsg > (long int)USHRT_MAX) || - (defaultAttr.mq_msgsize < 0) || (defaultAttr.mq_msgsize > (long int)(USHRT_MAX - sizeof(UINT32)))) { - errno = EINVAL; - goto OUT; - } + if (GetMqueueAttr(&defaultAttr, attr)) { + goto OUT; } - privateMqPersonal = DoMqueueCreate(&defaultAttr, mqName, openFlag); + privateMqPersonal = DoMqueueCreate(&defaultAttr, mqName, openFlag, mode); + } + /* Set mode data bit ,just for the first node */ + if (MqueueModeAnalysisSet(privateMqPersonal)) { + goto OUT; } } else { - if (mqueueCB == NULL) { - errno = ENOENT; + if (GetPermissionOfVisitor(mqueueCB)) { goto OUT; } privateMqPersonal = DoMqueueOpen(mqueueCB, openFlag); } - OUT: + if ((INT32)(UINTPTR)privateMqPersonal > 0) { + /* alloc sysFd */ + sysFd = MqAllocSysFd(MAX_MQ_FD, privateMqPersonal); + if (sysFd == -1) { + errno = ENFILE; + } + mqFd = (mqd_t)sysFd; + } (VOID)pthread_mutex_unlock(&g_mqueueMutex); - return (mqd_t)privateMqPersonal; + return mqFd; } int mq_close(mqd_t personal) { - INT32 ret = 0; + INT32 ret = -1; struct mqarray *mqueueCB = NULL; struct mqpersonal *privateMqPersonal = NULL; struct mqpersonal *tmp = NULL; - if (!LOS_IsKernelAddressRange(personal, sizeof(struct mqpersonal))) { - errno = EBADF; - return -1; + (VOID)pthread_mutex_lock(&g_mqueueMutex); + + /* Get the personal sysFd and reset personal fd -1 */ + privateMqPersonal = MqGetPrivDataBuff(personal); + if (privateMqPersonal == NULL) { + goto OUT_UNLOCK; } - (VOID)pthread_mutex_lock(&g_mqueueMutex); - privateMqPersonal = (struct mqpersonal *)personal; if (privateMqPersonal->mq_status != MQ_USE_MAGIC) { errno = EBADF; goto OUT_UNLOCK; } - + /* there have other thread used the fd */ + if (!MqTryClose(privateMqPersonal)) { + ret = 0; + goto OUT_UNLOCK; + } mqueueCB = privateMqPersonal->mq_posixdes; if (mqueueCB->mq_personal == NULL) { errno = EBADF; @@ -332,6 +564,7 @@ int mq_close(mqd_t personal) } /* flag no use */ privateMqPersonal->mq_status = 0; + MqFreeSysFd(mqueueCB, personal); /* free the personal */ ret = LOS_MemFree(OS_SYS_MEM_ADDR, privateMqPersonal); @@ -354,8 +587,8 @@ int OsMqGetAttr(mqd_t personal, struct mq_attr *mqAttr) struct mqarray *mqueueCB = NULL; struct mqpersonal *privateMqPersonal = NULL; - if (!LOS_IsKernelAddressRange(personal, sizeof(struct mqpersonal))) { - errno = EBADF; + privateMqPersonal = MqGetPrivDataBuff(personal); + if (privateMqPersonal == NULL) { return -1; } @@ -365,7 +598,6 @@ int OsMqGetAttr(mqd_t personal, struct mq_attr *mqAttr) } (VOID)pthread_mutex_lock(&g_mqueueMutex); - privateMqPersonal = (struct mqpersonal *)personal; if (privateMqPersonal->mq_status != MQ_USE_MAGIC) { errno = EBADF; (VOID)pthread_mutex_unlock(&g_mqueueMutex); @@ -385,8 +617,8 @@ int OsMqSetAttr(mqd_t personal, const struct mq_attr *mqSetAttr, struct mq_attr { struct mqpersonal *privateMqPersonal = NULL; - if (!LOS_IsKernelAddressRange(personal, sizeof(struct mqpersonal))) { - errno = EBADF; + privateMqPersonal = MqGetPrivDataBuff(personal); + if (privateMqPersonal == NULL) { return -1; } @@ -396,7 +628,6 @@ int OsMqSetAttr(mqd_t personal, const struct mq_attr *mqSetAttr, struct mq_attr } (VOID)pthread_mutex_lock(&g_mqueueMutex); - privateMqPersonal = (struct mqpersonal *)personal; if (privateMqPersonal->mq_status != MQ_USE_MAGIC) { errno = EBADF; (VOID)pthread_mutex_unlock(&g_mqueueMutex); @@ -404,7 +635,7 @@ int OsMqSetAttr(mqd_t personal, const struct mq_attr *mqSetAttr, struct mq_attr } if (mqOldAttr != NULL) { - (VOID)OsMqGetAttr((mqd_t)privateMqPersonal, mqOldAttr); + (VOID)OsMqGetAttr(personal, mqOldAttr); } privateMqPersonal->mq_flags = (INT32)((UINT32)privateMqPersonal->mq_flags & (UINT32)(~FNONBLOCK)); /* clear */ @@ -438,10 +669,13 @@ int mq_unlink(const char *mqName) errno = ENOENT; goto ERROUT_UNLOCK; } - + if (!MqTryUnlink(mqueueCB)) { + (VOID)pthread_mutex_unlock(&g_mqueueMutex); + return 0; + } if (mqueueCB->mq_personal != NULL) { mqueueCB->unlinkflag = TRUE; - } else { + } else if (mqueueCB->unlink_ref == 0) { ret = DoMqueueDelete(mqueueCB); } @@ -476,8 +710,7 @@ STATIC INT32 ConvertTimeout(long flags, const struct timespec *absTimeout, UINT6 STATIC INLINE BOOL MqParamCheck(mqd_t personal, const char *msg, size_t msgLen) { - if (!LOS_IsKernelAddressRange(personal, sizeof(struct mqpersonal))) { - errno = EBADF; + if (personal < 0) { return FALSE; } @@ -507,11 +740,14 @@ int mq_timedsend(mqd_t personal, const char *msg, size_t msgLen, unsigned int ms struct mqpersonal *privateMqPersonal = NULL; OS_MQ_GOTO_ERROUT_IF(!MqParamCheck(personal, msg, msgLen), errno); - OS_MQ_GOTO_ERROUT_IF(msgPrio > (MQ_PRIO_MAX - 1), EINVAL); (VOID)pthread_mutex_lock(&g_mqueueMutex); - privateMqPersonal = (struct mqpersonal *)personal; + privateMqPersonal = MqGetPrivDataBuff(personal); + if (privateMqPersonal == NULL) { + goto ERROUT_UNLOCK; + } + OS_MQ_GOTO_ERROUT_UNLOCK_IF(privateMqPersonal->mq_status != MQ_USE_MAGIC, EBADF); mqueueCB = privateMqPersonal->mq_posixdes; @@ -554,7 +790,10 @@ ssize_t mq_timedreceive(mqd_t personal, char *msg, size_t msgLen, unsigned int * } (VOID)pthread_mutex_lock(&g_mqueueMutex); - privateMqPersonal = (struct mqpersonal *)personal; + privateMqPersonal = MqGetPrivDataBuff(personal); + if (privateMqPersonal == NULL) { + goto ERROUT_UNLOCK; + } if (privateMqPersonal->mq_status != MQ_USE_MAGIC) { errno = EBADF; goto ERROUT_UNLOCK; diff --git a/compat/posix/src/posix_memalign.c b/compat/posix/src/posix_memalign.c index 40af37dd..59e85702 100644 --- a/compat/posix/src/posix_memalign.c +++ b/compat/posix/src/posix_memalign.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/pprivate.h b/compat/posix/src/pprivate.h index e484c81a..85f358ef 100644 --- a/compat/posix/src/pprivate.h +++ b/compat/posix/src/pprivate.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/pthread.c b/compat/posix/src/pthread.c old mode 100644 new mode 100755 index 8312cbb1..4fca2c13 --- a/compat/posix/src/pthread.c +++ b/compat/posix/src/pthread.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -36,6 +36,7 @@ #include "stdio.h" #include "map_error.h" #include "los_process_pri.h" +#include "los_sched_pri.h" #ifdef __cplusplus #if __cplusplus diff --git a/compat/posix/src/pthread_attr.c b/compat/posix/src/pthread_attr.c index ec3764be..736c898a 100644 --- a/compat/posix/src/pthread_attr.c +++ b/compat/posix/src/pthread_attr.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/pthread_cond.c b/compat/posix/src/pthread_cond.c old mode 100644 new mode 100755 index 0f824902..1b9e3203 --- a/compat/posix/src/pthread_cond.c +++ b/compat/posix/src/pthread_cond.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/pthread_mutex.c b/compat/posix/src/pthread_mutex.c old mode 100644 new mode 100755 index d12a3828..b4ab4015 --- a/compat/posix/src/pthread_mutex.c +++ b/compat/posix/src/pthread_mutex.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/sched.c b/compat/posix/src/sched.c index d4841303..feb713d8 100644 --- a/compat/posix/src/sched.c +++ b/compat/posix/src/sched.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/semaphore.c b/compat/posix/src/semaphore.c old mode 100644 new mode 100755 index 425259ba..63039039 --- a/compat/posix/src/semaphore.c +++ b/compat/posix/src/semaphore.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/socket.c b/compat/posix/src/socket.c index f29443dc..23d00cf7 100644 --- a/compat/posix/src/socket.c +++ b/compat/posix/src/socket.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/compat/posix/src/time.c b/compat/posix/src/time.c old mode 100644 new mode 100755 index d3a42f4e..462ea7c0 --- a/compat/posix/src/time.c +++ b/compat/posix/src/time.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -30,7 +30,6 @@ */ #include "time.h" -#include "asm/hal_platform_ints.h" #include "stdint.h" #include "stdio.h" #include "sys/times.h" @@ -744,7 +743,7 @@ int timer_settime(timer_t timerID, int flags, swtmr->ucMode = interval ? LOS_SWTMR_MODE_OPP : LOS_SWTMR_MODE_NO_SELFDELETE; swtmr->uwExpiry = expiry + !!expiry; // PS: skip the first tick because it is NOT a full tick. swtmr->uwInterval = interval; - swtmr->ucOverrun = 0; + swtmr->uwOverrun = 0; LOS_SpinUnlockRestore(&g_swtmrSpin, intSave); if ((value->it_value.tv_sec == 0) && (value->it_value.tv_nsec == 0)) { @@ -813,20 +812,15 @@ int timer_getoverrun(timer_t timerID) return -1; } - overRun = (INT32)(swtmr->ucOverrun); + overRun = (INT32)(swtmr->uwOverrun); return (overRun > DELAYTIMER_MAX) ? DELAYTIMER_MAX : overRun; } -STATIC INT32 DoNanoSleep(UINT64 nseconds) +STATIC INT32 DoNanoSleep(UINT64 useconds) { - UINT64 tick; UINT32 ret; - const UINT32 nsPerTick = OS_SYS_NS_PER_SECOND / LOSCFG_BASE_CORE_TICK_PER_SECOND; - tick = (nseconds + nsPerTick - 1) / nsPerTick; // Round up for ticks - - /* PS: skip the first tick because it is NOT a full tick. */ - ret = LOS_TaskDelay((tick >= UINT32_MAX) ? UINT32_MAX : (tick ? ((UINT32)tick + 1) : 0)); + ret = LOS_TaskDelay(OsUS2Tick(useconds)); if (ret == LOS_OK || ret == LOS_ERRNO_TSK_YIELD_NOT_ENOUGH_TASK) { return 0; } @@ -835,12 +829,12 @@ STATIC INT32 DoNanoSleep(UINT64 nseconds) int usleep(unsigned useconds) { - return DoNanoSleep((UINT64)useconds * OS_SYS_NS_PER_US); + return DoNanoSleep((UINT64)useconds); } int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) { - UINT64 nseconds; + UINT64 useconds; INT32 ret = -1; (VOID)rmtp; @@ -851,14 +845,14 @@ int nanosleep(const struct timespec *rqtp, struct timespec *rmtp) return ret; } - nseconds = (UINT64)rqtp->tv_sec * OS_SYS_NS_PER_SECOND + rqtp->tv_nsec; + useconds = (UINT64)rqtp->tv_sec * OS_SYS_US_PER_SECOND + rqtp->tv_nsec / OS_SYS_NS_PER_US; - return DoNanoSleep(nseconds); + return DoNanoSleep(useconds); } unsigned int sleep(unsigned int seconds) { - return DoNanoSleep((UINT64)seconds * OS_SYS_NS_PER_SECOND); + return DoNanoSleep((UINT64)seconds * OS_SYS_US_PER_SECOND); } double difftime(time_t time2, time_t time1) @@ -879,15 +873,10 @@ clock_t clock(VOID) clock_t times(struct tms *buf) { - clock_t clockTick; + clock_t clockTick = -1; - clockTick = LOS_TickCountGet(); - if (buf != NULL) { - buf->tms_cstime = clockTick; - buf->tms_cutime = clockTick; - buf->tms_stime = clockTick; - buf->tms_utime = clockTick; - } + (void)buf; + set_errno(ENOSYS); return clockTick; } @@ -914,6 +903,12 @@ int setitimer(int which, const struct itimerval *value, struct itimerval *ovalue } } LOS_TaskUnlock(); + + if (!ValidTimeval(&value->it_value) || !ValidTimeval(&value->it_interval)) { + set_errno(EINVAL); + return -1; + } + TIMEVAL_TO_TIMESPEC(&value->it_value, &spec.it_value); TIMEVAL_TO_TIMESPEC(&value->it_interval, &spec.it_interval); diff --git a/config.mk b/config.mk old mode 100644 new mode 100755 index 04f95d53..50fd8877 --- a/config.mk +++ b/config.mk @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: diff --git a/drivers/char/mem/Kconfig b/drivers/char/mem/Kconfig new file mode 100644 index 00000000..7cfed492 --- /dev/null +++ b/drivers/char/mem/Kconfig @@ -0,0 +1,6 @@ +config DRIVERS_MEM + bool "Enable MEM" + default y + depends on DRIVERS && FS_VFS + help + Answer Y to enable LiteOS support mem. \ No newline at end of file diff --git a/drivers/char/mem/Makefile b/drivers/char/mem/Makefile new file mode 100644 index 00000000..4e35bd1b --- /dev/null +++ b/drivers/char/mem/Makefile @@ -0,0 +1,36 @@ +# 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. + +include $(LITEOSTOPDIR)/config.mk + +MODULE_NAME := $(notdir $(shell pwd)) + +LOCAL_SRCS := $(wildcard src/*.c) + +include $(MODULE) diff --git a/kernel/extended/include/los_tickless_pri.h b/drivers/char/mem/include/los_dev_mem.h similarity index 72% rename from kernel/extended/include/los_tickless_pri.h rename to drivers/char/mem/include/los_dev_mem.h index 7116aa8e..cb5989e8 100644 --- a/kernel/extended/include/los_tickless_pri.h +++ b/drivers/char/mem/include/los_dev_mem.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -29,10 +29,10 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _LOS_TICKLESS_PRI_H -#define _LOS_TICKLESS_PRI_H +#ifndef __LOS_DEV_MEM_H__ +#define __LOS_DEV_MEM_H__ -#include "los_tickless.h" +#include "los_typedef.h" #ifdef __cplusplus #if __cplusplus @@ -40,15 +40,7 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -extern VOID OsTickTimerReload(UINT32 period); -extern VOID OsSysTimeUpdate(UINT32 sleepTicks); -extern VOID OsTicklessStart(VOID); -extern BOOL OsTickIrqFlagGet(VOID); -extern VOID OsTickIrqFlagSet(BOOL tickIrqFlag); -extern BOOL OsTicklessFlagGet(VOID); -extern UINT32 OsTicklessSleepTickGet(VOID); -extern VOID OsTicklessSleepTickSet(UINT32 sleeptick); -extern VOID OsTicklessUpdate(UINT32 irqNum); +extern int DevMemRegister(void); #ifdef __cplusplus #if __cplusplus @@ -56,4 +48,4 @@ extern VOID OsTicklessUpdate(UINT32 irqNum); #endif /* __cplusplus */ #endif /* __cplusplus */ -#endif /* _LOS_TICKLESS_PRI_H */ +#endif diff --git a/kernel/base/mem/common/memrecord/los_interto64radix.c b/drivers/char/mem/src/mem.c similarity index 51% rename from kernel/base/mem/common/memrecord/los_interto64radix.c rename to drivers/char/mem/src/mem.c index ecf91dac..df82cd07 100644 --- a/kernel/base/mem/common/memrecord/los_interto64radix.c +++ b/drivers/char/mem/src/mem.c @@ -1,87 +1,108 @@ -/* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, 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. - */ - -#include "los_typedef.h" -#include "los_printf.h" - -#ifdef __cplusplus -#if __cplusplus -extern "C" { -#endif /* __cplusplus */ -#endif /* __cplusplus */ - -/* array used for 64 binary conversion, include 64 characters */ -const CHAR g_base64Array[] = { - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', - 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', - 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', - 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', - 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', - 'Y', 'Z', '~', '!' -}; - -#define LOGARITHM 6 /* the logarithm of 64 to base 2 */ -#define BASE64_MARK ((1U << LOGARITHM) - 1) - -VOID OsDecTo64F(UINT32 num, CHAR *base64, INT32 base64Len) -{ - INT32 len = base64Len - 1; - UINT32 tempNum = num; - if (base64 == NULL) { - PRINT_ERR("%s:%d input null buf\n", __FUNCTION__, __LINE__); - return; - } - - if (base64Len <= 0) { - PRINT_ERR("%s:%d input illegal Len\n", __FUNCTION__, __LINE__); - return; - } - - while (num) { - if (len < 0) { - PRINT_ERR("Len[%d] is too short, input num: %u\n", base64Len, tempNum); - break; - } - base64[len--] = g_base64Array[num & BASE64_MARK]; - num >>= LOGARITHM; - } - for (; len >= 0; len--) { - base64[len] = '0'; - } - base64[base64Len] = '\0'; -} - -#ifdef __cplusplus -#if __cplusplus -} -#endif /* __cplusplus */ -#endif /* __cplusplus */ +/* + * 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. + */ + +#include "fcntl.h" +#include "linux/kernel.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +static int MemOpen(struct file *filep) +{ + return 0; +} + +static int MemClose(struct file *filep) +{ + return 0; +} + +static ssize_t MemRead(FAR struct file *filep, FAR char *buffer, size_t buflen) +{ + return 0; +} + +static ssize_t MemWrite(FAR struct file *filep, FAR const char *buffer, size_t buflen) +{ + return 0; +} + +static ssize_t MemMap(FAR struct file *filep, FAR LosVmMapRegion *region) +{ + size_t size = region->range.size; + PADDR_T paddr = region->pgOff << PAGE_SHIFT; + VADDR_T vaddr = region->range.base; + LosVmSpace *space = LOS_SpaceGet(vaddr); + + if ((paddr >= SYS_MEM_BASE) && (paddr < SYS_MEM_END)) { + return -EINVAL; + } + + /* Peripheral register memory adds strongly ordered attributes */ + region->regionFlags |= VM_MAP_REGION_FLAG_STRONGLY_ORDERED; + + if (space == NULL) { + return -EAGAIN; + } + if (LOS_ArchMmuMap(&space->archMmu, vaddr, paddr, size >> PAGE_SHIFT, region->regionFlags) <= 0) { + return -EAGAIN; + } + + return 0; +} + +static const struct file_operations_vfs g_memDevOps = { + MemOpen, /* open */ + MemClose, /* close */ + MemRead, /* read */ + MemWrite, /* write */ + NULL, /* seek */ + NULL, /* ioctl */ + MemMap, /* mmap */ +#ifndef CONFIG_DISABLE_POLL + NULL, /* poll */ +#endif + NULL, /* unlink */ +}; + +int DevMemRegister(void) +{ + return register_driver("/dev/mem", &g_memDevOps, 0666, 0); /* 0666: file mode */ +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ diff --git a/drivers/char/quickstart/Makefile b/drivers/char/quickstart/Makefile new file mode 100644 index 00000000..4e35bd1b --- /dev/null +++ b/drivers/char/quickstart/Makefile @@ -0,0 +1,36 @@ +# 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. + +include $(LITEOSTOPDIR)/config.mk + +MODULE_NAME := $(notdir $(shell pwd)) + +LOCAL_SRCS := $(wildcard src/*.c) + +include $(MODULE) diff --git a/drivers/char/quickstart/include/los_quick_start.h b/drivers/char/quickstart/include/los_quick_start.h new file mode 100644 index 00000000..c9b97082 --- /dev/null +++ b/drivers/char/quickstart/include/los_quick_start.h @@ -0,0 +1,51 @@ +/* + * 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 __LOS_QUICK_START_H__ +#define __LOS_QUICK_START_H__ + +#include "los_typedef.h" + +fdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +extern int DevQuickStartRegister(void); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif diff --git a/kernel/base/include/los_timeslice_pri.h b/drivers/char/quickstart/include/los_quick_start_pri.h similarity index 67% rename from kernel/base/include/los_timeslice_pri.h rename to drivers/char/quickstart/include/los_quick_start_pri.h index 99f159ca..012b548e 100644 --- a/kernel/base/include/los_timeslice_pri.h +++ b/drivers/char/quickstart/include/los_quick_start_pri.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -29,13 +29,8 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/** - * @defgroup los_timeslice Timeslice - * @ingroup kernel - */ - -#ifndef _LOS_TIMESLICE_PRI_H -#define _LOS_TIMESLICE_PRI_H +#ifndef __LOS_QUICK_START_PRI_H__ +#define __LOS_QUICK_START_PRI_H__ #include "los_typedef.h" @@ -45,28 +40,8 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -/** - * @ingroup los_timeslice - * @brief Check time slices. - * - * @par Description: - *
    - *
  • This API is used to check time slices. If the number of Ticks equals to the time for task switch, - * tasks are switched. Otherwise, the Tick counting continues.
  • - *
- * @attention - *
    - *
  • None.
  • - *
- * - * @param None. - * - * @retval None. - * @par Dependency: - *
  • los_timeslice_pri.h: the header file that contains the API declaration.
- * @see None. - */ -extern VOID OsTimesliceCheck(VOID); +unsigned int OsSystemInitStep2(void); +extern VOID SystemInit2(VOID); #ifdef __cplusplus #if __cplusplus @@ -74,4 +49,4 @@ extern VOID OsTimesliceCheck(VOID); #endif /* __cplusplus */ #endif /* __cplusplus */ -#endif /* _LOS_TIMESLICE_PRI_H */ +#endif /* __LOS_QUICK_START_PRI_H__ */ \ No newline at end of file diff --git a/drivers/char/quickstart/src/qucikstart.c b/drivers/char/quickstart/src/qucikstart.c new file mode 100644 index 00000000..8b4e8a57 --- /dev/null +++ b/drivers/char/quickstart/src/qucikstart.c @@ -0,0 +1,117 @@ +/* + * 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. + */ + +#include "los_quick_start_pri.h" +#include "bits/ioctl.h" +#include "fcntl.h" +#include "linux/kernel.h" + +#define QUICKSTART_IOC_MAGIC 'T' +#define QUICKSTART_INITSTEP2 _IO(QUICKSTART_IOC_MAGIC, 0) +#define QUICKSTART_UNREGISTER _IO(QUICKSTART_IOC_MAGIC, 1) +#define QUICKSTART_NODE "/dev/quickstart" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +static int QuickstartOpen(struct file *filep) +{ + return 0; +} + +static int QuickstartClose(struct file *filep) +{ + return 0; +} + +static void SystemInitStep2(void) +{ + static int once = 0; + /* Only one call is allowed */ + if (once != 0) { + return; + } + once = 1; + + unsigned int ret = OsSystemInitStep2(); + if (ret != LOS_OK) { + PRINT_ERR("systemInitStep2 failed\n"); + } +} + +static int QuickstartDevUnregister(void) +{ + return unregister_driver(QUICKSTART_NODE); +} + +static ssize_t QuickstartIoctl(struct file *filep, int cmd, unsigned long arg) +{ + switch (cmd) { + case QUICKSTART_INITSTEP2: + SystemInitStep2(); + break; + case QUICKSTART_UNREGISTER: + QuickstartDevUnregister(); + break; + + default: + break; + } + return 0; +} + +static const struct file_operations_vfs g_quickstartDevOps = { + QuickstartOpen, /* open */ + QuickstartClose, /* close */ + NULL, /* read */ + NULL, /* write */ + NULL, /* seek */ + QuickstartIoctl, /* ioctl */ + NULL, /* mmap */ +#ifndef CONFIG_DISABLE_POLL + NULL, /* poll */ +#endif + NULL, /* unlink */ +}; + +int DevQuickStartRegister(void) +{ + return register_driver(QUICKSTART_NODE, &g_quickstartDevOps, 0666, 0); /* 0666: file mode */ +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ diff --git a/drivers/char/random/Kconfig b/drivers/char/random/Kconfig new file mode 100644 index 00000000..5574bef6 --- /dev/null +++ b/drivers/char/random/Kconfig @@ -0,0 +1,12 @@ +config DRIVERS_RANDOM + bool "Enable random" + default y + depends on DRIVERS && FS_VFS && COMPAT_BSD + help + Answer Y to support random. +config HW_RANDOM_ENABLE + depends on DRIVERS_RANDOM && (PLATFORM_HI3518EV300 || PLATFORM_HI3516CV300 || PLATFORM_HI3516DV300 || PLATFORM_HI3556V200) + bool "Select hw random" + default y + help + Answer Y to select hw random. diff --git a/drivers/char/random/Makefile b/drivers/char/random/Makefile new file mode 100644 index 00000000..edd03c4a --- /dev/null +++ b/drivers/char/random/Makefile @@ -0,0 +1,45 @@ +# 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. + +include $(LITEOSTOPDIR)/config.mk + +MODULE_NAME := $(notdir $(shell pwd)) + +LOCAL_SRCS := $(wildcard src/random.c) + +ifdef LOSCFG_HW_RANDOM_ENABLE +LOCAL_SRCS += $(wildcard src/random_hw.c) +endif + +LOCAL_INCLUDE := -I $(LITEOSTOPDIR)/drivers/char/random/include \ + -I $(LITEOSTOPDIR)/../../$(LOSCFG_BOARD_CONFIG_PATH)/include + +LOCAL_FLAGS := $(LOCAL_INCLUDE) + +include $(MODULE) diff --git a/kernel/base/include/los_memrecord_pri.h b/drivers/char/random/include/los_random.h similarity index 63% rename from kernel/base/include/los_memrecord_pri.h rename to drivers/char/random/include/los_random.h index daa102e2..298449ea 100644 --- a/kernel/base/include/los_memrecord_pri.h +++ b/drivers/char/random/include/los_random.h @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -29,10 +29,11 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef _LOS_MEMRECORD_PRI_H -#define _LOS_MEMRECORD_PRI_H +#ifndef __LOS_RANDOM_H__ +#define __LOS_RANDOM_H__ -#include "los_memory.h" +#include "los_typedef.h" +#include "sys/ioctl.h" #ifdef __cplusplus #if __cplusplus @@ -40,40 +41,21 @@ extern "C" { #endif /* __cplusplus */ #endif /* __cplusplus */ -#define RECORD_LEN 4000 +#define RAMDOM_IOC_MAGIC 'r' +#define RANDOM_SET_MAX _IO(RAMDOM_IOC_MAGIC, 1) -typedef struct { - UINT32 addrID; - UINT32 taskID; - UINT32 reqSizeID; - UINT32 allocatedSizeID; - UINT32 actType; - UINT64 sysTick; - UINT32 linkRegID; -} MemRecordInfo; - -#define MEM_RECORDSHOW_TIMEOUT 6000 - -extern VOID OsMemRecordShowSet(UINT32 value); -extern VOID OsMemRecordMalloc(const VOID *ptr, UINT32 size); -extern VOID OsMemRecordFree(const VOID *ptr, UINT32 size); -extern VOID OsMemRecordShowTask(VOID); -extern VOID OsDecTo64F(UINT32 num, CHAR *base64, INT32 base64Len); +int DevRandomRegister(void); +int DevUrandomRegister(void); +typedef struct { + int (*support)(void); /* Whether hard random numbers are supported */ + void (*init)(void); /* Initializing the hard random number generator */ + void (*deinit)(void); /* Deinitializing the hard random number generator */ + int (*read)(char *buffer, size_t buflen); /* Read hard random number */ + int (*ioctl)(int cmd, unsigned long arg); /* Control hard random number generator */ +} RandomOperations; -#ifndef LOSCFG_MEM_RECORDINFO -INLINE VOID OsMemRecordFree(const VOID *ptr, UINT32 size) -{ - return; -} -#endif - -#ifndef LOSCFG_MEM_RECORDINFO -INLINE VOID OsMemRecordMalloc(const VOID *ptr, UINT32 size) -{ - return; -} -#endif +void RandomOperationsInit(const RandomOperations *r); #ifdef __cplusplus #if __cplusplus @@ -81,4 +63,4 @@ INLINE VOID OsMemRecordMalloc(const VOID *ptr, UINT32 size) #endif /* __cplusplus */ #endif /* __cplusplus */ -#endif /* _LOS_MEMRECORD_PRI_H */ +#endif diff --git a/drivers/char/random/src/random.c b/drivers/char/random/src/random.c new file mode 100644 index 00000000..9ef114d6 --- /dev/null +++ b/drivers/char/random/src/random.c @@ -0,0 +1,128 @@ +/* + * 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. + */ + +#include "los_random.h" +#include "fcntl.h" +#include "linux/kernel.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +static unsigned long g_randomMax = 0x7FFFFFFF; + +static long DoRand(unsigned long *value) +{ + long quotient, remainder, t; + + quotient = *value / 127773L; + remainder = *value % 127773L; + t = 16807L * remainder - 2836L * quotient; + if (t <= 0) { + t += 0x7fffffff; + } + return ((*value = t) % (g_randomMax + 1)); +} + +static unsigned long g_seed = 1; + +int RanOpen(struct file *filep) +{ + g_seed = (unsigned long)(hi_sched_clock() & 0xffffffff); + return 0; +} + +static int RanClose(struct file *filep) +{ + return 0; +} + +int RanIoctl(struct file *filep, int cmd, unsigned long arg) +{ + PRINT_ERR("random ioctl is not supported\n"); + return -ENOTSUP; +} + +ssize_t RanRead(struct file *filep, char *buffer, size_t buflen) +{ + ssize_t len = buflen; + char *buf = buffer; + unsigned int temp; + int ret; + + if (len % sizeof(unsigned int)) { + PRINT_ERR("random size not aligned by 4 bytes\n"); + return -EINVAL; + } + while (len > 0) { + temp = DoRand(&g_seed); + ret = LOS_CopyFromKernel((void *)buf, sizeof(unsigned int), (void *)&temp, sizeof(unsigned int)); + if (ret) { + break; + } + len -= sizeof(unsigned int); + buf += sizeof(unsigned int); + } + return (buflen - len); /* return a successful len */ +} + +static ssize_t RanMap(FAR struct file* filep, FAR LosVmMapRegion *region) +{ + PRINTK("%s %d, mmap is not support\n", __FUNCTION__, __LINE__); + return 0; +} + +static const struct file_operations_vfs g_ranDevOps = { + RanOpen, /* open */ + RanClose, /* close */ + RanRead, /* read */ + NULL, /* write */ + NULL, /* seek */ + RanIoctl, /* ioctl */ + RanMap, /* mmap */ +#ifndef CONFIG_DISABLE_POLL + NULL, /* poll */ +#endif + NULL, /* unlink */ +}; + +int DevRandomRegister(void) +{ + return register_driver("/dev/random", &g_ranDevOps, 0666, 0); /* 0666: file mode */ +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ diff --git a/drivers/char/random/src/random_hw.c b/drivers/char/random/src/random_hw.c new file mode 100644 index 00000000..fe412ee6 --- /dev/null +++ b/drivers/char/random/src/random_hw.c @@ -0,0 +1,127 @@ +/* + * 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. + */ + +#include "los_random.h" +#include "fcntl.h" +#include "hisoc/random.h" +#include "linux/kernel.h" + +static RandomOperations g_randomOp; +void RandomOperationsInit(const RandomOperations *r) +{ + if (r != NULL) { + (void)memcpy_s(&g_randomOp, sizeof(RandomOperations), r, sizeof(RandomOperations)); + } else { + PRINT_ERR("param is invalid\n", __FUNCTION__, __LINE__); + } + return; +} +static int RandomHwOpen(struct file *filep) +{ + if (g_randomOp.init != NULL) { + g_randomOp.init(); + return ENOERR; + } + return -1; +} + +static int RandomHwClose(struct file *filep) +{ + if (g_randomOp.deinit != NULL) { + g_randomOp.deinit(); + return ENOERR; + } + return -1; +} + +static int RandomHwIoctl(struct file *filep, int cmd, unsigned long arg) +{ + int ret; + + switch (cmd) { + default: + PRINT_ERR("!!!bad command!!!\n"); + return -EINVAL; + } + return ret; +} + +static ssize_t RandomHwRead(struct file *filep, char *buffer, size_t buflen) +{ + int ret; + + if (g_randomOp.read != NULL) { + ret = g_randomOp.read(buffer, buflen); + if (ret == ENOERR) { + ret = buflen; + } + } else { + ret = -1; + } + return ret; +} + +static ssize_t RandomMap(FAR struct file *filep, FAR LosVmMapRegion *region) +{ + PRINTK("%s %d, mmap is not support\n", __FUNCTION__, __LINE__); + return 0; +} + +static const struct file_operations_vfs g_randomHwDevOps = { + RandomHwOpen, /* open */ + RandomHwClose, /* close */ + RandomHwRead, /* read */ + NULL, /* write */ + NULL, /* seek */ + RandomHwIoctl, /* ioctl */ + RandomMap, /* mmap */ +#ifndef CONFIG_DISABLE_POLL + NULL, /* poll */ +#endif + NULL, /* unlink */ +}; + +int DevUrandomRegister(void) +{ + if (g_randomOp.support != NULL) { + int ret = g_randomOp.support(); + if (ret) { + return register_driver("/dev/urandom", &g_randomHwDevOps, 0666, 0); /* 0666: file mode */ + } + } + return -EPERM; +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ diff --git a/drivers/char/video/Kconfig b/drivers/char/video/Kconfig new file mode 100644 index 00000000..3fad196a --- /dev/null +++ b/drivers/char/video/Kconfig @@ -0,0 +1,6 @@ +config DRIVERS_VIDEO + bool "Enable Video" + default y + depends on DRIVERS + help + Answer Y to enable LiteOS support video driver. \ No newline at end of file diff --git a/kernel/extended/tickless/Makefile b/drivers/char/video/Makefile similarity index 83% rename from kernel/extended/tickless/Makefile rename to drivers/char/video/Makefile index 813c1296..790d2e62 100644 --- a/kernel/extended/tickless/Makefile +++ b/drivers/char/video/Makefile @@ -1,5 +1,5 @@ -# Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. -# Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. +# 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: @@ -31,13 +31,10 @@ include $(LITEOSTOPDIR)/config.mk MODULE_NAME := $(notdir $(shell pwd)) -LOCAL_SRCS := $(wildcard *.c) +LOCAL_SRCS := $(LITEOSTHIRDPARTY)/NuttX/drivers/video/fb.c -LOCAL_INCLUDE := \ - -I $(LITEOSTOPDIR)/kernel/base/include -I $(LITEOSTOPDIR)/kernel/extended/include \ - -I $(LITEOSTOPDIR)/kernel/base/core +LOCAL_INCLUDE := -I $(LITEOSTHIRDPARTY)/NuttX/include/nuttx/video LOCAL_FLAGS := $(LOCAL_INCLUDE) include $(MODULE) - diff --git "a/figures/OpenHarmony-LiteOS-A\345\206\205\346\240\270\346\236\266\346\236\204\345\233\276.png" "b/figures/OpenHarmony-LiteOS-A\345\206\205\346\240\270\346\236\266\346\236\204\345\233\276.png" new file mode 100644 index 0000000000000000000000000000000000000000..b2ff552d12a62fb207505772fc4c8cad29262022 GIT binary patch literal 30887 zcmeFZcT`jB*FT7&SO8H_x}aAn3I;+)AW=~fX^KiS)X+Nwqy|J3q$@36q0lH-p}68-k)8bgWn@%Ioi{#rzt2X zXyqT=Ri&UfilU%6vU!pU_=JoDCM^ z_-Wlee3Yu!)N<0ajp4=@24{+z?`Ncb(DK-|+qTx-U2cG$L>c#3{uly^%9(u}+_Acl4ahk;oSSOoxn&<$>fO_IeByD zc7l~6z_zNKr3z-ik9OAkd70*Q^~5MHWM@FrJ8`9)hrSn=2`rW@7Be+B2eb1@N;KXo zP?Q)dudA|cSyRJEqXz;r(t#PDS2anl%e*xJfl*_V6^QW7vk3*{?|^k5Jf%Pw@AV59 z6_gSDVne1D;LA)+<%6W7d0u-0SW5pZ;pS=$O3FUrmw>beAbmg-^3#gjeJb0g!Nli+ zz~>s$wHlU3#3#OQT=EC*3QZ<8KOT{F?-u&6&sgw)f@@Z*swxha#bLnD%)BlmXnBs4 zz(usDZk9L!r=_uMp&;5PVRzPiF(vr%c5M)*WP>`yW&e8T{%6u~&m5(KP}0^QnE+^` znRge?{>ICZX0`)X;VH_D)oW(lL$1kgSahxK_U40h# z->q;~qVCJm8NGQjbmk*c&0gGqY%;@HeS(h{TzY4zt5~V-?xMwpi^zLGwwm<}&OxVzrY`)(0AGk%#LRG4@a10VH)0_o zsLHafze??PKe(*~2)R|3O;r>d8pV62KIX&}$ykYeW^*t;DnK|D$Y6Vf(h2@Ek*G=& zV|C1g?}LGI9juX*v8a^lWDLS^uu(}*@$sP)Urt0*a2kQ!;9I$FX-$2ls5Z+AcX4LI zbJ`?`j?E0hIzI?2t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+LIBO`n{%~*yU^6SX@ zixCY~F`woiE#GU}IpV_w)U~elE|o+M4}{cpuPA9c0Z?H}Wlvwn!4W)eov+L7++ zY&lKgE?8KK;h2n}%>EEZe9kyOQrOM~U?u?36g|~usstJ%Vxg~E`^0!(C#3OF_)!O0 z#uNbQCAfX4sd01Yo239OND(7K7aUA{__FpZA9I6}!< zOZ+6MSJa;aKjI9mdOwP|c#tvXpH3mep#SU?;s3Q$bp9LWW!Rr>PeTMS$KZe;;$`ih z9@;Eyes<={kghnT`EN+i{LLZK`*r+{*k^XjtDirtSvHI9{=ic)C2Fvfv2dgjt6`2O zHK{Xmz&Z?_e&Hq6T#OwedM8GtnUXa|SmIUK&WQ_kkumJ!)b9R8GWxxcxQginP6xAF z?}Mn}Yt831u(7z~(vh;GROjtXlw1EXk)LUcumj*It%!7-($`4u4d6KebfAZ4_yf8= zoMeZ3kU?by04n1uByLB_vf7)cNCDq7ESas8UNBVO7ZbgTyDkl23Ys$FeJvXCH@?;> zADqF&2J5&ZxX4XgyR@fiGH}1gKI%LLG>@e_2gLKsS~D{t5?s==y5|h6%)X}vPl5ND zp1Z`gR9zS~)-)Hn!~UD~dEqMzusOTbIIANG&{weEzwIaa&pLHMd@ef0y}EmN?;M;+ z7!ui#e;F?x(lqXyQhYldPmlio%kbat;2T~X@h%JS2RKC{7qh%T9fDnTttE_%`xFU* oZ~dEl@D^~F-uLCPgL5e@bbO!-6J@{!#79&V@88Y4WAgI<0CH>Axc~qF literal 0 HcmV?d00001 diff --git a/figures/architecture-of-the-openharmony-liteos-cortex-a-kernel.png b/figures/architecture-of-the-openharmony-liteos-cortex-a-kernel.png new file mode 100644 index 0000000000000000000000000000000000000000..27b8a0e059ea26e2eb4e53c27afd76f722761550 GIT binary patch literal 24752 zcmdqJ30%_I+c)e|S&rFinklqQ%VcV1<_cI=*3@K8uBcEkrfH@~mVk&&Q&uian`SOp zPF5HYA{t+&4E*TUxbUC!0U7$FwE+^~fCYvYCY-L9ygOw5+wxaGW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IR *dp) +{ + DIR_FAT *dir_fat = NULL; + + if (dp != NULL) { + dir_fat = (DIR_FAT *)malloc(sizeof(DIR_FAT) + PATH_MAX); + if (dir_fat != NULL) { + (void)memset_s(dir_fat, sizeof(DIR_FAT) + PATH_MAX, 0, sizeof(DIR_FAT) + PATH_MAX); + + dir_fat->stDirStream.dd_nextloc = 0; + dir_fat->stDirStream.dd_size = 0; + dir_fat->stBuf.d_count = SECTOR_SIZE; + dir_fat->stBuf.d_usecount = 0; + + (void)pthread_mutex_init(&(dir_fat->stDirStream.dd_lock), (const pthread_mutexattr_t *)NULL); + dir_fat->stDirStream.dp = dp; + + return dir_fat; + } + + (void)closedir(dp); + } + + return NULL; +} + +DIR_FAT *opendir_fat(const char *name) +{ + INT ret; + DIR *dp = NULL; + + ret = vfat_check_path(name); + if (ret) { + return NULL; + } + + dp = opendir(name); + + return initdir_fat(dp); +} + +int closedir_fat(DIR_FAT *dir_fat) +{ + INT ret; + + if (dir_fat == NULL) { + return FAT_ERROR; + } + + ret = closedir(dir_fat->stDirStream.dp); + if (ret == ENOERR) { + (void)pthread_mutex_destroy(&(dir_fat->stDirStream.dd_lock)); + free(dir_fat); + } + + return ret; +} + +extern int fatfs_readdir_all(DIR_FAT *dir_fat); + +struct fat_direntall *readdir_fat(DIR_FAT *dir_fat) +{ + INT ret; + struct fat_direntall *de = (struct fat_direntall *)NULL; + + if (dir_fat == NULL) { + return NULL; + } + + if (pthread_mutex_lock(&(dir_fat->stDirStream.dd_lock)) != ENOERR) { + return NULL; + } + + ret = fatfs_readdir_all(dir_fat); + if (!ret) { + de = &(dir_fat->stBuf.direntall); + } + + if (pthread_mutex_unlock(&(dir_fat->stDirStream.dd_lock)) != ENOERR) + PRINT_ERR("readdir_fat mutex unlock error \n"); + return de; +} + +static struct fat_direntall **scandir_fat_remalloc_names(struct fat_direntall **names, + UINT *names_size, UINT pos, bool *failed) +{ + struct fat_direntall **new_direntall = NULL; + INT32 ret; + + if (pos == *names_size) { + + if (*names_size == 0) { + *names_size = FIRST_MALLOC_SIZE; + } else { + *names_size <<= 1; + } + + new_direntall = (struct fat_direntall **)malloc(*names_size * sizeof(struct fat_direntall *)); + if (new_direntall == NULL) { + *failed = 1; + return names; + } + + if (names != NULL) { + ret = memcpy_s(new_direntall, (*names_size) * sizeof(struct fat_direntall *), + names, pos * sizeof(struct fat_direntall *)); + if (ret != EOK){ + *failed = 1; + free(new_direntall); + return names; + } + free(names); + } + return new_direntall; + } + return names; +} + +int scandir_fat(const char *dir, struct fat_direntall ***namelist, + int (*selector) (const struct fat_direntall *), + int (*compar) (const struct fat_direntall **, const struct fat_direntall **)) +{ + DIR_FAT *dp = opendir_fat(dir); + struct fat_direntall *current = NULL; + struct fat_direntall **names = NULL; + struct fat_direntall *vnew = NULL; + UINT names_size = 0; + UINT pos = 0; + UINT dsize; + bool failed = 0; + INT use_it; + + if (dp == NULL) { + return FAT_ERROR; + } + + current = readdir_fat(dp); + while (current != NULL) { + use_it = (selector == NULL); + if (!use_it) { + use_it = (*selector) (current); + } + if (use_it) { + names = scandir_fat_remalloc_names(names, &names_size, pos, &failed); + if (failed == 1) { + break; + } + + dsize = current->d_reclen; + vnew = (struct fat_direntall *)malloc(dsize); + if (vnew == NULL) { + failed = 1; + break; + } + + (void)memcpy_s(vnew, dsize, current, dsize); + names[pos++] = vnew; + } + current = readdir_fat(dp); + } + + if (failed == 1) { + (void)closedir_fat(dp); + while (pos > 0) { + free(names[--pos]); + } + + if (names != NULL) { + free(names); + } + + return FAT_ERROR; + } + + (void)closedir_fat(dp); + + /* Sort the list if we have a comparison function to sort with. */ + if (compar != NULL && names != NULL) { + qsort((void *)names, pos, sizeof (struct fat_direntall *), (int (*)(const void *, const void *))*compar); + } + *namelist = names; + return pos; +} + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* __cplusplus */ +#endif /* CONFIG_FS_FAT */ diff --git a/fs/fat/os_adapt/dirop_fat.h b/fs/fat/os_adapt/dirop_fat.h new file mode 100755 index 00000000..2f9b9fa2 --- /dev/null +++ b/fs/fat/os_adapt/dirop_fat.h @@ -0,0 +1,195 @@ +/* + * 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. + */ + +/** + * @defgroup fat Fat + * @ingroup filesystem + */ + +#ifndef _DIROP_FAT_H +#define _DIROP_FAT_H + +#include "pthread.h" +#include "dirent.h" +#ifdef LOSCFG_FS_FAT + +#ifdef __cplusplus +#if __cplusplus +extern "C"{ +#endif +#endif /* __cplusplus */ + +#define TIME_LENGTH 8 + +struct fat_direntall { + unsigned long d_ino; + unsigned long d_off; + unsigned char d_type; + unsigned int d_size; + char d_createtime[TIME_LENGTH]; + unsigned short d_reclen; + char d_name[1]; +}; + +struct fat_direntall_buf { + int d_count; + int d_usecount; + struct fat_direntall direntall; +}; + +struct dirstream_fat { + DIR *dp; + + /* offset of the next dir entry in buffer */ + unsigned int dd_nextloc; + + /* bytes of valid entries in buffer */ + unsigned int dd_size; + + pthread_mutex_t dd_lock; +}; + +typedef struct fat_dir{ + struct dirstream_fat stDirStream; + struct fat_direntall_buf stBuf; +} DIR_FAT; + +/** + * @ingroup fat + * @brief open a directory + * + * @par Description: + * This API is used to open a directory stream corresponding to the directory name, and + * returns a pointer to the directory stream. + * + * @attention + *
    + *
  • The parameter name should be a valid string.
  • + *
+ * + * @param name [IN] the directory to open. + * + * @retval #NULL Open directory unsuccessfully and set errno. + * @retval #DIR_FAT* A pointer to the directory stream. + * @par Dependency: + *
  • dirop_fat.h: the header file that contains the API declaration.
+ * @see closedir_fat + */ +DIR_FAT *opendir_fat(const char *name); + +/** + * @ingroup fat + * @brief close a directory + * + * @par Description: + * This API is used to close the directory stream associated with dirp. + * + * @attention + *
    + *
  • The parameter dir_fat should be a valid pointer which opendir_fat returns.
  • + *
+ * + * @param dir_fat [IN] Directory object structure pointer which opendir_fat returns. + * + * @retval #FAT_ERROR The directory dirp close unsuccessfully and set errno. + * @retval #OK The directory dirp close successfully. + * @par Dependency: + *
  • dirop_fat.h: the header file that contains the API declaration.
+ * @see opendir_fat + */ +int closedir_fat(DIR_FAT *dir_fat); + +/** + * @ingroup fat + * @brief read a directory + * + * @par Description: + * This API is used to get a pointer to a dirent structure + * representing the next directory entry in the directory stream pointed + * to by dirp. + * + * @attention + *
    + *
  • The parameter dir_fat should be a valid pointer which opendir_fat returns.
  • + *
+ * + * @param dir_fat [IN] An instance of type DIR created by a previous call to opendir_fat(). + * + * @retval #NULL Reaching the end of the directory stream or if an error occurred and set errno. + * @retval #fat_direntall* A pointer to a dirent structure. + * @par Dependency: + *
  • dirop_fat.h: the header file that contains the API declaration.
+ * @see opendir_fat + */ +struct fat_direntall *readdir_fat(DIR_FAT *dir_fat); + +/** +* @ingroup fat +* @brief scan a directory for matching entries. +* +* @par Description: +* The scandir_fat() function scans the directory dirp, calling selector() in +* each directory entry. Entries for which selector() returns nonzero are +* stored in strings allocated via malloc, sorted using qsort with +* the comparison function compar(), and collected in array namelist +* which is allocated via malloc. If filter is NULL, all entries are +* selected, compare with scandir(), scandir_fat() can get the create-time of +* file. +* +* @attention +*
    +*
  • +*
+* +* @param dir [IN] Type #const char* a pointer to directory information. +* @param namelist [OUT] Type #const struct fat_direntall*** a pointer to collected directory entries. +* @param selector [IN] Type #int(*selector)(const struct fat_direntall*) a filter type function. +* @param compar [IN] Type #int(*compar)(const struct fat_direntall**,const struct dirent**) a compar type function. +* +* @retval #int The number of directory entries selected. +* @retval #<0 An error occurred. +* @par Dependency: +*
  • dirop_fat.h: the header file that contains the API declaration.
+* @see readdir_fat +*/ +int scandir_fat(const char *dir, struct fat_direntall ***namelist, + int (*selector) (const struct fat_direntall *), + int (*compar) (const struct fat_direntall **, const struct fat_direntall **)); + +#ifdef __cplusplus +#if __cplusplus +} +#endif +#endif /* __cplusplus */ + +#endif /* LOSCFG_FS_FAT */ + +#endif /* _DIROP_FAT_H */ diff --git a/fs/fat/os_adapt/fat_shellcmd.c b/fs/fat/os_adapt/fat_shellcmd.c index 2720a2ea..0648d29c 100644 --- a/fs/fat/os_adapt/fat_shellcmd.c +++ b/fs/fat/os_adapt/fat_shellcmd.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: diff --git a/fs/fat/os_adapt/fatfs.c b/fs/fat/os_adapt/fatfs.c old mode 100644 new mode 100755 index 1d3068db..e2829109 --- a/fs/fat/os_adapt/fatfs.c +++ b/fs/fat/os_adapt/fatfs.c @@ -1,6 +1,6 @@ /* - * Copyright (c) 2013-2019, Huawei Technologies Co., Ltd. All rights reserved. - * Copyright (c) 2020, Huawei Device Co., Ltd. All rights reserved. + * 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: @@ -492,7 +492,7 @@ int fatfs_unbind(void *handle, struct inode **blkdriver) result = FatFsUnbindVirPart(fat); FatfsVirtUnlock(); if (result == FR_OK) { - part = los_part_find(DiskDev[index]); + part = get_part((INT)fat->pdrv); (void)inode_find(&desc); inode = desc.node; if (part == NULL || part->dev == inode) { @@ -515,7 +515,7 @@ int fatfs_unbind(void *handle, struct inode **blkdriver) VolToPart[index].ps = 0; VolToPart[index].pc = 0; - part = los_part_find(DiskDev[index]); + part = get_part((INT)fat->pdrv); if (part != NULL && part->part_name) { free(part->part_name); part->part_name = NULL; @@ -543,17 +543,17 @@ static BYTE FatFsGetMode(int oflags, int *accMode) if ((UINT)oflags & O_WRONLY) { fmode |= FA_WRITE; - *accMode |= WRITE_OP; + *accMode = (unsigned int)(*accMode) | WRITE_OP; } if (((UINT)oflags & O_ACCMODE) & O_RDWR) { fmode |= FA_WRITE; - *accMode |= WRITE_OP; + *accMode = (unsigned int)(*accMode) | WRITE_OP; } /* Creates a new file if the file is not existing, otherwise, just open it. */ if ((UINT)oflags & O_CREAT) { fmode |= FA_OPEN_ALWAYS; - *accMode |= WRITE_OP; + *accMode = (unsigned int)(*accMode) | WRITE_OP; /* Creates a new file. If the file already exists, the function shall fail. */ if ((UINT)oflags & O_EXCL) fmode |= FA_CREATE_NEW; @@ -561,7 +561,7 @@ static BYTE FatFsGetMode(int oflags, int *accMode) /* Creates a new file. If the file already exists, its length shall be truncated to 0. */ if ((UINT)oflags & O_TRUNC) { fmode |= FA_CREATE_ALWAYS; - *accMode |= WRITE_OP; + *accMode = (unsigned int)(*accMode) | WRITE_OP; } return fmode; @@ -598,31 +598,31 @@ static unsigned int FatFsCheckPermission(struct inode *mountpt, bool dirFlag, in fileMode &= (READ_OP | WRITE_OP | EXEC_OP); - if ((accMode & fileMode) == accMode) { + if (((unsigned int)accMode & fileMode) == (unsigned int)accMode) { return FAT_PERM; } fileMode = 0; if (S_ISDIR(mountpt->i_mode)) { - if ((accMode & EXEC_OP) && (IsCapPermit(CAP_DAC_READ_SEARCH))) { + if (((unsigned int)accMode & EXEC_OP) && (IsCapPermit(CAP_DAC_READ_SEARCH))) { fileMode |= EXEC_OP; } } else { - if ((accMode & EXEC_OP) && (IsCapPermit(CAP_DAC_EXECUTE)) + if (((unsigned int)accMode & EXEC_OP) && (IsCapPermit(CAP_DAC_EXECUTE)) && (mountpt->i_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { fileMode |= EXEC_OP; } } - if ((accMode & WRITE_OP) && IsCapPermit(CAP_DAC_WRITE)) { + if (((unsigned int)accMode & WRITE_OP) && IsCapPermit(CAP_DAC_WRITE)) { fileMode |= WRITE_OP; } - if ((accMode & READ_OP) && IsCapPermit(CAP_DAC_READ_SEARCH)) { + if (((unsigned int)accMode & READ_OP) && IsCapPermit(CAP_DAC_READ_SEARCH)) { fileMode |= READ_OP; } - if ((accMode & fileMode) == accMode) { + if (((unsigned int)accMode & fileMode) == (unsigned int)accMode) { return FAT_PERM; } @@ -1190,7 +1190,7 @@ int fatfs_stat(struct inode *mountpt, const char *path, struct stat *buf) get_stmtime(buf, &finfo); } - if (result == FR_INVALID_NAME) { /* root directoy */ + if ((result == FR_INVALID_NAME) && (strlen(path) == 0)) { /* root directory */ buf->st_dev = 0; buf->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IWGRP | S_IWOTH; @@ -1256,7 +1256,6 @@ int fatfs_statfs(struct inode *mountpt, struct statfs *buf) return fatfs_2_vfs(result); } - (void)memset_s((void *)buf, sizeof(struct statfs), 0, sizeof(struct statfs)); buf->f_type = MSDOS_SUPER_MAGIC; buf->f_bfree = freClust; buf->f_bavail = freClust; @@ -1274,7 +1273,7 @@ int fatfs_statfs(struct inode *mountpt, struct statfs *buf) /* Maximum length of filenames: 8 is the basename length, 1 is the dot, 3 is the extension length */ buf->f_namelen = (8 + 1 + 3); #endif - + buf->f_flags = mountpt->mountflags; return 0; #else return -ENOSYS; @@ -1331,9 +1330,10 @@ int fatfs_utime(struct inode *mountpt, const char *pathname, const struct tm * s */ /* fdate: bit[15:9] Year since 1980(0..127), bit[8:5] Month(0..11), bit[4:0] Day(1..31) */ - finfo.fdate = (WORD)(((set_tm->tm_year - 80) << 9) | (set_tm->tm_mon + 1) << 5 | set_tm->tm_mday); + finfo.fdate = (WORD)(((UINT)(set_tm->tm_year - 80) << 9) | ((UINT)(set_tm->tm_mon + 1) << 5) | + (UINT)set_tm->tm_mday); /* ftime: bit[15:11] Hour(0..23), bit[10:5] Minute(0..59), bit[4:0] Second/2(0..29) */ - finfo.ftime = (WORD)(set_tm->tm_hour << 11 | set_tm->tm_min << 5 | set_tm->tm_sec >> 1); + finfo.ftime = (WORD)(((UINT)set_tm->tm_hour << 11) | ((UINT)set_tm->tm_min << 5) | ((UINT)set_tm->tm_sec >> 1)); result = f_utime(filePath, &finfo); status = fatfs_2_vfs(result); free(filePath); @@ -1421,6 +1421,7 @@ int fatfs_closedir(struct inode *mountpt, struct fs_dirent_s *dir) int fatfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) { + int i = 0; #if FF_FS_MINIMIZE <= 1 DIR *fdir = NULL; FILINFO fno; @@ -1429,37 +1430,41 @@ int fatfs_readdir(struct inode *mountpt, struct fs_dirent_s *dir) FAT_CHECK(dir); fdir = (DIR *)(dir->u.fs_dir); - d = &dir->fd_dir; - (void)memset_s(&fno, sizeof(FILINFO), 0, sizeof(FILINFO)); - result = f_readdir(fdir, &fno); - if (result != FR_OK) { - return fatfs_2_vfs(result); - } + while (i < dir->read_cnt) { + d = &(dir->fd_dir[i]); - /* - * 0x00:Reached end of directory. - * 0xFF:The directory is empty. - */ - if (fno.fname[0] == 0 || fno.fname[0] == (TCHAR)0xFF) { - return -ENOENT; - } + (void)memset_s(&fno, sizeof(FILINFO), 0, sizeof(FILINFO)); + result = f_readdir(fdir, &fno); + if (result != FR_OK) { + break; + } - if (fno.fattrib & AM_DIR) { - d->d_type = DT_DIR; - } else { - d->d_type = DT_REG; - } + /* + * 0x00:Reached end of directory. + * 0xFF:The directory is empty. + */ + if (fno.fname[0] == 0 || fno.fname[0] == (TCHAR)0xFF) { + break; + } - d->d_reclen = (WORD)sizeof(struct dirent); + if (fno.fattrib & AM_DIR) { + d->d_type = DT_DIR; + } else { + d->d_type = DT_REG; + } - if (strncpy_s(d->d_name, sizeof(d->d_name), fno.fname, strlen(fno.fname)) != EOK) { - return -ENAMETOOLONG; - } + if (strncpy_s(d->d_name, sizeof(d->d_name), fno.fname, strlen(fno.fname)) != EOK) { + return -ENAMETOOLONG; + } - d->d_off = dir->fd_position; + dir->fd_position++; + dir->fd_dir[i].d_off = dir->fd_position; + dir->fd_dir[i].d_reclen = (uint16_t)sizeof(struct dirent); + i++; + } - return ENOERR; + return i; #else return -ENOSYS; #endif diff --git a/fs/fat/os_adapt/fatfs.h b/fs/fat/os_adapt/fatfs.h new file mode 100755 index 00000000..cae3ec67 --- /dev/null +++ b/fs/fat/os_adapt/fatfs.h @@ -0,0 +1,100 @@ +/* + * 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 _FATFS_H +#define _FATFS_H + +#include "fs/fs.h" +#include "disk.h" +#include "unistd.h" +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "time.h" +#include "sys/stat.h" +#include "sys/statfs.h" + +#include "inode/inode.h" +#include "fs/dirent_fs.h" +#include "fcntl.h" + +#ifdef __cplusplus +#if __cplusplus +extern "C" { +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#define MAX_LFNAME_LENTH 256 +#define LABEL_LEN 12 +#define FAT32_MAXSZIE 0x100000000 +#define FAT_ERROR (-1) +extern char FatLabel[LABEL_LEN]; + +#define VOLUME_CHAR_LENGTH 4 +#define FAT_CHECK(ptr) \ + do { \ + if ((ptr) == NULL) \ + return -EINVAL; \ + } while (0) + +int fatfs_bind (struct inode *blkdriver, const void *data, void **handle, const char *realpath); +int fatfs_unbind (void *handle, struct inode **blkdriver); +int fatfs_mkfs (const char *dev, int sectors, int option); +int fatfs_statfs (struct inode *mountpt, struct statfs *buf); +int fatfs_open (struct file *filep, const char *relpath, int oflags, mode_t mode); +int fatfs_close (struct file *filep); +int fatfs_ioctl (FAR struct file *filep, int cmd, unsigned long arg); +ssize_t fatfs_read (struct file *filep, char *buffer, size_t buflen); +ssize_t fatfs_write (struct file *filep, const char *buffer, size_t buflen); +int fatfs_sync (struct file *filep); +int fatfs_virstatfs_internel (struct inode *mountpt, const char *relpath, struct statfs *buf); +int fatfs_dup (FAR const struct file *oldp, FAR struct file *newp); +off_t fatfs_seek (struct file *filep, off_t offset, int whence); +int fatfs_unlink (struct inode *mountpt, const char *relpath); +int fatfs_rename (struct inode *mountpt, const char *oldpath, const char *newpath); +int fatfs_stat (struct inode *mountpt, const char *path, struct stat *st); +int fatfs_opendir (struct inode *mountpt, const char *relpath, struct fs_dirent_s *dir); +int fatfs_closedir (struct inode *mountpt, struct fs_dirent_s *dir); +int fatfs_readdir (struct inode *mountpt, struct fs_dirent_s *dir); +int fatfs_rewinddir (struct inode *mountpt, struct fs_dirent_s *dir); +int fatfs_mkdir (struct inode *mountpt, const char *relpath, mode_t mode); +int fatfs_rmdir (struct inode *mountpt, const char *relpath); +int fatfs_utime (struct inode *mountpt, const char *pathname, const struct tm *times); +int fatfs_getlabel (void *handle, char *label); +int fatfs_2_vfs (int result); + +#ifdef __cplusplus +#if __cplusplus +} +#endif /* __cplusplus */ +#endif /* __cplusplus */ + +#endif diff --git a/fs/fat/os_adapt/format.c b/fs/fat/os_adapt/format.c new file mode 100755 index 00000000..6ffbfb6a --- /dev/null +++ b/fs/fat/os_adapt/format.c @@ -0,0 +1,99 @@ +/* + * 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. + */ + +#include "errno.h" +#include "fatfs.h" +#include "unistd.h" +#include "stdio.h" +#include "string.h" +#include "errcode_fat.h" +#include "integer.h" +#ifdef LOSCFG_FS_FAT + +#define DEV_NAME_SIZE 4 +int format(const char *dev, int sectors, int option) +{ + INT err; + if (dev == NULL) { + set_errno(EINVAL); + return -1; + } + + if (strncmp(dev, "/dev", DEV_NAME_SIZE) != 0) { + PRINTK("Usage :\n"); + PRINTK(" format