LOCAL AT91S_MciDeviceFeatures MCI_Device_Features;
LOCAL AT91S_MciDeviceDesc MCI_Device_Desc;
LOCAL AT91S_MciDevice * pMCI_Device=0;
/*-----------------------------------------------*/
/* SDCard Device Descriptor Structure Definition */
/*-----------------------------------------------*/
typedef struct _AT91S_MciDeviceDesc
{
volatile unsigned int state;
unsigned int SDCard_bus_width;
} AT91S_MciDeviceDesc, *AT91PS_MciDeviceDesc;
/*---------------------------------------------*/
/* MMC & SDCard Structure Device Features */
/*---------------------------------------------*/
typedef struct _AT91S_MciDeviceFeatures
{
unsigned int Card_Inserted; /* (0=AT91C_CARD_REMOVED) (1=AT91C_MMC_CARD_INSERTED) (2=AT91C_SD_CARD_INSERTED)*/
unsigned int Relative_Card_Address; /* RCA*/
unsigned int Max_Read_DataBlock_Length; /* 2^(READ_BL_LEN) in CSD */
unsigned int Max_Write_DataBlock_Length; /* 2^(WRITE_BL_LEN) in CSD*/
unsigned int Read_Partial; /* READ_BL_PARTIAL*/
unsigned int Write_Partial; /* WRITE_BL_PARTIAL*/
unsigned int Erase_Block_Enable; /* ERASE_BLK_EN*/
unsigned int Read_Block_Misalignment; /* READ_BLK_MISALIGN*/
unsigned int Write_Block_Misalignment; /* WRITE_BLK_MISALIGN*/
unsigned int Sector_Size; /* SECTOR_SIZE*/
unsigned int Memory_Capacity; /* Size in bits of the device*/
} AT91S_MciDeviceFeatures, *AT91PS_MciDeviceFeatures ;
/*---------------------------------------------*/
/* MCI Device Structure Definition */
/*---------------------------------------------*/
typedef struct _AT91S_MciDevice
{
BLK_DEV blkDev;
int drive;
int blkOffset ;
AT91PS_MciDeviceDesc pMCI_DeviceDesc; /* MCI device descriptor*/
AT91PS_MciDeviceFeatures pMCI_DeviceFeatures;/* Pointer on a MCI device features array */
}AT91S_MciDevice, *AT91PS_MciDevice;
void AT91F_CfgDevice(AT91PS_MciDevice pmmcDev)
{
/* Init Device Structure*/
MCI_Device_Features.Relative_Card_Address = 0;
MCI_Device_Features.Card_Inserted = AT91C_CARD_REMOVED;
MCI_Device_Features.Max_Read_DataBlock_Length = 0;
MCI_Device_Features.Max_Write_DataBlock_Length = 0;
MCI_Device_Features.Read_Partial = 0;
MCI_Device_Features.Write_Partial = 0;
MCI_Device_Features.Erase_Block_Enable = 0;
MCI_Device_Features.Sector_Size = 0;
MCI_Device_Features.Memory_Capacity = 0;
MCI_Device_Desc.state = AT91C_MCI_IDLE;
MCI_Device_Desc.SDCard_bus_width = AT91C_MCI_SCDBUS;
/* Init AT91S_DataFlash Global Structure, by default AT45DB choosen !!!*/
pmmcDev->pMCI_DeviceDesc = &MCI_Device_Desc;
pmmcDev->pMCI_DeviceFeatures = &MCI_Device_Features;
}
void mmcDevCreate(void)
{
AT91PS_MciDevice pmmcDev;
if ((pmmcDev = (AT91PS_MciDevice )calloc(sizeof (AT91PS_MciDevice), 1)) == NULL)
return (NULL);
pMCI_Device = pmmcDev;
AT91F_CfgDevice(pmmcDev);
}
上面代码中,执行到
pmmcDev->pMCI_DeviceDesc = &MCI_Device_Desc;
pmmcDev->pMCI_DeviceFeatures = &MCI_Device_Features;
系统出错,提示信息如下:
Data abort
Exception address: 0x20013fe8
Current Processor Status Register: 0x20000013
trcStack aborted: error in top frame
shell restarted.
请问,这边可以直接给指针赋值?谢谢!