procfs:add /proc/cpuinfo

Signed-off-by: liaoao <liaoao@xiaomi.com>
This commit is contained in:
liaoao
2023-03-15 20:48:40 +08:00
committed by Xiang Xiao
parent ac4183e589
commit 6ea3eb3ce2
8 changed files with 348 additions and 4 deletions
+19
View File
@@ -2560,6 +2560,25 @@ unsigned long up_perf_gettime(void);
unsigned long up_perf_getfreq(void);
void up_perf_convert(unsigned long elapsed, FAR struct timespec *ts);
/****************************************************************************
* Name: up_show_cpuinfo
*
* Description:
* This function will be called when reading /proc/cpufinfo.
* This function should be implemented by each arch to show its cpuinfo.
*
* Input Parameters:
* buf - The address of the user's receive buffer.
* buf_size - The size (in bytes) of the user's receive buffer.
* file_off - The /proc/cpuinfo file offset.
*
* Returned Value:
* The number of bytes actually transferred into the user's receive buffer.
*
****************************************************************************/
ssize_t up_show_cpuinfo(FAR char *buf, size_t buf_size, off_t file_off);
/****************************************************************************
* Name: up_saveusercontext
*
+21
View File
@@ -222,6 +222,27 @@ size_t procfs_memcpy(FAR const char *src, size_t srclen,
int procfs_snprintf(FAR char *buf, size_t size,
FAR const IPTR char *format, ...) printf_like(3, 4);
/****************************************************************************
* Name: procfs_sprintf
*
* Description:
* This function used to continous format string and copy it to buffer.
* Every single string length must be smaller then LINEBUF_SIZE.
*
* Input Parameters:
* buf - The address of the user's receive buffer.
* size - The size (in bytes) of the user's receive buffer.
* offset - On input, when *offset is larger the 0 , this is the
* number of bytes to skip before returning data; If bytes
* were skipped, this *offset will be decremented. when it
* decrements to a negative value, -*offset is the number of
* data copied to buffer.
*
****************************************************************************/
void procfs_sprintf(FAR char *buf, size_t size, FAR off_t *offset,
FAR const IPTR char *format, ...);
/****************************************************************************
* Name: procfs_register
*