Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New console system + small doc fix #3

Merged
merged 3 commits into from
Oct 12, 2014
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Use t_hydra_console instead of struct hydra_console.
  • Loading branch information
biot committed Oct 12, 2014
commit 69b6e965f4f22cbd33bb45baf0e115c94cf95eec
12 changes: 6 additions & 6 deletions common/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void DelayUs(uint32_t delay_us)
osalSysPolledDelayX(US2RTC(STM32_HCLK, delay_us));
}

void cmd_mem(struct hydra_console *con, int argc, const char* const* argv)
void cmd_mem(t_hydra_console *con, int argc, const char* const* argv)
{
size_t n, size;

Expand All @@ -84,7 +84,7 @@ void cmd_mem(struct hydra_console *con, int argc, const char* const* argv)
chprintf(con->bss, "heap free total : %u bytes\r\n", size);
}

void cmd_threads(struct hydra_console *con, int argc, const char* const* argv)
void cmd_threads(t_hydra_console *con, int argc, const char* const* argv)
{
static const char *states[] = {CH_STATE_NAMES};
thread_t *tp;
Expand All @@ -104,7 +104,7 @@ void cmd_threads(struct hydra_console *con, int argc, const char* const* argv)

}

void cmd_test(struct hydra_console *con, int argc, const char* const* argv)
void cmd_test(t_hydra_console *con, int argc, const char* const* argv)
{
thread_t *tp;

Expand All @@ -120,12 +120,12 @@ void cmd_test(struct hydra_console *con, int argc, const char* const* argv)
chThdWait(tp);
}

void cmd_info(struct hydra_console *con, int argc, const char* const* argv)
void cmd_info(t_hydra_console *con, int argc, const char* const* argv)
{
cmd_init(con, argc, argv);
}

void cmd_init(struct hydra_console *con, int argc, const char* const* argv)
void cmd_init(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand Down Expand Up @@ -207,7 +207,7 @@ void cmd_init(struct hydra_console *con, int argc, const char* const* argv)

#define waitcycles(n) ( wait_nbcycles(n) )
/* Just debug to check Timing and accuracy with output pin */
void cmd_dbg(struct hydra_console *con, int argc, const char* const* argv)
void cmd_dbg(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argv;
uint8_t i;
Expand Down
16 changes: 8 additions & 8 deletions common/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,21 @@ typedef struct
/* How much thread working area to allocate per console. */
#define CONSOLE_WA_SIZE 2048

struct hydra_console {
typedef struct hydra_console {
char *thread_name;
thread_t *thread;
union {
SerialUSBDriver *sdu;
BaseSequentialStream *bss;
};
microrl_t *mrl;
};
} t_hydra_console;

void cmd_info(struct hydra_console *con, int argc, const char* const* argv);
void cmd_init(struct hydra_console *con, int argc, const char* const* argv);
void cmd_mem(struct hydra_console *con, int argc, const char* const* argv);
void cmd_threads(struct hydra_console *con, int argc, const char* const* argv);
void cmd_test(struct hydra_console *con, int argc, const char* const* argv);
void cmd_dbg(struct hydra_console *con, int argc, const char* const* argv);
void cmd_info(t_hydra_console *con, int argc, const char* const* argv);
void cmd_init(t_hydra_console *con, int argc, const char* const* argv);
void cmd_mem(t_hydra_console *con, int argc, const char* const* argv);
void cmd_threads(t_hydra_console *con, int argc, const char* const* argv);
void cmd_test(t_hydra_console *con, int argc, const char* const* argv);
void cmd_dbg(t_hydra_console *con, int argc, const char* const* argv);

#endif /* _COMMON_H_ */
4 changes: 2 additions & 2 deletions common/microrl_callback.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

#include "ch.h"

typedef void (*ptFunc)(struct hydra_console *con, int argc, const char* const* argv);
typedef void (*ptFunc)(t_hydra_console *con, int argc, const char* const* argv);

typedef struct
{
Expand All @@ -31,7 +31,7 @@ typedef struct
void print(void *user_handle, const char *str);

// get_char from stream
char get_char(struct hydra_console *con);
char get_char(t_hydra_console *con);

// execute callback
unsigned int execute(void *user_handle, int argc, const char* const* argv);
Expand Down
10 changes: 5 additions & 5 deletions common/microrl_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
char** compl_world;
microrl_exec_t* keyworld;

void print_clear(struct hydra_console *con, int argc, const char* const* argv)
void print_clear(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand All @@ -45,7 +45,7 @@ void print_clear(struct hydra_console *con, int argc, const char* const* argv)
//*****************************************************************************
void print(void *user_handle, const char *str)
{
struct hydra_console *con;
t_hydra_console *con;
int len;

if(!str)
Expand All @@ -59,7 +59,7 @@ void print(void *user_handle, const char *str)
}

//*****************************************************************************
char get_char(struct hydra_console *con)
char get_char(t_hydra_console *con)
{
uint8_t car;

Expand Down Expand Up @@ -130,7 +130,7 @@ char** complet(void* user_handle, int argc, const char * const * argv)
// do what you want here, but don't write to argv!!! read only!!
unsigned int execute(void *user_handle, int argc, const char* const* argv)
{
struct hydra_console *con;
t_hydra_console *con;

con = user_handle;
if(hydranfc_is_detected())
Expand All @@ -142,7 +142,7 @@ unsigned int execute(void *user_handle, int argc, const char* const* argv)
//*****************************************************************************
void sigint(void *user_handle)
{
struct hydra_console *con;
t_hydra_console *con;

con = user_handle;
if(hydranfc_is_detected())
Expand Down
2 changes: 1 addition & 1 deletion common/microrl_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
#ifndef _MICRORL_COMMON_H_
#define _MICRORL_COMMON_H_

void print_clear(struct hydra_console *con, int argc, const char* const* argv);
void print_clear(t_hydra_console *con, int argc, const char* const* argv);

#endif /* _MICRORL_COMMON_H_ */
18 changes: 9 additions & 9 deletions common/microsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void fillbuffers(uint8_t pattern)
/**
* SDIO Test Non Destructive
*/
void cmd_sdiotest(struct hydra_console *con, int argc, const char* const* argv)
void cmd_sdiotest(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand Down Expand Up @@ -391,7 +391,7 @@ void cmd_sdiotest(struct hydra_console *con, int argc, const char* const* argv)
}
}

void cmd_sdc(struct hydra_console *con, int argc, const char* const* argv)
void cmd_sdc(t_hydra_console *con, int argc, const char* const* argv)
{
static const char *mode[] = {"SDV11", "SDV20", "MMC", NULL};
systime_t start, end;
Expand Down Expand Up @@ -497,7 +497,7 @@ void cmd_sdc(struct hydra_console *con, int argc, const char* const* argv)
sdcDisconnect(&SDCD1);
}

static FRESULT scan_files(struct hydra_console *con, char *path)
static FRESULT scan_files(t_hydra_console *con, char *path)
{
FRESULT res;
FILINFO fno;
Expand Down Expand Up @@ -667,7 +667,7 @@ int umount(void)
return 0;
}

void cmd_sd_mount(struct hydra_console *con, int argc, const char* const* argv)
void cmd_sd_mount(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand Down Expand Up @@ -702,7 +702,7 @@ void cmd_sd_mount(struct hydra_console *con, int argc, const char* const* argv)
fs_ready = TRUE;
}

void cmd_sd_umount(struct hydra_console *con, int argc, const char* const* argv)
void cmd_sd_umount(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand All @@ -720,7 +720,7 @@ void cmd_sd_umount(struct hydra_console *con, int argc, const char* const* argv)
fs_ready = FALSE;
}

void cmd_sd_ls(struct hydra_console *con, int argc, const char* const* argv)
void cmd_sd_ls(t_hydra_console *con, int argc, const char* const* argv)
{
FRESULT err;
uint32_t clusters;
Expand Down Expand Up @@ -779,7 +779,7 @@ void cmd_sd_ls(struct hydra_console *con, int argc, const char* const* argv)
}

/* Call only with len=multiples of 16 (unless end of dump). */
static void dump_hexbuf(struct hydra_console *con, uint32_t offset,
static void dump_hexbuf(t_hydra_console *con, uint32_t offset,
const uint8_t *buf, int len)
{
int b, i;
Expand All @@ -805,7 +805,7 @@ static void dump_hexbuf(struct hydra_console *con, uint32_t offset,
}
}

void cmd_sd_cat(struct hydra_console *con, int argc, const char* const* argv)
void cmd_sd_cat(t_hydra_console *con, int argc, const char* const* argv)
{
#define MAX_FILE_SIZE (524288)
bool hex;
Expand Down Expand Up @@ -885,7 +885,7 @@ void cmd_sd_cat(struct hydra_console *con, int argc, const char* const* argv)
/**
* SDIO Test Destructive
*/
void cmd_sd_erase(struct hydra_console *con, int argc, const char* const* argv){
void cmd_sd_erase(t_hydra_console *con, int argc, const char* const* argv){
(void)argc;
(void)argv;
uint32_t i = 0;
Expand Down
16 changes: 8 additions & 8 deletions common/microsd.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ int mount(void);
int umount(void);

/* Shell commands */
void cmd_sd_mount(struct hydra_console *con, int argc, const char* const* argv);
void cmd_sd_umount(struct hydra_console *con, int argc, const char* const* argv);
void cmd_sd_ls(struct hydra_console *con, int argc, const char* const* argv);
void cmd_sd_cat(struct hydra_console *con, int argc, const char* const* argv);

void cmd_sdiotest(struct hydra_console *con, int argc, const char* const* argv);
void cmd_sd_erase(struct hydra_console *con, int argc, const char* const* argv);
void cmd_sdc(struct hydra_console *con, int argc, const char* const* argv);
void cmd_sd_mount(t_hydra_console *con, int argc, const char* const* argv);
void cmd_sd_umount(t_hydra_console *con, int argc, const char* const* argv);
void cmd_sd_ls(t_hydra_console *con, int argc, const char* const* argv);
void cmd_sd_cat(t_hydra_console *con, int argc, const char* const* argv);

void cmd_sdiotest(t_hydra_console *con, int argc, const char* const* argv);
void cmd_sd_erase(t_hydra_console *con, int argc, const char* const* argv);
void cmd_sdc(t_hydra_console *con, int argc, const char* const* argv);

#endif /* _MICROSD_H_ */
6 changes: 3 additions & 3 deletions hydrabus/hydrabus_microrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ microrl_exec_t hydrabus_keyworld[HYDRABUS_NUM_OF_CMD] =
char* hydrabus_compl_world[HYDRABUS_NUM_OF_CMD + 1];

//*****************************************************************************
void hydrabus_print_help(struct hydra_console *con, int argc, const char* const* argv)
void hydrabus_print_help(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand All @@ -92,7 +92,7 @@ void hydrabus_print_help(struct hydra_console *con, int argc, const char* const*
//*****************************************************************************
// execute callback for microrl library
// do what you want here, but don't write to argv!!! read only!!
int hydrabus_execute(struct hydra_console *con, int argc, const char* const* argv)
int hydrabus_execute(t_hydra_console *con, int argc, const char* const* argv)
{
bool cmd_found;
int curr_arg = 0;
Expand Down Expand Up @@ -126,7 +126,7 @@ int hydrabus_execute(struct hydra_console *con, int argc, const char* const* arg
}

//*****************************************************************************
void hydrabus_sigint(struct hydra_console *con)
void hydrabus_sigint(t_hydra_console *con)
{
/* Hit ctrl-U and enter. */
microrl_insert_char(con->mrl, 0x15);
Expand Down
6 changes: 3 additions & 3 deletions hydrabus/hydrabus_microrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
extern char* hydrabus_compl_world[HYDRABUS_NUM_OF_CMD + 1];
extern microrl_exec_t hydrabus_keyworld[HYDRABUS_NUM_OF_CMD];

void hydrabus_print_help(struct hydra_console *con, int argc, const char* const* argv);
int hydrabus_execute(struct hydra_console *con, int argc, const char* const* argv);
void hydrabus_sigint(struct hydra_console *con);
void hydrabus_print_help(t_hydra_console *con, int argc, const char* const* argv);
int hydrabus_execute(t_hydra_console *con, int argc, const char* const* argv);
void hydrabus_sigint(t_hydra_console *con);

#endif /* _HYDRABUS_MICRORL_H_ */
6 changes: 3 additions & 3 deletions hydranfc/hydranfc.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ bool hydranfc_init(void)
return TRUE;
}

void cmd_nfc_vicinity(struct hydra_console *con, int argc, const char* const* argv)
void cmd_nfc_vicinity(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand Down Expand Up @@ -344,7 +344,7 @@ void cmd_nfc_vicinity(struct hydra_console *con, int argc, const char* const* ar
chprintf(con->bss, "Test nfv ISO15693/Vicinity end\r\n");
}

void cmd_nfc_mifare(struct hydra_console *con, int argc, const char* const* argv)
void cmd_nfc_mifare(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand Down Expand Up @@ -521,7 +521,7 @@ void cmd_nfc_mifare(struct hydra_console *con, int argc, const char* const* argv
chprintf(con->bss, "Test nfm ISO14443-A/Mifare end\r\n");
}

void cmd_nfc_dump_regs(struct hydra_console *con, int argc, const char* const* argv)
void cmd_nfc_dump_regs(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand Down
8 changes: 4 additions & 4 deletions hydranfc/hydranfc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ extern volatile int irq_end_rx;
bool hydranfc_init(void);
bool hydranfc_is_detected(void);

void cmd_nfc_vicinity(struct hydra_console *con, int argc, const char* const* argv);
void cmd_nfc_mifare(struct hydra_console *con, int argc, const char* const* argv);
void cmd_nfc_dump_regs(struct hydra_console *con, int argc, const char* const* argv);
void cmd_nfc_sniff_14443A(struct hydra_console *con, int argc, const char* const* argv);
void cmd_nfc_vicinity(t_hydra_console *con, int argc, const char* const* argv);
void cmd_nfc_mifare(t_hydra_console *con, int argc, const char* const* argv);
void cmd_nfc_dump_regs(t_hydra_console *con, int argc, const char* const* argv);
void cmd_nfc_sniff_14443A(t_hydra_console *con, int argc, const char* const* argv);

#endif /* _HYDRANFC_H_ */
2 changes: 1 addition & 1 deletion hydranfc/hydranfc_cmd_sniff.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void sniff_write_8b_ASCII_HEX(uint8_t data, bool add_space)
}
}

void cmd_nfc_sniff_14443A(struct hydra_console *con, int argc, const char* const* argv)
void cmd_nfc_sniff_14443A(t_hydra_console *con, int argc, const char* const* argv)
{
(void)con;
(void)argc;
Expand Down
6 changes: 3 additions & 3 deletions hydranfc/hydranfc_microrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ microrl_exec_t hydranfc_keyworld[HYDRANFC_NUM_OF_CMD] =
char* hydranfc_compl_world[HYDRANFC_NUM_OF_CMD + 1];

//*****************************************************************************
void hydranfc_print_help(struct hydra_console *con, int argc, const char* const* argv)
void hydranfc_print_help(t_hydra_console *con, int argc, const char* const* argv)
{
(void)argc;
(void)argv;
Expand Down Expand Up @@ -101,7 +101,7 @@ void hydranfc_print_help(struct hydra_console *con, int argc, const char* const*
//*****************************************************************************
// execute callback for microrl library
// do what you want here, but don't write to argv!!! read only!!
int hydranfc_execute(struct hydra_console *con, int argc, const char* const* argv)
int hydranfc_execute(t_hydra_console *con, int argc, const char* const* argv)
{
bool cmd_found;
int curr_arg = 0;
Expand Down Expand Up @@ -135,7 +135,7 @@ int hydranfc_execute(struct hydra_console *con, int argc, const char* const* arg
}

//*****************************************************************************
void hydranfc_sigint(struct hydra_console *con)
void hydranfc_sigint(t_hydra_console *con)
{
print(con, "HydraNFC microrl ^C catched!\n\r");
}
6 changes: 3 additions & 3 deletions hydranfc/hydranfc_microrl.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
extern char* hydranfc_compl_world[HYDRANFC_NUM_OF_CMD + 1];
extern microrl_exec_t hydranfc_keyworld[HYDRANFC_NUM_OF_CMD];

void hydranfc_print_help(struct hydra_console *con, int argc, const char* const* argv);
int hydranfc_execute(struct hydra_console *con, int argc, const char* const* argv);
void hydranfc_sigint(struct hydra_console *con);
void hydranfc_print_help(t_hydra_console *con, int argc, const char* const* argv);
int hydranfc_execute(t_hydra_console *con, int argc, const char* const* argv);
void hydranfc_sigint(t_hydra_console *con);

#endif /* _HYDRANFC_MICRORL_H_ */
Loading