|
在这种情况下,camera的驱动当然也就不会放在kernel下了,目前她被放在hardware/tegra/odm/product***/下,要具体地添加一个camera及其驱动,主要步骤如下:
1)odm_kit/query/include/nvodm_query_discovery_imager.h
定义一个标识序列,例如
#define QQ1234_GUID NV_ODM_GUID('s','_','Q','Q','1','2','3','4')
2)odm_kit/query/subboards/nvodm_query_discovery_e***_addresses.h 配置camera的硬件连接参数
java代码: #define QQ1234_PINS (NVODM_CAMERA_DEVICE_IS_DEFAULT)
static const NvOdmIoAddress s_ffaImagerQQ1234Addresses[] =
{
I2C配置;
Reset GPIO 配置;
powerdown GPIO 配置;
Camera VDD 配置;
VCSI 配置;
Video input 配置;
external Clock (CSUS)配置;
};
3)odm_kit/query/subboards/nvodm_query_discovery_e***_peripherals.h camera设备入口地址同GUID关联
java代码: // QQ1234
{
QQ1234_GUID,
s_ffaImagerQQ1234Addresses,
NV_ARRAY_SIZE(s_ffaImagerQQ1234Addresses),
NvOdmPeripheralClass_Imager
},
4)odm_kit/adaptations/imager/Android.mk
LOCAL_SRC_FILES += sensor_yuv_qq1234.c
5)odm_kit/adaptations/imager/imager_hal.c
添加Hal层会枚举的camera类型
java代码: #include "sensor_yuv_qq1234.h"
DeviceHalTable g_SensorHalTable[] ={
....
{QQ1234_GUID, SensorYuvQQ1234_GetHal},
....
};
5)odm_kit/adaptations/imager/sensor_yuv_qq1234.c
odm_kit/adaptations/imager/sensor_yuv_qq1234.h
NvBool SensorYuvxQQ1234_GetHal(NvOdmImagerHandle hImager);
这是对camera设备的配置和功能的具体实现的文件。硬件校准之类的工作主要就是修改sensor_yuv_qq1234.c
java代码: NvBool SensorYuvQQ1234_GetHal(NvOdmImagerHandle hImager)
{
if (!hImager || !hImager->pSensor)
return NV_FALSE;
hImager->pSensor->pfnOpen = SensorYuv_Open;
hImager->pSensor->pfnClose = SensorYuv_Close;
hImager->pSensor->pfnGetCapabilities = SensorYuv_GetCapabilities;
hImager->pSensor->pfnListModes = SensorYuv_ListModes;
hImager->pSensor->pfnSetMode = SensorYuv_SetMode;
hImager->pSensor->pfnSetPowerLevel = SensorYuv_SetPowerLevel;
hImager->pSensor->pfnGetPowerLevel = SensorYuv_GetPowerLevel;
hImager->pSensor->pfnSetParameter = SensorYuv_SetParameter;
hImager->pSensor->pfnGetParameter = SensorYuv_GetParameter;
return NV_TRUE;
} |
|