(Optional) dev_get_device_list

Declaration

int dev_get_device_list(int type, unsigned int buffSize, unsigned char *buff, unsigned int device_name_len)

Parameter Description

Table 1 Parameter description

Parameter

Type

Description

type

int

Device file descriptor

buff

unsigned char*

Cache used to transfer data

buffSize

unsigned int

Size of the array cache space

device_name_len

unsigned int

Array space occupied by a device name

Function Description

This API is used to dynamically obtain the device list of a specified type of module. Multiple device names are written into a continuous array. Different device names are divided based on the start address offset. The value of buffSize/device_name_len is the maximum number of devices that can be written into the cache. (This API needs to be implemented only when the dynamic field of the module is set to true. Otherwise, this API does not need to be implemented for static devices defined in the product specification configuration file.)

Buff Parsing

Based on the specified length of the device_name_len parameter, the device name is saved in the specified memory segment of the buffer by using the start address offset. The following figure shows the implementation. Ensure that the length of the device name is less than or equal to the maximum length specified by device_name_len. Ensure that the buffer space is greater than the space for storing all device information of the module.
Figure 1 Buff parsing diagram