SPI DTSI

https://blog.csdn.net/ibelieve1974/article/details/72235579

嵌入式中的BSP---BSP到底是什么?

https://blog.csdn.net/qq_38500662/article/details/80965774

BSP与HAL的关系

 

GPIO配置,电平的上拉,下拉。输入输出配置:

下面是某个平台上的gpio的配置:

*power management*/
int gf_power_on(struct gf_dev* gf_dev)
{
    int rc = 0;
    if (gpio_is_valid(gf_dev->pwr_gpio)) {
        gpio_set_value(gf_dev->pwr_gpio, 1);
    }
    msleep(10);
    pr_info("---- power on ok ----\n");

    return rc;
}

int gf_power_off(struct gf_dev* gf_dev)
{
    int rc = 0;
    if (gpio_is_valid(gf_dev->pwr_gpio)) {
        gpio_set_value(gf_dev->pwr_gpio, 0);
        gpio_set_value(gf_dev->reset_gpio, 0);
    }
    pr_info("---- power off ----\n");
    return rc;
}

/********************************************************************
 *CPU output low level in RST pin to reset GF. This is the MUST action for GF.
 *Take care of this function. IO Pin driver strength / glitch and so on.
 ********************************************************************/
int gf_hw_reset(struct gf_dev *gf_dev, unsigned int delay_ms)
{
    if(gf_dev == NULL) {
        pr_info("Input buff is NULL.\n");
        return -1;
    }
    gpio_direction_output(gf_dev->reset_gpio, 0); //这里注意一下gpio的方向(输入或者输出)
gpio_set_value(gf_dev->reset_gpio, 0); mdelay(3); gpio_set_value(gf_dev->reset_gpio, 1);//是拉高为高电平(1),或者拉低为低电平(0) mdelay(delay_ms); return 0; } int gf_irq_num(struct gf_dev *gf_dev) { if(gf_dev == NULL) { pr_info("Input buff is NULL.\n"); return -1; } else { return gpio_to_irq(gf_dev->irq_gpio); } }

DTSI的配置

 

上一篇:Magma calculator


下一篇:[tyvj 1450] GF打Dota {次短路}