projects
/
fw
/
altos
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clean up sample debug files
[fw/altos]
/
ccdbg.h
diff --git
a/ccdbg.h
b/ccdbg.h
index 32283c0d8e09527c74f6df6814555d3538c34d67..8ccd477012ca6d7264a8f8810a4aa911e7825019 100644
(file)
--- a/
ccdbg.h
+++ b/
ccdbg.h
@@
-30,17
+30,29
@@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
+#undef USE_KERNEL
+#ifdef USE_KERNEL
#include <cp2101.h>
#include <cp2101.h>
-
-#define CC_DATA CP2101_GPIO_MASK(0)
-#define CC_CLOCK CP2101_GPIO_MASK(1)
+#define CC_CLOCK CP2101_GPIO_MASK(0)
+#define CC_DATA CP2101_GPIO_MASK(1)
#define CC_RESET_N CP2101_GPIO_MASK(2)
#define CC_RESET_N CP2101_GPIO_MASK(2)
+#else
+#define CC_CLOCK 0x1
+#define CC_DATA 0x2
+#define CC_RESET_N 0x4
+#include <usb.h>
+#endif
+
/* painfully slow for now */
/* painfully slow for now */
-#define CC_CLOCK_US (100
0 * 1000
)
+#define CC_CLOCK_US (100)
struct ccdbg {
struct ccdbg {
+ usb_dev_handle *usb_dev;
+ uint8_t gpio;
+#ifdef USE_KERNEL
int fd;
int fd;
+#endif
uint8_t debug_data;
int clock;
};
uint8_t debug_data;
int clock;
};
@@
-80,6
+92,9
@@
struct ccdbg {
#define CC_GET_CHIP_ID 0x68
/* ccdbg-command.c */
#define CC_GET_CHIP_ID 0x68
/* ccdbg-command.c */
+void
+ccdbg_debug_mode(struct ccdbg *dbg);
+
void
ccdbg_reset(struct ccdbg *dbg);
void
ccdbg_reset(struct ccdbg *dbg);
@@
-89,10
+104,22
@@
ccdbg_read_status(struct ccdbg *dbg);
uint8_t
ccdbg_rd_config(struct ccdbg *dbg);
uint8_t
ccdbg_rd_config(struct ccdbg *dbg);
+uint16_t
+ccdbg_get_chip_id(struct ccdbg *dbg);
+
/* ccdbg-io.c */
void
ccdbg_quarter_clock(struct ccdbg *dbg);
/* ccdbg-io.c */
void
ccdbg_quarter_clock(struct ccdbg *dbg);
+void
+ccdbg_half_clock(struct ccdbg *dbg);
+
+int
+ccdbg_write(struct ccdbg *dbg, uint8_t mask, uint8_t value);
+
+uint8_t
+ccdbg_read(struct ccdbg *dbg);
+
struct ccdbg *
ccdbg_open(char *file);
struct ccdbg *
ccdbg_open(char *file);
@@
-126,4
+153,17
@@
ccdbg_cmd_write_read8(struct ccdbg *dbg, uint8_t cmd, uint8_t *data, int len);
uint16_t
ccdbg_cmd_write_read16(struct ccdbg *dbg, uint8_t cmd, uint8_t *data, int len);
uint16_t
ccdbg_cmd_write_read16(struct ccdbg *dbg, uint8_t cmd, uint8_t *data, int len);
+/* cp-usb.c */
+void
+cp_usb_init(struct ccdbg *dbg);
+
+void
+cp_usb_fini(struct ccdbg *dbg);
+
+void
+cp_usb_write(struct ccdbg *dbg, uint8_t mask, uint8_t value);
+
+uint8_t
+cp_usb_read(struct ccdbg *dbg);
+
#endif /* _CCDBG_H_ */
#endif /* _CCDBG_H_ */