主权项 |
1. A method for managing a plurality of commands received from a host system, the method comprising:
configuring a command queue register, a first indicator, and a second indicator, wherein the command queue register comprises a plurality of command transient units, and each of the command transient units has a command index pointing to a command storage address; configuring a command index register, wherein the command index register comprises a start index, an end index, and an outstanding command index; receiving at least one first command from the host system; storing the at least one first command in the command queue register according to a plurality of first indication bits in the first indicator and updating the first indication bits according to a current storage status of the command queue register to generate a plurality of updated first indication bits; generating a plurality of updated second indication bits according to the updated first indication bits in the first indicator and a plurality of second indication bits in the second indicator; obtaining the number of the at least one first command and at least one first command index among the command indices according to the updated second indication bits, wherein the at least one first command index corresponding to at least one command transient unit storing the at least one first command in the command queue register; adding the at least one first command index into the command index register and updating the end index according to the number of the at least one first command; and executing the commands corresponding to a plurality of un-executed command indices recorded in the command index register, wherein the commands are stored in corresponding command transient units among the command transient units of the command queue register. |