Platform/ECM3532/M3/framework/sensor_mgr/src/sensor.c
/**
 * Register sensor driver to SM
 *
 * @param Name Sensor driver name
 * @param sDrvOps Sensor driver ops struture pointer
 *
 * @return 0 on success, negative error code on failure.
 */
Register sensor driver to SM
@param Name Sensor driver name
@param sDrvOps Sensor driver ops struture pointer

@return 0 on success, negative error code on failure.
Register sensor driver to SM @param Name Sensor driver name @param sDrvOps Sensor driver ops struture pointer @return 0 on success negative error code on failure .
int32_t SensorDrvRegister(char *Name, tSensorDrvOps *sDrvOps)
{
    int32_t ret = -EINVAL;
    uint8_t ui8Cnt;
    if (!SmLock)
    {
        SmLock = xSemaphoreCreateMutex();
        for(ui8Cnt = 0; ui8Cnt < DRIVER_MAX_CNT; ui8Cnt++)
        {
            sHandleMapList[ui8Cnt].vDrvHandle = INVALID_HANDLE;
        }
    }
    if((Name && sDrvOps))
    {
        if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)
            xSemaphoreTake(SmLock, portMAX_DELAY);
        for(ui8Cnt = 0; ui8Cnt < SENSOR_MAX_CNT; ui8Cnt++)
        {
            if(!sSensorDevList[ui8Cnt].name)
                break;
        }
        if (ui8Cnt < SENSOR_MAX_CNT)
        {
            sSensorDevList[ui8Cnt].name = Name;
            sSensorDevList[ui8Cnt].sDops = sDrvOps;
            ret = 0;
        }
        if (xTaskGetSchedulerState() == taskSCHEDULER_RUNNING)
            xSemaphoreGive(SmLock);
    }
    return ret;
}
int32_t SensorDrvRegister ( char * Name , tSensorDrvOps * sDrvOps ) { int32_t ret = - EINVAL ; uint8_t ui8Cnt ; if ( ! SmLock ) { SmLock = xSemaphoreCreateMutex ( ) ; for ( ui8Cnt = 0 ; ui8Cnt < DRIVER_MAX_CNT ; ui8Cnt ++ ) { sHandleMapList [ ui8Cnt ] . vDrvHandle = INVALID_HANDLE ; } } if ( ( Name && sDrvOps ) ) { if ( xTaskGetSchedulerState ( ) == taskSCHEDULER_RUNNING ) xSemaphoreTake ( SmLock , portMAX_DELAY ) ; for ( ui8Cnt = 0 ; ui8Cnt < SENSOR_MAX_CNT ; ui8Cnt ++ ) { if ( ! sSensorDevList [ ui8Cnt ] . name ) break ; } if ( ui8Cnt < SENSOR_MAX_CNT ) { sSensorDevList [ ui8Cnt ] . name = Name ; sSensorDevList [ ui8Cnt ] . sDops = sDrvOps ; ret = 0 ; } if ( xTaskGetSchedulerState ( ) == taskSCHEDULER_RUNNING ) xSemaphoreGive ( SmLock ) ; } return ret ; }
Register sensor driver to SM
 @param Name Sensor driver name
 @param sDrvOps Sensor driver ops struture pointer
Register sensor driver to SM @param Name Sensor driver name @param sDrvOps Sensor driver ops struture pointer
/* Get Free Entry */