HB288016MM1
35
Write protect management
Card data may be protected against either erase or write. The entire card may be permanently write
protected by the manufacturer or content provider by setting the permanent or temporary write protect bits
in the CSD. Portions of the data may be protected (in units of WP_GRP_SIZE sectors as specified in the
CSD), and the write protection may be changed by the application. The SET_WRITE_PROT command
sets the write protection of the addressed write-protect group, and the CLR_WRITE_PROT command
clears the write protection of the addressed write-protect group. The SEND_WRITE_PROT command is
similar to a single block read command. The card shall send a data block containing 32 write protection
bits (representing 32 write protect groups starting at the specified address) followed by 16 CRC bits. The
address field in the write protect commands is a group address in byte units. The card will ignore all LSB’s
below the group size.
Card lock/unlock operation
The password protection feature enables the host to lock a card while providing a password, which later
will be used for unlocking the card. The password and its size are kept in a 128-bit PWD and 8-bit
PWD_LEN registers, respectively. These registers are non-volatile so that a power cycle will not erase
them. Locked cards respond to (and execute) all commands in the "basic" command class (class 0) and
“l(fā)ock card” command class. Thus the host is allowed to reset, initialize, select, query for status, etc., but
not to access data on the card. If the password was previously set (the value of PWD_LEN is not‘0’) will
be locked automatically after power on. Similar to the existing CSD and CID register write commands the
lock/unlock command is available in "transfer state" only. This means that it does not include an address
argument and the card has to be selected before using it. The card lock/unlock command has the structure
and bus transaction type of a regular single block write command. The transferred data block includes all
the required information of the command (password setting mode, PWD itself, card lock/unlock etc.). The
following table describes the structure of the command data block.
Lock Card Data Structure
Byte#
Bit7
Bit6
Bit5
Bit4
Bit3
Bit2
Bit1
Bit0
0
Reserved
ERASE
LOCK_
UNLOCK
CLR_
PWD
SET_
PWD
1
PWD_LEN
2
Password data
...
PWD_LEN + 1
ERASE: 1 Defines Forced Erase Operation (all other bits shall be ‘0’) and only the cmd byte is
sent.
LOCK/UNLOCK: 1 = Locks the card. 0 = Unlock the card (note that it is valid to set this bit
together with SET_PWD but it is not allowed to set it together with CLR_PWD).
CLR_PWD: 1 = Clears PWD.
SET_PWD: 1 = Set new password to PWD
PWD_LEN: Defines the following password length (in bytes).