Date: Fri, 11 Aug 2006 00:31:21 GMT From: Warner Losh <imp@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 103623 for review Message-ID: <200608110031.k7B0VL5c085162@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=103623 Change 103623 by imp@imp_lighthouse on 2006/08/11 00:31:09 Don't pass parameters that aren't used. Saves 58 bytes! Affected files ... .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/mci_device.c#4 edit .. //depot/projects/arm/src/sys/boot/arm/at91/libat91/mci_device.h#2 edit Differences ... ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/mci_device.c#4 (text+ko) ==== @@ -25,7 +25,6 @@ //*---------------------------------------------------------------------------- static AT91S_MCIDeviceStatus AT91F_MCI_SendCommand( - AT91PS_MciDevice pMCI_Device, unsigned int Cmd, unsigned int Arg) { @@ -83,7 +82,7 @@ if ( (Cmd_App && AT91C_SDCARD_APP_ALL_CMD) == 0) return AT91C_CMD_SEND_ERROR; - return(AT91F_MCI_SendCommand(pMCI_Device,Cmd_App,Arg)); + return(AT91F_MCI_SendCommand(Cmd_App,Arg)); } //*---------------------------------------------------------------------------- @@ -91,9 +90,9 @@ //* \brief Addressed card sends its status register //*---------------------------------------------------------------------------- static AT91S_MCIDeviceStatus -AT91F_MCI_GetStatus(AT91PS_MciDevice pMCI_Device,unsigned int relative_card_address) +AT91F_MCI_GetStatus(unsigned int relative_card_address) { - if (AT91F_MCI_SendCommand(pMCI_Device, AT91C_SEND_STATUS_CMD, + if (AT91F_MCI_SendCommand(AT91C_SEND_STATUS_CMD, relative_card_address <<16) == AT91C_CMD_SEND_OK) return (AT91C_BASE_MCI->MCI_RSPR[0]); return AT91C_CMD_SEND_ERROR; @@ -143,7 +142,7 @@ } - if ((AT91F_MCI_GetStatus(pMCI_Device, + if ((AT91F_MCI_GetStatus( pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address) & AT91C_SR_READY_FOR_DATA) != AT91C_SR_READY_FOR_DATA) { #if IMP_DEBUG @@ -198,7 +197,7 @@ AT91C_BASE_PDC_MCI->PDC_RCR = sizeToRead; // Send the Read single block command - if (AT91F_MCI_SendCommand(pMCI_Device, AT91C_READ_SINGLE_BLOCK_CMD, src) != AT91C_CMD_SEND_OK) + if (AT91F_MCI_SendCommand(AT91C_READ_SINGLE_BLOCK_CMD, src) != AT91C_CMD_SEND_OK) return AT91C_READ_ERROR; pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_RX_SINGLE_BLOCK; @@ -227,7 +226,7 @@ if( pMCI_Device->pMCI_DeviceDesc->state != AT91C_MCI_IDLE) return AT91C_WRITE_ERROR; - if( (AT91F_MCI_GetStatus(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address) & AT91C_SR_READY_FOR_DATA) != AT91C_SR_READY_FOR_DATA) + if( (AT91F_MCI_GetStatus(pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address) & AT91C_SR_READY_FOR_DATA) != AT91C_SR_READY_FOR_DATA) return AT91C_WRITE_ERROR; if ((dest + sizeToWrite) > pMCI_Device->pMCI_DeviceFeatures->Memory_Capacity) @@ -260,7 +259,7 @@ AT91C_BASE_PDC_MCI->PDC_TCR = sizeToWrite; // Send the write single block command - if ( AT91F_MCI_SendCommand(pMCI_Device, AT91C_WRITE_BLOCK_CMD, dest) != AT91C_CMD_SEND_OK) + if ( AT91F_MCI_SendCommand(AT91C_WRITE_BLOCK_CMD, dest) != AT91C_CMD_SEND_OK) return AT91C_WRITE_ERROR; pMCI_Device->pMCI_DeviceDesc->state = AT91C_MCI_TX_SINGLE_BLOCK; @@ -285,7 +284,7 @@ int status; //* Check if the MMC card chosen is already the selected one - status = AT91F_MCI_GetStatus(pMCI_Device,relative_card_address); + status = AT91F_MCI_GetStatus(relative_card_address); if (status < 0) return AT91C_CARD_SELECTED_ERROR; @@ -302,9 +301,8 @@ if (status > AT91C_MAX_MCI_CARDS) return AT91C_CARD_SELECTED_ERROR; - if (AT91F_MCI_SendCommand( pMCI_Device, - AT91C_SEL_DESEL_CARD_CMD, - pMCI_Device->pMCI_DeviceFeatures[status].Relative_Card_Address << 16) == AT91C_CMD_SEND_OK) + if (AT91F_MCI_SendCommand(AT91C_SEL_DESEL_CARD_CMD, + pMCI_Device->pMCI_DeviceFeatures[status].Relative_Card_Address << 16) == AT91C_CMD_SEND_OK) return AT91C_CARD_SELECTED_OK; return AT91C_CARD_SELECTED_ERROR; } @@ -314,11 +312,10 @@ //* \brief Asks to the specified card to send its CSD //*---------------------------------------------------------------------------- static AT91S_MCIDeviceStatus -AT91F_MCI_GetCSD(AT91PS_MciDevice pMCI_Device, unsigned int relative_card_address , unsigned int * response) +AT91F_MCI_GetCSD(unsigned int relative_card_address , unsigned int * response) { - if(AT91F_MCI_SendCommand(pMCI_Device, - AT91C_SEND_CSD_CMD, + if(AT91F_MCI_SendCommand(AT91C_SEND_CSD_CMD, (relative_card_address << 16)) != AT91C_CMD_SEND_OK) return AT91C_CMD_SEND_ERROR; @@ -335,9 +332,9 @@ //* \brief Select a block length for all following block commands (R/W) //*---------------------------------------------------------------------------- AT91S_MCIDeviceStatus -AT91F_MCI_SetBlocklength(AT91PS_MciDevice pMCI_Device,unsigned int length) +AT91F_MCI_SetBlocklength(unsigned int length) { - return( AT91F_MCI_SendCommand(pMCI_Device, AT91C_SET_BLOCKLEN_CMD, length) ); + return( AT91F_MCI_SendCommand(AT91C_SET_BLOCKLEN_CMD, length) ); } //*---------------------------------------------------------------------------- @@ -345,13 +342,12 @@ //* \brief Asks to all cards to send their operations conditions //*---------------------------------------------------------------------------- static AT91S_MCIDeviceStatus -AT91F_MCI_MMC_GetAllOCR (AT91PS_MciDevice pMCI_Device) +AT91F_MCI_MMC_GetAllOCR() { unsigned int response =0x0; while(1) { - response = AT91F_MCI_SendCommand(pMCI_Device, - AT91C_MMC_SEND_OP_COND_CMD, + response = AT91F_MCI_SendCommand(AT91C_MMC_SEND_OP_COND_CMD, AT91C_MMC_HOST_VOLTAGE_RANGE); if (response != AT91C_CMD_SEND_OK) return AT91C_INIT_ERROR; @@ -371,8 +367,7 @@ int Nb_Cards_Found=-1; while (1) { - if(AT91F_MCI_SendCommand(pMCI_Device, - AT91C_MMC_ALL_SEND_CID_CMD, + if(AT91F_MCI_SendCommand(AT91C_MMC_ALL_SEND_CID_CMD, AT91C_NO_ARGUMENT) != AT91C_CMD_SEND_OK) return Nb_Cards_Found; else { @@ -382,7 +377,7 @@ //* Set the insert flag pMCI_Device->pMCI_DeviceFeatures[Nb_Cards_Found].Card_Inserted = AT91C_MMC_CARD_INSERTED; - if (AT91F_MCI_SendCommand(pMCI_Device, + if (AT91F_MCI_SendCommand( AT91C_MMC_SET_RELATIVE_ADDR_CMD, (Nb_Cards_Found + AT91C_FIRST_RCA) << 16) != AT91C_CMD_SEND_OK) return AT91C_CMD_SEND_ERROR; @@ -406,7 +401,7 @@ AT91PS_MciDeviceFeatures f; //* Resets all MMC Cards in Idle state - AT91F_MCI_SendCommand(pMCI_Device, AT91C_MMC_GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT); + AT91F_MCI_SendCommand(AT91C_MMC_GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT); if (AT91F_MCI_MMC_GetAllOCR(pMCI_Device) == AT91C_INIT_ERROR) return AT91C_INIT_ERROR; @@ -419,9 +414,8 @@ AT91C_BASE_MCI->MCI_MR = AT91C_MCI_MR_PDCMODE; for(i = 0; i < Nb_Cards_Found; i++) { f = pMCI_Device->pMCI_DeviceFeatures + i; - if (AT91F_MCI_GetCSD(pMCI_Device, - f->Relative_Card_Address, - tab_response) != AT91C_CMD_SEND_OK) { + if (AT91F_MCI_GetCSD(f->Relative_Card_Address, tab_response) != + AT91C_CMD_SEND_OK) { f->Relative_Card_Address = 0; continue; } @@ -481,10 +475,9 @@ //* \brief Asks to the SDCard on the chosen slot to send its CID //*---------------------------------------------------------------------------- static AT91S_MCIDeviceStatus -AT91F_MCI_SDCard_GetCID(AT91PS_MciDevice pMCI_Device, unsigned int *response) +AT91F_MCI_SDCard_GetCID(unsigned int *response) { - if (AT91F_MCI_SendCommand(pMCI_Device, - AT91C_ALL_SEND_CID_CMD, + if (AT91F_MCI_SendCommand(AT91C_ALL_SEND_CID_CMD, AT91C_NO_ARGUMENT) != AT91C_CMD_SEND_OK) return AT91C_CMD_SEND_ERROR; @@ -507,13 +500,12 @@ char bus_width; do { - ret_value =AT91F_MCI_GetStatus(pMCI_Device,pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address); + ret_value =AT91F_MCI_GetStatus(pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address); } while((ret_value > 0) && ((ret_value & AT91C_SR_READY_FOR_DATA) == 0)); // Select Card - AT91F_MCI_SendCommand(pMCI_Device, - AT91C_SEL_DESEL_CARD_CMD, + AT91F_MCI_SendCommand(AT91C_SEL_DESEL_CARD_CMD, (pMCI_Device->pMCI_DeviceFeatures->Relative_Card_Address)<<16); // Set bus width for Sdcard @@ -538,21 +530,20 @@ unsigned int mult,blocknr; AT91PS_MciDeviceFeatures f; - AT91F_MCI_SendCommand(pMCI_Device, AT91C_GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT); + AT91F_MCI_SendCommand(AT91C_GO_IDLE_STATE_CMD, AT91C_NO_ARGUMENT); if (AT91F_MCI_SDCard_GetOCR(pMCI_Device) == AT91C_INIT_ERROR) return AT91C_INIT_ERROR; f = pMCI_Device->pMCI_DeviceFeatures; - if (AT91F_MCI_SDCard_GetCID(pMCI_Device,tab_response) != - AT91C_CMD_SEND_OK) + if (AT91F_MCI_SDCard_GetCID(tab_response) != AT91C_CMD_SEND_OK) return AT91C_INIT_ERROR; f->Card_Inserted = AT91C_SD_CARD_INSERTED; - if (AT91F_MCI_SendCommand(pMCI_Device, AT91C_SET_RELATIVE_ADDR_CMD, 0) - != AT91C_CMD_SEND_OK) + if (AT91F_MCI_SendCommand(AT91C_SET_RELATIVE_ADDR_CMD, 0) != + AT91C_CMD_SEND_OK) return AT91C_INIT_ERROR; f->Relative_Card_Address = (AT91C_BASE_MCI->MCI_RSPR[0] >> 16); - if (AT91F_MCI_GetCSD(pMCI_Device,f->Relative_Card_Address,tab_response) + if (AT91F_MCI_GetCSD(f->Relative_Card_Address,tab_response) != AT91C_CMD_SEND_OK) return AT91C_INIT_ERROR; f->READ_BL_LEN = 1 << ((tab_response[1] >> AT91C_CSD_RD_B_LEN_S) & @@ -587,8 +578,8 @@ //// End of Compute Memory Capacity if (AT91F_MCI_SDCard_SetBusWidth(pMCI_Device) != AT91C_CMD_SEND_OK) return AT91C_INIT_ERROR; - if (AT91F_MCI_SetBlocklength(pMCI_Device,f->Max_Read_DataBlock_Length) - != AT91C_CMD_SEND_OK) + if (AT91F_MCI_SetBlocklength(f->Max_Read_DataBlock_Length) != + AT91C_CMD_SEND_OK) return AT91C_INIT_ERROR; return AT91C_INIT_OK; } ==== //depot/projects/arm/src/sys/boot/arm/at91/libat91/mci_device.h#2 (text+ko) ==== @@ -377,7 +377,7 @@ void AT91F_MCI_Device_Handler(AT91PS_MciDevice,unsigned int); AT91S_MCIDeviceStatus AT91F_MCI_SDCard_Init (AT91PS_MciDevice); -AT91S_MCIDeviceStatus AT91F_MCI_SetBlocklength(AT91PS_MciDevice,unsigned int); +AT91S_MCIDeviceStatus AT91F_MCI_SetBlocklength(unsigned int); AT91S_MCIDeviceStatus AT91F_MCI_ReadBlock(AT91PS_MciDevice,int,unsigned int *,int); AT91S_MCIDeviceStatus AT91F_MCI_WriteBlock(AT91PS_MciDevice,int,unsigned int *,int); AT91S_MCIDeviceStatus AT91F_MCI_MMC_Init (AT91PS_MciDevice pMCI_Device);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200608110031.k7B0VL5c085162>