LPT26x-HSF-4MB-Hilink_14.2..../application/ws63/hsf/hfsys.h
2025-05-13 22:00:58 +08:00

121 lines
3.0 KiB
C
Executable File

#ifndef _HF_SYS_H_
#define _HF_SYS_H_
#define MOD_ERROR_START(x) ((x << 16) | 0)
/* Create Module index */
#define MOD_GENERIC 0
/** HTTPD module index */
#define MOD_HTTPDE 1
/** HTTP-CLIENT module index */
#define MOD_HTTPC 2
/** WPS module index */
#define MOD_WPS 3
/** WLAN module index */
#define MOD_WLAN 4
/** USB module index */
#define MOD_USB 5
#define MOD_USER_DEFINE (0x80)
/* Globally unique success code */
#define HF_SUCCESS 0
#define HFSYS_RESET_REASON_NORMAL (0)
#define HFSYS_RESET_REASON_OTA (0x00000100)
enum hf_errno {
/* First Generic Error codes */
HF_GEN_E_BASE = MOD_ERROR_START(MOD_GENERIC),
HF_FAIL,
HF_E_PERM, /* Operation not permitted */
HF_E_NOENT, /* No such file or directory */
HF_E_SRCH, /* No such process */
HF_E_INTR, /* Interrupted system call */
HF_E_IO, /* I/O error */
HF_E_NXIO, /* No such device or address */
HF_E_2BIG, /* Argument list too long */
HF_E_NOEXEC, /* Exec format error */
HF_E_BADF, /* Bad file number */
HF_E_CHILD, /* No child processes */
HF_E_AGAIN, /* Try again */
HF_E_NOMEM, /* Out of memory */
HF_E_ACCES, /* Permission denied */
HF_E_FAULT, /* Bad address */
HF_E_NOTBLK, /* Block device required */
HF_E_BUSY, /* Device or resource busy */
HF_E_EXIST, /* File exists */
HF_E_XDEV, /* Cross-device link */
HF_E_NODEV, /* No such device */
HF_E_NOTDIR, /* Not a directory */
HF_E_ISDIR, /* Is a directory */
HF_E_INVAL, /* Invalid argument */
HF_E_NFILE, /* File table overflow */
HF_E_MFILE, /* Too many open files */
HF_E_NOTTY, /* Not a typewriter */
HF_E_TXTBSY, /* Text file busy */
HF_E_FBIG, /* File too large */
HF_E_NOSPC, /* No space left on device */
HF_E_SPIPE, /* Illegal seek */
HF_E_ROFS, /* Read-only file system */
HF_E_MLINK, /* Too many links */
HF_E_PIPE, /* Broken pipe */
HF_E_DOM, /* Math argument out of domain of func */
HF_E_RANGE, /* Math result not representable */
HF_E_DEADLK, /*Resource deadlock would occur*/
};
enum HFSYS_RUN_MODE_E
{
HFSYS_STATE_RUN_THROUGH=0,
HFSYS_STATE_RUN_CMD=1,
HFSYS_STATE_RUN_GPIO,
HFSYS_STATE_RUN_PWM,
HFSYS_STATE_MAX_VALUE
};
void HSF_API hfsys_reset(void);
uint32_t HSF_API hfsys_get_time(void);
int HSF_API hfsys_switch_run_mode(int mode);
int HSF_API hfsys_get_run_mode(void);
void HSF_API *hfmem_malloc(int size);
void HSF_API hfmem_free(void *pv);
uint32_t HSF_API hfsys_get_memory(void);
int HSF_API hfwifi_read_sta_mac_address(uint8_t *mac);
int HSF_IAPI hfwifi_write_sta_mac_address(uint8_t *mac, char *key);
uint32_t HSF_API hfsys_get_reset_reason(void);
void HSF_API hfsys_set_reset_reason(uint32_t reason);
int HSF_API hfwifi_read_sle_mac_address(uint8_t *mac);
int HSF_API hfwifi_write_sle_mac_address(uint8_t *mac);
int HSF_API hfwifi_read_ap_mac_address(uint8_t *mac);
unsigned int HSF_API hfsys_random(void);
void HSF_API hfsys_set_time(uint32_t t);
#endif