summaryrefslogtreecommitdiff
path: root/src/stm
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2012-04-12 14:51:07 -0700
committerKeith Packard <keithp@keithp.com>2012-04-14 14:04:29 -0700
commit040a6eb119451026e1ec7c3a6a8e76b439c632d5 (patch)
treec334b0f83d8202626c544238b53def46339042b0 /src/stm
parentf952f9c285e2718a433c8c720c9b5d9c369e7036 (diff)
altos: Massive product config cleanup
Support multiple serial ports more cleanly Split out parts of ao.h into separate feature header files Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'src/stm')
-rw-r--r--src/stm/ao_arch.h2
-rw-r--r--src/stm/ao_serial_stm.c2
-rw-r--r--src/stm/ao_usb.h101
-rw-r--r--src/stm/ao_usb_stm.c6
4 files changed, 4 insertions, 107 deletions
diff --git a/src/stm/ao_arch.h b/src/stm/ao_arch.h
index adb6eb94..62af86f7 100644
--- a/src/stm/ao_arch.h
+++ b/src/stm/ao_arch.h
@@ -181,8 +181,6 @@ void ao_lcd_font_init(void);
void ao_lcd_font_string(char *s);
-#define USE_SERIAL_STDIN (USE_SERIAL_1_STDIN + USE_SERIAL_2_STDIN + USE_SERIAL_3_STDIN)
-
char
ao_serial1_getchar(void);
diff --git a/src/stm/ao_serial_stm.c b/src/stm/ao_serial_stm.c
index 3cebc094..406da9fb 100644
--- a/src/stm/ao_serial_stm.c
+++ b/src/stm/ao_serial_stm.c
@@ -249,7 +249,7 @@ ao_serial2_set_speed(uint8_t speed)
struct ao_stm_usart ao_stm_usart3;
-void stm_usart3_isr(void) { ao_usart_isr(&ao_stm_usart3, USE_SERIAL_3_STDIN); }
+void stm_usart3_isr(void) { ao_usart_isr(&ao_stm_usart3, USE_SERIAL_2_STDIN); }
char
ao_serial3_getchar(void)
diff --git a/src/stm/ao_usb.h b/src/stm/ao_usb.h
deleted file mode 100644
index d3129d34..00000000
--- a/src/stm/ao_usb.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright © 2009 Keith Packard <keithp@keithp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
- */
-
-#ifndef _AO_USB_H_
-#define _AO_USB_H_
-
-#define AO_USB_SETUP_DIR_MASK (0x01 << 7)
-#define AO_USB_SETUP_TYPE_MASK (0x03 << 5)
-#define AO_USB_SETUP_RECIP_MASK (0x1f)
-
-#define AO_USB_DIR_OUT 0
-#define AO_USB_DIR_IN (1 << 7)
-
-#define AO_USB_TYPE_STANDARD 0
-#define AO_USB_TYPE_CLASS (1 << 5)
-#define AO_USB_TYPE_VENDOR (2 << 5)
-#define AO_USB_TYPE_RESERVED (3 << 5)
-
-#define AO_USB_RECIP_DEVICE 0
-#define AO_USB_RECIP_INTERFACE 1
-#define AO_USB_RECIP_ENDPOINT 2
-#define AO_USB_RECIP_OTHER 3
-
-/* standard requests */
-#define AO_USB_REQ_GET_STATUS 0x00
-#define AO_USB_REQ_CLEAR_FEATURE 0x01
-#define AO_USB_REQ_SET_FEATURE 0x03
-#define AO_USB_REQ_SET_ADDRESS 0x05
-#define AO_USB_REQ_GET_DESCRIPTOR 0x06
-#define AO_USB_REQ_SET_DESCRIPTOR 0x07
-#define AO_USB_REQ_GET_CONFIGURATION 0x08
-#define AO_USB_REQ_SET_CONFIGURATION 0x09
-#define AO_USB_REQ_GET_INTERFACE 0x0A
-#define AO_USB_REQ_SET_INTERFACE 0x0B
-#define AO_USB_REQ_SYNCH_FRAME 0x0C
-
-#define AO_USB_DESC_DEVICE 1
-#define AO_USB_DESC_CONFIGURATION 2
-#define AO_USB_DESC_STRING 3
-#define AO_USB_DESC_INTERFACE 4
-#define AO_USB_DESC_ENDPOINT 5
-#define AO_USB_DESC_DEVICE_QUALIFIER 6
-#define AO_USB_DESC_OTHER_SPEED 7
-#define AO_USB_DESC_INTERFACE_POWER 8
-
-#define AO_USB_GET_DESC_TYPE(x) (((x)>>8)&0xFF)
-#define AO_USB_GET_DESC_INDEX(x) ((x)&0xFF)
-
-#define AO_USB_CONTROL_EP 0
-#define AO_USB_INT_EP 1
-#define AO_USB_OUT_EP 4
-#define AO_USB_IN_EP 5
-#define AO_USB_CONTROL_SIZE 32
-/*
- * Double buffer IN and OUT EPs, so each
- * gets half of the available space
- *
- * Ah, but USB bulk packets can only come in 8, 16, 32 and 64
- * byte sizes, so we'll use 64 for everything
- */
-#define AO_USB_INT_SIZE 8
-#define AO_USB_IN_SIZE 64
-#define AO_USB_OUT_SIZE 64
-
-#define AO_USB_EP0_IDLE 0
-#define AO_USB_EP0_DATA_IN 1
-#define AO_USB_EP0_DATA_OUT 2
-
-#define LE_WORD(x) ((x)&0xFF),((uint8_t) (((uint16_t) (x))>>8))
-
-/* CDC definitions */
-#define CS_INTERFACE 0x24
-#define CS_ENDPOINT 0x25
-
-#define SET_LINE_CODING 0x20
-#define GET_LINE_CODING 0x21
-#define SET_CONTROL_LINE_STATE 0x22
-
-/* Data structure for GET_LINE_CODING / SET_LINE_CODING class requests */
-struct ao_usb_line_coding {
- uint32_t rate;
- uint8_t char_format;
- uint8_t parity;
- uint8_t data_bits;
-} ;
-
-#endif /* _AO_USB_H_ */
diff --git a/src/stm/ao_usb_stm.c b/src/stm/ao_usb_stm.c
index 5a447d43..586f1e33 100644
--- a/src/stm/ao_usb_stm.c
+++ b/src/stm/ao_usb_stm.c
@@ -717,17 +717,17 @@ ao_usb_ep0_setup(void)
case AO_USB_TYPE_CLASS:
debug ("Class setup packet\n");
switch (ao_usb_setup.request) {
- case SET_LINE_CODING:
+ case AO_USB_SET_LINE_CODING:
debug ("set line coding\n");
ao_usb_ep0_out_len = 7;
ao_usb_ep0_out_data = (uint8_t *) &ao_usb_line_coding;
break;
- case GET_LINE_CODING:
+ case AO_USB_GET_LINE_CODING:
debug ("get line coding\n");
ao_usb_ep0_in_len = 7;
ao_usb_ep0_in_data = (uint8_t *) &ao_usb_line_coding;
break;
- case SET_CONTROL_LINE_STATE:
+ case AO_USB_SET_CONTROL_LINE_STATE:
break;
}
break;