0

当我将此函数调用到另一个函数时,我在函数中出现错误可能是第二个参数 int u16 地址我传递错误

int SpimodFlashWrite(XSpi *SpiPtr, u16 Address, u16 ByteCount)
{
u16 Index;

/*
 * Setup the write command with the specified address, and data to be
 * written to the flash.
 */
WriteBuffer[MOD_COMMAND_OFFSET]       = MOD_COMMAND_WRITE;
WriteBuffer[MOD_ADDRESS_BYTE1_OFFSET] = (u8) (Address >> 16);
WriteBuffer[MOD_ADDRESS_BYTE2_OFFSET] = (u8) (Address >> 8);
WriteBuffer[MOD_ADDRESS_BYTE3_OFFSET] = (u8) (Address);

/*
 * Prepare the write buffer. Fill in the data that is to be written into
 * the Flash.
 */
for(Index = 4; Index < (ByteCount + MOD_READ_WRITE_EXTRA_BYTES);Index++)
{
    WriteBuffer[Index] = (u8)(MOD_TEST_BYTE + Index);
}

/*
 * Send the write command, address, and data to the Flash.
 * No receive buffer is specified since there is nothing to receive.
 */
TransferInProgress = TRUE;
XSpi_Transfer(SpiPtr, WriteBuffer, NULL,
        ByteCount + MOD_READ_WRITE_EXTRA_BYTES)
                        ;

/*
 * Wait till the Transfer is complete and check if there are any errors
 * in the transaction.
 */
while (TransferInProgress);
if(ErrorCount != 0) {
    ErrorCount = 0;
    return XST_FAILURE;
}

return XST_SUCCESS;

}

如果我像这样使用这个功能

 `int express_configure( void )
  {

 int Status;
 unsigned char b[3];
  b[0] = 0xD4;
 b[1]=29;b[2]=0x80;
 Status = SpimodFlashWrite(&Spi, b, 3);

`

错误:“SpimodFlashWrite”的类型冲突

谢谢

4

0 回答 0