WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
Disk 的协作图:

函数

INT32 los_disk_init (const CHAR *diskName, const struct block_operations *bops, VOID *priv, INT32 diskId, VOID *info)
 Disk driver initialization.
 
INT32 los_disk_deinit (INT32 diskId)
 Destroy a disk driver.
 
INT32 los_disk_read (INT32 drvId, VOID *buf, UINT64 sector, UINT32 count)
 Read data from disk driver.
 
INT32 los_disk_write (INT32 drvId, const VOID *buf, UINT64 sector, UINT32 count)
 Write data to a disk driver.
 
INT32 los_disk_ioctl (INT32 drvId, INT32 cmd, VOID *buf)
 Get information of disk driver.
 
INT32 los_disk_sync (INT32 drvId)
 Sync blib cache.
 
INT32 los_disk_set_bcache (INT32 drvId, UINT32 sectorPerBlock, UINT32 blockNum)
 Set blib cache for the disk driver.
 
INT32 los_part_read (INT32 pt, VOID *buf, UINT64 sector, UINT32 count)
 Read data from chosen partition.
 
INT32 los_part_write (INT32 pt, const VOID *buf, UINT64 sector, UINT32 count)
 Write data to chosen partition.
 
INT32 los_part_ioctl (INT32 pt, INT32 cmd, VOID *buf)
 Get information of chosen partition.
 
INT32 los_part_access (const CHAR *dev, mode_t mode)
 Decide the chosen partition is exist or not.
 
los_partlos_part_find (const struct inode *blkDriver)
 Find disk partition.
 
los_diskget_disk (INT32 id)
 Find disk driver.
 
los_partget_part (INT32 id)
 Find disk partition.
 
VOID show_part (const los_part *part)
 Print partition information.
 
INT32 add_mmc_partition (struct disk_divide_info *info, size_t sectorStart, size_t sectorCount)
 Add a new mmc partition.
 
INT32 los_alloc_diskid_byname (const CHAR *diskName)
 alloc a new UNUSED disk id.
 
INT32 los_get_diskid_byname (const CHAR *diskName)
 get the disk id in used.
 
VOID OsSetUsbStatus (UINT32 diskId)
 Set usb mode.
 
VOID OsClearUsbStatus (UINT32 diskId)
 Set usb mode.
 

详细描述

函数说明

◆ add_mmc_partition()

INT32 add_mmc_partition ( struct disk_divide_info info,
size_t  sectorStart,
size_t  sectorCount 
)

Add a new mmc partition.

Description:
Add a new mmc partition, users can set the start sector and size of the new partition.
注意
参数
info[IN] Type #struct disk_divide_info * Disk driver information structure pointer.
sectorStart[IN] Type size_t Start sector number of the new partition.
sectorCount[IN] Type size_t Sector count of the new partition.
返回值
#0Add partition success.
#-1Add partition failed.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ get_disk()

los_disk * get_disk ( INT32  id)

Find disk driver.

Description:
By disk driver id number to find disk dirver.
注意
参数
id[IN] Type INT32 disk id number,less than the value defined by SYS_MAX_DISK.
返回值
NULLCan't find chosen disk driver.
los_disk* This is disk structure pointer of chosen disk driver.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ get_part()

los_part * get_part ( INT32  id)

Find disk partition.

Description:
By driver partition id number to find disk partition.
注意
参数
id[IN] Type INT32 partition id number,less than the value defined by SYS_MAX_PART.
返回值
NULLCan't find chosen disk partition.
los_part* This is partition structure pointer of chosen disk partition.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ los_alloc_diskid_byname()

INT32 los_alloc_diskid_byname ( const CHAR diskName)

alloc a new UNUSED disk id.

Description:
Get a free disk id for new device.
注意
  • The parameter diskName must point a valid string, which end with the null byte ('\0')
  • The total length of parameter diskName must be less than the value defined by DISK_NAME
参数
diskName[IN] Type #const CHAR * device name.
返回值
INT32available disk id
#-1alloc disk id failed
Dependency:
参见
los_get_diskid_byname
自从
Huawei LiteOS V200R001C00

◆ los_disk_deinit()

INT32 los_disk_deinit ( INT32  diskId)

Destroy a disk driver.

Description:
Destroy a disk driver, free the dependent resource.
注意
参数
diskId[IN] Type INT32 disk driver id number, less than the value defined by SYS_MAX_DISK.
返回值
#0Destroy success.
#-1Destroy failed.
Dependency:
参见
los_disk_init
自从
Huawei LiteOS V100R001C00

◆ los_disk_init()

INT32 los_disk_init ( const CHAR diskName,
const struct block_operations *  bops,
VOID priv,
INT32  diskId,
VOID info 
)

Disk driver initialization.

Description:
Initializate a disk dirver, and set the block cache.
注意
  • The parameter diskName must point a valid string, which end with the terminating null byte.
  • The total length of parameter diskName must be less than the value defined by PATH_MAX.
  • The parameter bops must pointed the right functions, otherwise the system will crash when the disk is being operated.
  • The parameter info can be null or point to struct disk_divide_info. when info is null, the disk will be divided base the information of MBR, otherwise, the disk will be divided base the information of parameter info.
参数
diskName[IN] Type #const CHAR * disk driver name.
bops[IN] Type #const struct block_operations * block driver control structure.
priv[IN] Type VOID * private data of inode.
diskId[IN] Type INT32 disk id number, less than SYS_MAX_DISK.
info[IN] Type VOID * disk driver partition information.
返回值
#0Initialization success.
#-1Initialization failed.
Dependency:
参见
los_disk_deinit
自从
Huawei LiteOS V100R001C00

◆ los_disk_ioctl()

INT32 los_disk_ioctl ( INT32  drvId,
INT32  cmd,
VOID buf 
)

Get information of disk driver.

Description:
Get information of disk driver.
注意
参数
drvId[IN] Type INT32 disk driver id number, less than the value defined by SYS_MAX_DISK.
cmd[IN] Type INT32 command to issu, currently support DISK_GET_SECTOR_COUNT, DISK_GET_SECTOR_SIZE, DISK_GET_BLOCK_SIZE, DISK_CTRL_SYNC.
buf[OUT] Type VOID * memory to storage the information, different cmd require different buf sizes: DISK_CTRL_SYNC(NULL) DISK_GET_SECTOR_COUNT(UINT64) DISK_GET_SECTOR_SIZE(size_t) DISK_GET_BLOCK_SIZE(size_t)
返回值
#0Get information success.
#-1Get information failed.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ los_disk_read()

INT32 los_disk_read ( INT32  drvId,
VOID buf,
UINT64  sector,
UINT32  count 
)

Read data from disk driver.

Description:
Read data from disk driver.
注意
  • The sector size of the disk to be read should be acquired by los_part_ioctl before calling this function.
  • The parameter buf must point to a valid memory and the buf size is count * sector_size.
参数
drvId[IN] Type INT32 disk driver id number, less than the value defined by SYS_MAX_DISK.
buf[OUT] Type VOID * memory which used to store read data.
sector[IN] Type UINT64 expected start sector number to read.
count[IN] Type UINT32 expected sector count to read.
返回值
#0Read success.
#-1Read failed.
Dependency:
参见
los_disk_write
自从
Huawei LiteOS V100R001C00

◆ los_disk_set_bcache()

INT32 los_disk_set_bcache ( INT32  drvId,
UINT32  sectorPerBlock,
UINT32  blockNum 
)

Set blib cache for the disk driver.

Description:
Set blib cache for the disk driver, users can set the number of sectors of per block, and the number of blocks.
注意
参数
drvId[IN] Type INT32 disk driver id number, less than the value defined by SYS_MAX_DISK.
sectorPerBlock[IN] Type UINT32 sector number of per block, only can be 32 * (1, 2, ..., 8).
blockNum[IN] Type UINT32 block number of cache.
返回值
#0Set success.
INT32Set failed.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ los_disk_sync()

INT32 los_disk_sync ( INT32  drvId)

Sync blib cache.

Description:
Sync blib cache, write the valid data to disk driver.
注意
参数
drvId[IN] Type INT32 disk driver id number, less than the value defined by SYS_MAX_DISK.
返回值
#0Sync success.
INT32Sync failed.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ los_disk_write()

INT32 los_disk_write ( INT32  drvId,
const VOID buf,
UINT64  sector,
UINT32  count 
)

Write data to a disk driver.

Description:
Write data to a disk driver.
注意
  • The sector size of the disk to be read should be acquired by los_part_ioctl before calling this function.
  • The parameter buf must point to a valid memory and the buf size is count * sector_size.
参数
drvId[IN] Type INT32 disk driver id number, less than the value defined by SYS_MAX_DISK.
buf[IN] Type #const VOID * memory which used to storage write data.
sector[IN] Type UINT64 expected start sector number to read.
count[IN] Type UINT32 experted sector count of write.
返回值
#0Write success.
#-1Write failed.
Dependency:
参见
los_disk_read
自从
Huawei LiteOS V100R001C00

◆ los_get_diskid_byname()

INT32 los_get_diskid_byname ( const CHAR diskName)

get the disk id in used.

Description:
Get the disk id in used by diskName.
注意
  • The parameter diskName must point a valid string, which end with the null byte ('\0')
  • The total length of parameter diskName must be less than the value defined by DISK_NAME
参数
diskName[IN] Type #const CHAR * device name.
返回值
INT32available disk id
#-1get disk id failed
Dependency:
参见
los_alloc_diskid_byname
自从
Huawei LiteOS V200R001C00

◆ los_part_access()

INT32 los_part_access ( const CHAR dev,
mode_t  mode 
)

Decide the chosen partition is exist or not.

Description:
Decide the chosen partition is exist or not.
注意
  • The parameter dev is a full path, which begin with '/' and end with '/0'.
参数
dev[IN] Type #const CHAR * partition driver name.
mode[IN] Type #mode_t access modd.
返回值
#0The chosen partition is exist.
#-1The chosen partition is not exist.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ los_part_find()

los_part * los_part_find ( const struct inode *  blkDriver)

Find disk partition.

Description:
By driver partition inode to find disk partition.
注意
参数
blkDriver[IN] Type #struct inode * partition driver inode.
返回值
NULLCan't find chosen disk partition.
los_part* This is partition structure pointer of chosen disk partition.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ los_part_ioctl()

INT32 los_part_ioctl ( INT32  pt,
INT32  cmd,
VOID buf 
)

Get information of chosen partition.

Description:
By passed command to get information of chosen partition.
注意
参数
pt[IN] Type INT32 partition number,less than the value defined by SYS_MAX_PART.
cmd[IN] Type INT32 command to issu, currently support GET_SECTOR_COUNT, GET_SECTOR_SIZE, GET_BLOCK_SIZE, CTRL_SYNC, TRIM_CMD.
buf[OUT] Type VOID * memory to store the information, different cmd require different buf size: CTRL_SYNC(NULL) GET_SECTOR_COUNT(UINT64) GET_SECTOR_SIZE(size_t) GET_BLOCK_SIZE(size_t) TRIM_CMD(UINT64 * 2).
返回值
#0Get information success.
#-1Get information failed.
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00

◆ los_part_read()

INT32 los_part_read ( INT32  pt,
VOID buf,
UINT64  sector,
UINT32  count 
)

Read data from chosen partition.

Description:
Read data from chosen partition.
注意
  • The sector size of the disk to be read should be acquired by los_part_ioctl before calling this function.
  • The parameter buf must point to valid memory and the buf size is count * sector_size.
参数
pt[IN] Type INT32 partition number, less than the value defined by SYS_MAX_PART.
buf[OUT] Type VOID * memory which used to store the data to be read.
sector[IN] Type UINT64 start sector number of chosen partition.
count[IN] Type UINT32 the expected sector count for reading.
返回值
#0Read success.
#-1Read failed.
Dependency:
参见
los_part_read
自从
Huawei LiteOS V100R001C00

◆ los_part_write()

INT32 los_part_write ( INT32  pt,
const VOID buf,
UINT64  sector,
UINT32  count 
)

Write data to chosen partition.

Description:
Write data to chosen partition.
注意
  • The sector size of the disk to be write should be acquired by los_part_ioctl before calling this function.
  • The parameter buf must point to valid memory and the buf size is count * sector_size.
参数
pt[IN] Type INT32 partition number,less than the value defined by SYS_MAX_PART.
buf[IN] Type VOID * memory which used to storage the written data.
sector[IN] Type UINT64 start sector number of chosen partition.
count[IN] Type UINT32 the expected sector count for write.
返回值
#0Write success.
#-1Write failed.
Dependency:
参见
los_part_read
自从
Huawei LiteOS V100R001C00

◆ OsClearUsbStatus()

VOID OsClearUsbStatus ( UINT32  diskId)

Set usb mode.

Description:
Clear the corresponding bit of g_usbMode as usb host mode.
注意
  • diskId should be [0,SYS_MAX_DISK)
参数
diskId[IN] Type # unsigned int disk id.
Dependency:
参见
OsSetUsbStatus
自从
Huawei LiteOS V100R001C00

◆ OsSetUsbStatus()

VOID OsSetUsbStatus ( UINT32  diskId)

Set usb mode.

Description:
Set the corresponding bit of g_usbMode as usb host mode.
注意
  • diskId should be [0,SYS_MAX_DISK)
参数
diskId[IN] Type # unsigned int disk id.
Dependency:
参见
OsClearUsbStatus
自从
Huawei LiteOS V100R001C00

◆ show_part()

VOID show_part ( const los_part part)

Print partition information.

Description:
Print partition information.
注意
参数
part[IN] Type los_part * partition control structure pointer
Dependency:
参见
None
自从
Huawei LiteOS V100R001C00