Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/c/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C 错误:';SpimodFlashWrite';_C_Microblaze - Fatal编程技术网

C 错误:';SpimodFlashWrite';

C 错误:';SpimodFlashWrite';,c,microblaze,C,Microblaze,当我将此函数调用到另一个函数时,函数中出现错误,可能是我传递错误的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_O

当我将此函数调用到另一个函数时,函数中出现错误,可能是我传递错误的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;
`

错误:“SpimodFlashWrite”的类型冲突


谢谢

头文件中是否声明了
SpimodFlashWrite
函数?是否包含头文件?如何在头文件中声明函数?hello`int-SpimodFlashWrite(XSpi*SpiPtr,u32地址,u16字节数);`我在headerYes中这样声明,那么您有一个冲突的类型。参数
地址的类型是什么?更糟糕的是,您也错误地调用了它(假设
u32
u16
都是无符号整数类型)。这是什么警告
警告:传递'SpimodFlashWrite'的参数2会从指针生成整数,而不使用强制转换(默认情况下启用)
?听起来就是这样。您说函数的参数是一个整数值。但是你传递了一个指针。也许你应该后退几步,读一本书(任何真正的书),学习数组、指针以及数组如何衰减为指针。
 `int express_configure( void )
  {

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