Permalink
Browse files

NAND flash mode (#67)

* Initial flash support
  • Loading branch information...
Baldanos authored and bvernoux committed Dec 18, 2016
1 parent 85ec373 commit 5247a8379c008bc5c481aa8afc3f5dc9e2c6a620
View
@@ -246,6 +246,7 @@ static struct cmd_map {
{ T_ONEWIRE, cmd_mode_init },
{ T_TWOWIRE, cmd_mode_init },
{ T_THREEWIRE, cmd_mode_init },
{ T_FLASH, cmd_mode_init },
{ 0, NULL }
};
View
@@ -142,6 +142,7 @@ t_token_dict tl_dict[] = {
{ T_SCRIPT, "script" },
{ T_FILE, "filename" },
{ T_ONEWIRE, "1-wire" },
{ T_FLASH, "flash" },
{ T_LEFT_SQ, "[" },
{ T_RIGHT_SQ, "]" },
@@ -1185,6 +1186,29 @@ t_token tokens_threewire[] = {
{ }
};
t_token tokens_mode_flash[] = {
{
T_SHOW,
.subtokens = tokens_mode_show,
.help = "Show flash parameters"
},
/* flash-specific commands */
{
T_ID,
.help = "Displays the ID and status registers"
},
/* BP commands */
{
T_EXIT,
.help = "Exit flash mode"
},
{ }
};
t_token tokens_flash[] = {
{ }
};
t_token tokens_gpio_mode[] = {
{
T_IN,
@@ -1581,6 +1605,11 @@ t_token tl_tokens[] = {
T_RNG,
.help = "Random number"
},
{
T_FLASH,
.subtokens = tokens_flash,
.help = "NAND flash mode"
},
{
T_DEBUG,
.subtokens = tokens_debug,
View
@@ -135,6 +135,7 @@ enum {
T_SCRIPT,
T_FILE,
T_ONEWIRE,
T_FLASH,
/* BP-compatible commands */
T_LEFT_SQ,
View
@@ -16,6 +16,7 @@ HYDRABUSSRC = hydrabus/hydrabus.c \
hydrabus/hydrabus_mode_twowire.c \
hydrabus/hydrabus_mode_threewire.c \
hydrabus/hydrabus_mode_can.c \
hydrabus/hydrabus_mode_flash.c \
hydrabus/hydrabus_bbio.c \
hydrabus/hydrabus_bbio_spi.c \
hydrabus/hydrabus_bbio_pin.c \
@@ -24,7 +25,8 @@ HYDRABUSSRC = hydrabus/hydrabus.c \
hydrabus/hydrabus_bbio_i2c.c \
hydrabus/hydrabus_bbio_rawwire.c \
hydrabus/hydrabus_freq.c \
hydrabus/hydrabus_bbio_onewire.c
hydrabus/hydrabus_bbio_onewire.c \
hydrabus/hydrabus_bbio_flash.c \
# Required include directories
HYDRABUSINC = ./hydrabus
View
@@ -33,6 +33,7 @@
#include "hydrabus_bbio_i2c.h"
#include "hydrabus_bbio_rawwire.h"
#include "hydrabus_bbio_onewire.h"
#include "hydrabus_bbio_flash.h"
int cmd_bbio(t_hydra_console *con)
{
@@ -67,6 +68,9 @@ int cmd_bbio(t_hydra_console *con)
case BBIO_PIN:
bbio_mode_pin(con);
break;
case BBIO_FLASH:
bbio_mode_flash(con);
break;
case BBIO_RESET_HW:
return TRUE;
default:
View
@@ -34,6 +34,7 @@
//Hydrabus specific
#define BBIO_CAN 0b00001000
#define BBIO_PIN 0b00001001
#define BBIO_FLASH 0b00001010
#define BBIO_RESET_HW 0b00001111
#define BBIO_PWM 0b00010010
@@ -138,4 +139,16 @@
#define BBIO_ONEWIRE_READ 0b00000100
#define BBIO_ONEWIRE_BULK_TRANSFER 0b00010000
/*
* Flash-specific commands
*/
#define BBIO_FLASH_EN_LOW 0b00000010
#define BBIO_FLASH_EN_HIGH 0b00000011
#define BBIO_FLASH_WRITE_READ 0b00000100
#define BBIO_FLASH_WRITE_BYTE 0b00000101
#define BBIO_FLASH_WRITE_CMD 0b00000110
#define BBIO_FLASH_READ_BYTE 0b00000111
#define BBIO_FLASH_WAIT_READY 0b00001000
#define BBIO_FLASH_WRITE_ADDR 0b00010000
int cmd_bbio(t_hydra_console *con);
View
@@ -44,6 +44,7 @@ extern const mode_exec_t mode_onewire_exec;
extern const mode_exec_t mode_twowire_exec;
extern const mode_exec_t mode_threewire_exec;
extern const mode_exec_t mode_can_exec;
extern const mode_exec_t mode_flash_exec;
extern t_token tokens_mode_spi[];
extern t_token tokens_mode_i2c[];
extern t_token tokens_mode_uart[];
@@ -53,6 +54,7 @@ extern t_token tokens_mode_onewire[];
extern t_token tokens_mode_twowire[];
extern t_token tokens_mode_threewire[];
extern t_token tokens_mode_can[];
extern t_token tokens_mode_flash[];
static struct {
int token;
@@ -68,6 +70,7 @@ static struct {
{ T_TWOWIRE, tokens_mode_twowire, &mode_twowire_exec },
{ T_THREEWIRE, tokens_mode_threewire, &mode_threewire_exec },
{ T_CAN, tokens_mode_can, &mode_can_exec },
{ T_FLASH, tokens_mode_flash, &mode_flash_exec },
};
const char hydrabus_mode_str_cs_enabled[] = "/CS ENABLED\r\n";
Oops, something went wrong.

0 comments on commit 5247a83

Please sign in to comment.