RESET != (FMC_CTL0 & FMC_CTL0_LK)
时间: 2023-12-20 11:07:41 浏览: 150
这是一个IT类问题。这个式子是在判断Flash Memory Control的锁定状态是否为解锁状态。RESET表示FMC已被重置,FMC_CTL0是FMC的控制寄存器,FMC_CTL0_LK是FMC的锁定位。如果FMC_CTL0_LK为0,则表示FMC未被锁定,即为解锁状态。因此,这个式子的含义是:如果FMC已被重置且FMC未被锁定,则该式子成立。
相关问题
if(FMC_READY == fmc_state){ FMC_CTL0 |= FMC_CTL0_PER; FMC_ADDR0 = page_address; FMC_CTL0 |= FMC_CTL0_START; /* wait for the FMC ready */ fmc_state = fmc_bank0_ready_wait(FMC_TIMEOUT_COUNT); /* reset the PER bit */ FMC_CTL0 &= ~FMC_CTL0_PER; }
这段代码是在进行Flash写操作。如果FMC已经准备好(FMC_READY == fmc_state),则将FMC_CTL0寄存器的FMC_CTL0_PER位置为1,表示打开Flash编程使能。接着设置FMC_ADDR0寄存器的值为要编程的页地址。然后将FMC_CTL0寄存器的FMC_CTL0_START位置为1,开始Flash编程操作。此时需要等待FMC编程完成,即等待FMC_READY状态。如果等待超时,fmc_state将被设置为错误状态。如果FMC编程完成,则将FMC_CTL0寄存器的FMC_CTL0_PER位置为0,表示关闭Flash编程使能。
fmc_state_enum fmc_word_program(uint32_t address, uint32_t data) { fmc_state_enum fmc_state = FMC_READY; if(FMC_BANK0_SIZE < FMC_SIZE){ if(FMC_BANK0_END_ADDRESS > address){ fmc_state = fmc_bank0_ready_wait(FMC_TIMEOUT_COUNT); if(FMC_READY == fmc_state){ /* set the PG bit to start program */ FMC_CTL0 |= FMC_CTL0_PG; REG32(address) = data; /* wait for the FMC ready */ fmc_state = fmc_bank0_ready_wait(FMC_TIMEOUT_COUNT); /* reset the PG bit */ FMC_CTL0 &= ~FMC_CTL0_PG; } }else{ fmc_state = fmc_bank1_ready_wait(FMC_TIMEOUT_COUNT); if(FMC_READY == fmc_state){ /* set the PG bit to start program */ FMC_CTL1 |= FMC_CTL1_PG; REG32(address) = data; /* wait for the FMC ready */ fmc_state = fmc_bank1_ready_wait(FMC_TIMEOUT_COUNT); /* reset the PG bit */ FMC_CTL1 &= ~FMC_CTL1_PG; } } }else{ fmc_state = fmc_bank0_ready_wait(FMC_TIMEOUT_COUNT); if(FMC_READY == fmc_state){ /* set the PG bit to start program */ FMC_CTL0 |= FMC_CTL0_PG; REG32(address) = data; /* wait for the FMC ready */ fmc_state = fmc_bank0_ready_wait(FMC_TIMEOUT_COUNT); /* reset the PG bit */ FMC_CTL0 &= ~FMC_CTL0_PG; } } /* return the FMC state */ return fmc_state; }
这段代码看起来是一个烧录器或者编程器的代码,用于将数据写入地址中。函数名是fmc_word_program,输入参数是要写入的地址和数据。代码中首先判断FMC_BANK0_SIZE是否小于FMC_SIZE,如果是,则说明只有一个FMC BANK可以使用,否则有两个可以使用。然后根据地址所在的FMC BANK,调用相应的fmc_bank_ready_wait函数等待FMC就绪。如果FMC就绪,则设置PG位开始编程,将数据写入地址中,等待FMC再次就绪后,清除PG位。最后返回FMC状态。
阅读全文