<commit_before>package sdcard

type Command byte

const (
	NoResp    Command = 0 << 6
	ShortResp Command = 1 << 6
	LongResp  Command = 3 << 6

	CMD0  = 0 | NoResp     // GO_IDLE_STATE                -
	CMD2  = 2 | LongResp   // ALL_SEND_CID                 R2
	CMD3  = 3 | ShortResp  // SEND_RELATIVE_ADDR           R6
	CMD4  = 4 | NoResp     // SET_DSR                      -
	CMD5  = 5 | ShortResp  // IO_SEND_OP_COND              R4
	CMD7  = 7 | ShortResp  // SELECT_CARD/DESELECT_CARD    R1b
	CMD8  = 8 | ShortResp  // SEND_IF_COND                 R7
	CMD9  = 9 | LongResp   // SEND_CSD                     R2
	CMD10 = 10 | LongResp  // SEND_CID                     R2
	CMD11 = 11 | ShortResp // VOLTAGE_SWITCH               R1
	CMD12 = 12 | ShortResp // STOP_TRANSMISSION            R1b
	CMD13 = 13 | ShortResp // SEND_STATUS/SEND_TASK_STATUS R1
	CMD15 = 12 | NoResp    // GO_INACTIVE_STATE            -
	CMD16 = 16 | ShortResp // SET_BLOCKLEN                 R1
	CMD17 = 17 | ShortResp // READ_SINGLE_BLOCK            R1
	CMD18 = 18 | ShortResp // READ_MULTIPLE_BLOCK          R1
	CMD19 = 19 | ShortResp // SEND_TUNING_BLOCK            R1
	CMD20 = 20 | ShortResp // SPEED_CLASS_CONTROL          R1b
	CMD23 = 23 | ShortResp // SET_BLOCK_COUNT              R1
	CMD24 = 24 | ShortResp // WRITE_BLOCK                  R1
	CMD25 = 25 | ShortResp // WRITE_MULTIPLE_BLOCK         R1
	CMD27 = 27 | ShortResp // PROGRAM_CSD                  R1
	CMD28 = 28 | ShortResp // SET_WRITE_PROT               R1b
	CMD29 = 29 | ShortResp // CLR_WRITE_PROT               R1b
	CMD30 = 30 | ShortResp // SEND_WRITE_PROT              R1
	CMD32 = 30 | ShortResp // ERASE_WR_BLK_START           R1
	CMD33 = 33 | ShortResp // ERASE_WR_BLK_END             R1
	CMD38 = 38 | ShortResp // ERASE                        R1b
	CMD40 = 40 | ShortResp // TODO: See DPS spec.          R1
	CMD42 = 42 | ShortResp // LOCK_UNLOCK                  R1
	CMD52 = 52 | ShortResp // IO_RW_DIRECT                 R5
	CMD53 = 53 | ShortResp // IO_RW_EXTENDED               R5
	CMD55 = 55 | ShortResp // APP_CMD                      R1
	CMD56 = 56 | ShortResp // GEN_CMD                      R1
)

func GO_IDLE_STATE() (Command, uint32)            { return CMD0, 0 }
func SEND_IF_COND(a SendIfCond) (Command, uint32) { return CMD8, uint32(a) }

type SendIfCond uint32<commit_msg>sdcard: Encode response type in cmd.<commit_after>package sdcard

type Command uint16

const (
	NoResp    Command = 0 << 6
	ShortResp Command = 1 << 6
	LongResp  Command = 3 << 6

	Busy Command = 1 << 8

	R1  = 1<<9 | ShortResp
	R1b = 1<<9 | ShortResp | Busy
	R2  = 2<<9 | LongResp
	R4  = 4<<9 | ShortResp
	R5  = 5<<9 | ShortResp
	R6  = 6<<9 | ShortResp
	R7  = 7<<9 | ShortResp

	CMD0  = 0 | NoResp  // GO_IDLE_STATE
	CMD2  = 2 | R2      // ALL_SEND_CID
	CMD3  = 3 | R6      // SEND_RELATIVE_ADDR
	CMD4  = 4 | NoResp  // SET_DSR
	CMD5  = 5 | R4      // IO_SEND_OP_COND
	CMD7  = 7 | R1b     // SELECT_CARD/DESELECT_CARD
	CMD8  = 8 | R7      // SEND_IF_COND
	CMD9  = 9 | R2      // SEND_CSD
	CMD10 = 10 | R2     // SEND_CID
	CMD11 = 11 | R1     // VOLTAGE_SWITCH
	CMD12 = 12 | R1b    // STOP_TRANSMISSION
	CMD13 = 13 | R1     // SEND_STATUS/SEND_TASK_STATUS
	CMD15 = 12 | NoResp // GO_INACTIVE_STATE
	CMD16 = 16 | R1     // SET_BLOCKLEN
	CMD17 = 17 | R1     // READ_SINGLE_BLOCK
	CMD18 = 18 | R1     // READ_MULTIPLE_BLOCK
	CMD19 = 19 | R1     // SEND_TUNING_BLOCK
	CMD20 = 20 | R1b    // SPEED_CLASS_CONTROL
	CMD23 = 23 | R1     // SET_BLOCK_COUNT
	CMD24 = 24 | R1     // WRITE_BLOCK
	CMD25 = 25 | R1     // WRITE_MULTIPLE_BLOCK
	CMD27 = 27 | R1     // PROGRAM_CSD
	CMD28 = 28 | R1b    // SET_WRITE_PROT
	CMD29 = 29 | R1b    // CLR_WRITE_PROT
	CMD30 = 30 | R1     // SEND_WRITE_PROT
	CMD32 = 30 | R1     // ERASE_WR_BLK_START
	CMD33 = 33 | R1     // ERASE_WR_BLK_END
	CMD38 = 38 | R1b    // ERASE
	CMD40 = 40 | R1     // TODO: See DPS spec.
	CMD42 = 42 | R1     // LOCK_UNLOCK
	CMD52 = 52 | R5     // IO_RW_DIRECT
	CMD53 = 53 | R5     // IO_RW_EXTENDED
	CMD55 = 55 | R1     // APP_CMD
	CMD56 = 56 | R1     // GEN_CMD
)

func GO_IDLE_STATE() (Command, uint32)            { return CMD0, 0 }
func SEND_IF_COND(a SendIfCond) (Command, uint32) { return CMD8, uint32(a) }

type SendIfCond uint32
{'fraction_non_alphanumeric': 0.09019886363636363, 'fraction_numerical': 0.08546401515151515, 'mean_word_length': 1.704865556978233, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5602011', 'n_tokens_mistral': 1897, 'n_tokens_neox': 1614, 'n_words': 411}