/nrf52832-nimble/rt-thread/components/dfs/filesystems/uffs/src/uffs/ |
H A D | uffs_flash.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 49 #define SPOOL(dev) &((dev)->mem.spare_pool) argument 50 #define HEADER(buf) ((struct uffs_MiniHeaderSt *)(buf)->header) 52 #define ECC_SIZE(dev) ((dev)->attr->ecc_size) argument 53 #define NOMINAL_ECC_SIZE(dev) (3 * ((((dev)->attr->page_data_size - 1) / 256) + 1)) argument 57 #define SEAL_BYTE(dev, spare) spare[(dev)->mem.spare_data_size - 1] // seal byte is the last byte … argument 61 static const u8 MTD512_LAYOUT_ECC[] = {0, 4, 6, 2, 0xFF, 0}; 62 static const u8 MTD512_LAYOUT_DATA[] = {8, 8, 0xFF, 0}; [all …]
|
H A D | uffs_utils.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 53 #define SPOOL(dev) &((dev)->mem.spare_pool) argument 90 static void _ForceFormatAndCheckBlock(uffs_Device *dev, int block) in _ForceFormatAndCheckBlock() argument 96 struct uffs_FlashOpsSt *ops = dev->ops; in _ForceFormatAndCheckBlock() 100 buf = uffs_BufClone(dev, NULL); in _ForceFormatAndCheckBlock() 107 spare = (u8 *)uffs_PoolGet(SPOOL(dev)); in _ForceFormatAndCheckBlock() 111 //step 1: Erase, fully fill with 0x0, and check in _ForceFormatAndCheckBlock() 112 ret = uffs_FlashEraseBlock(dev, block); in _ForceFormatAndCheckBlock() [all …]
|
H A D | uffs_buf.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 52 URET _BufFlush(struct uffs_DeviceSt *dev, UBOOL force_block_recover, int slot); 57 * \param[in] dev uffs device to be inspected. 59 void uffs_BufInspect(uffs_Device *dev) in uffs_BufInspect() argument 61 struct uffs_PageBufDescSt *pb = &dev->buf; in uffs_BufInspect() 65 "------------- page buffer inspect ---------" TENDSTR); in uffs_BufInspect() 67 for (buf = pb->head; buf; buf = buf->next) { in uffs_BufInspect() 68 if (buf->mark != 0) { in uffs_BufInspect() [all …]
|
H A D | uffs_tree.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 48 #define TPOOL(dev) &(dev->mem.tree_pool) argument 52 static void uffs_InsertToFileEntry(uffs_Device *dev, TreeNode *node); 53 static void uffs_InsertToDirEntry(uffs_Device *dev, TreeNode *node); 54 static void uffs_InsertToDataEntry(uffs_Device *dev, TreeNode *node); 56 static TreeNode * uffs_TreeGetErasedNodeNoCheck(uffs_Device *dev); 67 * \param[in] dev uffs device 69 URET uffs_TreeInit(uffs_Device *dev) in uffs_TreeInit() argument [all …]
|
H A D | uffs_blockinfo.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 48 #define UFFS_CLONE_BLOCK_INFO_NEXT ((uffs_BlockInfo *)(-2)) 54 * \param[in] dev uffs device 60 URET uffs_BlockInfoInitCache(uffs_Device *dev, int maxCachedBlocks) in uffs_BlockInfoInitCache() argument 68 if (dev->bc.head != NULL) { in uffs_BlockInfoInitCache() 72 uffs_BlockInfoReleaseCache(dev); in uffs_BlockInfoInitCache() 77 sizeof(uffs_PageSpare) * dev->attr->pages_per_block in uffs_BlockInfoInitCache() 80 if (dev->mem.blockinfo_pool_size == 0) { in uffs_BlockInfoInitCache() [all …]
|
H A D | uffs_fs.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 53 (obj)->type == UFFS_TYPE_DIR ? \ 54 (obj)->node->u.dir.serial : (obj)->node->u.file.serial \ 59 (obj)->type == UFFS_TYPE_DIR ? \ 60 (obj)->node->u.dir.parent : (obj)->node->u.file.parent \ 64 ((obj)->node ? GET_OBJ_NODE_SERIAL(obj) : obj->serial) 67 ((obj)->node ? GET_OBJ_NODE_FATHER(obj) : obj->parent) 72 (obj)->type == UFFS_TYPE_DIR ? \ [all …]
|
H A D | uffs_public.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 53 return 0; in uffs_GetFirstBlockTimeStamp() 63 switch (src - obj) { in uffs_IsSrcNewerThanObj() 64 case 0: in uffs_IsSrcNewerThanObj() 69 case -2: in uffs_IsSrcNewerThanObj() 71 case -1: in uffs_IsSrcNewerThanObj() 87 * \param[in] dev uffs device 94 u16 uffs_FindBestPageInBlock(uffs_Device *dev, uffs_BlockInfo *bc, u16 page) in uffs_FindBestPageInBlock() argument [all …]
|
H A D | uffs_init.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 50 static URET uffs_InitDeviceConfig(uffs_Device *dev) in uffs_InitDeviceConfig() argument 52 if (dev->cfg.dirty_groups == 0) in uffs_InitDeviceConfig() 53 dev->cfg.dirty_groups = MAX_DIRTY_BUF_GROUPS; in uffs_InitDeviceConfig() 55 if (!uffs_Assert(dev->cfg.dirty_groups >= 1 && dev->cfg.dirty_groups <= MAX_DIRTY_BUF_GROUPS, in uffs_InitDeviceConfig() 56 "invalid config: dirty_groups = %d\n", dev->cfg.dirty_groups)) in uffs_InitDeviceConfig() 59 #if CONFIG_USE_STATIC_MEMORY_ALLOCATOR > 0 in uffs_InitDeviceConfig() 60 dev->cfg.bc_caches = MAX_CACHED_BLOCK_INFO; in uffs_InitDeviceConfig() [all …]
|
H A D | uffs_find.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 44 #define TPOOL(dev) &((dev)->mem.tree_pool) argument 48 f->hash = 0; in ResetFindInfo() 49 f->work = NULL; in ResetFindInfo() 50 f->step = 0; in ResetFindInfo() 51 f->pos = 0; in ResetFindInfo() 54 static URET _LoadObjectInfo(uffs_Device *dev, in _LoadObjectInfo() argument 62 buf = uffs_BufGetEx(dev, (u8)type, node, 0, 0); in _LoadObjectInfo() [all …]
|
H A D | uffs_mtb.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 68 * \return 0 succ 69 * -1 failed (e.g. already registered and mounted) 74 static int dev_num = 0; in uffs_RegisterMountTable() 77 return -1; in uffs_RegisterMountTable() 79 for (work = m_head; work; work = work->next) { in uffs_RegisterMountTable() 81 return -1; // already mounted ? in uffs_RegisterMountTable() 84 for (work = m_free_head; work; work = work->next) { in uffs_RegisterMountTable() [all …]
|
H A D | uffs_device.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 45 #define PFX "dev : " 49 void uffs_DeviceInitLock(uffs_Device *dev) in uffs_DeviceInitLock() argument 51 uffs_SemCreate(&dev->lock.sem); in uffs_DeviceInitLock() 52 dev->lock.task_id = UFFS_TASK_ID_NOT_EXIST; in uffs_DeviceInitLock() 53 dev->lock.counter = 0; in uffs_DeviceInitLock() 56 void uffs_DeviceReleaseLock(uffs_Device *dev) in uffs_DeviceReleaseLock() argument 58 uffs_SemDelete(&dev->lock.sem); in uffs_DeviceReleaseLock() [all …]
|
/nrf52832-nimble/rt-thread/src/ |
H A D | device.c | 2 * Copyright (c) 2006-2018, RT-Thread Development Team 4 * SPDX-License-Identifier: Apache-2.0 8 * 2007-01-21 Bernard the first version 9 * 2010-05-04 Bernard add rt_device_init implementation 10 * 2012-10-20 Bernard add device check in register function, 12 * 2012-12-25 Bernard return RT_EOK if the device interface not exist. 13 * 2013-07-09 Grissiom add ref_count support 14 * 2016-04-02 Bernard fix the open_flag initialization issue. 25 #define device_init (dev->ops->init) 26 #define device_open (dev->ops->open) [all …]
|
/nrf52832-nimble/rt-thread/components/dfs/filesystems/uffs/ |
H A D | uffs_nandif.c | 2 * RT-Thread Device Interface for uffs 9 static int nand_init_flash(uffs_Device *dev) in nand_init_flash() argument 14 static int nand_release_flash(uffs_Device *dev) in nand_release_flash() argument 18 static int nand_erase_block(uffs_Device *dev, unsigned block) in nand_erase_block() argument 22 res = rt_mtd_nand_erase_block(RT_MTD_NAND_DEVICE(dev->_private), block); in nand_erase_block() 28 static int nand_check_block(uffs_Device *dev, unsigned block) in nand_check_block() argument 32 res = rt_mtd_nand_check_block(RT_MTD_NAND_DEVICE(dev->_private), block); in nand_check_block() 37 static int nand_mark_badblock(uffs_Device *dev, unsigned block) in nand_mark_badblock() argument 41 res = rt_mtd_nand_mark_badblock(RT_MTD_NAND_DEVICE(dev->_private), block); in nand_mark_badblock() 48 static int nand_read_page(uffs_Device *dev, in nand_read_page() argument [all …]
|
/nrf52832-nimble/rt-thread/components/vbus/ |
H A D | vbus_chnx.c | 2 * COPYRIGHT (C) 2018, Real-Thread Information Technology Ltd 4 * SPDX-License-Identifier: Apache-2.0 8 * 2013-11-04 Grissiom add comment 19 rt_device_t dev = ctx; in _rx_indicate() local 21 if (dev->rx_indicate) in _rx_indicate() 22 dev->rx_indicate(dev, 0); in _rx_indicate() 27 rt_device_t dev = ctx; in _tx_complete() local 29 if (dev->tx_complete) in _tx_complete() 30 dev->tx_complete(dev, 0); in _tx_complete() 33 static rt_err_t _open(rt_device_t dev, rt_uint16_t oflag) in _open() argument [all …]
|
/nrf52832-nimble/rt-thread/components/drivers/usb/usbhost/class/ |
H A D | udisk.c | 2 * Copyright (c) 2006-2018, RT-Thread Development Team 4 * SPDX-License-Identifier: Apache-2.0 8 * 2011-12-12 Yi Qiu first version 19 static rt_uint8_t _udisk_idset = 0; 25 for(i=0; i< UDISK_MAX_COUNT; i++) in udisk_get_id() 27 if((_udisk_idset & (1 << i)) != 0) continue; in udisk_get_id() 32 if(i == UDISK_MAX_COUNT) RT_ASSERT(0); in udisk_get_id() 48 * @param dev the pointer of device driver structure 52 static rt_err_t rt_udisk_init(rt_device_t dev) in rt_udisk_init() argument 60 * @param dev the pointer of device driver structure [all …]
|
/nrf52832-nimble/rt-thread/components/drivers/sdio/ |
H A D | block_dev.c | 2 * Copyright (c) 2006-2018, RT-Thread Development Team 4 * SPDX-License-Identifier: Apache-2.0 8 * 2011-07-25 weety first version 34 struct rt_device dev; member 54 rt_memset(&cmd, 0, sizeof(struct rt_mmcsd_cmd)); in mmcsd_num_wr_blocks() 57 cmd.arg = card->rca << 16; in mmcsd_num_wr_blocks() 60 err = mmcsd_send_cmd(card->host, &cmd, 0); in mmcsd_num_wr_blocks() 62 return -RT_ERROR; in mmcsd_num_wr_blocks() 63 if (!controller_is_spi(card->host) && !(cmd.resp[0] & R1_APP_CMD)) in mmcsd_num_wr_blocks() 64 return -RT_ERROR; in mmcsd_num_wr_blocks() [all …]
|
/nrf52832-nimble/rt-thread/components/dfs/filesystems/uffs/src/emu/ |
H A D | helper_cmds.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 66 uffs_Device *dev; in cmd_format() local 71 if (argc > 2 && strcmp(argv[2], "-f") == 0) in cmd_format() 76 dev = uffs_GetDeviceFromMountPoint(mount); in cmd_format() 77 if (dev == NULL) { in cmd_format() 79 return -1; in cmd_format() 82 ret = uffs_FormatDevice(dev, force); in cmd_format() 85 return -1; in cmd_format() [all …]
|
H A D | uffs_fileem_wrap.c | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 72 {24, 4, -3, 1 << 2}, /* block 24, page 4, spare offset 3, bit 2*/ \ 80 static int femu_InitFlash_wrap(uffs_Device *dev); 82 static int femu_ReadPage_wrap(uffs_Device *dev, u32 block, u32 page, u8 *data, int data_len, u8 *ec… 84 static int femu_ReadPageWithLayout_wrap(uffs_Device *dev, u32 block, u32 page, u8* data, int data_l… 86 static int femu_WritePage_wrap(uffs_Device *dev, u32 block, u32 page, 88 static int femu_WritePageWithLayout_wrap(uffs_Device *dev, u32 block, u32 page, const u8* data, int… 90 static int femu_EraseBlock_wrap(uffs_Device *dev, u32 blockNumber); [all …]
|
/nrf52832-nimble/rt-thread/components/dfs/filesystems/uffs/src/inc/uffs/ |
H A D | uffs_tree.h | 2 This file is part of UFFS, the Ultra-low-cost Flash File System. 4 Copyright (C) 2005-2009 Ricky Zheng <[email protected]> 19 Boston, MA 02110-1301, USA. 45 #define UFFS_TYPE_DIR 0 49 #define UFFS_TYPE_INVALID 0xFF 143 #define EMPTY_NODE 0xffff //!< special index num of empty node. 145 #define ROOT_DIR_SERIAL 0 //!< serial num of root dir 146 #define MAX_UFFS_FSN 0x3ff //!< maximum dir|file serial number (uffs_TagStore#parent: 10 bits) 147 #define MAX_UFFS_FDN 0x3fff //!< maximum file data block serial numbers (uffs_TagStore#serial: 14… 148 #define PARENT_OF_ROOT 0xfffd //!< parent of ROOT ? kidding me ... [all …]
|
/nrf52832-nimble/rt-thread/libcpu/blackfin/bf53x/ |
H A D | serial.c | 3 * This file is part of RT-Thread RTOS 4 * COPYRIGHT (C) 2006, RT-Thread Development Team 8 * http://openlab.rt-thread.com/license/LICENSE 12 * 2006-03-13 Bernard first version 13 * 2009-04-20 yi.qiu modified according bernard's stm32 version 14 * 2012-02-17 mojingxian modified for bf53x 26 /* RT-Thread Device Interface */ 30 static rt_err_t rt_serial_init (rt_device_t dev) in rt_serial_init() argument 32 struct serial_device* uart = (struct serial_device*) dev->user_data; in rt_serial_init() 34 if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) in rt_serial_init() [all …]
|
/nrf52832-nimble/rt-thread/libcpu/arm/s3c24x0/ |
H A D | serial.c | 2 * Copyright (c) 2006-2018, RT-Thread Development Team 4 * SPDX-License-Identifier: Apache-2.0 8 * 2006-03-13 Bernard first version 9 * 2009-04-20 yi.qiu modified according bernard's stm32 version 21 /* RT-Thread Device Interface */ 25 static rt_err_t rt_serial_init(rt_device_t dev) in rt_serial_init() argument 27 struct serial_device* uart = (struct serial_device*) dev->user_data; in rt_serial_init() 29 if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) in rt_serial_init() 32 if (dev->flag & RT_DEVICE_FLAG_INT_RX) in rt_serial_init() 34 rt_memset(uart->int_rx->rx_buffer, 0, in rt_serial_init() [all …]
|
/nrf52832-nimble/rt-thread/libcpu/arm/sep4020/ |
H A D | serial.c | 2 * Copyright (c) 2006-2018, RT-Thread Development Team 4 * SPDX-License-Identifier: Apache-2.0 8 * 2006-03-13 Bernard first version 9 * 2009-04-20 yi.qiu modified according bernard's stm32 version 10 * 2010-10-6 wangmeng added sep4020 surpport 21 /* RT-Thread Device Interface */ 25 static rt_err_t rt_serial_init (rt_device_t dev) in rt_serial_init() argument 27 struct serial_device* uart = (struct serial_device*) dev->user_data; in rt_serial_init() 29 if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) in rt_serial_init() 32 if (dev->flag & RT_DEVICE_FLAG_INT_RX) in rt_serial_init() [all …]
|
/nrf52832-nimble/rt-thread/components/drivers/mtd/ |
H A D | mtd_nand.c | 2 * Copyright (c) 2006-2018, RT-Thread Development Team 4 * SPDX-License-Identifier: Apache-2.0 8 * 2011-12-05 Bernard the first version 20 * RT-Thread Generic Device Interface 22 static rt_err_t _mtd_init(rt_device_t dev) in _mtd_init() argument 27 static rt_err_t _mtd_open(rt_device_t dev, rt_uint16_t oflag) in _mtd_open() argument 32 static rt_err_t _mtd_close(rt_device_t dev) in _mtd_close() argument 37 static rt_size_t _mtd_read(rt_device_t dev, in _mtd_read() argument 45 static rt_size_t _mtd_write(rt_device_t dev, in _mtd_write() argument 53 static rt_err_t _mtd_control(rt_device_t dev, int cmd, void *args) in _mtd_control() argument [all …]
|
/nrf52832-nimble/rt-thread/libcpu/unicore32/sep6200/ |
H A D | serial.c | 3 * This file is part of RT-Thread RTOS 4 * COPYRIGHT (C) 2006 - 2013, RT-Thread Development Team 18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 22 * 2013-03-16 Peng Fan Modified from sep4020 33 /* RT-Thread Device Interface */ 37 static rt_err_t rt_serial_init (rt_device_t dev) in rt_serial_init() argument 39 struct serial_device* uart = (struct serial_device*) dev->user_data; in rt_serial_init() 41 if (!(dev->flag & RT_DEVICE_FLAG_ACTIVATED)) in rt_serial_init() 44 if (dev->flag & RT_DEVICE_FLAG_INT_RX) in rt_serial_init() 46 rt_memset(uart->int_rx->rx_buffer, 0, in rt_serial_init() [all …]
|
/nrf52832-nimble/rt-thread/libcpu/avr32/uc3/ |
H A D | serial.c | 3 * This file is part of RT-Thread RTOS 4 * COPYRIGHT (C) 2010, RT-Thread Development Team 8 * http://www.rt-thread.org/license/LICENSE 12 * 2009-02-05 Bernard first version 13 * 2009-10-25 Bernard fix rt_serial_read bug when there is no data 15 * 2010-03-29 Bernard cleanup code. 16 * 2010-03-30 Kyle Ported from STM32 to AVR32. 36 /* RT-Thread Device Interface */ 37 static rt_err_t rt_serial_init (rt_device_t dev) in rt_serial_init() argument 39 struct avr32_serial_device* uart = (struct avr32_serial_device*) dev->user_data; in rt_serial_init() [all …]
|