Skip to content

Commit cbcf25f

Browse files
committed
Introduce type for command code
1 parent 9093154 commit cbcf25f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

firmware/nand_programmer.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
#define NP_NAND_GOOD_BLOCK_MARK 0xFF
2222

23-
enum
23+
typedef enum
2424
{
2525
NP_CMD_NAND_READ_ID = 0x00,
2626
NP_CMD_NAND_ERASE = 0x01,
@@ -31,7 +31,7 @@ enum
3131
NP_CMD_NAND_SELECT = 0x06,
3232
NP_CMD_NAND_READ_BB = 0x07,
3333
NP_CMD_NAND_LAST = 0x08,
34-
};
34+
} np_cmd_code_t;
3535

3636
enum
3737
{
@@ -52,7 +52,7 @@ enum
5252

5353
typedef struct __attribute__((__packed__))
5454
{
55-
uint8_t code;
55+
np_cmd_code_t code;
5656
} np_cmd_t;
5757

5858
typedef struct __attribute__((__packed__))
@@ -743,9 +743,9 @@ static np_cmd_handler_t cmd_handler[] =
743743
{ NP_CMD_NAND_READ_BB, np_cmd_read_bad_blocks },
744744
};
745745

746-
static bool np_cmd_is_valid(int cmd)
746+
static bool np_cmd_is_valid(np_cmd_code_t code)
747747
{
748-
return cmd >= 0 && cmd < NP_CMD_NAND_LAST;
748+
return code >= 0 && code < NP_CMD_NAND_LAST;
749749
}
750750

751751
static int np_cmd_handler(np_prog_t *prog)

0 commit comments

Comments
 (0)