我现在可以在uefi中控制gpio,所以我可以控制物理层没有问题。同时,成功打开I2C_instance via。高通 I2cApiLib。但是当我在我的代码中使用 I2C_read/write 时,引导加载程序会在启动时崩溃。
崩溃日志如下:
示例代码:
EFI_STATUS
EFIAPI
BootLEDMain(IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable)
{
DEBUG((EFI_D_ERROR, "------BootLED APPLICATION TEST------\n"));
i2c_status istatus = I2C_SUCCESS;
VOID *i2c_handle = NULL;
UINT32 bytes_read = 0;
uint8 readbuf = 0;
//UINT32 bytes_written = 0;
//uint8 writebuf = 0x01;
i2c_config cfg;
cfg.bus_frequency_khz = 400;
cfg.slave_address = 0x77;
cfg.slave_address_type = I2C_07_BIT_SLAVE_ADDRESS;
istatus = i2c_open((i2c_instance) (I2C_INSTANCE_003), &i2c_handle);
if (I2C_SUCCESS != istatus)
{
DEBUG((EFI_D_ERROR, "Failed to initialize I2C %d\n", istatus));
goto error;
}
else
{
DEBUG((EFI_D_ERROR, "Succeed to open I2C\n"));
}
istatus = i2c_read (i2c_handle, &cfg, 0x45, 1, &readbuf, 1, &bytes_read, 2500);
if (I2C_SUCCESS != istatus)
{
DEBUG((EFI_D_ERROR, "Read Failed %d\n", (uint32) istatus));
goto error;
}
else
{
DEBUG((EFI_D_ERROR, "Succeed to Read\n"));
}
.
.
.
对qualcomm uefi有点了解的各位能否解释一下原因,谢谢。评论你们需要或想知道的细节。