diff src/avr_jtag.c @ 10:cc106f278d7d

Get identify of components
author Thinker K.F. Li <thinker@branda.to>
date Tue, 24 Feb 2009 13:32:04 +0800
parents 61f27549de57
children
line wrap: on
line diff
--- a/src/avr_jtag.c	Sun Feb 22 22:43:26 2009 +0800
+++ b/src/avr_jtag.c	Tue Feb 24 13:32:04 2009 +0800
@@ -8,7 +8,7 @@
 
 #define BAUD_RATE 420000
 
-static char client_buf[256 + CP_CMD_OVERHEAD];
+static unsigned char client_buf[256 + CP_CMD_OVERHEAD];
 
 static
 void ack(int seq) {
@@ -22,7 +22,7 @@
 }
 
 static
-void nak(int seq, const char *msg) {
+void nak(int seq, const unsigned char *msg) {
     int i;
     int sz;
     
@@ -34,37 +34,23 @@
 }
 
 static
-void send_client(const char *buf, int bsz) {
+void send_client(const unsigned char *buf, int bsz) {
     int i;
     
     for(i = 0; i < bsz; i++)
 	uart_putc(buf[i]);
 }
 
-void flash_init(void) {
-    pin_mode(&PORTB, PINB4, PM_OUTPUT);
-    pin_mode(&PORTB, PINB5, PM_OUTPUT);
-    pin_lo(PORTB, PINB4);
-    pin_lo(PORTB, PINB5);
-}
-
-void flash_led(void) {
-    pin_hi(PORTB, PINB4);
-    _delay_ms(50);
-    pin_lo(PORTB, PINB4);
-}
-
-#define GET_DATA_BITS(data) ((data)[0] | ((data)[1] << 8))
+#define GET_DATA_BITS(data) (((unsigned int)(data)[0]) |	\
+			     ((unsigned int)(data)[1] << 8))
 
 int main(int argc, char * const argv[]) {
     cp_cmd_t *cmd;
     cmd_proto_t *cp;
-    int c, nbits;
+    int c;
+    unsigned int nbits;
     int bsz;
-    static char buf[16];
-    
-    flash_init();
-    flash_led();
+    static unsigned char buf[16];
     
     uart_init(BAUD_RATE);
     jtag_init();