6#ifndef ZEPHYR_INCLUDE_DRIVERS_HL78XX_APIS_H_
7#define ZEPHYR_INCLUDE_DRIVERS_HL78XX_APIS_H_
21#define CSQ_RSSI_UNKNOWN (99)
22#define CESQ_RSRP_UNKNOWN (255)
23#define CESQ_RSRQ_UNKNOWN (255)
25#define CSQ_RSSI_TO_DB(v) (-113 + (2 * (v)))
26#define CESQ_RSRP_TO_DB(v) (-140 + (v))
27#define CESQ_RSRQ_TO_DB(v) (-20 + ((v) / 2))
32#define MDM_MANUFACTURER_LENGTH 20
33#define MDM_MODEL_LENGTH 32
34#define MDM_REVISION_LENGTH 64
35#define MDM_IMEI_LENGTH 16
36#define MDM_IMSI_LENGTH 23
37#define MDM_ICCID_LENGTH 22
38#define MDM_APN_MAX_LENGTH 64
39#define MDM_MAX_CERT_LENGTH 4096
40#define MDM_MAX_HOSTNAME_LEN 128
49#define HL78XX_EVT_MONITOR(name, _handler, ...) \
50 static STRUCT_SECTION_ITERABLE(hl78xx_evt_monitor_entry, name) = { \
51 .handler = _handler, \
53 .flags.direct = false, \
54 COND_CODE_1(__VA_ARGS__, (.flags.paused = __VA_ARGS__,), ()) }
60#ifdef CONFIG_MODEM_HL78XX_12
62#ifdef CONFIG_MODEM_HL78XX_12_FW_R6
66#ifdef CONFIG_MODEM_HL78XX_AUTORAT
Main header file for cellular modem driver API.
cellular_access_technology
Cellular access technologies (3GPP TS 27.007 AcT)
Definition cellular.h:33
cellular_registration_status
Cellular registration status (3GPP TS 27.007)
Definition cellular.h:109
cellular_signal_type
Cellular signal type.
Definition cellular.h:86
cellular_modem_info_type
Cellular modem info type.
Definition cellular.h:93
static void cmd(uint32_t command)
Execute a display list command by co-processor engine.
Definition ft8xx_reference_api.h:153
#define EINVAL
Invalid argument.
Definition errno.h:60
int(* hl78xx_api_configure_networks)(const struct device *dev, const struct hl78xx_network *networks, uint8_t size)
API for configuring networks.
Definition hl78xx_apis.h:131
#define CESQ_RSRP_UNKNOWN
Definition hl78xx_apis.h:22
static int hl78xx_parse_rsrq(uint8_t rsrq, int16_t *value)
Convert raw RSRQ value from the modem to dB.
Definition hl78xx_apis.h:396
hl78xx_cell_rat_mode
Cellular radio access technologies.
Definition hl78xx_apis.h:57
@ HL78XX_RAT_MODE_NONE
Definition hl78xx_apis.h:69
@ HL78XX_RAT_COUNT
Definition hl78xx_apis.h:70
@ HL78XX_RAT_NB1
Definition hl78xx_apis.h:59
@ HL78XX_RAT_CAT_M1
Definition hl78xx_apis.h:58
#define CESQ_RSRP_TO_DB(v)
Definition hl78xx_apis.h:26
hl78xx_phone_functionality
Phone functionality modes.
Definition hl78xx_apis.h:74
@ HL78XX_SIM_POWER_OFF
Definition hl78xx_apis.h:75
@ HL78XX_AIRPLANE
Definition hl78xx_apis.h:77
@ HL78XX_FULLY_FUNCTIONAL
Definition hl78xx_apis.h:76
#define CESQ_RSRQ_TO_DB(v)
Definition hl78xx_apis.h:27
int(* hl78xx_api_get_registration_status)(const struct device *dev, enum cellular_access_technology tech, enum cellular_registration_status *status)
API for getting registration status.
Definition hl78xx_apis.h:149
int hl78xx_evt_monitor_register(struct hl78xx_evt_monitor_entry *mon)
Register an event monitor to receive HL78xx modem event notifications.
int(* hl78xx_api_get_supported_networks)(const struct device *dev, const struct hl78xx_network **networks, uint8_t *size)
API for getting supported networks.
Definition hl78xx_apis.h:135
#define CSQ_RSSI_TO_DB(v)
Definition hl78xx_apis.h:25
int(* hl78xx_api_get_signal)(const struct device *dev, const enum cellular_signal_type type, int16_t *value)
API for getting network signal strength.
Definition hl78xx_apis.h:140
int(* hl78xx_api_set_phone_functionality)(const struct device *dev, enum hl78xx_phone_functionality functionality, bool reset)
API for set phone functionality.
Definition hl78xx_apis.h:157
int(* hl78xx_api_send_at_cmd)(const struct device *dev, const char *cmd, uint16_t cmd_size, const struct modem_chat_match *response_matches, uint16_t matches_size)
API for get phone functionality.
Definition hl78xx_apis.h:166
int hl78xx_evt_notif_handler_set(hl78xx_evt_monitor_dispatcher_t handler)
Set the event notification handler for HL78xx modem events.
hl78xx_evt_type
Definition hl78xx_apis.h:113
@ HL78XX_LTE_REGISTRATION_STAT_UPDATE
Definition hl78xx_apis.h:115
@ HL78XX_LTE_RAT_UPDATE
Definition hl78xx_apis.h:114
@ HL78XX_LTE_MODEM_STARTUP
Definition hl78xx_apis.h:117
@ HL78XX_LTE_SIM_REGISTRATION
Definition hl78xx_apis.h:116
static int hl78xx_parse_rsrp(uint8_t rsrp, int16_t *value)
Convert raw RSRP value from the modem to dBm.
Definition hl78xx_apis.h:365
#define CSQ_RSSI_UNKNOWN
Definition hl78xx_apis.h:21
#define CESQ_RSRQ_UNKNOWN
Definition hl78xx_apis.h:23
static int hl78xx_parse_rssi(uint8_t rssi, int16_t *value)
Convert raw RSSI value from the modem to dBm.
Definition hl78xx_apis.h:337
void(* hl78xx_evt_monitor_handler_t)(struct hl78xx_evt *notif, struct hl78xx_evt_monitor_entry *mon)
Definition hl78xx_apis.h:175
int(* hl78xx_api_get_modem_info)(const struct device *dev, const enum cellular_modem_info_type type, char *info, size_t size)
API for getting modem information.
Definition hl78xx_apis.h:144
int hl78xx_api_func_set_phone_functionality(const struct device *dev, enum hl78xx_phone_functionality functionality, bool reset)
hl78xx_api_func_set_phone_functionality
int(* hl78xx_api_set_apn)(const struct device *dev, const char *apn, uint16_t size)
API for setting apn.
Definition hl78xx_apis.h:154
hl78xx_modem_info_type
Cellular modem info type.
Definition hl78xx_apis.h:91
@ HL78XX_MODEM_INFO_APN
Definition hl78xx_apis.h:93
@ HL78XX_MODEM_INFO_CURRENT_RAT
Definition hl78xx_apis.h:95
@ HL78XX_MODEM_INFO_NETWORK_OPERATOR
Definition hl78xx_apis.h:97
static void hl78xx_evt_monitor_resume(struct hl78xx_evt_monitor_entry *mon)
Resume monitor.
Definition hl78xx_apis.h:423
int(* hl78xx_api_get_phone_functionality)(const struct device *dev, enum hl78xx_phone_functionality *functionality)
API for get phone functionality.
Definition hl78xx_apis.h:162
hl78xx_module_status
Module status codes.
Definition hl78xx_apis.h:80
@ HL78XX_MODULE_SIM_NOT_PRESENT
Definition hl78xx_apis.h:83
@ HL78XX_MODULE_READY
Definition hl78xx_apis.h:81
@ HL78XX_MODULE_UNRECOVERABLE_ERROR
Definition hl78xx_apis.h:85
@ HL78XX_MODULE_INACTIVE_SIM
Definition hl78xx_apis.h:87
@ HL78XX_MODULE_WAITING_FOR_ACCESS_CODE
Definition hl78xx_apis.h:82
@ HL78XX_MODULE_UNKNOWN_STATE
Definition hl78xx_apis.h:86
@ HL78XX_MODULE_SIMLOCK
Definition hl78xx_apis.h:84
static int hl78xx_get_modem_info(const struct device *dev, const enum hl78xx_modem_info_type type, void *info, size_t size)
Get modem info for the device.
Definition hl78xx_apis.h:252
int hl78xx_api_func_get_phone_functionality(const struct device *dev, enum hl78xx_phone_functionality *functionality)
hl78xx_api_func_get_phone_functionality
int hl78xx_api_func_get_modem_info_vendor(const struct device *dev, enum hl78xx_modem_info_type type, void *info, size_t size)
hl78xx_api_func_get_modem_info_vendor - Brief description of the function.
void(* hl78xx_evt_monitor_dispatcher_t)(struct hl78xx_evt *notif)
Definition hl78xx_apis.h:173
static void hl78xx_evt_monitor_pause(struct hl78xx_evt_monitor_entry *mon)
Pause monitor.
Definition hl78xx_apis.h:412
int hl78xx_api_func_modem_dynamic_cmd_send(const struct device *dev, const char *cmd, uint16_t cmd_size, const struct modem_chat_match *response_matches, uint16_t matches_size)
hl78xx_api_func_modem_dynamic_cmd_send - Brief description of the function.
int hl78xx_api_func_get_signal(const struct device *dev, const enum cellular_signal_type type, int16_t *value)
hl78xx_api_func_get_signal - Brief description of the function.
static int hl78xx_modem_cmd_send(const struct device *dev, const char *cmd, uint16_t cmd_size, const struct modem_chat_match *response_matches, uint16_t matches_size)
Send an AT command to the modem and wait for a matched response.
Definition hl78xx_apis.h:316
static int hl78xx_set_phone_functionality(const struct device *dev, enum hl78xx_phone_functionality functionality, bool reset)
Set the modem phone functionality mode.
Definition hl78xx_apis.h:273
int hl78xx_evt_monitor_unregister(struct hl78xx_evt_monitor_entry *mon)
Unregister an event monitor from receiving HL78xx modem event notifications.
static int hl78xx_get_phone_functionality(const struct device *dev, enum hl78xx_phone_functionality *functionality)
Get the current phone functionality mode of the modem.
Definition hl78xx_apis.h:293
enum cellular_access_technology hl78xx_rat_to_access_tech(enum hl78xx_cell_rat_mode rat_mode)
Convert HL78xx RAT mode to standard cellular API.
flags
Definition parser.h:97
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
__INT16_TYPE__ int16_t
Definition stdint.h:73
Runtime device structure (in ROM) per driver instance.
Definition device.h:510
Definition hl78xx_apis.h:178
uint8_t direct
Definition hl78xx_apis.h:185
uint8_t paused
Definition hl78xx_apis.h:184
struct hl78xx_evt_monitor_entry * next
Definition hl78xx_apis.h:182
struct hl78xx_evt_monitor_entry::@123314375256277045305202074155231060013037303316 flags
const hl78xx_evt_monitor_handler_t handler
Monitor callback.
Definition hl78xx_apis.h:180
Definition hl78xx_apis.h:120
enum hl78xx_evt_type type
Definition hl78xx_apis.h:121
bool status
Definition hl78xx_apis.h:126
union hl78xx_evt::@245116247166211205273371261316135324040054344202 content
int value
Definition hl78xx_apis.h:127
enum hl78xx_cell_rat_mode rat_mode
Definition hl78xx_apis.h:125
enum cellular_registration_status reg_status
Definition hl78xx_apis.h:124
Cellular network structure.
Definition hl78xx_apis.h:101
enum hl78xx_cell_rat_mode technology
Cellular access technology.
Definition hl78xx_apis.h:103
uint16_t * bands
List of bands, as defined by the specified cellular access technology, to enables.
Definition hl78xx_apis.h:108
uint16_t size
Size of bands.
Definition hl78xx_apis.h:110
Modem chat match.
Definition chat.h:47