本文主要是介绍[NOVATEK] NT96580行车记录仪功能学习笔记,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、u-Boot升级灯
运行u-Boot程序时LED灯闪烁,找到运行过程中一直在运行的函数在里面进行LED引脚电平的翻转
宏定义
Z:\SunFan\AHD580\pip\na51055_PIP\BSP\u-boot\include\configs\nvt-na51055-evb.h
Z:\SunFan\AHD580\pip\na51055_PIP\BSP\u-boot\drivers\mtd\nvt_flash_spi\nvt_flash_spi_cmd.c
自带led引脚电平设置函数
/* LED function for FW update*/
static void led_set_gpio_high(int operation)
{u32 gpio_reg;int ofs = NVT_LED_RED_PIN/32;int shift = NVT_LED_RED_PIN & 0x1F;ofs = ofs*0x4;/*Set gpio as high*/gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs);#if 0if (gpio_reg & (1 << shift))RESTORE_GPIO_DIR = 1;else {gpio_reg |= (1 << shift);OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg);}#elsegpio_reg |= (1 << shift);OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg);#endifOUTW(IOADDR_GPIO_REG_BASE + 0x40 + ofs, (1 << shift));//LED BLUEofs = NVT_LED_BLUE_PIN/32;shift = NVT_LED_BLUE_PIN & 0x1F;ofs = ofs*0x4;gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs);gpio_reg |= (1 << shift);OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg);OUTW(IOADDR_GPIO_REG_BASE + 0x40 + ofs, (1 << shift));#if 0 // do not use delay!!! it will slow down flash erase/program!!!/*Config duration*/if (operation)mdelay(NVT_LED_PROGRAM_DURATION);elsemdelay(NVT_LED_ERASE_DURATION);#endif
}static void led_set_gpio_low(void)
{//u32 gpio_reg;int ofs = NVT_LED_RED_PIN/32;int shift = NVT_LED_RED_PIN & 0x1F;ofs = ofs*0x4;/*Set gpio as low*/OUTW(IOADDR_GPIO_REG_BASE + 0x60 + ofs, (1 << shift));//LED BLUEofs = NVT_LED_BLUE_PIN/32;shift = NVT_LED_BLUE_PIN & 0x1F;ofs = ofs*0x4;OUTW(IOADDR_GPIO_REG_BASE + 0x60 + ofs, (1 << shift));#if 0/*Force gpio direction as original config*/if (!(RESTORE_GPIO_DIR)) {gpio_reg = INW(IOADDR_GPIO_REG_BASE + 0x20 + ofs);gpio_reg &= ~(1 << shift);OUTW(IOADDR_GPIO_REG_BASE + 0x20 + ofs, gpio_reg);RESTORE_GPIO_DIR = 0;}#endif
}
在spiNand_programPage和nand_cmd_erase_block里面进行计数电平翻转
这篇关于[NOVATEK] NT96580行车记录仪功能学习笔记的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!