kal.h

Overview

Related Modules:

KAL

Description:

Defines the kernel adaptation layer (KAL), which provides compatible interfaces across different types of OpenHarmony devices.

Since:

1.0

Version:

1.0

Summary

Data Structures

Data Structure Name

Description

ThreadInfo

Describes a thread.

MemInfo

Describes a memory pool.

Macros

Macro Name and Value

Description

KAL_TASK_NAME_LEN 32

Indicates the maximum length of a thread name.

Enumerations

Enumeration Name

Description

KalTimerType { KAL_TIMER_ONCE = 0, KAL_TIMER_PERIODIC = 1 }

Enumerates timer types.

KalErrCode { KAL_OK = 0, KAL_ERR_PARA = 1, KAL_ERR_INNER = 2, KAL_ERR_TIMER_STATE = 0x100 }

Enumerates return values of the KAL function.

Functions

Function Name

Description

KalThreadGetInfo (unsigned int threadId, ThreadInfo info)

unsigned int

Obtains thread information.

KalDelayUs (unsigned int us)

void

Delays a thread.

KalTimerCreate (KalTimerProc func, KalTimerType type, void arg, unsigned int ticks)

KalTimerId

Creates a timer.

KalTimerStart (KalTimerId timerId)

KalErrCode

Starts a timer.

KalTimerChange (KalTimerId timerId, unsigned int ticks)

KalErrCode

Changes the duration of a timer.

KalTimerStop (KalTimerId timerId)

KalErrCode

Stops a timer.

KalTimerDelete (KalTimerId timerId)

KalErrCode

Deletes a timer.

KalTimerIsRunning (KalTimerId timerId)

unsigned int

Checks whether a timer is running.

KalTickToMs (unsigned int ticks)

unsigned int

Converts system ticks into milliseconds.

KalMsToTick (unsigned int millisec)

unsigned int

Converts milliseconds into system ticks.

KalGetMemInfo (MemInfo *pmemInfo)

KalErrCode

Obtains memory information.