DJI Onboard SDK  4.0
Macros | Typedefs | Functions
osdk_platform.h File Reference

This is the header file for define OSDK platform interfaces. More...

#include "osdk_typedef.h"
Include dependency graph for osdk_platform.h:

Go to the source code of this file.

Macros

#define OSDK_TASK_STACK_SIZE_DEFAULT   1024
 

Typedefs

typedef void * T_OsdkTaskHandle
 Platform handle of thread task operation.
 
typedef void * T_OsdkMutexHandle
 Platform handle of mutex operation.
 
typedef void * T_OsdkSemHandle
 Platform handle of semaphore operation.
 

Functions

E_OsdkStat OsdkPlatform_RegHalUartHandler (const T_OsdkHalUartHandler *halUartHandler)
 Register the handler for hal uart interfaces by your platform. More...
 
E_OsdkStat OsdkPlatform_RegOsalHandler (const T_OsdkOsalHandler *osalHandler)
 Register the handler for osal interfaces by your platform. More...
 
E_OsdkStat OsdkOsal_TaskCreate (T_OsdkTaskHandle *task, void *(*taskFunc)(void *), uint32_t stackSize, void *arg)
 Declare the task container, initialize the task, and create task ID. More...
 
E_OsdkStat OsdkOsal_TaskDestroy (T_OsdkTaskHandle task)
 Destroy the created task. More...
 
E_OsdkStat OsdkOsal_TaskSleepMs (uint32_t timeMs)
 Let task into a sleep state in a set time, uint:ms. More...
 
E_OsdkStat OsdkOsal_MutexCreate (T_OsdkMutexHandle *mutex)
 Declare the mutex container, initialize the mutex, and create mutex ID. More...
 
E_OsdkStat OsdkOsal_MutexDestroy (T_OsdkMutexHandle mutex)
 Destroy the created mutex. More...
 
E_OsdkStat OsdkOsal_MutexLock (T_OsdkMutexHandle mutex)
 Acquire and lock the mutex when peripheral access is required. More...
 
E_OsdkStat OsdkOsal_MutexUnlock (T_OsdkMutexHandle mutex)
 Unlock and release the mutex, when done with the peripheral access. More...
 
E_OsdkStat OsdkOsal_SemaphoreCreate (T_OsdkSemHandle *semaphore, uint32_t initValue)
 Declare the semaphore container, initialize the semaphore, and create semaphore ID. More...
 
E_OsdkStat OsdkOsal_SemaphoreDestroy (T_OsdkSemHandle semaphore)
 Destroy the created semaphore. More...
 
E_OsdkStat OsdkOsal_SemaphoreWait (T_OsdkSemHandle semaphore)
 Wait the created semaphore forever. More...
 
E_OsdkStat OsdkOsal_SemaphoreTimedWait (T_OsdkSemHandle semaphore, uint32_t waitTimeMs)
 Wait the created semaphore and set the value of timeout. More...
 
E_OsdkStat OsdkOsal_SemaphorePost (T_OsdkSemHandle semaphore)
 Post the created semaphore. More...
 
E_OsdkStat OsdkOsal_GetTimeMs (uint32_t *ms)
 Get the system millisecond time, uint:ms. More...
 
void * OsdkOsal_Malloc (uint32_t size)
 Get the system time, uint:us. More...
 
void OsdkOsal_Free (void *ptr)
 Release allocated memory. More...
 

Detailed Description

This is the header file for define OSDK platform interfaces.

Version
V2.0.0
Date
2019/8/30

All information contained herein is, and remains, the property of DJI. The intellectual and technical concepts contained herein are proprietary to DJI and may be covered by U.S. and foreign patents, patents in process, and protected by trade secret or copyright law. Dissemination of this information, including but not limited to data and other proprietary material(s) incorporated within the information, in any form, is strictly prohibited without the express written consent of DJI.

If you receive this source code without DJI’s authorization, you may not further disseminate the information, and you must immediately remove the source code and notify DJI of its removal. DJI reserves the right to pursue legal actions against you for any loss(es) or damage(s) caused by your failure to do so.

Function Documentation

◆ OsdkOsal_Free()

void OsdkOsal_Free ( void *  ptr)

Release allocated memory.

Note
After calling the OsdkOsal_Malloc interface, if you do not use memory, please remember to use this interface to release the memory.
Parameters
ptrpointer to the need allocated memory.

◆ OsdkOsal_GetTimeMs()

E_OsdkStat OsdkOsal_GetTimeMs ( uint32_t *  ms)

Get the system millisecond time, uint:ms.

Parameters
mspointer to the got time ms.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_Malloc()

void* OsdkOsal_Malloc ( uint32_t  size)

Get the system time, uint:us.

Parameters
uspointer to the got time us.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.Allocate size bytes of memory.
Note
Users need to apply for memory according to the actual situation of the platform and application. If you do not use the memory after applying for it, please call OsdkOsal_Free to release the memory.
Parameters
sizeuint32_t size that need allocate.
Returns
a void pointer to the allocated memory, if equal to NULL, please do related processing to avoid null pointer crash.

◆ OsdkOsal_MutexCreate()

E_OsdkStat OsdkOsal_MutexCreate ( T_OsdkMutexHandle mutex)

Declare the mutex container, initialize the mutex, and create mutex ID.

Parameters
mutexpointer to the created mutex ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_MutexDestroy()

E_OsdkStat OsdkOsal_MutexDestroy ( T_OsdkMutexHandle  mutex)

Destroy the created mutex.

Parameters
mutexpointer to the created mutex ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_MutexLock()

E_OsdkStat OsdkOsal_MutexLock ( T_OsdkMutexHandle  mutex)

Acquire and lock the mutex when peripheral access is required.

Parameters
mutexpointer to the created mutex ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_MutexUnlock()

E_OsdkStat OsdkOsal_MutexUnlock ( T_OsdkMutexHandle  mutex)

Unlock and release the mutex, when done with the peripheral access.

Parameters
mutexpointer to the created mutex ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_SemaphoreCreate()

E_OsdkStat OsdkOsal_SemaphoreCreate ( T_OsdkSemHandle semaphore,
uint32_t  initValue 
)

Declare the semaphore container, initialize the semaphore, and create semaphore ID.

Parameters
semaphorepointer to the created semaphore ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_SemaphoreDestroy()

E_OsdkStat OsdkOsal_SemaphoreDestroy ( T_OsdkSemHandle  semaphore)

Destroy the created semaphore.

Parameters
semaphorepointer to the created semaphore ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_SemaphorePost()

E_OsdkStat OsdkOsal_SemaphorePost ( T_OsdkSemHandle  semaphore)

Post the created semaphore.

Parameters
semaphorepointer to the created semaphore ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_SemaphoreTimedWait()

E_OsdkStat OsdkOsal_SemaphoreTimedWait ( T_OsdkSemHandle  semaphore,
uint32_t  waitTimeMs 
)

Wait the created semaphore and set the value of timeout.

Parameters
semaphorepointer to the created semaphore ID.
waitTimeMsvalue of timeout for waiting created semaphore.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_SemaphoreWait()

E_OsdkStat OsdkOsal_SemaphoreWait ( T_OsdkSemHandle  semaphore)

Wait the created semaphore forever.

Parameters
semaphorepointer to the created semaphore ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_TaskCreate()

E_OsdkStat OsdkOsal_TaskCreate ( T_OsdkTaskHandle task,
void *(*)(void *)  taskFunc,
uint32_t  stackSize,
void *  arg 
)

Declare the task container, initialize the task, and create task ID.

Parameters
pthread_tpointer to the created task ID.
taskFuncpointer to the created task function.
stackSizevalue of task stack size.
argpointer to the user defined data.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_TaskDestroy()

E_OsdkStat OsdkOsal_TaskDestroy ( T_OsdkTaskHandle  task)

Destroy the created task.

Parameters
pthread_tpointer to the created task ID.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkOsal_TaskSleepMs()

E_OsdkStat OsdkOsal_TaskSleepMs ( uint32_t  timeMs)

Let task into a sleep state in a set time, uint:ms.

Parameters
timeMsvalue of time ms for task sleeping.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkPlatform_RegHalUartHandler()

E_OsdkStat OsdkPlatform_RegHalUartHandler ( const T_OsdkHalUartHandler *  halUartHandler)

Register the handler for hal uart interfaces by your platform.

Note
It should be noted that the interface in hal is written and tested well. Users need to implement all the interfaces. Otherwise, the user interface cannot be successfully registered, and then the user interface is registered through the interface. If the registration fails, it needs to be based on the return code. To judge the problem. Make sure that the feature is available after successful registration. The interface needs to be called at the beginning of the application for registration, otherwise the subsequent functions will not work properly.
Parameters
halUartHandlerpointer to the handler for hal uart interfaces by your platform.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.

◆ OsdkPlatform_RegOsalHandler()

E_OsdkStat OsdkPlatform_RegOsalHandler ( const T_OsdkOsalHandler *  osalHandler)

Register the handler for osal interfaces by your platform.

Note
It should be noted that the interface in osal is written and tested well. Users need to implement all the interfaces. Otherwise, the user interface cannot be successfully registered, and then the user interface is registered through the interface. If the registration fails, it needs to be based on the return code. To judge the problem. Make sure that the feature is available after successful registration. The interface needs to be called at the beginning of the application for registration, otherwise the subsequent functions will not work properly.
Parameters
osalHandlerpointer to the handler for osal interfaces by your platform.
Returns
The return code represents the status of the interface execution. For details, please refer to the osdk_typedef.h.