SERVICE_COMM

Defines

__ARRAY_EMPTY_
SIFLI_DEFAULT_YEAR
SIFLI_DEFAULT_MON
SIFLI_DEFAULT_DAY
SIFLI_DEFAULT_HOUR
SIFLI_DEFAULT_MIN
SIFLI_DEFAULT_SECOND
SIFLI_DEFAULT_TIMEZONE
service_get_elapse_ms(cur, pre)

Typedefs

typedef int (*comm_msg_cb_t)(comm_msg_t *msg)

The function prototype of primitive callback.

Enums

enum ds_type_t

The begin ID of the communication interface: between data_services, between processers, between HCPU and LCPU.

Values:

enumerator LCPU_SERVICE_CUSTOM_ID_BEGIN

used between LCPU and HCPU

enumerator BAT_SERVICE_CUSTOM_ID_BEGIN

used between BAT and APP

enumerator SENSOR_SERVICE_CUSTOM_ID_BEGIN

used between SENSOR and APP

enumerator PMIC_SERVICE_CUSTOM_ID_BEGIN

used between PMIC and APP

enumerator BLE_SERVICE_CUSTOM_ID_BEGIN

used between BLE/BT and APP

enumerator OTA_SERVICE_CUSTOM_ID_BEGIN

used between OTA and APP

enumerator APP_POPUP_CUSTOM_ID_BEGIN

used between POPUP and APP

enumerator USB_SERVICE_CUSTOM_ID_BEGIN

used between USB and APP

Functions

void *service_msg_fill(void *payload, uint32_t data_len, void *cb, uint32_t user_data)

Generate a Message used to inter-processer communication.

参数:
  • payload -- Message content which use to communicaiton

  • data_len -- Message length

  • user_data -- Message's user_data

返回值:

Pointer -- Message pointer with return type of comm_msg_t

void service_msg_rel(comm_msg_t *msg)

Release a msg which applied by service_msg_fill.

参数:
  • msg -- Message which applied by service_msg_fill

struct timezone *service_timezone_get(void)

Get current timezone.

返回值:

Pointer -- Timezone pointer

void service_timezone_set(struct timezone *tz)

Set current timezone.

参数:
  • tz -- Current timezone

uint32_t service_timezone_get_timestamp(int tz_minutes)

Get timestamp from timezone.

参数:
  • uint32_t -- timestamp

uint32_t service_timestamp_get(void)
void service_sys_time_set(sys_time_t *cur_time)

Set system time.

参数:
  • cur_time -- Current time

void service_sys_timestamp_set(time_t timestamp)

Set system timestamp.

参数:
  • timestamp -- Current timestamp

uint32_t service_current_ms_get(void)

Get tick, unit is millisecond.

返回值:

Pointer -- Message pointer with return type of comm_msg_t

time_data_t *service_current_time_get(bool ms_need)

Get current time.

参数:
  • ms_need -- Is need millisecond

返回值:

Pointer -- Current time with time_data_t's type

int service_time_init(void)

Intial time when power_on /awake from sleep /reset_system_time.

void service_watchdog_enable_set(uint8_t enable)

Enable watchdog or not.

参数:
  • enable -- Enable or not

返回值:

Pointer -- Current time with time_data_t's type

void service_watchdog_pet(void)

Pet watchdog.

uint32_t calc_crc32(uint32_t crc, const void *buf, uint32_t size)

Calculate the CRC32 value of a memory buffer.

参数:
  • Crc -- accumulated CRC32 value, must be 0 on first call

  • Buf -- buffer to calculate CRC32 value for

  • Size -- bytes in buffer

返回值:

crc_value -- Calculated CRC32 value

struct comm_msg_t
#include <service_comm.h>

The primitive of the communication interface: between processers.

Public Members

void *cb

primitive callback when received in receive process

uint32_t user_data

user data of primitive

uint32_t data_len

data length of body which will send to another process

void *data

body which will send to another processer

struct time_data_t
#include <service_comm.h>

The time stucture, used for service_current_time_get.

Public Members

uint16_t year
uint8_t month
uint8_t day
uint8_t hour
uint8_t min
uint8_t second
uint16_t ms
uint8_t wday
struct sys_time_t
#include <service_comm.h>

The time stucture, used for service_sys_time_set.

Public Members

uint16_t year
uint8_t month
uint8_t day
uint8_t hour
uint8_t min
uint8_t second
uint8_t hour_mode
int8_t zone
uint8_t dst_offset