#ifndef _PROC_API_H
#define _PROC_API_H
#ifdef __KERNEL__

#include <asm/atomic.h>

#include "../../common/common.h"

#define PROC_API_DIR_NAME               ("isg")

typedef enum {
    ERR_DBGFS_NO_ERROR          = 0,
    ERR_PARA_OUTOFRANGE,
    ERR_MALLOC_MEMORY,
    ERR_DBGFS_INIT,
    ERR_DBGFS_REGISTER,
    ERR_DBGFS_UNREGISTER,
    ERR_DBGFS_WRITEOPTS
} PROC_ERRCODE;

typedef struct {
    const char*     name;                       ///< 节点名称
    unsigned int    params;                     ///< 参数
    unsigned long   mask;                       ///< 命令掩码
    char*           cmd;                        ///< 命令
    char*           cmd_data;                   ///< 命令参数
    int (* show)(struct seq_file*, void*);      ///< 输出接口
    int (* ioctl)(struct seq_file*, void*);     ///< 输入接口
    int (* help)(struct seq_file*, void*);      ///< 帮助接口
} DBGFS_PRIV, *PDBGFS_PRIV;

typedef struct {
    const char*         dir_name;               ///< 目录名称
    PDBGFS_PRIV         data;                   ///< 节点数组
    int                 num_data;               ///< 节点个数
} PROC_API, *PPROC_API;

int proc_api_register(PPROC_API pv);
int proc_api_unregister(PPROC_API pv);
int get_int_value(unsigned char* pBuf, int index, int* pValue);
int get_string_value(unsigned char* pBuf, int index, unsigned char* pValue, unsigned int maxBytes);
#endif
#endif