如何計算eMMC大小


User Area

from:http://ericnode.info/post/how_to_determine_emmc_size/

 

計算方法其實已經在規范中給出了,參考eMMC 5.0 spec里的段落。首先是:

7.3.12 C_SIZE [73:62]

The C_SIZE parameter is used to compute the device capacity for devices up to2 GB of density. See 7.4.52, SEC_COUNT [215:212] , for details on calculatingdensities greater than 2 GB. When the device density is greater than 2GB, themaximum possible value should be set to this register (0xFFF). This parameteris used to compute the device capacity.

The memory capacity of the device is computed from the entries C_SIZE,C_SIZE_MULT and READ_BL_LEN as follows:

  • Memory capacity = BLOCKNR * BLOCK_LEN where BLOCKNR = (C_SIZE+1) * MULT
  • MULT = 2 ^ (C_SIZE_MULT+2), (C_SIZE_MULT < 8)
  • BLOCK_LEN = 2 ^ READ_BL_LEN, (READ_BL_LEN < 12)

Therefore, the maximal capacity that can be coded is 4096*512*2048 = 4 GBytes.

Example: A 4 MByte device with BLOCK_LEN = 512 can be coded by C_SIZE_MULT = 0and C_SIZE = 2047. When the partition configuration is executed by host, devicewill re-calculate the C_SIZE value that can indicate the size of user data areaafter the partition.

其次是

7.4.52 SEC_COUNT [215:212]

The device density is calculated from the register by multiplying the value ofthe register (sector count) by 512B/sector as shown in following equation.

Device density = SEC_COUNT x 512B

The maximum density possible to be indicated is thus 4 294 967 295x 512B.

The addressable sector range for the device will be from Sector 0 to Sector(SEC_COUNT-1).

The least significant byte (LSB) of the sector count value is the byte [212].

When the partition configuration is executed by host, device will re-calculatethe SEC_COUNT value that can indicate the size of user data area after thepartition.

簡而言之,對於容量小於2GB的,采用第一種方法,即:

  • Memory capacity = BLOCKNR * BLOCK_LEN where BLOCKNR = (C_SIZE+1) * MULT
  • MULT = 2 ^ (C_SIZE_MULT+2), (C_SIZE_MULT < 8)
  • BLOCK_LEN = 2 ^ READ_BL_LEN, (READ_BL_LEN < 12)

其中C_SIZEC_SIZE_MULTREAD_BL_LEN為CSD寄存器中的字段(注意在C_SIZE/C_SIZE_MULT時注意大小端的情況)。然而時代在發展,對於目前使用的eMMC來說,2GB顯然都被淘汰了,因此制定了新的計算方法,即:

Device density = SEC_COUNT x 512B

直接使用Extended CSD中的SEC_COUNT,更加簡單。

Boot Area

對於Boot Area分區,規范中規定有兩個Boot Area分區,大小為128KB的整數倍。通常每個為4MB,一共8MB。

7.4.42 BOOT_SIZE_MULT [226]

The boot partition size is calculated from the register by using the followingequation:

Boot Partition size = 128Kbytes × BOOT_SIZE_MULT

RPMP

協議中規定必須有一個RPMP分區,大小為128KB的整數倍,通常為8MB。

7.4.77 RPMB_SIZE_MULT [168]

The RPMB partition size is calculated from the register by using the followingequation:

RPMB partition size = 128kB x RPMB_SIZE_MULT


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM