├── README.md
├── hardware
├── eagle
│ ├── glcd2usb.brd
│ └── glcd2usb.sch
└── gerber
│ ├── glcd2usb.GBL
│ ├── glcd2usb.GBO
│ ├── glcd2usb.GBP
│ ├── glcd2usb.GBS
│ ├── glcd2usb.GML
│ ├── glcd2usb.GTL
│ ├── glcd2usb.GTO
│ ├── glcd2usb.GTP
│ ├── glcd2usb.GTS
│ ├── glcd2usb.TXT
│ ├── glcd2usb.brd
│ ├── glcd2usb.do
│ ├── glcd2usb.dri
│ ├── glcd2usb.drl
│ ├── glcd2usb.gpi
│ └── glcd2usb.sch
├── images
├── glcd2usb.jpg
├── glcd2usb_bottom.jpg
├── glcd2usb_top.jpg
├── parts.png
├── pcb.png
├── pcb_full.png
├── polarity1.jpg
├── polarity2.jpg
├── schematic.png
├── schematic_full.png
└── usbpinout.jpg
├── ks0108
├── COPYING
├── Makefile
├── avrlibdefs.h
├── avrlibtypes.h
├── checksize
├── firmware.bin
├── firmware.hex
├── font5x7.h
├── fontgr.h
├── glcd.c
├── glcd.h
├── glcd.o
├── global.h
├── ks0108.c
├── ks0108.h
├── ks0108.o
├── ks0108conf.h
├── main.c
├── main.o
├── rprintf.c
├── rprintf.h
├── rprintf.o
├── usbconfig.h
├── usbdrv
│ ├── Changelog.txt
│ ├── CommercialLicense.txt
│ ├── License.txt
│ ├── Readme.txt
│ ├── USB-ID-FAQ.txt
│ ├── USB-IDs-for-free.txt
│ ├── asmcommon.inc
│ ├── oddebug.c
│ ├── oddebug.h
│ ├── oddebug.o
│ ├── usbconfig-prototype.h
│ ├── usbdrv.c
│ ├── usbdrv.h
│ ├── usbdrv.o
│ ├── usbdrvasm.S
│ ├── usbdrvasm.asm
│ ├── usbdrvasm.o
│ ├── usbdrvasm12.inc
│ ├── usbdrvasm128.inc
│ ├── usbdrvasm15.inc
│ ├── usbdrvasm16.inc
│ ├── usbdrvasm165.inc
│ ├── usbdrvasm18-crc.inc
│ ├── usbdrvasm18.inc
│ ├── usbdrvasm20.inc
│ └── usbportability.h
└── version.h
├── lcd4linux
├── drv_GLCD2USB.c
├── glcd2usb.h
└── readme.txt
└── testclient
├── Makefile
├── Makefile.mingw
├── hidsdi.h
├── main.c
├── usb-libusb.c
├── usb-windows.c
├── usbcalls.c
└── usbcalls.h
/README.md:
--------------------------------------------------------------------------------
1 | # GLCD2USB
2 |
3 | GLCD2USB is the graphic display capable descendant of the [LCD2USB](https://github.com/harbaum/LCD2USB). While the LCD2USB was meant to connect text LCDs via USB to a PC, GLCD2USB does the same for some common graphic LCD modules. While the LCD2USB made use of the fact that there's a quasi standard for text LCD controllers, the GLCD2USB needs to cope with various graphic LCD controllers available. The GLCD2USB was thus designed for maximum flexibility and the number and types of supported displays can easily be increased by providing matching modified firmware versions. However, currently only 128x64 ks0108 based displays are supported.
4 |
5 | 
6 |
7 | GLCD2USB is currently supported by [lcd4linux](http://ssl.bulix.org/projects/lcd4linux/). Since May '12 [serdisplib](http://serdisplib.sourceforge.net/) also supports the glcd2usb.
8 |
9 | Every now and then i have spare PCBs (11 Euro each) and flashed and tested CPUs available. Send me an email if you are interested.
10 |
11 | ## Hardware
12 |
13 |  | 
14 | ---- | ----
15 | **GLCD2USB without display** | **On pcb V1.1 the USB connector was mounted on the rear PCB side**
16 |
17 | **Important**: Unlike pcb V1.1 depicted above, the current pcb layout V1.2 has the USB connector mounted from the front side (the same side all other parts are mounted as well)!
18 |
19 | ### Schematics and pcb layout
20 |
21 | [](images/schematic_full.png)
22 | [](images/pcb_full.png)
23 | [](images/parts_full.png)
24 |
25 | ## Supported display types
26 |
27 | The GLCD2USB concept is meant to support various different display types. Currently a version is available to directly attach to some of the popular ks0108 based displays like the Displaytech 64128A (available e.g. from [Reichelt](http://www.reichelt.de)) or the TG12864B (verified to work, available e.g. from [Pollin](http://www.pollin.de)) or the [Buydisplay --ERM12864DNS-2](http://www.buydisplay.com/default/graphic-display/128x64-dots?cotroller_ic=470)
28 |
29 | The GLCD2USB features 16 firmware configurable interface lines (AVR ports A and C) which will allow to connect the GLCD2USB to virtually any intelligent graphic display out there. However, currently only a hardware design and a firmware for certain ks0108 based displays have been developed. Further hardware versions with a matching firmware solution may support other controllers as well.
30 |
31 | ### Required parts
32 |
33 | You can get all parts in germany from Reichelt or Conrad. Or in APAC from Element14.
34 |
35 | Part | Qty | Name | [Reichelt](http://www.reichelt.de) | [Conrad](http://www.conrad.de) | [Maplin UK](http://www.maplin.co.uk) | [Element14](http://element14.com)
36 | ---- | ---- | ---- | ---- | ---- | ---- | ----
37 | Q1 | 1 | 16Mhz crystal, HC49U package | 16,0000-HC49U-S | 155145 | RR89W | 1701139
38 | R1 | 1 | 2.2k ohm resistor | 1/4W 2,2k | 403270 | M2K2 | 1127929
39 | R2, R3 | 2 | 68 ohm resistor | 1/4W 68 | 403113 | M68R | 1128049
40 | R4 | 1 | 47 ohm resistor | 1/4W 47 | 403091 | M47R | 1126986
41 | R5 | 1 | 220 ohm resistor | 1/4W 220 | 403172 | M220R | 1128007
42 | R6 | 1 | 4.7k ohm resistor | 1/4W 4,7k | 403334 | M4K7 | 1128937
43 | C1, C2 | 2 | 22pF ceramic capacitor, 2.54mm | KERKO 22P | 457167 | RA34M | 1600966
44 | C3, C5 | 2 | 100nF capacitor, 5.08mm | X7R-5 100N | 453358 | RA49D | 1600820
45 | C6 | 1 | 10μF electrolytic capacitor | RAD 10/35 | 472484 | AT98G | 1823702
46 | T1 | 1 | BC547C transistor | BC 547C | 154989 | QQ14Q | 2453321
47 | S1, S2, S3, S4 | 4 | push button | TASTER 9305 | 700460 | KR89W | 1712978
48 | SV1 | 1 | 10 pin ISP connector | WSL 10W | 742365 | JB85G | 1298795
49 | JP1 | - | serial connector, for debugging only | - | - | - | -
50 | JP2 | 1 | display connector | BL 1X20G8 2,54 | 734993 | --- | -
51 | -- | 1 | display side connector for JP2 | SL 1X36G 2,54 | 744018 | JW59P | -
52 | LED1 | 1 | LED 3mm green | LED 3MM GN | 184713 | WL33L | -
53 | X1 | 1 | mini USB-B print connector | USB BWM | ??? | --- | -
54 | IC1 | 1 | Atmega16-16 DIP | ATMEGA 16-16 DIP | 154242 | --- | 9171142
55 | -- | 1 | socket for IC1 | GS 40P | 184882 | HQ38R | 4285669
56 | D1, D2 | 2 | 3.6V zener diode | ZF 3,6 | 180050 | QH03D | 1861480
57 | R7 | 1 | 10k precision variable resistor | 962-20 10K | 425109 | WR49D | 1141462
58 | -- | 1 | Display | LCD 128X064 BL, LCD 64128A LED | 187429, 187433 | --- | -
59 |
60 | Additionally required: Display, Mini USB cable
61 |
62 | #### Part list remarks
63 |
64 | The crystal should be in the small HC49U package. You can use a crystal in HC18 package, but you'd then have to mount it from the rear pcb side.
65 |
66 | C1 and C2 should have their pins 2.54mm (1/10 inch) apart, C3 and C5 have their pins 5.08mm (2/10 inch) apart.
67 |
68 | Although T1 is labeled BC547C, a BC547A or BC547B will be fine as well. Also tested working with a BC337
69 |
70 | If the backlight of the display draws more current than the 100mA the BC547 can handle a BC447 or BS170 may be used instead. I have not tested this and feedback is welcome. I have unknowingly been running the BC547 with a display drawing over 120mA without any problems, but using a transistor specified for the required current sure is a good idea.
71 |
72 | D1 and D2 must be 1/2w (500mA) or less. Otherwise you will encounter USB issues.
73 |
74 | ### Contrast voltage supply
75 |
76 | Some contrast voltage has to provided to basically any LCD in order to generate readable output at a useful contrast. Without proper contrast voltage a LCD won't display anything. Unlike e.g. the HD44780 controllers used with the [LCD2USB](../lcd2usb), the KS0108 needs a negative contrast voltage. This is provided by the display controller itself and needs to be fed back into it. Since the AVR CPU can't easily work with negative voltages, the contrast is not software controlled but by the variable resistor R7.
77 |
78 | ### Backlight polarity
79 |
80 | Most of the 20 pin connector seems to be the same for many 128x64 ks0108 displays. But you should still carefully verify the pinout of the display you are going to use. One frequent difference between different displays seems to be the polarity of the backlighting. The GLCD2USB contains two SMD solder jumpers in the rear side below the programming connector. Please take care to close for the current polarity on your used by your display. Using the wrong polarity might damage the backlight of your display.
81 |
82 | If the backlights cathode (GND) is on pin 19 and the anode (VCC) is on pin 20 then the innermost SMD pads are to be connected as seen on the left image below. If the cathode of the displays backlight LED is on pin 20 and the anode on pin 19 then the both outermost SMD pads have to be connected with a small solder blob as seen on the right image below.
83 |
84 |  
85 |
86 | ### Backlight current
87 |
88 | Resistor R4 is the current limiting resistor for backlight. The 47 ohm in the part list is a useful and secure value for some LCDs with low power LED backlighting. Some displays already include the current limiting resistor and/or require a higher current. The symptom usually is a very dark or even barely visible backlighting with R4 at 47 ohms. You can lower the value of R4 in order to increase the backlight current and thus the brightness. Please consult the datasheet of your display for its backlight power requirements and in order to select the correct current limiting resistors. The BC547 transistor T1 may not be sufficient for displays requiring backlight currents > 100mA.
89 |
90 | Also keep in mind that the backlight is software controlled by the AVR CPU and that it's not at full brightness at startup time. Use the "Brightness" option in lcd4linux.conf to adjust to the full brightness by setting this value to 255 before doing any hardware modifications with regard to this.
91 |
92 | ### Buttons
93 |
94 | The GLCD2USB supports 4 user controllable buttons. The buttons states are reported to the host and can be used there for further processing. The GLCD2USB does not use the buttons by itself.
95 |
96 | ### USB interface
97 |
98 | If you wish to solder a cable directly to the board the pin the pin out is like this :
99 | [](images/usbpinout.jpg)
100 |
101 |
102 |
103 | ## Software
104 |
105 | The GLCD2USB consists of two software components: The firmware installed inside the device and a software driver installed on the controlling host.
106 |
107 | ### Firmware installation
108 |
109 | The GLCD2USB is based on the Atmega16, member of the Atmel AVR family, but the hardware allows to use the Mega32 and Mega664 chips as well if e.g. internal flash space becomes a bottleneck. It is driven by a firmware available in the download section below. By installing different firmware versions, various display types can be supported. Currently a firmware for ks0108 based displays is available.
110 |
111 | The ATmega chips have initially to be flashed with the GLCD2USB firmware using a special programming hardware like e.g. the [AVR ISP](../lcd2usb/avrisp.gif) or the [USBASP](http://www.fischl.de/usbasp/).
112 |
113 | Various AVR ISP programming solutions exist as well as various PC flash software to use these. The following explanation details one of these possibilities.
114 |
115 | If the firmware file named firmware.hex is to be uploaded to the Atmega16 using the [AVRDUDE programming software](http://www.nongnu.org/avrdude/avrdude) and the [USBASP programming hardware](http://www.fischl.de/usbasp/) the following command is required:
116 |
117 |
118 | avrdude -c usbasp -P usb -p atmega16 -U lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U flash:w:firmware.hex
119 |
120 |
121 | The [USB tiny ISP](https://learn.adafruit.com/usbtinyisp) programer also works.
122 | Use the following syntax :
123 |
124 |
125 | avrdude -c usbtiny -P usb -p atmega16 -U lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U flash:w:firmware.hex
126 |
127 |
128 | This will install the firmware in the AVRs flash memory. Once the firmware is installed and the device is powered up, the LED on the GLCD2USB will be switched on and an attached display will display the demo screen (actual contents may vary with different firmware versions).
129 |
130 | ### Host driver software
131 |
132 | #### Example dmesg output
133 | Using the "dmesg" command on your linux machine you should see an output similar to this, when you plug in the GLCD2USB device :
134 | ```
135 | [2256973.693080] usb 3-2: new low-speed USB device number 30 using xhci_hcd
136 | [2256977.137440] usb 3-2: New USB device found, idVendor=1c40, idProduct=0525
137 | [2256977.137448] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
138 | [2256977.137453] usb 3-2: Product: GLCD2USB
139 | [2256977.137457] usb 3-2: Manufacturer: www.harbaum.org/till/glcd2usb
140 | [2256977.137655] usb 3-2: ep 0x81 - rounding interval to 64 microframes, ep desc says 80 microframes
141 | [2256980.974769] hid-generic 0003:1C40:0525.0008: hiddev0,hidraw6: USB HID v1.01 Device [www.harbaum.org/till/glcd2usb GLCD2USB] on usb-0000:03:00.0-2/input0
142 | ```
143 |
144 |
145 | #### lcd4linux
146 | Currently only the SVN version of lcd4linux available [here](http://ssl.bulix.org/projects/lcd4linux/wiki/Howto) supports the GLCD2USB interface. Fetch a copy from SVN as described there and compile and install it. The resulting lcd2linux binary should mention the GLCD2USB interface when invoked with the -l parameter.
147 |
148 | The [glcd2usb example configuration](lcd4linux.conf) can be used as a basis for own configurations. Please make sure the tux.png from the lcd4linux package is in the current directory when running this demo config to make sure the little tux is displayed to show the graphic capabilities of the display.
149 |
150 | #### LCDproc
151 |
152 | You need at least version 0.5.6.
153 | Ensure your configure command contains "--enable-drivers=glcd" to enable support for GLCD2USB.
154 |
155 |
156 | Ensure your LCDd.conf file has the following options set at a minimum.
157 |
158 | ```
159 | [server]
160 | Driver=glcd
161 | ```
162 |
163 | ```
164 | [glcd]
165 | ConnectionType=glcd2usb
166 |
167 | Size=128x64
168 | ```
169 |
170 | ## Adding support for a new display
171 |
172 | The GLCD2USB was designed to be directly attached to certain ks0108 controller based displays (see above). But it can be adopted to other displays as well. If these displays are based upon one of the controllers already supported getting the display to work with the GLCD2USB may be as simple as doing the correct wiring. However, this will not be sufficient with displays based on controllers not yet supported.
173 |
174 | The GLCD2USB only supports "intelligent" displays. This means that it only supports displays with built-in graphic controller which do the major work of driving the display. The GLCD2USB does e.g. not support bare TFT displays as used in notebook computers or palmtops. As a basic rule of thumb: GLCD2USB can be adopted to any display that some hackers have been able to drive via a PCs printer port (this is e.g. true for the [ks0108](http://www.fractronics.com/koppling_ks0108.gif)). On the other hand, displays that need to be connected to the video card of a PC (either VGA, DVI or something similar) are not supported by GLCD2USB.
175 |
176 | Writing a driver for an unsupported display controller is faily easy if you have access to the controllers specification or even some AVR library with routines for the controller in question. You can take the ks0108 driver of the GLCD2USB as a reference to build your own driver upon. The display connectors of the GLCD2USB give you access to 16 general purpose pins of the AVR CPU. This should be sufficient to drive the vast majority of displays.
177 |
178 | ## Links
179 |
180 | * [LCD4LINUX, lcd interfacing for linux](http://ssl.bulix.org/projects/lcd4linux/)
181 | * [LCDproc, lcd interface for Linux](http://www.lcdproc.org)
182 | * [AVR-USB, software USB for the AVR plattform](http://www.obdev.at/products/avrusb/index.html)
183 | * [USB user space library libusb](http://libusb.sourceforge.net/)
184 | * [Win32 port of libusb](http://libusb-win32.sourceforge.net/)
185 |
--------------------------------------------------------------------------------
/hardware/eagle/glcd2usb.brd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/hardware/eagle/glcd2usb.brd
--------------------------------------------------------------------------------
/hardware/eagle/glcd2usb.sch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/hardware/eagle/glcd2usb.sch
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.GBP:
--------------------------------------------------------------------------------
1 | G75*
2 | %MOIN*%
3 | %OFA0B0*%
4 | %FSLAX25Y25*%
5 | %IPPOS*%
6 | %LPD*%
7 | %AMOC8*
8 | 5,1,8,0,0,1.08239X$1,22.5*
9 | %
10 | %ADD10C,0.00000*%
11 | %ADD11R,0.04600X0.06300*%
12 | D10*
13 | X0002038Y0001200D02*
14 | X0002038Y0148650D01*
15 | X0376959Y0148650D01*
16 | X0376959Y0001200D01*
17 | X0002038Y0001200D01*
18 | X0012018Y0030550D02*
19 | X0012018Y0033050D01*
20 | X0115768Y0033050D01*
21 | X0115768Y0030550D01*
22 | X0012018Y0030550D01*
23 | X0011112Y0046800D02*
24 | X0011114Y0046953D01*
25 | X0011120Y0047107D01*
26 | X0011130Y0047260D01*
27 | X0011144Y0047412D01*
28 | X0011162Y0047565D01*
29 | X0011184Y0047716D01*
30 | X0011209Y0047867D01*
31 | X0011239Y0048018D01*
32 | X0011273Y0048168D01*
33 | X0011310Y0048316D01*
34 | X0011351Y0048464D01*
35 | X0011396Y0048610D01*
36 | X0011445Y0048756D01*
37 | X0011498Y0048900D01*
38 | X0011554Y0049042D01*
39 | X0011614Y0049183D01*
40 | X0011678Y0049323D01*
41 | X0011745Y0049461D01*
42 | X0011816Y0049597D01*
43 | X0011891Y0049731D01*
44 | X0011968Y0049863D01*
45 | X0012050Y0049993D01*
46 | X0012134Y0050121D01*
47 | X0012222Y0050247D01*
48 | X0012313Y0050370D01*
49 | X0012407Y0050491D01*
50 | X0012505Y0050609D01*
51 | X0012605Y0050725D01*
52 | X0012709Y0050838D01*
53 | X0012815Y0050949D01*
54 | X0012924Y0051057D01*
55 | X0013036Y0051162D01*
56 | X0013150Y0051263D01*
57 | X0013268Y0051362D01*
58 | X0013387Y0051458D01*
59 | X0013509Y0051551D01*
60 | X0013634Y0051640D01*
61 | X0013761Y0051727D01*
62 | X0013890Y0051809D01*
63 | X0014021Y0051889D01*
64 | X0014154Y0051965D01*
65 | X0014289Y0052038D01*
66 | X0014426Y0052107D01*
67 | X0014565Y0052172D01*
68 | X0014705Y0052234D01*
69 | X0014847Y0052292D01*
70 | X0014990Y0052347D01*
71 | X0015135Y0052398D01*
72 | X0015281Y0052445D01*
73 | X0015428Y0052488D01*
74 | X0015576Y0052527D01*
75 | X0015725Y0052563D01*
76 | X0015875Y0052594D01*
77 | X0016026Y0052622D01*
78 | X0016177Y0052646D01*
79 | X0016330Y0052666D01*
80 | X0016482Y0052682D01*
81 | X0016635Y0052694D01*
82 | X0016788Y0052702D01*
83 | X0016941Y0052706D01*
84 | X0017095Y0052706D01*
85 | X0017248Y0052702D01*
86 | X0017401Y0052694D01*
87 | X0017554Y0052682D01*
88 | X0017706Y0052666D01*
89 | X0017859Y0052646D01*
90 | X0018010Y0052622D01*
91 | X0018161Y0052594D01*
92 | X0018311Y0052563D01*
93 | X0018460Y0052527D01*
94 | X0018608Y0052488D01*
95 | X0018755Y0052445D01*
96 | X0018901Y0052398D01*
97 | X0019046Y0052347D01*
98 | X0019189Y0052292D01*
99 | X0019331Y0052234D01*
100 | X0019471Y0052172D01*
101 | X0019610Y0052107D01*
102 | X0019747Y0052038D01*
103 | X0019882Y0051965D01*
104 | X0020015Y0051889D01*
105 | X0020146Y0051809D01*
106 | X0020275Y0051727D01*
107 | X0020402Y0051640D01*
108 | X0020527Y0051551D01*
109 | X0020649Y0051458D01*
110 | X0020768Y0051362D01*
111 | X0020886Y0051263D01*
112 | X0021000Y0051162D01*
113 | X0021112Y0051057D01*
114 | X0021221Y0050949D01*
115 | X0021327Y0050838D01*
116 | X0021431Y0050725D01*
117 | X0021531Y0050609D01*
118 | X0021629Y0050491D01*
119 | X0021723Y0050370D01*
120 | X0021814Y0050247D01*
121 | X0021902Y0050121D01*
122 | X0021986Y0049993D01*
123 | X0022068Y0049863D01*
124 | X0022145Y0049731D01*
125 | X0022220Y0049597D01*
126 | X0022291Y0049461D01*
127 | X0022358Y0049323D01*
128 | X0022422Y0049183D01*
129 | X0022482Y0049042D01*
130 | X0022538Y0048900D01*
131 | X0022591Y0048756D01*
132 | X0022640Y0048610D01*
133 | X0022685Y0048464D01*
134 | X0022726Y0048316D01*
135 | X0022763Y0048168D01*
136 | X0022797Y0048018D01*
137 | X0022827Y0047867D01*
138 | X0022852Y0047716D01*
139 | X0022874Y0047565D01*
140 | X0022892Y0047412D01*
141 | X0022906Y0047260D01*
142 | X0022916Y0047107D01*
143 | X0022922Y0046953D01*
144 | X0022924Y0046800D01*
145 | X0022922Y0046647D01*
146 | X0022916Y0046493D01*
147 | X0022906Y0046340D01*
148 | X0022892Y0046188D01*
149 | X0022874Y0046035D01*
150 | X0022852Y0045884D01*
151 | X0022827Y0045733D01*
152 | X0022797Y0045582D01*
153 | X0022763Y0045432D01*
154 | X0022726Y0045284D01*
155 | X0022685Y0045136D01*
156 | X0022640Y0044990D01*
157 | X0022591Y0044844D01*
158 | X0022538Y0044700D01*
159 | X0022482Y0044558D01*
160 | X0022422Y0044417D01*
161 | X0022358Y0044277D01*
162 | X0022291Y0044139D01*
163 | X0022220Y0044003D01*
164 | X0022145Y0043869D01*
165 | X0022068Y0043737D01*
166 | X0021986Y0043607D01*
167 | X0021902Y0043479D01*
168 | X0021814Y0043353D01*
169 | X0021723Y0043230D01*
170 | X0021629Y0043109D01*
171 | X0021531Y0042991D01*
172 | X0021431Y0042875D01*
173 | X0021327Y0042762D01*
174 | X0021221Y0042651D01*
175 | X0021112Y0042543D01*
176 | X0021000Y0042438D01*
177 | X0020886Y0042337D01*
178 | X0020768Y0042238D01*
179 | X0020649Y0042142D01*
180 | X0020527Y0042049D01*
181 | X0020402Y0041960D01*
182 | X0020275Y0041873D01*
183 | X0020146Y0041791D01*
184 | X0020015Y0041711D01*
185 | X0019882Y0041635D01*
186 | X0019747Y0041562D01*
187 | X0019610Y0041493D01*
188 | X0019471Y0041428D01*
189 | X0019331Y0041366D01*
190 | X0019189Y0041308D01*
191 | X0019046Y0041253D01*
192 | X0018901Y0041202D01*
193 | X0018755Y0041155D01*
194 | X0018608Y0041112D01*
195 | X0018460Y0041073D01*
196 | X0018311Y0041037D01*
197 | X0018161Y0041006D01*
198 | X0018010Y0040978D01*
199 | X0017859Y0040954D01*
200 | X0017706Y0040934D01*
201 | X0017554Y0040918D01*
202 | X0017401Y0040906D01*
203 | X0017248Y0040898D01*
204 | X0017095Y0040894D01*
205 | X0016941Y0040894D01*
206 | X0016788Y0040898D01*
207 | X0016635Y0040906D01*
208 | X0016482Y0040918D01*
209 | X0016330Y0040934D01*
210 | X0016177Y0040954D01*
211 | X0016026Y0040978D01*
212 | X0015875Y0041006D01*
213 | X0015725Y0041037D01*
214 | X0015576Y0041073D01*
215 | X0015428Y0041112D01*
216 | X0015281Y0041155D01*
217 | X0015135Y0041202D01*
218 | X0014990Y0041253D01*
219 | X0014847Y0041308D01*
220 | X0014705Y0041366D01*
221 | X0014565Y0041428D01*
222 | X0014426Y0041493D01*
223 | X0014289Y0041562D01*
224 | X0014154Y0041635D01*
225 | X0014021Y0041711D01*
226 | X0013890Y0041791D01*
227 | X0013761Y0041873D01*
228 | X0013634Y0041960D01*
229 | X0013509Y0042049D01*
230 | X0013387Y0042142D01*
231 | X0013268Y0042238D01*
232 | X0013150Y0042337D01*
233 | X0013036Y0042438D01*
234 | X0012924Y0042543D01*
235 | X0012815Y0042651D01*
236 | X0012709Y0042762D01*
237 | X0012605Y0042875D01*
238 | X0012505Y0042991D01*
239 | X0012407Y0043109D01*
240 | X0012313Y0043230D01*
241 | X0012222Y0043353D01*
242 | X0012134Y0043479D01*
243 | X0012050Y0043607D01*
244 | X0011968Y0043737D01*
245 | X0011891Y0043869D01*
246 | X0011816Y0044003D01*
247 | X0011745Y0044139D01*
248 | X0011678Y0044277D01*
249 | X0011614Y0044417D01*
250 | X0011554Y0044558D01*
251 | X0011498Y0044700D01*
252 | X0011445Y0044844D01*
253 | X0011396Y0044990D01*
254 | X0011351Y0045136D01*
255 | X0011310Y0045284D01*
256 | X0011273Y0045432D01*
257 | X0011239Y0045582D01*
258 | X0011209Y0045733D01*
259 | X0011184Y0045884D01*
260 | X0011162Y0046035D01*
261 | X0011144Y0046188D01*
262 | X0011130Y0046340D01*
263 | X0011120Y0046493D01*
264 | X0011114Y0046647D01*
265 | X0011112Y0046800D01*
266 | X0134518Y0033050D02*
267 | X0134518Y0030550D01*
268 | X0244518Y0030550D01*
269 | X0244518Y0033050D01*
270 | X0134518Y0033050D01*
271 | X0263268Y0033050D02*
272 | X0263268Y0030550D01*
273 | X0367018Y0030550D01*
274 | X0367018Y0033050D01*
275 | X0263268Y0033050D01*
276 | X0358612Y0046800D02*
277 | X0358614Y0046953D01*
278 | X0358620Y0047107D01*
279 | X0358630Y0047260D01*
280 | X0358644Y0047412D01*
281 | X0358662Y0047565D01*
282 | X0358684Y0047716D01*
283 | X0358709Y0047867D01*
284 | X0358739Y0048018D01*
285 | X0358773Y0048168D01*
286 | X0358810Y0048316D01*
287 | X0358851Y0048464D01*
288 | X0358896Y0048610D01*
289 | X0358945Y0048756D01*
290 | X0358998Y0048900D01*
291 | X0359054Y0049042D01*
292 | X0359114Y0049183D01*
293 | X0359178Y0049323D01*
294 | X0359245Y0049461D01*
295 | X0359316Y0049597D01*
296 | X0359391Y0049731D01*
297 | X0359468Y0049863D01*
298 | X0359550Y0049993D01*
299 | X0359634Y0050121D01*
300 | X0359722Y0050247D01*
301 | X0359813Y0050370D01*
302 | X0359907Y0050491D01*
303 | X0360005Y0050609D01*
304 | X0360105Y0050725D01*
305 | X0360209Y0050838D01*
306 | X0360315Y0050949D01*
307 | X0360424Y0051057D01*
308 | X0360536Y0051162D01*
309 | X0360650Y0051263D01*
310 | X0360768Y0051362D01*
311 | X0360887Y0051458D01*
312 | X0361009Y0051551D01*
313 | X0361134Y0051640D01*
314 | X0361261Y0051727D01*
315 | X0361390Y0051809D01*
316 | X0361521Y0051889D01*
317 | X0361654Y0051965D01*
318 | X0361789Y0052038D01*
319 | X0361926Y0052107D01*
320 | X0362065Y0052172D01*
321 | X0362205Y0052234D01*
322 | X0362347Y0052292D01*
323 | X0362490Y0052347D01*
324 | X0362635Y0052398D01*
325 | X0362781Y0052445D01*
326 | X0362928Y0052488D01*
327 | X0363076Y0052527D01*
328 | X0363225Y0052563D01*
329 | X0363375Y0052594D01*
330 | X0363526Y0052622D01*
331 | X0363677Y0052646D01*
332 | X0363830Y0052666D01*
333 | X0363982Y0052682D01*
334 | X0364135Y0052694D01*
335 | X0364288Y0052702D01*
336 | X0364441Y0052706D01*
337 | X0364595Y0052706D01*
338 | X0364748Y0052702D01*
339 | X0364901Y0052694D01*
340 | X0365054Y0052682D01*
341 | X0365206Y0052666D01*
342 | X0365359Y0052646D01*
343 | X0365510Y0052622D01*
344 | X0365661Y0052594D01*
345 | X0365811Y0052563D01*
346 | X0365960Y0052527D01*
347 | X0366108Y0052488D01*
348 | X0366255Y0052445D01*
349 | X0366401Y0052398D01*
350 | X0366546Y0052347D01*
351 | X0366689Y0052292D01*
352 | X0366831Y0052234D01*
353 | X0366971Y0052172D01*
354 | X0367110Y0052107D01*
355 | X0367247Y0052038D01*
356 | X0367382Y0051965D01*
357 | X0367515Y0051889D01*
358 | X0367646Y0051809D01*
359 | X0367775Y0051727D01*
360 | X0367902Y0051640D01*
361 | X0368027Y0051551D01*
362 | X0368149Y0051458D01*
363 | X0368268Y0051362D01*
364 | X0368386Y0051263D01*
365 | X0368500Y0051162D01*
366 | X0368612Y0051057D01*
367 | X0368721Y0050949D01*
368 | X0368827Y0050838D01*
369 | X0368931Y0050725D01*
370 | X0369031Y0050609D01*
371 | X0369129Y0050491D01*
372 | X0369223Y0050370D01*
373 | X0369314Y0050247D01*
374 | X0369402Y0050121D01*
375 | X0369486Y0049993D01*
376 | X0369568Y0049863D01*
377 | X0369645Y0049731D01*
378 | X0369720Y0049597D01*
379 | X0369791Y0049461D01*
380 | X0369858Y0049323D01*
381 | X0369922Y0049183D01*
382 | X0369982Y0049042D01*
383 | X0370038Y0048900D01*
384 | X0370091Y0048756D01*
385 | X0370140Y0048610D01*
386 | X0370185Y0048464D01*
387 | X0370226Y0048316D01*
388 | X0370263Y0048168D01*
389 | X0370297Y0048018D01*
390 | X0370327Y0047867D01*
391 | X0370352Y0047716D01*
392 | X0370374Y0047565D01*
393 | X0370392Y0047412D01*
394 | X0370406Y0047260D01*
395 | X0370416Y0047107D01*
396 | X0370422Y0046953D01*
397 | X0370424Y0046800D01*
398 | X0370422Y0046647D01*
399 | X0370416Y0046493D01*
400 | X0370406Y0046340D01*
401 | X0370392Y0046188D01*
402 | X0370374Y0046035D01*
403 | X0370352Y0045884D01*
404 | X0370327Y0045733D01*
405 | X0370297Y0045582D01*
406 | X0370263Y0045432D01*
407 | X0370226Y0045284D01*
408 | X0370185Y0045136D01*
409 | X0370140Y0044990D01*
410 | X0370091Y0044844D01*
411 | X0370038Y0044700D01*
412 | X0369982Y0044558D01*
413 | X0369922Y0044417D01*
414 | X0369858Y0044277D01*
415 | X0369791Y0044139D01*
416 | X0369720Y0044003D01*
417 | X0369645Y0043869D01*
418 | X0369568Y0043737D01*
419 | X0369486Y0043607D01*
420 | X0369402Y0043479D01*
421 | X0369314Y0043353D01*
422 | X0369223Y0043230D01*
423 | X0369129Y0043109D01*
424 | X0369031Y0042991D01*
425 | X0368931Y0042875D01*
426 | X0368827Y0042762D01*
427 | X0368721Y0042651D01*
428 | X0368612Y0042543D01*
429 | X0368500Y0042438D01*
430 | X0368386Y0042337D01*
431 | X0368268Y0042238D01*
432 | X0368149Y0042142D01*
433 | X0368027Y0042049D01*
434 | X0367902Y0041960D01*
435 | X0367775Y0041873D01*
436 | X0367646Y0041791D01*
437 | X0367515Y0041711D01*
438 | X0367382Y0041635D01*
439 | X0367247Y0041562D01*
440 | X0367110Y0041493D01*
441 | X0366971Y0041428D01*
442 | X0366831Y0041366D01*
443 | X0366689Y0041308D01*
444 | X0366546Y0041253D01*
445 | X0366401Y0041202D01*
446 | X0366255Y0041155D01*
447 | X0366108Y0041112D01*
448 | X0365960Y0041073D01*
449 | X0365811Y0041037D01*
450 | X0365661Y0041006D01*
451 | X0365510Y0040978D01*
452 | X0365359Y0040954D01*
453 | X0365206Y0040934D01*
454 | X0365054Y0040918D01*
455 | X0364901Y0040906D01*
456 | X0364748Y0040898D01*
457 | X0364595Y0040894D01*
458 | X0364441Y0040894D01*
459 | X0364288Y0040898D01*
460 | X0364135Y0040906D01*
461 | X0363982Y0040918D01*
462 | X0363830Y0040934D01*
463 | X0363677Y0040954D01*
464 | X0363526Y0040978D01*
465 | X0363375Y0041006D01*
466 | X0363225Y0041037D01*
467 | X0363076Y0041073D01*
468 | X0362928Y0041112D01*
469 | X0362781Y0041155D01*
470 | X0362635Y0041202D01*
471 | X0362490Y0041253D01*
472 | X0362347Y0041308D01*
473 | X0362205Y0041366D01*
474 | X0362065Y0041428D01*
475 | X0361926Y0041493D01*
476 | X0361789Y0041562D01*
477 | X0361654Y0041635D01*
478 | X0361521Y0041711D01*
479 | X0361390Y0041791D01*
480 | X0361261Y0041873D01*
481 | X0361134Y0041960D01*
482 | X0361009Y0042049D01*
483 | X0360887Y0042142D01*
484 | X0360768Y0042238D01*
485 | X0360650Y0042337D01*
486 | X0360536Y0042438D01*
487 | X0360424Y0042543D01*
488 | X0360315Y0042651D01*
489 | X0360209Y0042762D01*
490 | X0360105Y0042875D01*
491 | X0360005Y0042991D01*
492 | X0359907Y0043109D01*
493 | X0359813Y0043230D01*
494 | X0359722Y0043353D01*
495 | X0359634Y0043479D01*
496 | X0359550Y0043607D01*
497 | X0359468Y0043737D01*
498 | X0359391Y0043869D01*
499 | X0359316Y0044003D01*
500 | X0359245Y0044139D01*
501 | X0359178Y0044277D01*
502 | X0359114Y0044417D01*
503 | X0359054Y0044558D01*
504 | X0358998Y0044700D01*
505 | X0358945Y0044844D01*
506 | X0358896Y0044990D01*
507 | X0358851Y0045136D01*
508 | X0358810Y0045284D01*
509 | X0358773Y0045432D01*
510 | X0358739Y0045582D01*
511 | X0358709Y0045733D01*
512 | X0358684Y0045884D01*
513 | X0358662Y0046035D01*
514 | X0358644Y0046188D01*
515 | X0358630Y0046340D01*
516 | X0358620Y0046493D01*
517 | X0358614Y0046647D01*
518 | X0358612Y0046800D01*
519 | D11*
520 | X0333018Y0064300D03*
521 | X0327018Y0064300D03*
522 | X0321018Y0064300D03*
523 | X0321018Y0076800D03*
524 | X0327018Y0076800D03*
525 | X0333018Y0076800D03*
526 | M02*
527 |
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.GTP:
--------------------------------------------------------------------------------
1 | G75*
2 | %MOIN*%
3 | %OFA0B0*%
4 | %FSLAX25Y25*%
5 | %IPPOS*%
6 | %LPD*%
7 | %AMOC8*
8 | 5,1,8,0,0,1.08239X$1,22.5*
9 | %
10 | %ADD10C,0.00000*%
11 | D10*
12 | X0002038Y0001200D02*
13 | X0002038Y0148650D01*
14 | X0376959Y0148650D01*
15 | X0376959Y0001200D01*
16 | X0002038Y0001200D01*
17 | X0012018Y0030550D02*
18 | X0012018Y0033050D01*
19 | X0115768Y0033050D01*
20 | X0115768Y0030550D01*
21 | X0012018Y0030550D01*
22 | X0011112Y0046800D02*
23 | X0011114Y0046953D01*
24 | X0011120Y0047107D01*
25 | X0011130Y0047260D01*
26 | X0011144Y0047412D01*
27 | X0011162Y0047565D01*
28 | X0011184Y0047716D01*
29 | X0011209Y0047867D01*
30 | X0011239Y0048018D01*
31 | X0011273Y0048168D01*
32 | X0011310Y0048316D01*
33 | X0011351Y0048464D01*
34 | X0011396Y0048610D01*
35 | X0011445Y0048756D01*
36 | X0011498Y0048900D01*
37 | X0011554Y0049042D01*
38 | X0011614Y0049183D01*
39 | X0011678Y0049323D01*
40 | X0011745Y0049461D01*
41 | X0011816Y0049597D01*
42 | X0011891Y0049731D01*
43 | X0011968Y0049863D01*
44 | X0012050Y0049993D01*
45 | X0012134Y0050121D01*
46 | X0012222Y0050247D01*
47 | X0012313Y0050370D01*
48 | X0012407Y0050491D01*
49 | X0012505Y0050609D01*
50 | X0012605Y0050725D01*
51 | X0012709Y0050838D01*
52 | X0012815Y0050949D01*
53 | X0012924Y0051057D01*
54 | X0013036Y0051162D01*
55 | X0013150Y0051263D01*
56 | X0013268Y0051362D01*
57 | X0013387Y0051458D01*
58 | X0013509Y0051551D01*
59 | X0013634Y0051640D01*
60 | X0013761Y0051727D01*
61 | X0013890Y0051809D01*
62 | X0014021Y0051889D01*
63 | X0014154Y0051965D01*
64 | X0014289Y0052038D01*
65 | X0014426Y0052107D01*
66 | X0014565Y0052172D01*
67 | X0014705Y0052234D01*
68 | X0014847Y0052292D01*
69 | X0014990Y0052347D01*
70 | X0015135Y0052398D01*
71 | X0015281Y0052445D01*
72 | X0015428Y0052488D01*
73 | X0015576Y0052527D01*
74 | X0015725Y0052563D01*
75 | X0015875Y0052594D01*
76 | X0016026Y0052622D01*
77 | X0016177Y0052646D01*
78 | X0016330Y0052666D01*
79 | X0016482Y0052682D01*
80 | X0016635Y0052694D01*
81 | X0016788Y0052702D01*
82 | X0016941Y0052706D01*
83 | X0017095Y0052706D01*
84 | X0017248Y0052702D01*
85 | X0017401Y0052694D01*
86 | X0017554Y0052682D01*
87 | X0017706Y0052666D01*
88 | X0017859Y0052646D01*
89 | X0018010Y0052622D01*
90 | X0018161Y0052594D01*
91 | X0018311Y0052563D01*
92 | X0018460Y0052527D01*
93 | X0018608Y0052488D01*
94 | X0018755Y0052445D01*
95 | X0018901Y0052398D01*
96 | X0019046Y0052347D01*
97 | X0019189Y0052292D01*
98 | X0019331Y0052234D01*
99 | X0019471Y0052172D01*
100 | X0019610Y0052107D01*
101 | X0019747Y0052038D01*
102 | X0019882Y0051965D01*
103 | X0020015Y0051889D01*
104 | X0020146Y0051809D01*
105 | X0020275Y0051727D01*
106 | X0020402Y0051640D01*
107 | X0020527Y0051551D01*
108 | X0020649Y0051458D01*
109 | X0020768Y0051362D01*
110 | X0020886Y0051263D01*
111 | X0021000Y0051162D01*
112 | X0021112Y0051057D01*
113 | X0021221Y0050949D01*
114 | X0021327Y0050838D01*
115 | X0021431Y0050725D01*
116 | X0021531Y0050609D01*
117 | X0021629Y0050491D01*
118 | X0021723Y0050370D01*
119 | X0021814Y0050247D01*
120 | X0021902Y0050121D01*
121 | X0021986Y0049993D01*
122 | X0022068Y0049863D01*
123 | X0022145Y0049731D01*
124 | X0022220Y0049597D01*
125 | X0022291Y0049461D01*
126 | X0022358Y0049323D01*
127 | X0022422Y0049183D01*
128 | X0022482Y0049042D01*
129 | X0022538Y0048900D01*
130 | X0022591Y0048756D01*
131 | X0022640Y0048610D01*
132 | X0022685Y0048464D01*
133 | X0022726Y0048316D01*
134 | X0022763Y0048168D01*
135 | X0022797Y0048018D01*
136 | X0022827Y0047867D01*
137 | X0022852Y0047716D01*
138 | X0022874Y0047565D01*
139 | X0022892Y0047412D01*
140 | X0022906Y0047260D01*
141 | X0022916Y0047107D01*
142 | X0022922Y0046953D01*
143 | X0022924Y0046800D01*
144 | X0022922Y0046647D01*
145 | X0022916Y0046493D01*
146 | X0022906Y0046340D01*
147 | X0022892Y0046188D01*
148 | X0022874Y0046035D01*
149 | X0022852Y0045884D01*
150 | X0022827Y0045733D01*
151 | X0022797Y0045582D01*
152 | X0022763Y0045432D01*
153 | X0022726Y0045284D01*
154 | X0022685Y0045136D01*
155 | X0022640Y0044990D01*
156 | X0022591Y0044844D01*
157 | X0022538Y0044700D01*
158 | X0022482Y0044558D01*
159 | X0022422Y0044417D01*
160 | X0022358Y0044277D01*
161 | X0022291Y0044139D01*
162 | X0022220Y0044003D01*
163 | X0022145Y0043869D01*
164 | X0022068Y0043737D01*
165 | X0021986Y0043607D01*
166 | X0021902Y0043479D01*
167 | X0021814Y0043353D01*
168 | X0021723Y0043230D01*
169 | X0021629Y0043109D01*
170 | X0021531Y0042991D01*
171 | X0021431Y0042875D01*
172 | X0021327Y0042762D01*
173 | X0021221Y0042651D01*
174 | X0021112Y0042543D01*
175 | X0021000Y0042438D01*
176 | X0020886Y0042337D01*
177 | X0020768Y0042238D01*
178 | X0020649Y0042142D01*
179 | X0020527Y0042049D01*
180 | X0020402Y0041960D01*
181 | X0020275Y0041873D01*
182 | X0020146Y0041791D01*
183 | X0020015Y0041711D01*
184 | X0019882Y0041635D01*
185 | X0019747Y0041562D01*
186 | X0019610Y0041493D01*
187 | X0019471Y0041428D01*
188 | X0019331Y0041366D01*
189 | X0019189Y0041308D01*
190 | X0019046Y0041253D01*
191 | X0018901Y0041202D01*
192 | X0018755Y0041155D01*
193 | X0018608Y0041112D01*
194 | X0018460Y0041073D01*
195 | X0018311Y0041037D01*
196 | X0018161Y0041006D01*
197 | X0018010Y0040978D01*
198 | X0017859Y0040954D01*
199 | X0017706Y0040934D01*
200 | X0017554Y0040918D01*
201 | X0017401Y0040906D01*
202 | X0017248Y0040898D01*
203 | X0017095Y0040894D01*
204 | X0016941Y0040894D01*
205 | X0016788Y0040898D01*
206 | X0016635Y0040906D01*
207 | X0016482Y0040918D01*
208 | X0016330Y0040934D01*
209 | X0016177Y0040954D01*
210 | X0016026Y0040978D01*
211 | X0015875Y0041006D01*
212 | X0015725Y0041037D01*
213 | X0015576Y0041073D01*
214 | X0015428Y0041112D01*
215 | X0015281Y0041155D01*
216 | X0015135Y0041202D01*
217 | X0014990Y0041253D01*
218 | X0014847Y0041308D01*
219 | X0014705Y0041366D01*
220 | X0014565Y0041428D01*
221 | X0014426Y0041493D01*
222 | X0014289Y0041562D01*
223 | X0014154Y0041635D01*
224 | X0014021Y0041711D01*
225 | X0013890Y0041791D01*
226 | X0013761Y0041873D01*
227 | X0013634Y0041960D01*
228 | X0013509Y0042049D01*
229 | X0013387Y0042142D01*
230 | X0013268Y0042238D01*
231 | X0013150Y0042337D01*
232 | X0013036Y0042438D01*
233 | X0012924Y0042543D01*
234 | X0012815Y0042651D01*
235 | X0012709Y0042762D01*
236 | X0012605Y0042875D01*
237 | X0012505Y0042991D01*
238 | X0012407Y0043109D01*
239 | X0012313Y0043230D01*
240 | X0012222Y0043353D01*
241 | X0012134Y0043479D01*
242 | X0012050Y0043607D01*
243 | X0011968Y0043737D01*
244 | X0011891Y0043869D01*
245 | X0011816Y0044003D01*
246 | X0011745Y0044139D01*
247 | X0011678Y0044277D01*
248 | X0011614Y0044417D01*
249 | X0011554Y0044558D01*
250 | X0011498Y0044700D01*
251 | X0011445Y0044844D01*
252 | X0011396Y0044990D01*
253 | X0011351Y0045136D01*
254 | X0011310Y0045284D01*
255 | X0011273Y0045432D01*
256 | X0011239Y0045582D01*
257 | X0011209Y0045733D01*
258 | X0011184Y0045884D01*
259 | X0011162Y0046035D01*
260 | X0011144Y0046188D01*
261 | X0011130Y0046340D01*
262 | X0011120Y0046493D01*
263 | X0011114Y0046647D01*
264 | X0011112Y0046800D01*
265 | X0134518Y0033050D02*
266 | X0134518Y0030550D01*
267 | X0244518Y0030550D01*
268 | X0244518Y0033050D01*
269 | X0134518Y0033050D01*
270 | X0263268Y0033050D02*
271 | X0263268Y0030550D01*
272 | X0367018Y0030550D01*
273 | X0367018Y0033050D01*
274 | X0263268Y0033050D01*
275 | X0358612Y0046800D02*
276 | X0358614Y0046953D01*
277 | X0358620Y0047107D01*
278 | X0358630Y0047260D01*
279 | X0358644Y0047412D01*
280 | X0358662Y0047565D01*
281 | X0358684Y0047716D01*
282 | X0358709Y0047867D01*
283 | X0358739Y0048018D01*
284 | X0358773Y0048168D01*
285 | X0358810Y0048316D01*
286 | X0358851Y0048464D01*
287 | X0358896Y0048610D01*
288 | X0358945Y0048756D01*
289 | X0358998Y0048900D01*
290 | X0359054Y0049042D01*
291 | X0359114Y0049183D01*
292 | X0359178Y0049323D01*
293 | X0359245Y0049461D01*
294 | X0359316Y0049597D01*
295 | X0359391Y0049731D01*
296 | X0359468Y0049863D01*
297 | X0359550Y0049993D01*
298 | X0359634Y0050121D01*
299 | X0359722Y0050247D01*
300 | X0359813Y0050370D01*
301 | X0359907Y0050491D01*
302 | X0360005Y0050609D01*
303 | X0360105Y0050725D01*
304 | X0360209Y0050838D01*
305 | X0360315Y0050949D01*
306 | X0360424Y0051057D01*
307 | X0360536Y0051162D01*
308 | X0360650Y0051263D01*
309 | X0360768Y0051362D01*
310 | X0360887Y0051458D01*
311 | X0361009Y0051551D01*
312 | X0361134Y0051640D01*
313 | X0361261Y0051727D01*
314 | X0361390Y0051809D01*
315 | X0361521Y0051889D01*
316 | X0361654Y0051965D01*
317 | X0361789Y0052038D01*
318 | X0361926Y0052107D01*
319 | X0362065Y0052172D01*
320 | X0362205Y0052234D01*
321 | X0362347Y0052292D01*
322 | X0362490Y0052347D01*
323 | X0362635Y0052398D01*
324 | X0362781Y0052445D01*
325 | X0362928Y0052488D01*
326 | X0363076Y0052527D01*
327 | X0363225Y0052563D01*
328 | X0363375Y0052594D01*
329 | X0363526Y0052622D01*
330 | X0363677Y0052646D01*
331 | X0363830Y0052666D01*
332 | X0363982Y0052682D01*
333 | X0364135Y0052694D01*
334 | X0364288Y0052702D01*
335 | X0364441Y0052706D01*
336 | X0364595Y0052706D01*
337 | X0364748Y0052702D01*
338 | X0364901Y0052694D01*
339 | X0365054Y0052682D01*
340 | X0365206Y0052666D01*
341 | X0365359Y0052646D01*
342 | X0365510Y0052622D01*
343 | X0365661Y0052594D01*
344 | X0365811Y0052563D01*
345 | X0365960Y0052527D01*
346 | X0366108Y0052488D01*
347 | X0366255Y0052445D01*
348 | X0366401Y0052398D01*
349 | X0366546Y0052347D01*
350 | X0366689Y0052292D01*
351 | X0366831Y0052234D01*
352 | X0366971Y0052172D01*
353 | X0367110Y0052107D01*
354 | X0367247Y0052038D01*
355 | X0367382Y0051965D01*
356 | X0367515Y0051889D01*
357 | X0367646Y0051809D01*
358 | X0367775Y0051727D01*
359 | X0367902Y0051640D01*
360 | X0368027Y0051551D01*
361 | X0368149Y0051458D01*
362 | X0368268Y0051362D01*
363 | X0368386Y0051263D01*
364 | X0368500Y0051162D01*
365 | X0368612Y0051057D01*
366 | X0368721Y0050949D01*
367 | X0368827Y0050838D01*
368 | X0368931Y0050725D01*
369 | X0369031Y0050609D01*
370 | X0369129Y0050491D01*
371 | X0369223Y0050370D01*
372 | X0369314Y0050247D01*
373 | X0369402Y0050121D01*
374 | X0369486Y0049993D01*
375 | X0369568Y0049863D01*
376 | X0369645Y0049731D01*
377 | X0369720Y0049597D01*
378 | X0369791Y0049461D01*
379 | X0369858Y0049323D01*
380 | X0369922Y0049183D01*
381 | X0369982Y0049042D01*
382 | X0370038Y0048900D01*
383 | X0370091Y0048756D01*
384 | X0370140Y0048610D01*
385 | X0370185Y0048464D01*
386 | X0370226Y0048316D01*
387 | X0370263Y0048168D01*
388 | X0370297Y0048018D01*
389 | X0370327Y0047867D01*
390 | X0370352Y0047716D01*
391 | X0370374Y0047565D01*
392 | X0370392Y0047412D01*
393 | X0370406Y0047260D01*
394 | X0370416Y0047107D01*
395 | X0370422Y0046953D01*
396 | X0370424Y0046800D01*
397 | X0370422Y0046647D01*
398 | X0370416Y0046493D01*
399 | X0370406Y0046340D01*
400 | X0370392Y0046188D01*
401 | X0370374Y0046035D01*
402 | X0370352Y0045884D01*
403 | X0370327Y0045733D01*
404 | X0370297Y0045582D01*
405 | X0370263Y0045432D01*
406 | X0370226Y0045284D01*
407 | X0370185Y0045136D01*
408 | X0370140Y0044990D01*
409 | X0370091Y0044844D01*
410 | X0370038Y0044700D01*
411 | X0369982Y0044558D01*
412 | X0369922Y0044417D01*
413 | X0369858Y0044277D01*
414 | X0369791Y0044139D01*
415 | X0369720Y0044003D01*
416 | X0369645Y0043869D01*
417 | X0369568Y0043737D01*
418 | X0369486Y0043607D01*
419 | X0369402Y0043479D01*
420 | X0369314Y0043353D01*
421 | X0369223Y0043230D01*
422 | X0369129Y0043109D01*
423 | X0369031Y0042991D01*
424 | X0368931Y0042875D01*
425 | X0368827Y0042762D01*
426 | X0368721Y0042651D01*
427 | X0368612Y0042543D01*
428 | X0368500Y0042438D01*
429 | X0368386Y0042337D01*
430 | X0368268Y0042238D01*
431 | X0368149Y0042142D01*
432 | X0368027Y0042049D01*
433 | X0367902Y0041960D01*
434 | X0367775Y0041873D01*
435 | X0367646Y0041791D01*
436 | X0367515Y0041711D01*
437 | X0367382Y0041635D01*
438 | X0367247Y0041562D01*
439 | X0367110Y0041493D01*
440 | X0366971Y0041428D01*
441 | X0366831Y0041366D01*
442 | X0366689Y0041308D01*
443 | X0366546Y0041253D01*
444 | X0366401Y0041202D01*
445 | X0366255Y0041155D01*
446 | X0366108Y0041112D01*
447 | X0365960Y0041073D01*
448 | X0365811Y0041037D01*
449 | X0365661Y0041006D01*
450 | X0365510Y0040978D01*
451 | X0365359Y0040954D01*
452 | X0365206Y0040934D01*
453 | X0365054Y0040918D01*
454 | X0364901Y0040906D01*
455 | X0364748Y0040898D01*
456 | X0364595Y0040894D01*
457 | X0364441Y0040894D01*
458 | X0364288Y0040898D01*
459 | X0364135Y0040906D01*
460 | X0363982Y0040918D01*
461 | X0363830Y0040934D01*
462 | X0363677Y0040954D01*
463 | X0363526Y0040978D01*
464 | X0363375Y0041006D01*
465 | X0363225Y0041037D01*
466 | X0363076Y0041073D01*
467 | X0362928Y0041112D01*
468 | X0362781Y0041155D01*
469 | X0362635Y0041202D01*
470 | X0362490Y0041253D01*
471 | X0362347Y0041308D01*
472 | X0362205Y0041366D01*
473 | X0362065Y0041428D01*
474 | X0361926Y0041493D01*
475 | X0361789Y0041562D01*
476 | X0361654Y0041635D01*
477 | X0361521Y0041711D01*
478 | X0361390Y0041791D01*
479 | X0361261Y0041873D01*
480 | X0361134Y0041960D01*
481 | X0361009Y0042049D01*
482 | X0360887Y0042142D01*
483 | X0360768Y0042238D01*
484 | X0360650Y0042337D01*
485 | X0360536Y0042438D01*
486 | X0360424Y0042543D01*
487 | X0360315Y0042651D01*
488 | X0360209Y0042762D01*
489 | X0360105Y0042875D01*
490 | X0360005Y0042991D01*
491 | X0359907Y0043109D01*
492 | X0359813Y0043230D01*
493 | X0359722Y0043353D01*
494 | X0359634Y0043479D01*
495 | X0359550Y0043607D01*
496 | X0359468Y0043737D01*
497 | X0359391Y0043869D01*
498 | X0359316Y0044003D01*
499 | X0359245Y0044139D01*
500 | X0359178Y0044277D01*
501 | X0359114Y0044417D01*
502 | X0359054Y0044558D01*
503 | X0358998Y0044700D01*
504 | X0358945Y0044844D01*
505 | X0358896Y0044990D01*
506 | X0358851Y0045136D01*
507 | X0358810Y0045284D01*
508 | X0358773Y0045432D01*
509 | X0358739Y0045582D01*
510 | X0358709Y0045733D01*
511 | X0358684Y0045884D01*
512 | X0358662Y0046035D01*
513 | X0358644Y0046188D01*
514 | X0358630Y0046340D01*
515 | X0358620Y0046493D01*
516 | X0358614Y0046647D01*
517 | X0358612Y0046800D01*
518 | M02*
519 |
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.TXT:
--------------------------------------------------------------------------------
1 | %
2 | M48
3 | M72
4 | T01C0.02362
5 | T02C0.02756
6 | T03C0.03200
7 | T04C0.03543
8 | T05C0.03600
9 | T06C0.03937
10 | T07C0.04000
11 | T08C0.11811
12 | %
13 | T01
14 | X44518Y53050
15 | X167018Y90550
16 | X215768Y70550
17 | X232018Y80550
18 | X262018Y93050
19 | X282018Y91800
20 | X295768Y100550
21 | X224518Y130550
22 | X79518Y105550
23 | X270768Y41800
24 | X249518Y19300
25 | X254518Y18050
26 | X249518Y14300
27 | T02
28 | X35640Y101751
29 | X30916Y104900
30 | X35640Y108050
31 | X30916Y111200
32 | X35640Y114349
33 | T03
34 | X27018Y11800
35 | X37018Y11800
36 | X50768Y25550
37 | X10768Y25550
38 | X9518Y61800
39 | X9518Y71800
40 | X9518Y83050
41 | X49518Y83050
42 | X49518Y71800
43 | X49518Y61800
44 | X67018Y61800
45 | X77018Y61800
46 | X87018Y61800
47 | X97018Y61800
48 | X107018Y61800
49 | X117018Y61800
50 | X127018Y61800
51 | X137018Y61800
52 | X147018Y61800
53 | X157018Y61800
54 | X167018Y61800
55 | X177018Y61800
56 | X187018Y61800
57 | X197018Y61800
58 | X207018Y61800
59 | X217018Y61800
60 | X227018Y61800
61 | X237018Y61800
62 | X247018Y61800
63 | X257018Y61800
64 | X278268Y45550
65 | X298268Y45550
66 | X308268Y45550
67 | X308268Y56800
68 | X300768Y69300
69 | X300768Y79300
70 | X348268Y56800
71 | X348268Y45550
72 | X359518Y70550
73 | X367018Y75550
74 | X359518Y80550
75 | X257018Y121800
76 | X247018Y121800
77 | X237018Y121800
78 | X227018Y121800
79 | X217018Y121800
80 | X207018Y121800
81 | X197018Y121800
82 | X187018Y121800
83 | X177018Y121800
84 | X167018Y121800
85 | X157018Y121800
86 | X147018Y121800
87 | X137018Y121800
88 | X127018Y121800
89 | X117018Y121800
90 | X107018Y121800
91 | X97018Y121800
92 | X87018Y121800
93 | X77018Y121800
94 | X67018Y121800
95 | X49518Y133050
96 | X49518Y143050
97 | X9518Y143050
98 | X9518Y133050
99 | X119518Y138050
100 | X129518Y138050
101 | X150018Y138050
102 | X169018Y138050
103 | X189518Y138050
104 | X199518Y138050
105 | X228268Y138050
106 | X248268Y138050
107 | T04
108 | X277018Y136800
109 | X287018Y116800
110 | X277018Y86800
111 | T05
112 | X314518Y98050
113 | X324518Y98050
114 | X334518Y98050
115 | X344518Y98050
116 | X354518Y98050
117 | X354518Y108050
118 | X344518Y108050
119 | X334518Y108050
120 | X324518Y108050
121 | X314518Y108050
122 | T06
123 | X15758Y93680
124 | X15758Y122420
125 | T07
126 | X68268Y140550
127 | X78268Y140550
128 | X88268Y140550
129 | X98268Y140550
130 | X102018Y46800
131 | X92018Y46800
132 | X82018Y46800
133 | X72018Y46800
134 | X62018Y46800
135 | X64218Y25700
136 | X89818Y25700
137 | X89818Y7900
138 | X64218Y7900
139 | X139218Y7900
140 | X164818Y7900
141 | X164818Y25700
142 | X139218Y25700
143 | X142018Y46800
144 | X132018Y46800
145 | X122018Y46800
146 | X112018Y46800
147 | X152018Y46800
148 | X162018Y46800
149 | X172018Y46800
150 | X182018Y46800
151 | X192018Y46800
152 | X202018Y46800
153 | X212018Y46800
154 | X222018Y46800
155 | X232018Y46800
156 | X242018Y46800
157 | X252018Y46800
158 | X239818Y25700
159 | X214218Y25700
160 | X214218Y7900
161 | X239818Y7900
162 | X289218Y7900
163 | X314818Y7900
164 | X314818Y25700
165 | X289218Y25700
166 | T08
167 | X364518Y46800
168 | X17018Y46800
169 | M30
170 |
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.brd:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/hardware/gerber/glcd2usb.brd
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.dri:
--------------------------------------------------------------------------------
1 | Generated by EAGLE CAM Processor 7.5.0
2 |
3 | Drill Station Info File: /tmp/glcd2usb/hardware/glcd2usb.dri
4 |
5 | Date : 1/12/16 7:28 PM
6 | Drills : generated
7 | Device : Excellon drill station, coordinate format 2.5 inch
8 |
9 | Parameter settings:
10 |
11 | Tolerance Drill + : 0.00 %
12 | Tolerance Drill - : 0.00 %
13 | Rotate : no
14 | Mirror : no
15 | Optimize : yes
16 | Auto fit : yes
17 | OffsetX : 0inch
18 | OffsetY : 0inch
19 | Layers : Drills Holes
20 |
21 | Drill File Info:
22 |
23 | Data Mode : Absolute
24 | Units : 1/100000 Inch
25 |
26 | Drills used:
27 |
28 | Code Size used
29 |
30 | T01 0.0236inch 13
31 | T02 0.0276inch 5
32 | T03 0.0320inch 73
33 | T04 0.0354inch 3
34 | T05 0.0360inch 10
35 | T06 0.0394inch 2
36 | T07 0.0400inch 40
37 | T08 0.1181inch 2
38 |
39 | Total number of drills: 148
40 |
41 | Plotfiles:
42 |
43 | /tmp/glcd2usb/hardware/glcd2usb.TXT
44 |
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.drl:
--------------------------------------------------------------------------------
1 | T01 0.60mm
2 | T02 0.70mm
3 | T03 0.81mm
4 | T04 0.90mm
5 | T05 0.91mm
6 | T06 1.00mm
7 | T07 1.02mm
8 | T08 3.00mm
9 |
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.gpi:
--------------------------------------------------------------------------------
1 | Generated by EAGLE CAM Processor 7.5.0
2 |
3 | Photoplotter Info File: /tmp/glcd2usb/hardware/glcd2usb.gpi
4 |
5 | Date : 1/12/16 7:28 PM
6 | Plotfile : /tmp/glcd2usb/hardware/glcd2usb.GTL
7 | Apertures : generated:
8 | Device : Gerber RS-274-X photoplotter, coordinate format 2.5 inch
9 |
10 | Parameter settings:
11 |
12 | Emulate Apertures : no
13 | Tolerance Draw + : 0.00 %
14 | Tolerance Draw - : 0.00 %
15 | Tolerance Flash + : 0.00 %
16 | Tolerance Flash - : 0.00 %
17 | Rotate : no
18 | Mirror : no
19 | Optimize : yes
20 | Auto fit : yes
21 | OffsetX : 0inch
22 | OffsetY : 0inch
23 |
24 | Plotfile Info:
25 |
26 | Coordinate Format : 2.5
27 | Coordinate Units : Inch
28 | Data Mode : Absolute
29 | Zero Suppression : None
30 | End Of Block : *
31 |
32 | Apertures used:
33 |
34 | Code Shape Size used
35 |
36 | D10 draw 0.0000inch 18
37 | D11 round 0.0480inch 2
38 | D12 octagon 0.0480inch 25
39 | D13 octagon 0.0630inch 1
40 | D14 round 0.0630inch 1
41 | D15 draw 0.0560inch 42
42 | D16 draw 0.0480inch 44
43 | D17 round 0.0514inch 3
44 | D18 octagon 0.0520inch 10
45 | D19 round 0.0436inch 5
46 | D20 draw 0.0160inch 4052
47 | D21 draw 0.0320inch 24
48 | D22 round 0.0356inch 13
49 |
50 |
--------------------------------------------------------------------------------
/hardware/gerber/glcd2usb.sch:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/hardware/gerber/glcd2usb.sch
--------------------------------------------------------------------------------
/images/glcd2usb.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/glcd2usb.jpg
--------------------------------------------------------------------------------
/images/glcd2usb_bottom.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/glcd2usb_bottom.jpg
--------------------------------------------------------------------------------
/images/glcd2usb_top.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/glcd2usb_top.jpg
--------------------------------------------------------------------------------
/images/parts.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/parts.png
--------------------------------------------------------------------------------
/images/pcb.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/pcb.png
--------------------------------------------------------------------------------
/images/pcb_full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/pcb_full.png
--------------------------------------------------------------------------------
/images/polarity1.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/polarity1.jpg
--------------------------------------------------------------------------------
/images/polarity2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/polarity2.jpg
--------------------------------------------------------------------------------
/images/schematic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/schematic.png
--------------------------------------------------------------------------------
/images/schematic_full.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/schematic_full.png
--------------------------------------------------------------------------------
/images/usbpinout.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/images/usbpinout.jpg
--------------------------------------------------------------------------------
/ks0108/Makefile:
--------------------------------------------------------------------------------
1 | # Name: Makefile
2 | # Project: GLCD2USB
3 | # Author: Christian Starkjohann, modified for GLCD2USB by Till Harbaum
4 | # Creation Date: 2005-03-20
5 | # Tabsize: 4
6 | # Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 | # License: Proprietary, free under certain conditions. See Documentation.
8 | # This Revision: $Id: Makefile.avrusb,v 1.1 2007/01/14 12:12:27 harbaum Exp $
9 |
10 | # DEFINES += -DBWCT_COMPAT
11 | # DEFINES += -DDEBUG_LEVEL=1 -DDEBUG
12 | # change the following line to atmega32 to use that cpu
13 | MCU=atmega32
14 | DEFINES += -DF_CPU=16000000
15 | COMPILE = avr-gcc -Wall -O2 -fno-strict-aliasing -Iusbdrv -I. -mmcu=$(MCU) $(DEFINES)
16 |
17 | OBJECTS = usbdrv/usbdrv.o usbdrv/usbdrvasm.o usbdrv/oddebug.o main.o ks0108.o glcd.o rprintf.o
18 |
19 |
20 | # symbolic targets:
21 | all: firmware.hex
22 |
23 | .c.o:
24 | $(COMPILE) -c $< -o $@
25 |
26 | .S.o:
27 | $(COMPILE) -x assembler-with-cpp -c $< -o $@
28 | # "-x assembler-with-cpp" should not be necessary since this is the default
29 | # file type for the .S (with capital S) extension. However, upper case
30 | # characters are not always preserved on Windows. To ensure WinAVR
31 | # compatibility define the file type manually.
32 |
33 | .c.s:
34 | $(COMPILE) -S $< -o $@
35 |
36 | flash: all
37 | avrdude -c usbasp -P usb -p $(MCU) -U lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U flash:w:firmware.hex
38 |
39 | # avrdude -c stk500 -P /dev/ttyUSB0 -p $(MCU) -U lfuse:w:0x9f:m -U hfuse:w:0xc9:m -U flash:w:firmware.hex
40 |
41 | # Fuse high byte:
42 | # 0xc9 = 1 1 0 0 1 0 0 1 <-- BOOTRST (boot reset vector at 0x0000)
43 | # ^ ^ ^ ^ ^ ^ ^------ BOOTSZ0
44 | # | | | | | +-------- BOOTSZ1
45 | # | | | | + --------- EESAVE (don't preserve EEPROM over chip erase)
46 | # | | | +-------------- CKOPT (full output swing)
47 | # | | +---------------- SPIEN (allow serial programming)
48 | # | +------------------ JTAGEN (JTAG disabled)
49 | # +-------------------- OCDEN (OCD disabled)
50 | # Fuse low byte:
51 | # 0x9f = 1 0 0 1 1 1 1 1
52 | # ^ ^ \ / \--+--/
53 | # | | | +------- CKSEL 3..0 (external >8M crystal)
54 | # | | +--------------- SUT 1..0 (crystal osc, BOD enabled)
55 | # | +------------------ BODEN (BrownOut Detector enabled)
56 | # +-------------------- BODLEVEL (2.7V)
57 | fuse:
58 | $(UISP) --wr_fuse_h=0xc9 --wr_fuse_l=0x9f
59 |
60 |
61 | clean:
62 | rm -f *~ firmware.lst firmware.obj firmware.cof firmware.list firmware.map firmware.bin *.o usbdrv/*.o firmware.s usbdrv/oddebug.s usbdrv/usbdrv.s
63 |
64 | # file targets:
65 | firmware.bin: $(OBJECTS)
66 | $(COMPILE) -o firmware.bin $(OBJECTS)
67 |
68 | firmware.hex: firmware.bin
69 | rm -f firmware.hex
70 | avr-objcopy -j .text -j .data -O ihex firmware.bin firmware.hex
71 | ./checksize firmware.bin 16384 960
72 | # do the checksize script as our last action to allow successful compilation
73 | # on Windows with WinAVR where the Unix commands will fail.
74 |
75 | disasm: firmware.bin
76 | avr-objdump -d firmware.bin
77 |
78 | cpp:
79 | $(COMPILE) -E main.c
80 |
--------------------------------------------------------------------------------
/ks0108/avrlibdefs.h:
--------------------------------------------------------------------------------
1 | /*! \file avrlibdefs.h \brief AVRlib global defines and macros. */
2 | //*****************************************************************************
3 | //
4 | // File Name : 'avrlibdefs.h'
5 | // Title : AVRlib global defines and macros include file
6 | // Author : Pascal Stang
7 | // Created : 7/12/2001
8 | // Revised : 9/30/2002
9 | // Version : 1.1
10 | // Target MCU : Atmel AVR series
11 | // Editor Tabs : 4
12 | //
13 | // Description : This include file is designed to contain items useful to all
14 | // code files and projects, regardless of specific implementation.
15 | //
16 | // This code is distributed under the GNU Public License
17 | // which can be found at http://www.gnu.org/licenses/gpl.txt
18 | //
19 | //*****************************************************************************
20 |
21 |
22 | #ifndef AVRLIBDEFS_H
23 | #define AVRLIBDEFS_H
24 |
25 | // Code compatibility to new AVR-libc
26 | // outb(), inb(), inw(), outw(), BV(), sbi(), cbi(), sei(), cli()
27 | #ifndef outb
28 | #define outb(addr, data) addr = (data)
29 | #endif
30 | #ifndef inb
31 | #define inb(addr) (addr)
32 | #endif
33 | #ifndef outw
34 | #define outw(addr, data) addr = (data)
35 | #endif
36 | #ifndef inw
37 | #define inw(addr) (addr)
38 | #endif
39 | #ifndef BV
40 | #define BV(bit) (1<<(bit))
41 | #endif
42 | #ifndef cbi
43 | #define cbi(reg,bit) reg &= ~(BV(bit))
44 | #endif
45 | #ifndef sbi
46 | #define sbi(reg,bit) reg |= (BV(bit))
47 | #endif
48 | #ifndef cli
49 | #define cli() __asm__ __volatile__ ("cli" ::)
50 | #endif
51 | #ifndef sei
52 | #define sei() __asm__ __volatile__ ("sei" ::)
53 | #endif
54 |
55 | // support for individual port pin naming in the mega128
56 | // see port128.h for details
57 | #ifdef __AVR_ATmega128__
58 | // not currently necessary due to inclusion
59 | // of these defines in newest AVR-GCC
60 | // do a quick test to see if include is needed
61 | #ifndef PD0
62 | #include "port128.h"
63 | #endif
64 | #endif
65 |
66 | // use this for packed structures
67 | // (this is seldom necessary on an 8-bit architecture like AVR,
68 | // but can assist in code portability to AVR)
69 | #define GNUC_PACKED __attribute__((packed))
70 |
71 | // port address helpers
72 | #define DDR(x) ((x)-1) // address of data direction register of port x
73 | #define PIN(x) ((x)-2) // address of input register of port x
74 |
75 | // MIN/MAX/ABS macros
76 | #define MIN(a,b) ((ab)?(a):(b))
78 | #define ABS(x) ((x>0)?(x):(-x))
79 |
80 | // constants
81 | #define PI 3.14159265359
82 |
83 | #endif
84 |
--------------------------------------------------------------------------------
/ks0108/avrlibtypes.h:
--------------------------------------------------------------------------------
1 | /*! \file avrlibtypes.h \brief AVRlib global types and typedefines. */
2 | //*****************************************************************************
3 | //
4 | // File Name : 'avrlibtypes.h'
5 | // Title : AVRlib global types and typedefines include file
6 | // Author : Pascal Stang
7 | // Created : 7/12/2001
8 | // Revised : 9/30/2002
9 | // Version : 1.0
10 | // Target MCU : Atmel AVR series
11 | // Editor Tabs : 4
12 | //
13 | // Description : Type-defines required and used by AVRlib. Most types are also
14 | // generally useful.
15 | //
16 | // This code is distributed under the GNU Public License
17 | // which can be found at http://www.gnu.org/licenses/gpl.txt
18 | //
19 | //*****************************************************************************
20 |
21 |
22 | #ifndef AVRLIBTYPES_H
23 | #define AVRLIBTYPES_H
24 |
25 | #ifndef WIN32
26 | // true/false defines
27 | #define FALSE 0
28 | #define TRUE -1
29 | #endif
30 |
31 | // datatype definitions macros
32 | typedef unsigned char u08;
33 | typedef signed char s08;
34 | typedef unsigned short u16;
35 | typedef signed short s16;
36 | typedef unsigned long u32;
37 | typedef signed long s32;
38 | typedef unsigned long long u64;
39 | typedef signed long long s64;
40 |
41 | /* use inttypes.h instead
42 | // C99 standard integer type definitions
43 | typedef unsigned char uint8_t;
44 | typedef signed char int8_t;
45 | typedef unsigned short uint16_t;
46 | typedef signed short int16_t;
47 | typedef unsigned long uint32_t;
48 | typedef signed long int32_t;
49 | typedef unsigned long uint64_t;
50 | typedef signed long int64_t;
51 | */
52 | // maximum value that can be held
53 | // by unsigned data types (8,16,32bits)
54 | #define MAX_U08 255
55 | #define MAX_U16 65535
56 | #define MAX_U32 4294967295
57 |
58 | // maximum values that can be held
59 | // by signed data types (8,16,32bits)
60 | #define MIN_S08 -128
61 | #define MAX_S08 127
62 | #define MIN_S16 -32768
63 | #define MAX_S16 32767
64 | #define MIN_S32 -2147483648
65 | #define MAX_S32 2147483647
66 |
67 | #ifndef WIN32
68 | // more type redefinitions
69 | typedef unsigned char BOOL;
70 | typedef unsigned char BYTE;
71 | typedef unsigned int WORD;
72 | typedef unsigned long DWORD;
73 |
74 | typedef unsigned char UCHAR;
75 | typedef unsigned int UINT;
76 | typedef unsigned short USHORT;
77 | typedef unsigned long ULONG;
78 |
79 | typedef char CHAR;
80 | typedef int INT;
81 | typedef long LONG;
82 | #endif
83 |
84 | #endif
85 |
--------------------------------------------------------------------------------
/ks0108/checksize:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # Name: checksize
3 | # Project: AVR Make system
4 | # Author: Christian Starkjohann
5 | # Creation Date: 2004-12-29
6 | # Tabsize: 4
7 | # Copyright: (c) 2005 OBJECTIVE DEVELOPMENT Software GmbH.
8 | # Revision: $Id: checksize,v 1.1.1.1 2007/01/14 11:37:56 harbaum Exp $
9 |
10 | error=0
11 | codelimit=2048 # default value
12 | datalimit=96 # default value; leave 32 bytes for stack
13 |
14 | if [ $# -gt 1 ]; then
15 | codelimit="$2"
16 | fi
17 | if [ $# -gt 2 ]; then
18 | datalimit="$3"
19 | fi
20 |
21 | set -- `avr-size -d "$1" | awk '/[0-9]/ {print $1 + $2, $2 + $3, $2}'`
22 | if [ $1 -gt $codelimit ]; then
23 | echo "*** code size $1 exceeds limit of $codelimit"
24 | error=1
25 | else
26 | echo "ROM: $1 bytes (data=$3)"
27 | fi
28 | if [ $2 -gt $datalimit ]; then
29 | echo "*** data size $2 exceeds limit of $datalimit"
30 | error=1
31 | else
32 | echo "RAM: $2 bytes"
33 | fi
34 |
35 | exit $error
36 |
--------------------------------------------------------------------------------
/ks0108/firmware.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/harbaum/GLCD2USB/38cd51e058b9763d0a6591b3bc98631da958f17d/ks0108/firmware.bin
--------------------------------------------------------------------------------
/ks0108/font5x7.h:
--------------------------------------------------------------------------------
1 | /*! \file font5x7.h \brief Graphic LCD Font (Ascii Characters). */
2 | //*****************************************************************************
3 | //
4 | // File Name : 'font5x7.h'
5 | // Title : Graphic LCD Font (Ascii Charaters)
6 | // Author : Pascal Stang
7 | // Date : 10/19/2001
8 | // Revised : 10/19/2001
9 | // Version : 0.1
10 | // Target MCU : Atmel AVR
11 | // Editor Tabs : 4
12 | //
13 | //*****************************************************************************
14 |
15 | #ifndef FONT5X7_H
16 | #define FONT5X7_H
17 |
18 | // standard ascii 5x7 font
19 | // defines ascii characters 0x20-0x7F (32-127)
20 | static const unsigned char __attribute__ ((progmem)) Font5x7[] = {
21 | 0x00, 0x00, 0x00, 0x00, 0x00,// (space)
22 | 0x00, 0x00, 0x5F, 0x00, 0x00,// !
23 | 0x00, 0x07, 0x00, 0x07, 0x00,// "
24 | 0x14, 0x7F, 0x14, 0x7F, 0x14,// #
25 | 0x24, 0x2A, 0x7F, 0x2A, 0x12,// $
26 | 0x23, 0x13, 0x08, 0x64, 0x62,// %
27 | 0x36, 0x49, 0x55, 0x22, 0x50,// &
28 | 0x00, 0x05, 0x03, 0x00, 0x00,// '
29 | 0x00, 0x1C, 0x22, 0x41, 0x00,// (
30 | 0x00, 0x41, 0x22, 0x1C, 0x00,// )
31 | 0x08, 0x2A, 0x1C, 0x2A, 0x08,// *
32 | 0x08, 0x08, 0x3E, 0x08, 0x08,// +
33 | 0x00, 0x50, 0x30, 0x00, 0x00,// ,
34 | 0x08, 0x08, 0x08, 0x08, 0x08,// -
35 | 0x00, 0x60, 0x60, 0x00, 0x00,// .
36 | 0x20, 0x10, 0x08, 0x04, 0x02,// /
37 | 0x3E, 0x51, 0x49, 0x45, 0x3E,// 0
38 | 0x00, 0x42, 0x7F, 0x40, 0x00,// 1
39 | 0x42, 0x61, 0x51, 0x49, 0x46,// 2
40 | 0x21, 0x41, 0x45, 0x4B, 0x31,// 3
41 | 0x18, 0x14, 0x12, 0x7F, 0x10,// 4
42 | 0x27, 0x45, 0x45, 0x45, 0x39,// 5
43 | 0x3C, 0x4A, 0x49, 0x49, 0x30,// 6
44 | 0x01, 0x71, 0x09, 0x05, 0x03,// 7
45 | 0x36, 0x49, 0x49, 0x49, 0x36,// 8
46 | 0x06, 0x49, 0x49, 0x29, 0x1E,// 9
47 | 0x00, 0x36, 0x36, 0x00, 0x00,// :
48 | 0x00, 0x56, 0x36, 0x00, 0x00,// ;
49 | 0x00, 0x08, 0x14, 0x22, 0x41,// <
50 | 0x14, 0x14, 0x14, 0x14, 0x14,// =
51 | 0x41, 0x22, 0x14, 0x08, 0x00,// >
52 | 0x02, 0x01, 0x51, 0x09, 0x06,// ?
53 | 0x32, 0x49, 0x79, 0x41, 0x3E,// @
54 | 0x7E, 0x11, 0x11, 0x11, 0x7E,// A
55 | 0x7F, 0x49, 0x49, 0x49, 0x36,// B
56 | 0x3E, 0x41, 0x41, 0x41, 0x22,// C
57 | 0x7F, 0x41, 0x41, 0x22, 0x1C,// D
58 | 0x7F, 0x49, 0x49, 0x49, 0x41,// E
59 | 0x7F, 0x09, 0x09, 0x01, 0x01,// F
60 | 0x3E, 0x41, 0x41, 0x51, 0x32,// G
61 | 0x7F, 0x08, 0x08, 0x08, 0x7F,// H
62 | 0x00, 0x41, 0x7F, 0x41, 0x00,// I
63 | 0x20, 0x40, 0x41, 0x3F, 0x01,// J
64 | 0x7F, 0x08, 0x14, 0x22, 0x41,// K
65 | 0x7F, 0x40, 0x40, 0x40, 0x40,// L
66 | 0x7F, 0x02, 0x04, 0x02, 0x7F,// M
67 | 0x7F, 0x04, 0x08, 0x10, 0x7F,// N
68 | 0x3E, 0x41, 0x41, 0x41, 0x3E,// O
69 | 0x7F, 0x09, 0x09, 0x09, 0x06,// P
70 | 0x3E, 0x41, 0x51, 0x21, 0x5E,// Q
71 | 0x7F, 0x09, 0x19, 0x29, 0x46,// R
72 | 0x46, 0x49, 0x49, 0x49, 0x31,// S
73 | 0x01, 0x01, 0x7F, 0x01, 0x01,// T
74 | 0x3F, 0x40, 0x40, 0x40, 0x3F,// U
75 | 0x1F, 0x20, 0x40, 0x20, 0x1F,// V
76 | 0x7F, 0x20, 0x18, 0x20, 0x7F,// W
77 | 0x63, 0x14, 0x08, 0x14, 0x63,// X
78 | 0x03, 0x04, 0x78, 0x04, 0x03,// Y
79 | 0x61, 0x51, 0x49, 0x45, 0x43,// Z
80 | 0x00, 0x00, 0x7F, 0x41, 0x41,// [
81 | 0x02, 0x04, 0x08, 0x10, 0x20,// "\"
82 | 0x41, 0x41, 0x7F, 0x00, 0x00,// ]
83 | 0x04, 0x02, 0x01, 0x02, 0x04,// ^
84 | 0x40, 0x40, 0x40, 0x40, 0x40,// _
85 | 0x00, 0x01, 0x02, 0x04, 0x00,// `
86 | 0x20, 0x54, 0x54, 0x54, 0x78,// a
87 | 0x7F, 0x48, 0x44, 0x44, 0x38,// b
88 | 0x38, 0x44, 0x44, 0x44, 0x20,// c
89 | 0x38, 0x44, 0x44, 0x48, 0x7F,// d
90 | 0x38, 0x54, 0x54, 0x54, 0x18,// e
91 | 0x08, 0x7E, 0x09, 0x01, 0x02,// f
92 | 0x08, 0x14, 0x54, 0x54, 0x3C,// g
93 | 0x7F, 0x08, 0x04, 0x04, 0x78,// h
94 | 0x00, 0x44, 0x7D, 0x40, 0x00,// i
95 | 0x20, 0x40, 0x44, 0x3D, 0x00,// j
96 | 0x00, 0x7F, 0x10, 0x28, 0x44,// k
97 | 0x00, 0x41, 0x7F, 0x40, 0x00,// l
98 | 0x7C, 0x04, 0x18, 0x04, 0x78,// m
99 | 0x7C, 0x08, 0x04, 0x04, 0x78,// n
100 | 0x38, 0x44, 0x44, 0x44, 0x38,// o
101 | 0x7C, 0x14, 0x14, 0x14, 0x08,// p
102 | 0x08, 0x14, 0x14, 0x18, 0x7C,// q
103 | 0x7C, 0x08, 0x04, 0x04, 0x08,// r
104 | 0x48, 0x54, 0x54, 0x54, 0x20,// s
105 | 0x04, 0x3F, 0x44, 0x40, 0x20,// t
106 | 0x3C, 0x40, 0x40, 0x20, 0x7C,// u
107 | 0x1C, 0x20, 0x40, 0x20, 0x1C,// v
108 | 0x3C, 0x40, 0x30, 0x40, 0x3C,// w
109 | 0x44, 0x28, 0x10, 0x28, 0x44,// x
110 | 0x0C, 0x50, 0x50, 0x50, 0x3C,// y
111 | 0x44, 0x64, 0x54, 0x4C, 0x44,// z
112 | 0x00, 0x08, 0x36, 0x41, 0x00,// {
113 | 0x00, 0x00, 0x7F, 0x00, 0x00,// |
114 | 0x00, 0x41, 0x36, 0x08, 0x00,// }
115 | 0x08, 0x08, 0x2A, 0x1C, 0x08,// ->
116 | 0x08, 0x1C, 0x2A, 0x08, 0x08 // <-
117 | };
118 |
119 | #endif
120 |
--------------------------------------------------------------------------------
/ks0108/fontgr.h:
--------------------------------------------------------------------------------
1 | /*! \file fontgr.h \brief Graphic LCD Font (Graphic Characters). */
2 | //*****************************************************************************
3 | //
4 | // File Name : 'fontgr.h'
5 | // Title : Graphic LCD Font (Graphic Charaters)
6 | // Author : Pascal Stang
7 | // Date : 10/19/2001
8 | // Revised : 10/19/2001
9 | // Version : 0.1
10 | // Target MCU : Atmel AVR
11 | // Editor Tabs : 4
12 | //
13 | //*****************************************************************************
14 |
15 | #ifndef FONTGR_H
16 | #define FONTGR_H
17 |
18 | #ifndef WIN32
19 | // AVR specific includes
20 | #include
21 | #endif
22 |
23 | static const unsigned char __attribute__ ((progmem)) FontGr[] =
24 | {
25 | // format is one character per line:
26 | // length, byte array[length]
27 | 0x0B,0x3E,0x41,0x41,0x41,0x41,0x42,0x42,0x42,0x42,0x3C,0x00,// 0. Folder Icon
28 | 0x06,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF // 1. Solid 6x8 block
29 | };
30 |
31 | #endif
32 |
--------------------------------------------------------------------------------
/ks0108/glcd.c:
--------------------------------------------------------------------------------
1 | /*! \file glcd.c \brief Graphic LCD API functions. */
2 | //*****************************************************************************
3 | //
4 | // File Name : 'glcd.c'
5 | // Title : Graphic LCD API functions
6 | // Author : Pascal Stang - Copyright (C) 2002
7 | // Date : 5/30/2002
8 | // Revised : 5/30/2002
9 | // Version : 0.5
10 | // Target MCU : Atmel AVR
11 | // Editor Tabs : 4
12 | //
13 | // NOTE: This code is currently below version 1.0, and therefore is considered
14 | // to be lacking in some functionality or documentation, or may not be fully
15 | // tested. Nonetheless, you can expect most functions to work.
16 | //
17 | // This code is distributed under the GNU Public License
18 | // which can be found at http://www.gnu.org/licenses/gpl.txt
19 | //
20 | //*****************************************************************************
21 |
22 | #ifndef WIN32
23 | // AVR specific includes
24 | #include
25 | #include
26 | #include
27 | #endif
28 |
29 | #include "glcd.h"
30 |
31 | // include hardware support
32 | #include "ks0108.h"
33 |
34 | // include fonts
35 | #include "font5x7.h"
36 | #include "fontgr.h"
37 |
38 | // graphic routines
39 |
40 | // set dot
41 | void glcdSetDot(u08 x, u08 y) {
42 | unsigned char temp;
43 |
44 | glcdSetAddress(x, y/8);
45 | glcdDataRead(1);
46 | temp = glcdDataRead(0);
47 |
48 | glcdSetAddress(x, y/8);
49 | glcdDataWrite(temp | _BV(y % 8));
50 |
51 | glcdStartLine(0);
52 | }
53 |
54 | // clear dot
55 | void glcdClearDot(u08 x, u08 y) {
56 | unsigned char temp;
57 |
58 | glcdSetAddress(x, y/8);
59 | glcdDataRead(1); // dummy read
60 | temp = glcdDataRead(0); // read back current value
61 |
62 | glcdSetAddress(x, y/8);
63 | glcdDataWrite(temp & ~_BV(y % 8));
64 |
65 | glcdStartLine(0);
66 | }
67 |
68 | // change (invert) dot
69 | void glcdChangeDot(u08 x, u08 y) {
70 | unsigned char temp;
71 |
72 | glcdSetAddress(x, y/8);
73 | glcdDataRead(1); // dummy read
74 | temp = glcdDataRead(0); // read back current value
75 |
76 | glcdSetAddress(x, y/8);
77 | glcdDataWrite(temp ^ _BV(y % 8));
78 |
79 | glcdStartLine(0);
80 | }
81 |
82 | // draw line
83 | void glcdLine(void(*draw)(u08,u08), u08 x1, u08 y1, u08 x2, u08 y2) {
84 | int dx, dy, inx, iny, e;
85 |
86 | dx = x2 - x1;
87 | dy = y2 - y1;
88 | inx = dx > 0 ? 1 : -1;
89 | iny = dy > 0 ? 1 : -1;
90 |
91 | dx = (dx > 0)?dx:-dx;
92 | dy = (dy > 0)?dy:-dy;
93 |
94 | if(dx >= dy) {
95 | dy <<= 1;
96 | e = dy - dx;
97 | dx <<= 1;
98 | while (x1 != x2) {
99 | draw(x1, y1);
100 | if(e >= 0) {
101 | y1 += iny;
102 | e-= dx;
103 | }
104 | e += dy; x1 += inx;
105 | }
106 | } else {
107 | dx <<= 1;
108 | e = dx - dy;
109 | dy <<= 1;
110 | while (y1 != y2) {
111 | draw(x1, y1);
112 | if(e >= 0) {
113 | x1 += inx;
114 | e -= dy;
115 | }
116 | e += dx; y1 += iny;
117 | }
118 | }
119 | draw(x1, y1);
120 | }
121 |
122 | // draw rectangle
123 | void glcdRectangle(u08 x, u08 y, u08 a, u08 b)
124 | {
125 | unsigned char j;
126 |
127 | for (j = 0; j < a; j++) {
128 | glcdSetDot(x, y + j);
129 | glcdSetDot(x + b - 1, y + j);
130 | }
131 | for (j = 0; j < b; j++) {
132 | glcdSetDot(x + j, y);
133 | glcdSetDot(x + j, y + a - 1);
134 | }
135 | }
136 |
137 | // draw circle
138 | void glcdCircle(u08 xcenter, u08 ycenter, u08 radius)
139 | {
140 | int tswitch, y, x = 0;
141 | unsigned char d;
142 |
143 | d = ycenter - xcenter;
144 | y = radius;
145 | tswitch = 3 - 2 * radius;
146 | while (x <= y) {
147 | glcdSetDot(xcenter + x, ycenter + y); glcdSetDot(xcenter + x, ycenter - y);
148 | glcdSetDot(xcenter - x, ycenter + y); glcdSetDot(xcenter - x, ycenter - y);
149 | glcdSetDot(ycenter + y - d, ycenter + x); glcdSetDot(ycenter + y - d, ycenter - x);
150 | glcdSetDot(ycenter - y - d, ycenter + x); glcdSetDot(ycenter - y - d, ycenter - x);
151 |
152 | if (tswitch < 0) tswitch += (4 * x + 6);
153 | else {
154 | tswitch += (4 * (x - y) + 10);
155 | y--;
156 | }
157 | x++;
158 | }
159 | }
160 |
161 | // text routines
162 |
163 | // write a character at the current position
164 | void glcdWriteChar(unsigned char c)
165 | {
166 | u08 i = 0;
167 |
168 | for(i=0; i<5; i++)
169 | {
170 | glcdDataWrite(pgm_read_byte(&Font5x7[((c - 0x20) * 5) + i]));
171 | }
172 |
173 | // write a spacer line
174 | glcdDataWrite(0x00);
175 | // unless we're at the end of the display
176 | //if(xx == 128)
177 | // xx = 0;
178 | //else
179 | // glcdWriteData(0x00);
180 |
181 | //cbi(GLCD_Control, GLCD_CS1);
182 | //cbi(GLCD_Control, GLCD_CS2);
183 | glcdStartLine(0);
184 | }
185 |
186 | void glcdWriteCharGr(u08 grCharIdx)
187 | {
188 | u08 idx;
189 | u08 grLength;
190 | u08 grStartIdx = 0;
191 |
192 | // get starting index of graphic bitmap
193 | for(idx=0; idx
25 | #include
26 | #include
27 | #endif
28 |
29 | #include "global.h"
30 | #include "ks0108.h"
31 |
32 | #define NOP asm volatile ("nop")
33 |
34 | // global variables
35 | GrLcdStateType GrLcdState;
36 |
37 | /*************************************************************/
38 | /********************** LOCAL FUNCTIONS **********************/
39 | /*************************************************************/
40 |
41 | void glcdInitHW(void) {
42 | // initialize I/O ports
43 | // if I/O interface is in use
44 |
45 | //TODO: make setup of chip select lines contingent on how
46 | // many controllers are actually in the display
47 |
48 | // initialize LCD control lines levels
49 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
50 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
51 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
52 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS0);
53 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS1);
54 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RESET);
55 | // initialize LCD control port to output
56 | sbi(GLCD_CTRL_DDR, GLCD_CTRL_RS);
57 | sbi(GLCD_CTRL_DDR, GLCD_CTRL_RW);
58 | sbi(GLCD_CTRL_DDR, GLCD_CTRL_E);
59 | sbi(GLCD_CTRL_DDR, GLCD_CTRL_CS0);
60 | sbi(GLCD_CTRL_DDR, GLCD_CTRL_CS1);
61 | sbi(GLCD_CTRL_DDR, GLCD_CTRL_RESET);
62 | // initialize LCD data
63 | outb(GLCD_DATA_PORT, 0x00);
64 | // initialize LCD data port to output
65 | outb(GLCD_DATA_DDR, 0xFF);
66 | }
67 |
68 | void glcdControllerSelect(u08 controller)
69 | {
70 | // select requested controller
71 | if(!controller) {
72 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_CS0);
73 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS1);
74 | } else {
75 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_CS0);
76 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_CS1);
77 | }
78 | }
79 |
80 | void glcdBusyWait(u08 controller) {
81 |
82 | // wait until LCD busy bit goes to zero
83 | // select the controller chip
84 | glcdControllerSelect(controller);
85 | // do a read from control register
86 | outb(GLCD_DATA_PORT, 0x00); // no pullups
87 | outb(GLCD_DATA_DDR, 0x00);
88 |
89 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
90 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
91 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
92 | NOP; NOP; NOP; NOP;
93 | NOP; NOP; NOP; NOP;
94 |
95 | while(inb(GLCD_DATA_PIN) & (GLCD_STATUS_BUSY | GLCD_STATUS_RESET));
96 |
97 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
98 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
99 | outb(GLCD_DATA_DDR, 0xFF); // output
100 | }
101 |
102 | void glcdControlWrite(u08 controller, u08 data) {
103 | glcdBusyWait(controller); // wait until LCD not busy
104 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
105 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
106 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
107 | outb(GLCD_DATA_DDR, 0xFF);
108 | outb(GLCD_DATA_PORT, data);
109 | NOP; NOP; NOP; NOP;
110 | NOP; NOP; NOP; NOP;
111 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
112 | }
113 |
114 | u08 glcdControlRead(u08 controller) {
115 | register u08 data;
116 |
117 | glcdBusyWait(controller); // wait until LCD not busy
118 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
119 | outb(GLCD_DATA_DDR, 0x00);
120 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
121 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
122 | NOP; NOP; NOP; NOP;
123 | NOP; NOP; NOP; NOP;
124 | data = inb(GLCD_DATA_PIN);
125 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
126 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
127 | outb(GLCD_DATA_DDR, 0xFF);
128 |
129 | return data;
130 | }
131 |
132 | void glcdDataWrite(u08 data) {
133 | register u08 controller = (GrLcdState.lcdXAddr/GLCD_CONTROLLER_XPIXELS);
134 |
135 | glcdBusyWait(controller); // wait until LCD not busy
136 |
137 | outb(GLCD_DATA_DDR, 0xFF);
138 | outb(GLCD_DATA_PORT, data);
139 |
140 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_RS);
141 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RW);
142 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
143 |
144 | NOP; NOP; NOP; NOP;
145 | NOP; NOP; NOP; NOP;
146 |
147 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_E);
148 |
149 |
150 | // increment our local address counter
151 | GrLcdState.ctrlr[controller].xAddr++;
152 | GrLcdState.lcdXAddr++;
153 | if(GrLcdState.lcdXAddr >= GLCD_XPIXELS) {
154 | glcdSetYAddress(GrLcdState.lcdYAddr+1);
155 | glcdSetXAddress(0);
156 | }
157 | }
158 |
159 | u08 glcdDataRead(u08 dummy)
160 | {
161 | register u08 data;
162 | register u08 controller = (GrLcdState.lcdXAddr/GLCD_CONTROLLER_XPIXELS);
163 |
164 | glcdBusyWait(controller); // wait until LCD not busy
165 |
166 | outb(GLCD_DATA_PORT, 0x00); // no pullups
167 | outb(GLCD_DATA_DDR, 0x00); // don't drive data lines
168 |
169 | GLCD_CTRL_PORT |= _BV(GLCD_CTRL_RS) |
170 | _BV(GLCD_CTRL_RW) | _BV(GLCD_CTRL_E);
171 |
172 | NOP; NOP; NOP; NOP;
173 | NOP; NOP; NOP; NOP;
174 |
175 | data = inb(GLCD_DATA_PIN);
176 |
177 | GLCD_CTRL_PORT &= ~(_BV(GLCD_CTRL_RS) |
178 | _BV(GLCD_CTRL_RW) | _BV(GLCD_CTRL_E));
179 |
180 | if(!dummy) {
181 | // increment our local address counter, not done for dummy reads
182 | GrLcdState.ctrlr[controller].xAddr++;
183 | GrLcdState.lcdXAddr++;
184 | if(GrLcdState.lcdXAddr >= GLCD_XPIXELS) {
185 | glcdSetYAddress(GrLcdState.lcdYAddr+1);
186 | glcdSetXAddress(0);
187 | }
188 | }
189 | return data;
190 | }
191 |
192 | void glcdReset(u08 resetState)
193 | {
194 | // reset lcd if argument is true
195 | // run lcd if argument is false
196 |
197 | if(resetState)
198 | cbi(GLCD_CTRL_PORT, GLCD_CTRL_RESET);
199 | else
200 | sbi(GLCD_CTRL_PORT, GLCD_CTRL_RESET);
201 | }
202 |
203 | void glcdSetXAddress(u08 xAddr)
204 | {
205 | // record address change locally
206 | GrLcdState.lcdXAddr = xAddr;
207 |
208 | glcdControlWrite(0, GLCD_SET_Y_ADDR);
209 | GrLcdState.ctrlr[0].xAddr = 0;
210 | glcdControlWrite(1, GLCD_SET_Y_ADDR);
211 | GrLcdState.ctrlr[1].xAddr = 0;
212 |
213 | // set y (col) address on destination controller
214 | glcdControlWrite((GrLcdState.lcdXAddr/GLCD_CONTROLLER_XPIXELS),
215 | GLCD_SET_Y_ADDR | (GrLcdState.lcdXAddr & 0x3F));
216 | }
217 |
218 | void glcdSetYAddress(u08 yAddr) {
219 | // record address change locally
220 | GrLcdState.lcdYAddr = yAddr;
221 | // set page address for all controllers
222 | glcdControlWrite(0, GLCD_SET_PAGE | yAddr);
223 | glcdControlWrite(1, GLCD_SET_PAGE | yAddr);
224 | }
225 |
226 | /*************************************************************/
227 | /********************* PUBLIC FUNCTIONS **********************/
228 | /*************************************************************/
229 |
230 | void glcdInit()
231 | {
232 | // initialize hardware
233 | glcdInitHW();
234 | // bring lcd out of reset
235 | glcdReset(FALSE);
236 | // Turn on LCD
237 | glcdControlWrite(0, GLCD_ON_CTRL | GLCD_ON_DISPLAY);
238 | glcdControlWrite(1, GLCD_ON_CTRL | GLCD_ON_DISPLAY);
239 | // clear lcd
240 | glcdClearScreen();
241 | // initialize positions
242 | glcdHome();
243 | }
244 |
245 | void glcdHome(void)
246 | {
247 | // initialize addresses/positions
248 | glcdStartLine(0);
249 | glcdSetAddress(0,0);
250 | // initialize local data structures
251 | GrLcdState.ctrlr[0].xAddr = GrLcdState.ctrlr[0].yAddr = 0;
252 | GrLcdState.ctrlr[1].xAddr = GrLcdState.ctrlr[1].yAddr = 0;
253 | }
254 |
255 | void glcdClearScreen(void)
256 | {
257 | u08 pageAddr;
258 | u08 xAddr;
259 |
260 | // clear LCD
261 | // loop through all pages
262 | for(pageAddr=0; pageAddr<(GLCD_YPIXELS>>3); pageAddr++)
263 | {
264 | // set page address
265 | glcdSetAddress(0, pageAddr);
266 | // clear all lines of this page of display memory
267 | for(xAddr=0; xAddr when compiling with IAR.
107 | - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each
108 | USB descriptor should be handled. It is now possible to provide descriptor
109 | data in Flash, RAM or dynamically at runtime.
110 | - STALL is now a status in usbTxLen* instead of a message. We can now conform
111 | to the spec and leave the stall status pending until it is cleared.
112 | - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the
113 | application code to reset data toggling on interrupt pipes.
114 |
115 | * Release 2006-07-18
116 |
117 | - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes
118 | an assembler error.
119 | - usbDeviceDisconnect() takes pull-up resistor to high impedance now.
120 |
121 | * Release 2007-02-01
122 |
123 | - Merged in some code size improvements from usbtiny (thanks to Dick
124 | Streefland for these optimizations!)
125 | - Special alignment requirement for usbRxBuf not required any more. Thanks
126 | again to Dick Streefland for this hint!
127 | - Reverted to "#warning" instead of unused static variables -- new versions
128 | of IAR CC should handle this directive.
129 | - Changed Open Source license to GNU GPL v2 in order to make linking against
130 | other free libraries easier. We no longer require publication of the
131 | circuit diagrams, but we STRONGLY encourage it. If you improve the driver
132 | itself, PLEASE grant us a royalty free license to your changes for our
133 | commercial license.
134 |
135 | * Release 2007-03-29
136 |
137 | - New configuration option "USB_PUBLIC" in usbconfig.h.
138 | - Set USB version number to 1.10 instead of 1.01.
139 | - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and
140 | USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences
141 | to USB_CFG_DESCR_PROPS_STRING_PRODUCT.
142 | - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver
143 | code.
144 | - New assembler module for 16 MHz crystal.
145 | - usbdrvasm.S contains common code only, clock-specific parts have been moved
146 | to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively.
147 |
148 | * Release 2007-06-25
149 |
150 | - 16 MHz module: Do SE0 check in stuffed bits as well.
151 |
152 | * Release 2007-07-07
153 |
154 | - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary
155 | for negative values.
156 | - Added 15 MHz module contributed by V. Bosch.
157 | - Interrupt vector name can now be configured. This is useful if somebody
158 | wants to use a different hardware interrupt than INT0.
159 |
160 | * Release 2007-08-07
161 |
162 | - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is
163 | not exceeded.
164 | - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN,
165 | USB_COUNT_SOF
166 | - USB_INTR_PENDING can now be a memory address, not just I/O
167 |
168 | * Release 2007-09-19
169 |
170 | - Split out common parts of assembler modules into separate include file
171 | - Made endpoint numbers configurable so that given interface definitions
172 | can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h.
173 | - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut()
174 | can handle any number of endpoints.
175 | - Define usbDeviceConnect() and usbDeviceDisconnect() even if no
176 | USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this
177 | case.
178 |
179 | * Release 2007-12-01
180 |
181 | - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size
182 | when USB_CFG_PULLUP_IOPORTNAME is not defined.
183 |
184 | * Release 2007-12-13
185 |
186 | - Renamed all include-only assembler modules from *.S to *.inc so that
187 | people don't add them to their project sources.
188 | - Distribute leap bits in tx loop more evenly for 16 MHz module.
189 | - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR
190 | - Avoid compiler warnings for constant expr range by casting some values in
191 | USB descriptors.
192 |
193 | * Release 2008-01-21
194 |
195 | - Fixed bug in 15 and 16 MHz module where the new address set with
196 | SET_ADDRESS was already accepted at the next NAK or ACK we send, not at
197 | the next data packet we send. This caused problems when the host polled
198 | too fast. Thanks to Alexander Neumann for his help and patience debugging
199 | this issue!
200 |
201 | * Release 2008-02-05
202 |
203 | - Fixed bug in 16.5 MHz module where a register was used in the interrupt
204 | handler before it was pushed. This bug was introduced with version
205 | 2007-09-19 when common parts were moved to a separate file.
206 | - Optimized CRC routine (thanks to Reimar Doeffinger).
207 |
208 | * Release 2008-02-16
209 |
210 | - Removed outdated IAR compatibility stuff (code sections).
211 | - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK().
212 | - Added optional routine usbMeasureFrameLength() for calibration of the
213 | internal RC oscillator.
214 |
215 | * Release 2008-02-28
216 |
217 | - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we
218 | start with sending USBPID_DATA0.
219 | - Changed defaults in usbconfig-prototype.h
220 | - Added free USB VID/PID pair for MIDI class devices
221 | - Restructured AVR-USB as separate package, not part of PowerSwitch any more.
222 |
223 | * Release 2008-04-18
224 |
225 | - Restructured usbdrv.c so that it is easier to read and understand.
226 | - Better code optimization with gcc 4.
227 | - If a second interrupt in endpoint is enabled, also add it to config
228 | descriptor.
229 | - Added config option for long transfers (above 254 bytes), see
230 | USB_CFG_LONG_TRANSFERS in usbconfig.h.
231 | - Added 20 MHz module contributed by Jeroen Benschop.
232 |
233 | * Release 2008-05-13
234 |
235 | - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length
236 | was not incremented, pointer to length was incremented instead.
237 | - Added code to command line tool(s) which claims an interface. This code
238 | is disabled by default, but may be necessary on newer Linux kernels.
239 | - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING".
240 | - New header "usbportability.h" prepares ports to other development
241 | environments.
242 | - Long transfers (above 254 bytes) did not work when usbFunctionRead() was
243 | used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!]
244 | - In hiddata.c (example code for sending/receiving data over HID), use
245 | USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so
246 | that we need not claim the interface.
247 | - in usbPoll() loop 20 times polling for RESET state instead of 10 times.
248 | This accounts for the higher clock rates we now support.
249 | - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop.
250 | - Added hook to SOF code so that oscillator can be tuned to USB frame clock.
251 | - Added timeout to waitForJ loop. Helps preventing unexpected hangs.
252 | - Added example code for oscillator tuning to libs-device (thanks to
253 | Henrik Haftmann for the idea to this routine).
254 | - Implemented option USB_CFG_SUPPRESS_INTR_CODE.
255 |
256 | * Release 2008-10-22
257 |
258 | - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and
259 | similar, not offset of 0x20 needs to be added.
260 | - Allow distribution under GPLv3 for those who have to link against other
261 | code distributed under GPLv3.
262 |
263 | * Release 2008-11-26
264 |
265 | - Removed libusb-win32 dependency for hid-data example in Makefile.windows.
266 | It was never required and confused many people.
267 | - Added extern uchar usbRxToken to usbdrv.h.
268 | - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser.
269 |
270 | * Release 2009-03-23
271 |
272 | - Hid-mouse example used settings from hid-data example, fixed that.
273 | - Renamed project to V-USB due to a trademark issue with Atmel(r).
274 | - Changed CommercialLicense.txt and USBID-License.txt to make the
275 | background of USB ID registration clearer.
276 |
277 | * Release 2009-04-15
278 |
279 | - Changed CommercialLicense.txt to reflect the new range of PIDs from
280 | Jason Kotzin.
281 | - Removed USBID-License.txt in favor of USB-IDs-for-free.txt and
282 | USB-ID-FAQ.txt
283 | - Fixed a bug in the 12.8 MHz module: End Of Packet decection was made in
284 | the center between bit 0 and 1 of each byte. This is where the data lines
285 | are expected to change and the sampled data may therefore be nonsense.
286 | We therefore check EOP ONLY if bits 0 AND 1 have both been read as 0 on D-.
287 | - Fixed a bitstuffing problem in the 16 MHz module: If bit 6 was stuffed,
288 | the unstuffing code in the receiver routine was 1 cycle too long. If
289 | multiple bytes had the unstuffing in bit 6, the error summed up until the
290 | receiver was out of sync.
291 | - Included option for faster CRC routine.
292 | Thanks to Slawomir Fras (BoskiDialer) for this code!
293 | - Updated bits in Configuration Descriptor's bmAttributes according to
294 | USB 1.1 (in particular bit 7, it is a must-be-set bit now).
295 |
296 | * Release 2009-08-22
297 |
298 | - Moved first DBG1() after odDebugInit() in all examples.
299 | - Use vector INT0_vect instead of SIG_INTERRUPT0 if defined. This makes
300 | V-USB compatible with the new "p" suffix devices (e.g. ATMega328p).
301 | - USB_CFG_CLOCK_KHZ setting is now required in usbconfig.h (no default any
302 | more).
303 | - New option USB_CFG_DRIVER_FLASH_PAGE allows boot loaders on devices with
304 | more than 64 kB flash.
305 | - Built-in configuration descriptor allows custom definition for second
306 | endpoint now.
307 |
308 | * Release 2010-07-15
309 |
310 | - Fixed bug in usbDriverSetup() which prevented descriptor sizes above 255
311 | bytes.
312 | - Avoid a compiler warning for unused parameter in usbHandleResetHook() when
313 | compiler option -Wextra is enabled.
314 | - Fixed wrong hex value for some IDs in USB-IDs-for-free.txt.
315 | - Keep a define for USBATTR_BUSPOWER, although the flag does not exist
316 | in USB 1.1 any more. Set it to 0. This is for backward compatibility.
317 |
318 | * Release 2012-01-09
319 |
320 | - Define a separate (defined) type for usbMsgPtr so that projects using a
321 | tiny memory model can define it to an 8 bit type in usbconfig.h. This
322 | change also saves a couple of bytes when using a scalar 16 bit type.
323 | - Inserted "const" keyword for all PROGMEM declarations because new GCC
324 | requires it.
325 | - Fixed problem with dependence of usbportability.h on usbconfig.h. This
326 | problem occurred with IAR CC only.
327 | - Prepared repository for github.com.
328 |
329 | * Release 2012-12-06
--------------------------------------------------------------------------------
/ks0108/usbdrv/CommercialLicense.txt:
--------------------------------------------------------------------------------
1 | V-USB Driver Software License Agreement
2 | Version 2012-07-09
3 |
4 | THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN
5 | ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING
6 | THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT.
7 |
8 |
9 | 1 DEFINITIONS
10 |
11 | 1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH,
12 | Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA.
13 |
14 | 1.2 "You" shall mean the Licensee.
15 |
16 | 1.3 "V-USB" shall mean all files included in the package distributed under
17 | the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/)
18 | unless otherwise noted. This includes the firmware-only USB device
19 | implementation for Atmel AVR microcontrollers, some simple device examples
20 | and host side software examples and libraries.
21 |
22 |
23 | 2 LICENSE GRANTS
24 |
25 | 2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source
26 | code of V-USB.
27 |
28 | 2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the
29 | non-exclusive right to use, copy and distribute V-USB with your hardware
30 | product(s), restricted by the limitations in section 3 below.
31 |
32 | 2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify
33 | the source code and your copy of V-USB according to your needs.
34 |
35 | 2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB
36 | Product ID(s), sent to you in e-mail. These Product IDs are reserved
37 | exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID
38 | ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen
39 | Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from
40 | Jason Kotzin (now flirc.tv, Inc.). Both owners of the Vendor IDs have
41 | obtained these IDs from the USB Implementers Forum, Inc. (www.usb.org).
42 | OBJECTIVE DEVELOPMENT disclaims all liability which might arise from the
43 | assignment of USB IDs.
44 |
45 | 2.5 USB Certification. Although not part of this agreement, we want to make
46 | it clear that you cannot become USB certified when you use V-USB or a USB
47 | Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't
48 | meet the electrical specifications required by the USB specification and
49 | the USB Implementers Forum certifies only members who bought a Vendor ID of
50 | their own.
51 |
52 |
53 | 3 LICENSE RESTRICTIONS
54 |
55 | 3.1 Number of Units. Only one of the following three definitions is
56 | applicable. Which one is determined by the amount you pay to OBJECTIVE
57 | DEVELOPMENT, see section 4 ("Payment") below.
58 |
59 | Hobby License: You may use V-USB according to section 2 above in no more
60 | than 5 hardware units. These units must not be sold for profit.
61 |
62 | Entry Level License: You may use V-USB according to section 2 above in no
63 | more than 150 hardware units.
64 |
65 | Professional License: You may use V-USB according to section 2 above in
66 | any number of hardware units, except for large scale production ("unlimited
67 | fair use"). Quantities below 10,000 units are not considered large scale
68 | production. If your reach quantities which are obviously large scale
69 | production, you must pay a license fee of 0.10 EUR per unit for all units
70 | above 10,000.
71 |
72 | 3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber
73 | any copy of V-USB, or any of the rights granted herein.
74 |
75 | 3.3 Transfer. You may not transfer your rights under this Agreement to
76 | another party without OBJECTIVE DEVELOPMENT's prior written consent. If
77 | such consent is obtained, you may permanently transfer this License to
78 | another party. The recipient of such transfer must agree to all terms and
79 | conditions of this Agreement.
80 |
81 | 3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not
82 | expressly granted.
83 |
84 | 3.5 Non-Exclusive Rights. Your license rights under this Agreement are
85 | non-exclusive.
86 |
87 | 3.6 Third Party Rights. This Agreement cannot grant you rights controlled
88 | by third parties. In particular, you are not allowed to use the USB logo or
89 | other trademarks owned by the USB Implementers Forum, Inc. without their
90 | consent. Since such consent depends on USB certification, it should be
91 | noted that V-USB will not pass certification because it does not
92 | implement checksum verification and the microcontroller ports do not meet
93 | the electrical specifications.
94 |
95 |
96 | 4 PAYMENT
97 |
98 | The payment amount depends on the variation of this agreement (according to
99 | section 3.1) into which you want to enter. Concrete prices are listed on
100 | OBJECTIVE DEVELOPMENT's web site, usually at
101 | http://www.obdev.at/vusb/license.html. You agree to pay the amount listed
102 | there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor
103 | or reseller.
104 |
105 |
106 | 5 COPYRIGHT AND OWNERSHIP
107 |
108 | V-USB is protected by copyright laws and international copyright
109 | treaties, as well as other intellectual property laws and treaties. V-USB
110 | is licensed, not sold.
111 |
112 |
113 | 6 TERM AND TERMINATION
114 |
115 | 6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE
116 | DEVELOPMENT may terminate this Agreement and revoke the granted license and
117 | USB-IDs if you fail to comply with any of its terms and conditions.
118 |
119 | 6.2 Survival of Terms. All provisions regarding secrecy, confidentiality
120 | and limitation of liability shall survive termination of this agreement.
121 |
122 |
123 | 7 DISCLAIMER OF WARRANTY AND LIABILITY
124 |
125 | LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
126 | KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE
127 | DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER
128 | EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
129 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
130 | NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE
131 | TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL
132 | RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO
133 | STATE/JURISDICTION.
134 |
135 | LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
136 | IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY
137 | SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER
138 | (INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS,
139 | BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY
140 | LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE
141 | PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE
142 | DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY
143 | CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS
144 | AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB.
145 |
146 |
147 | 8 MISCELLANEOUS TERMS
148 |
149 | 8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing
150 | purposes that you entered into this agreement.
151 |
152 | 8.2 Entire Agreement. This document represents the entire agreement between
153 | OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by
154 | an authorized representative of both, OBJECTIVE DEVELOPMENT and you.
155 |
156 | 8.3 Severability. In case a provision of these terms and conditions should
157 | be or become partly or entirely invalid, ineffective, or not executable,
158 | the validity of all other provisions shall not be affected.
159 |
160 | 8.4 Applicable Law. This agreement is governed by the laws of the Republic
161 | of Austria.
162 |
163 | 8.5 Responsible Courts. The responsible courts in Vienna/Austria will have
164 | exclusive jurisdiction regarding all disputes in connection with this
165 | agreement.
166 |
167 |
--------------------------------------------------------------------------------
/ks0108/usbdrv/Readme.txt:
--------------------------------------------------------------------------------
1 | This is the Readme file to Objective Development's firmware-only USB driver
2 | for Atmel AVR microcontrollers. For more information please visit
3 | http://www.obdev.at/vusb/
4 |
5 | This directory contains the USB firmware only. Copy it as-is to your own
6 | project and add all .c and .S files to your project (these files are marked
7 | with an asterisk in the list below). Then copy usbconfig-prototype.h as
8 | usbconfig.h to your project and edit it according to your configuration.
9 |
10 |
11 | TECHNICAL DOCUMENTATION
12 | =======================
13 | The technical documentation (API) for the firmware driver is contained in the
14 | file "usbdrv.h". Please read all of it carefully! Configuration options are
15 | documented in "usbconfig-prototype.h".
16 |
17 | The driver consists of the following files:
18 | Readme.txt ............. The file you are currently reading.
19 | Changelog.txt .......... Release notes for all versions of the driver.
20 | usbdrv.h ............... Driver interface definitions and technical docs.
21 | * usbdrv.c ............... High level language part of the driver. Link this
22 | module to your code!
23 | * usbdrvasm.S ............ Assembler part of the driver. This module is mostly
24 | a stub and includes one of the usbdrvasm*.S files
25 | depending on processor clock. Link this module to
26 | your code!
27 | usbdrvasm*.inc ......... Assembler routines for particular clock frequencies.
28 | Included by usbdrvasm.S, don't link it directly!
29 | asmcommon.inc .......... Common assembler routines. Included by
30 | usbdrvasm*.inc, don't link it directly!
31 | usbconfig-prototype.h .. Prototype for your own usbdrv.h file.
32 | * oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is
33 | defined to a value greater than 0. Link this module
34 | to your code!
35 | oddebug.h .............. Interface definitions of the debug module.
36 | usbportability.h ....... Header with compiler-dependent stuff.
37 | usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this
38 | module instead of usbdrvasm.S when you assembler
39 | with IAR's tools.
40 | License.txt ............ Open Source license for this driver.
41 | CommercialLicense.txt .. Optional commercial license for this driver.
42 | USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs.
43 | USB-IDs-for-free.txt ... List and terms of use for free shared PIDs.
44 |
45 | (*) ... These files should be linked to your project.
46 |
47 |
48 | CPU CORE CLOCK FREQUENCY
49 | ========================
50 | We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz,
51 | 16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The
52 | actual clock rate must be configured in usbconfig.h.
53 |
54 | 12 MHz Clock
55 | This is the traditional clock rate of V-USB because it's the lowest clock
56 | rate where the timing constraints of the USB spec can be met.
57 |
58 | 15 MHz Clock
59 | Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock
60 | rate allows for some loops which make the resulting code size somewhat smaller
61 | than the 12 MHz version.
62 |
63 | 16 MHz Clock
64 | This clock rate has been added for users of the Arduino board and other
65 | ready-made boards which come with a fixed 16 MHz crystal. It's also an option
66 | if you need the slightly higher clock rate for performance reasons. Since
67 | 16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code
68 | is somewhat tricky and has to insert a leap cycle every third byte.
69 |
70 | 12.8 MHz and 16.5 MHz Clock
71 | The assembler modules for these clock rates differ from the other modules
72 | because they have been built for an RC oscillator with only 1% precision. The
73 | receiver code inserts leap cycles to compensate for clock deviations. 1% is
74 | also the precision which can be achieved by calibrating the internal RC
75 | oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL
76 | oscillator can reach 16.5 MHz with the RC oscillator. This includes the very
77 | popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost
78 | all AVRs can reach 12.8 MHz, although this is outside the specified range.
79 |
80 | See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for
81 | code which calibrates the RC oscillator based on the USB frame clock.
82 |
83 | 18 MHz Clock
84 | This module is closer to the USB specification because it performs an on the
85 | fly CRC check for incoming packets. Packets with invalid checksum are
86 | discarded as required by the spec. If you also implement checks for data
87 | PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING
88 | in usbconfig.h for more info), this ensures data integrity. Due to the CRC
89 | tables and alignment requirements, this code is bigger than modules for other
90 | clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1
91 | and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h.
92 |
93 | 20 MHz Clock
94 | This module is for people who won't do it with less than the maximum. Since
95 | 20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code
96 | uses similar tricks as the 16 MHz module to insert leap cycles.
97 |
98 |
99 | USB IDENTIFIERS
100 | ===============
101 | Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs
102 | are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you
103 | can assign PIDs at will.
104 |
105 | Since an entry level cost of 1,500 USD is too high for most small companies
106 | and hobbyists, we provide some VID/PID pairs for free. See the file
107 | USB-IDs-for-free.txt for details.
108 |
109 | Objective Development also has some license offerings which include product
110 | IDs. See http://www.obdev.at/vusb/ for details.
111 |
112 |
113 | DEVELOPMENT SYSTEM
114 | ==================
115 | This driver has been developed and optimized for the GNU compiler version 3
116 | and 4. We recommend that you use the GNU compiler suite because it is freely
117 | available. V-USB has also been ported to the IAR compiler and assembler. It
118 | has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the
119 | "small" and "tiny" memory model. Not every release is tested with IAR CC and
120 | the driver may therefore fail to compile with IAR. Please note that gcc is
121 | more efficient for usbdrv.c because this module has been deliberately
122 | optimized for gcc.
123 |
124 | Gcc version 3 produces smaller code than version 4 due to new optimizing
125 | capabilities which don't always improve things on 8 bit CPUs. The code size
126 | generated by gcc 4 can be reduced with the compiler options
127 | -fno-move-loop-invariants, -fno-tree-scev-cprop and
128 | -fno-inline-small-functions in addition to -Os. On devices with more than
129 | 8k of flash memory, we also recommend the linker option --relax (written as
130 | -Wl,--relax for gcc) to convert absolute calls into relative where possible.
131 |
132 | For more information about optimizing options see:
133 |
134 | http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html
135 |
136 | These optimizations are good for gcc 4.x. Version 3.x of gcc does not support
137 | most of these options and produces good code anyway.
138 |
139 |
140 | USING V-USB FOR FREE
141 | ====================
142 | The AVR firmware driver is published under the GNU General Public License
143 | Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is
144 | your choice whether you apply the terms of version 2 or version 3.
145 |
146 | If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the
147 | following things IN ADDITION to the obligations from the GPL:
148 |
149 | (1) Publish your entire project on a web site and drop us a note with the URL.
150 | Use the form at http://www.obdev.at/vusb/feedback.html for your submission.
151 | If you don't have a web site, you can publish the project in obdev's
152 | documentation wiki at
153 | http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects.
154 |
155 | (2) Adhere to minimum publication standards. Please include AT LEAST:
156 | - a circuit diagram in PDF, PNG or GIF format
157 | - full source code for the host software
158 | - a Readme.txt file in ASCII format which describes the purpose of the
159 | project and what can be found in which directories and which files
160 | - a reference to http://www.obdev.at/vusb/
161 |
162 | (3) If you improve the driver firmware itself, please give us a free license
163 | to your modifications for our commercial license offerings.
164 |
165 |
166 | COMMERCIAL LICENSES FOR V-USB
167 | =============================
168 | If you don't want to publish your source code under the terms of the GPL,
169 | you can simply pay money for V-USB. As an additional benefit you get
170 | USB PIDs for free, reserved exclusively to you. See the file
171 | "CommercialLicense.txt" for details.
172 |
173 |
--------------------------------------------------------------------------------
/ks0108/usbdrv/USB-ID-FAQ.txt:
--------------------------------------------------------------------------------
1 | Version 2012-07-09
2 |
3 | ==========================
4 | WHY DO WE NEED THESE IDs?
5 | ==========================
6 |
7 | USB is more than a low level protocol for data transport. It also defines a
8 | common set of requests which must be understood by all devices. And as part
9 | of these common requests, the specification defines data structures, the
10 | USB Descriptors, which are used to describe the properties of the device.
11 |
12 | From the perspective of an operating system, it is therefore possible to find
13 | out basic properties of a device (such as e.g. the manufacturer and the name
14 | of the device) without a device-specific driver. This is essential because
15 | the operating system can choose a driver to load based on this information
16 | (Plug-And-Play).
17 |
18 | Among the most important properties in the Device Descriptor are the USB
19 | Vendor- and Product-ID. Both are 16 bit integers. The most simple form of
20 | driver matching is based on these IDs. The driver announces the Vendor- and
21 | Product-IDs of the devices it can handle and the operating system loads the
22 | appropriate driver when the device is connected.
23 |
24 | It is obvious that this technique only works if the pair Vendor- plus
25 | Product-ID is unique: Only devices which require the same driver can have the
26 | same pair of IDs.
27 |
28 |
29 | =====================================================
30 | HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE?
31 | =====================================================
32 |
33 | Since it is so important that USB IDs are unique, the USB Implementers Forum,
34 | Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by
35 | law to build a device and assign it any random numbers as IDs. Usb.org
36 | therefore needs an agreement to regulate the use of USB IDs. The agreement
37 | binds only parties who agreed to it, of course. Everybody else is free to use
38 | any numbers for their IDs.
39 |
40 | So how can usb.org ensure that every manufacturer of USB devices enters into
41 | an agreement with them? They do it via trademark licensing. Usb.org has
42 | registered the trademark "USB", all associated logos and related terms. If
43 | you want to put an USB logo on your product or claim that it is USB
44 | compliant, you must license these trademarks from usb.org. And this is where
45 | you enter into an agreement. See the "USB-IF Trademark License Agreement and
46 | Usage Guidelines for the USB-IF Logo" at
47 | http://www.usb.org/developers/logo_license/.
48 |
49 | Licensing the USB trademarks requires that you buy a USB Vendor-ID from
50 | usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org
51 | (yearly fee of ca. 4,000 USD) and that you meet all the technical
52 | specifications from the USB spec.
53 |
54 | This means that most hobbyists and small companies will never be able to
55 | become USB compliant, just because membership is so expensive. And you can't
56 | be compliant with a driver based on V-USB anyway, because the AVR's port pins
57 | don't meet the electrical specifications for USB. So, in principle, all
58 | hobbyists and small companies are free to choose any random numbers for their
59 | IDs. They have nothing to lose...
60 |
61 | There is one exception worth noting, though: If you use a sub-component which
62 | implements USB, the vendor of the sub-components may guarantee USB
63 | compliance. This might apply to some or all of FTDI's solutions.
64 |
65 |
66 | =======================================================================
67 | WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS?
68 | =======================================================================
69 |
70 | You have learned in the previous section that you are free to choose any
71 | numbers for your IDs anyway. So why not do exactly this? There is still the
72 | technical issue. If you choose IDs which are already in use by somebody else,
73 | operating systems will load the wrong drivers and your device won't work.
74 | Even if you choose IDs which are not currently in use, they may be in use in
75 | the next version of the operating system or even after an automatic update.
76 |
77 | So what you need is a pair of Vendor- and Product-IDs for which you have the
78 | guarantee that no USB compliant product uses them. This implies that no
79 | operating system will ever ship with drivers responsible for these IDs.
80 |
81 |
82 | ==============================================
83 | HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs?
84 | ==============================================
85 |
86 | Objective Development gives away pairs of USB-IDs with their V-USB licenses.
87 | In order to ensure that these IDs are unique, Objective Development has an
88 | agreement with the company/person who has bought the USB Vendor-ID from
89 | usb.org. This agreement ensures that a range of USB Product-IDs is reserved
90 | for assignment by Objective Development and that the owner of the Vendor-ID
91 | won't give it to anybody else.
92 |
93 | This means that you have to trust three parties to ensure uniqueness of
94 | your IDs:
95 |
96 | - Objective Development, that they don't give the same PID to more than
97 | one person.
98 | - The owner of the Vendor-ID that they don't assign PIDs from the range
99 | assigned to Objective Development to anybody else.
100 | - Usb.org that they don't assign the same Vendor-ID a second time.
101 |
102 |
103 | ==================================
104 | WHO IS THE OWNER OF THE VENDOR-ID?
105 | ==================================
106 |
107 | Objective Development has obtained ranges of USB Product-IDs under two
108 | Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen
109 | Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason
110 | Kotzin (now flirc.tv, Inc.). Both VID owners have received their Vendor-ID
111 | directly from usb.org.
112 |
113 |
114 | =========================================================================
115 | CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE?
116 | =========================================================================
117 |
118 | The short answer is: Yes. All you get is a guarantee that the IDs are never
119 | assigned to anybody else. What more do you need?
120 |
121 |
122 | ============================
123 | WHAT ABOUT SHARED ID PAIRS?
124 | ============================
125 |
126 | Objective Development has reserved some PID/VID pairs for shared use. You
127 | have no guarantee of uniqueness for them, except that no USB compliant device
128 | uses them. In order to avoid technical problems, we must ensure that all
129 | devices with the same pair of IDs use the same driver on kernel level. For
130 | details, see the file USB-IDs-for-free.txt.
131 |
132 |
133 | ======================================================
134 | I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL?
135 | ======================================================
136 |
137 | A 16 bit integer number cannot be protected by copyright laws. It is not
138 | sufficiently complex. And since none of the parties involved entered into the
139 | USB-IF Trademark License Agreement, we are not bound by this agreement. So
140 | there is no reason why it should be illegal to sub-license USB-IDs.
141 |
142 |
143 | =============================================
144 | WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES?
145 | =============================================
146 |
147 | Objective Development disclaims all liabilities which might arise from the
148 | assignment of IDs. If you guarantee product features to your customers
149 | without proper disclaimer, YOU are liable for that.
150 |
--------------------------------------------------------------------------------
/ks0108/usbdrv/USB-IDs-for-free.txt:
--------------------------------------------------------------------------------
1 | Version 2009-08-22
2 |
3 | ===========================
4 | FREE USB-IDs FOR SHARED USE
5 | ===========================
6 |
7 | Objective Development has reserved a set of USB Product-IDs for use according
8 | to the guidelines outlined below. For more information about the concept of
9 | USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees
10 | that the IDs listed below are not used by any USB compliant devices.
11 |
12 |
13 | ====================
14 | MECHANISM OF SHARING
15 | ====================
16 |
17 | From a technical point of view, two different devices can share the same USB
18 | Vendor- and Product-ID if they require the same driver on operating system
19 | level. We make use of this fact by assigning separate IDs for various device
20 | classes. On application layer, devices must be distinguished by their textual
21 | name or serial number. We offer separate sets of IDs for discrimination by
22 | textual name and for serial number.
23 |
24 | Examples for shared use of USB IDs are included with V-USB in the "examples"
25 | subdirectory.
26 |
27 |
28 | ======================================
29 | IDs FOR DISCRIMINATION BY TEXTUAL NAME
30 | ======================================
31 |
32 | If you use one of the IDs listed below, your device and host-side software
33 | must conform to these rules:
34 |
35 | (1) The USB device MUST provide a textual representation of the manufacturer
36 | and product identification. The manufacturer identification MUST be available
37 | at least in USB language 0x0409 (English/US).
38 |
39 | (2) The textual manufacturer identification MUST contain either an Internet
40 | domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail
41 | address under your control (e.g. "myname@gmx.net"). You can embed the domain
42 | name or e-mail address in any string you like, e.g. "Objective Development
43 | http://www.obdev.at/vusb/".
44 |
45 | (3) You are responsible for retaining ownership of the domain or e-mail
46 | address for as long as any of your products are in use.
47 |
48 | (4) You may choose any string for the textual product identification, as long
49 | as this string is unique within the scope of your textual manufacturer
50 | identification.
51 |
52 | (5) Application side device look-up MUST be based on the textual manufacturer
53 | and product identification in addition to VID/PID matching. The driver
54 | matching MUST be a comparison of the entire strings, NOT a sub-string match.
55 |
56 | (6) For devices which implement a particular USB device class (e.g. HID), the
57 | operating system's default class driver MUST be used. If an operating system
58 | driver for Vendor Class devices is needed, this driver must be libusb or
59 | libusb-win32 (see http://libusb.org/ and
60 | http://libusb-win32.sourceforge.net/).
61 |
62 | Table if IDs for discrimination by textual name:
63 |
64 | PID dec (hex) | VID dec (hex) | Description of use
65 | ==============+===============+============================================
66 | 1500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb
67 | --------------+---------------+--------------------------------------------
68 | 1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are
69 | | | NOT mice, keyboards or joysticks)
70 | --------------+---------------+--------------------------------------------
71 | 1505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
72 | --------------+---------------+--------------------------------------------
73 | 1508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices
74 | --------------+---------------+--------------------------------------------
75 |
76 | Note that Windows caches the textual product- and vendor-description for
77 | mice, keyboards and joysticks. Name-bsed discrimination is therefore not
78 | recommended for these device classes.
79 |
80 |
81 | =======================================
82 | IDs FOR DISCRIMINATION BY SERIAL NUMBER
83 | =======================================
84 |
85 | If you use one of the IDs listed below, your device and host-side software
86 | must conform to these rules:
87 |
88 | (1) The USB device MUST provide a textual representation of the serial
89 | number, unless ONLY the operating system's default class driver is used.
90 | The serial number string MUST be available at least in USB language 0x0409
91 | (English/US).
92 |
93 | (2) The serial number MUST start with either an Internet domain name (e.g.
94 | "mycompany.com") registered and owned by you, or an e-mail address under your
95 | control (e.g. "myname@gmx.net"), both terminated with a colon (":") character.
96 | You MAY append any string you like for further discrimination of your devices.
97 |
98 | (3) You are responsible for retaining ownership of the domain or e-mail
99 | address for as long as any of your products are in use.
100 |
101 | (5) Application side device look-up MUST be based on the serial number string
102 | in addition to VID/PID matching. The matching must start at the first
103 | character of the serial number string and include the colon character
104 | terminating your domain or e-mail address. It MAY stop anywhere after that.
105 |
106 | (6) For devices which implement a particular USB device class (e.g. HID), the
107 | operating system's default class driver MUST be used. If an operating system
108 | driver for Vendor Class devices is needed, this driver must be libusb or
109 | libusb-win32 (see http://libusb.org/ and
110 | http://libusb-win32.sourceforge.net/).
111 |
112 | (7) If ONLY the operating system's default class driver is used, e.g. for
113 | mice, keyboards, joysticks, CDC or MIDI devices and no discrimination by an
114 | application is needed, the serial number may be omitted.
115 |
116 |
117 | Table if IDs for discrimination by serial number string:
118 |
119 | PID dec (hex) | VID dec (hex) | Description of use
120 | ===============+===============+===========================================
121 | 10200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb
122 | ---------------+---------------+-------------------------------------------
123 | 10201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are
124 | | | NOT mice, keyboards or joysticks)
125 | ---------------+---------------+-------------------------------------------
126 | 10202 (0x27da) | 5824 (0x16c0) | For USB Mice
127 | ---------------+---------------+-------------------------------------------
128 | 10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards
129 | ---------------+---------------+-------------------------------------------
130 | 10204 (0x27dc) | 5824 (0x16c0) | For USB Joysticks
131 | ---------------+---------------+-------------------------------------------
132 | 10205 (0x27dd) | 5824 (0x16c0) | For CDC-ACM class devices (modems)
133 | ---------------+---------------+-------------------------------------------
134 | 10206 (0x27de) | 5824 (0x16c0) | For MIDI class devices
135 | ---------------+---------------+-------------------------------------------
136 |
137 |
138 | =================
139 | ORIGIN OF USB-IDs
140 | =================
141 |
142 | OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed
143 | here from Wouter van Ooijen (see www.voti.nl) for exclusive disposition.
144 | Wouter van Ooijen has obtained the VID from the USB Implementers Forum, Inc.
145 | (see www.usb.org). The VID is registered for the company name "Van Ooijen
146 | Technische Informatica".
147 |
148 |
149 | ==========
150 | DISCLAIMER
151 | ==========
152 |
153 | OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any
154 | problems which are caused by the shared use of these VID/PID pairs.
155 |
--------------------------------------------------------------------------------
/ks0108/usbdrv/asmcommon.inc:
--------------------------------------------------------------------------------
1 | /* Name: asmcommon.inc
2 | * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers
3 | * Author: Christian Starkjohann
4 | * Creation Date: 2007-11-05
5 | * Tabsize: 4
6 | * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH
7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 | */
9 |
10 | /* Do not link this file! Link usbdrvasm.S instead, which includes the
11 | * appropriate implementation!
12 | */
13 |
14 | /*
15 | General Description:
16 | This file contains assembler code which is shared among the USB driver
17 | implementations for different CPU cocks. Since the code must be inserted
18 | in the middle of the module, it's split out into this file and #included.
19 |
20 | Jump destinations called from outside:
21 | sofError: Called when no start sequence was found.
22 | se0: Called when a package has been successfully received.
23 | overflow: Called when receive buffer overflows.
24 | doReturn: Called after sending data.
25 |
26 | Outside jump destinations used by this module:
27 | waitForJ: Called to receive an already arriving packet.
28 | sendAckAndReti:
29 | sendNakAndReti:
30 | sendCntAndReti:
31 | usbSendAndReti:
32 |
33 | The following macros must be defined before this file is included:
34 | .macro POP_STANDARD
35 | .endm
36 | .macro POP_RETI
37 | .endm
38 | */
39 |
40 | #define token x1
41 |
42 | overflow:
43 | ldi x2, 1< 0
13 |
14 | #warning "Never compile production devices with debugging enabled"
15 |
16 | static void uartPutc(char c)
17 | {
18 | while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */
19 | ODDBG_UDR = c;
20 | }
21 |
22 | static uchar hexAscii(uchar h)
23 | {
24 | h &= 0xf;
25 | if(h >= 10)
26 | h += 'a' - (uchar)10 - '0';
27 | h += '0';
28 | return h;
29 | }
30 |
31 | static void printHex(uchar c)
32 | {
33 | uartPutc(hexAscii(c >> 4));
34 | uartPutc(hexAscii(c));
35 | }
36 |
37 | void odDebug(uchar prefix, uchar *data, uchar len)
38 | {
39 | printHex(prefix);
40 | uartPutc(':');
41 | while(len--){
42 | uartPutc(' ');
43 | printHex(*data++);
44 | }
45 | uartPutc('\r');
46 | uartPutc('\n');
47 | }
48 |
49 | #endif
50 |
--------------------------------------------------------------------------------
/ks0108/usbdrv/oddebug.h:
--------------------------------------------------------------------------------
1 | /* Name: oddebug.h
2 | * Project: AVR library
3 | * Author: Christian Starkjohann
4 | * Creation Date: 2005-01-16
5 | * Tabsize: 4
6 | * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH
7 | * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt)
8 | */
9 |
10 | #ifndef __oddebug_h_included__
11 | #define __oddebug_h_included__
12 |
13 | /*
14 | General Description:
15 | This module implements a function for debug logs on the serial line of the
16 | AVR microcontroller. Debugging can be configured with the define
17 | 'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging
18 | calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is
19 | 2, DBG1 and DBG2 logs will be printed.
20 |
21 | A debug log consists of a label ('prefix') to indicate which debug log created
22 | the output and a memory block to dump in hex ('data' and 'len').
23 | */
24 |
25 |
26 | #ifndef F_CPU
27 | # define F_CPU 12000000 /* 12 MHz */
28 | #endif
29 |
30 | /* make sure we have the UART defines: */
31 | #include "usbportability.h"
32 |
33 | #ifndef uchar
34 | # define uchar unsigned char
35 | #endif
36 |
37 | #if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */
38 | # warning "Debugging disabled because device has no UART"
39 | # undef DEBUG_LEVEL
40 | #endif
41 |
42 | #ifndef DEBUG_LEVEL
43 | # define DEBUG_LEVEL 0
44 | #endif
45 |
46 | /* ------------------------------------------------------------------------- */
47 |
48 | #if DEBUG_LEVEL > 0
49 | # define DBG1(prefix, data, len) odDebug(prefix, data, len)
50 | #else
51 | # define DBG1(prefix, data, len)
52 | #endif
53 |
54 | #if DEBUG_LEVEL > 1
55 | # define DBG2(prefix, data, len) odDebug(prefix, data, len)
56 | #else
57 | # define DBG2(prefix, data, len)
58 | #endif
59 |
60 | /* ------------------------------------------------------------------------- */
61 |
62 | #if DEBUG_LEVEL > 0
63 | extern void odDebug(uchar prefix, uchar *data, uchar len);
64 |
65 | /* Try to find our control registers; ATMEL likes to rename these */
66 |
67 | #if defined UBRR
68 | # define ODDBG_UBRR UBRR
69 | #elif defined UBRRL
70 | # define ODDBG_UBRR UBRRL
71 | #elif defined UBRR0
72 | # define ODDBG_UBRR UBRR0
73 | #elif defined UBRR0L
74 | # define ODDBG_UBRR UBRR0L
75 | #endif
76 |
77 | #if defined UCR
78 | # define ODDBG_UCR UCR
79 | #elif defined UCSRB
80 | # define ODDBG_UCR UCSRB
81 | #elif defined UCSR0B
82 | # define ODDBG_UCR UCSR0B
83 | #endif
84 |
85 | #if defined TXEN
86 | # define ODDBG_TXEN TXEN
87 | #else
88 | # define ODDBG_TXEN TXEN0
89 | #endif
90 |
91 | #if defined USR
92 | # define ODDBG_USR USR
93 | #elif defined UCSRA
94 | # define ODDBG_USR UCSRA
95 | #elif defined UCSR0A
96 | # define ODDBG_USR UCSR0A
97 | #endif
98 |
99 | #if defined UDRE
100 | # define ODDBG_UDRE UDRE
101 | #else
102 | # define ODDBG_UDRE UDRE0
103 | #endif
104 |
105 | #if defined UDR
106 | # define ODDBG_UDR UDR
107 | #elif defined UDR0
108 | # define ODDBG_UDR UDR0
109 | #endif
110 |
111 | static inline void odDebugInit(void)
112 | {
113 | ODDBG_UCR |= (1< 10.6666666 cycles per bit, 85.333333333 cycles per byte
29 | ; Numbers in brackets are clocks counted from center of last sync bit
30 | ; when instruction starts
31 |
32 | USB_INTR_VECTOR:
33 | ;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt
34 | push YL ;[-25] push only what is necessary to sync with edge ASAP
35 | in YL, SREG ;[-23]
36 | push YL ;[-22]
37 | push YH ;[-20]
38 | ;----------------------------------------------------------------------------
39 | ; Synchronize with sync pattern:
40 | ;----------------------------------------------------------------------------
41 | ;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K]
42 | ;sync up with J to K edge during sync pattern -- use fastest possible loops
43 | ;The first part waits at most 1 bit long since we must be in sync pattern.
44 | ;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to
45 | ;waitForJ, ensure that this prerequisite is met.
46 | waitForJ:
47 | inc YL
48 | sbis USBIN, USBMINUS
49 | brne waitForJ ; just make sure we have ANY timeout
50 | waitForK:
51 | ;The following code results in a sampling window of < 1/4 bit which meets the spec.
52 | sbis USBIN, USBMINUS ;[-15]
53 | rjmp foundK ;[-14]
54 | sbis USBIN, USBMINUS
55 | rjmp foundK
56 | sbis USBIN, USBMINUS
57 | rjmp foundK
58 | sbis USBIN, USBMINUS
59 | rjmp foundK
60 | sbis USBIN, USBMINUS
61 | rjmp foundK
62 | sbis USBIN, USBMINUS
63 | rjmp foundK
64 | #if USB_COUNT_SOF
65 | lds YL, usbSofCount
66 | inc YL
67 | sts usbSofCount, YL
68 | #endif /* USB_COUNT_SOF */
69 | #ifdef USB_SOF_HOOK
70 | USB_SOF_HOOK
71 | #endif
72 | rjmp sofError
73 | foundK: ;[-12]
74 | ;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling]
75 | ;we have 1 bit time for setup purposes, then sample again. Numbers in brackets
76 | ;are cycles from center of first sync (double K) bit after the instruction
77 | push bitcnt ;[-12]
78 | ; [---] ;[-11]
79 | lds YL, usbInputBufOffset;[-10]
80 | ; [---] ;[-9]
81 | clr YH ;[-8]
82 | subi YL, lo8(-(usbRxBuf));[-7] [rx loop init]
83 | sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init]
84 | push shift ;[-5]
85 | ; [---] ;[-4]
86 | ldi bitcnt, 0x55 ;[-3] [rx loop init]
87 | sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early)
88 | rjmp haveTwoBitsK ;[-1]
89 | pop shift ;[0] undo the push from before
90 | pop bitcnt ;[2] undo the push from before
91 | rjmp waitForK ;[4] this was not the end of sync, retry
92 | ; The entire loop from waitForK until rjmp waitForK above must not exceed two
93 | ; bit times (= 21 cycles).
94 |
95 | ;----------------------------------------------------------------------------
96 | ; push more registers and initialize values while we sample the first bits:
97 | ;----------------------------------------------------------------------------
98 | haveTwoBitsK:
99 | push x1 ;[1]
100 | push x2 ;[3]
101 | push x3 ;[5]
102 | ldi shift, 0 ;[7]
103 | ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that
104 | push x4 ;[9] == leap
105 |
106 | in x1, USBIN ;[11] <-- sample bit 0
107 | andi x1, USBMASK ;[12]
108 | bst x1, USBMINUS ;[13]
109 | bld shift, 7 ;[14]
110 | push cnt ;[15]
111 | ldi leap, 0 ;[17] [rx loop init]
112 | ldi cnt, USB_BUFSIZE;[18] [rx loop init]
113 | rjmp rxbit1 ;[19] arrives at [21]
114 |
115 | ;----------------------------------------------------------------------------
116 | ; Receiver loop (numbers in brackets are cycles within byte after instr)
117 | ;----------------------------------------------------------------------------
118 |
119 | ; duration of unstuffing code should be 10.66666667 cycles. We adjust "leap"
120 | ; accordingly to approximate this value in the long run.
121 |
122 | unstuff6:
123 | andi x2, USBMASK ;[03]
124 | ori x3, 1<<6 ;[04] will not be shifted any more
125 | andi shift, ~0x80;[05]
126 | mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6
127 | subi leap, -1 ;[07] total duration = 11 bits -> subtract 1/3
128 | rjmp didUnstuff6 ;[08]
129 |
130 | unstuff7:
131 | ori x3, 1<<7 ;[09] will not be shifted any more
132 | in x2, USBIN ;[00] [10] re-sample bit 7
133 | andi x2, USBMASK ;[01]
134 | andi shift, ~0x80;[02]
135 | subi leap, 2 ;[03] total duration = 10 bits -> add 1/3
136 | rjmp didUnstuff7 ;[04]
137 |
138 | unstuffEven:
139 | ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0
140 | in x1, USBIN ;[00] [10]
141 | andi shift, ~0x80;[01]
142 | andi x1, USBMASK ;[02]
143 | breq se0 ;[03]
144 | subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3
145 | nop2 ;[05]
146 | rjmp didUnstuffE ;[06]
147 |
148 | unstuffOdd:
149 | ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1
150 | in x2, USBIN ;[00] [10]
151 | andi shift, ~0x80;[01]
152 | andi x2, USBMASK ;[02]
153 | breq se0 ;[03]
154 | subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3
155 | nop2 ;[05]
156 | rjmp didUnstuffO ;[06]
157 |
158 | rxByteLoop:
159 | andi x1, USBMASK ;[03]
160 | eor x2, x1 ;[04]
161 | subi leap, 1 ;[05]
162 | brpl skipLeap ;[06]
163 | subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte
164 | nop ;1
165 | skipLeap:
166 | subi x2, 1 ;[08]
167 | ror shift ;[09]
168 | didUnstuff6:
169 | cpi shift, 0xfc ;[10]
170 | in x2, USBIN ;[00] [11] <-- sample bit 7
171 | brcc unstuff6 ;[01]
172 | andi x2, USBMASK ;[02]
173 | eor x1, x2 ;[03]
174 | subi x1, 1 ;[04]
175 | ror shift ;[05]
176 | didUnstuff7:
177 | cpi shift, 0xfc ;[06]
178 | brcc unstuff7 ;[07]
179 | eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others
180 | st y+, x3 ;[09] store data
181 | rxBitLoop:
182 | in x1, USBIN ;[00] [11] <-- sample bit 0/2/4
183 | andi x1, USBMASK ;[01]
184 | eor x2, x1 ;[02]
185 | andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7
186 | subi x2, 1 ;[04]
187 | ror shift ;[05]
188 | cpi shift, 0xfc ;[06]
189 | brcc unstuffEven ;[07]
190 | didUnstuffE:
191 | lsr x3 ;[08]
192 | lsr x3 ;[09]
193 | rxbit1:
194 | in x2, USBIN ;[00] [10] <-- sample bit 1/3/5
195 | andi x2, USBMASK ;[01]
196 | breq se0 ;[02]
197 | eor x1, x2 ;[03]
198 | subi x1, 1 ;[04]
199 | ror shift ;[05]
200 | cpi shift, 0xfc ;[06]
201 | brcc unstuffOdd ;[07]
202 | didUnstuffO:
203 | subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3
204 | brcs rxBitLoop ;[09]
205 |
206 | subi cnt, 1 ;[10]
207 | in x1, USBIN ;[00] [11] <-- sample bit 6
208 | brcc rxByteLoop ;[01]
209 | rjmp overflow
210 |
211 | macro POP_STANDARD ; 14 cycles
212 | pop cnt
213 | pop x4
214 | pop x3
215 | pop x2
216 | pop x1
217 | pop shift
218 | pop bitcnt
219 | endm
220 | macro POP_RETI ; 7 cycles
221 | pop YH
222 | pop YL
223 | out SREG, YL
224 | pop YL
225 | endm
226 |
227 | #include "asmcommon.inc"
228 |
229 | ; USB spec says:
230 | ; idle = J
231 | ; J = (D+ = 0), (D- = 1)
232 | ; K = (D+ = 1), (D- = 0)
233 | ; Spec allows 7.5 bit times from EOP to SOP for replies
234 |
235 | bitstuffN:
236 | eor x1, x4 ;[5]
237 | ldi x2, 0 ;[6]
238 | nop2 ;[7]
239 | nop ;[9]
240 | out USBOUT, x1 ;[10] <-- out
241 | rjmp didStuffN ;[0]
242 |
243 | bitstuff6:
244 | eor x1, x4 ;[5]
245 | ldi x2, 0 ;[6] Carry is zero due to brcc
246 | rol shift ;[7] compensate for ror shift at branch destination
247 | rjmp didStuff6 ;[8]
248 |
249 | bitstuff7:
250 | ldi x2, 0 ;[2] Carry is zero due to brcc
251 | rjmp didStuff7 ;[3]
252 |
253 |
254 | sendNakAndReti:
255 | ldi x3, USBPID_NAK ;[-18]
256 | rjmp sendX3AndReti ;[-17]
257 | sendAckAndReti:
258 | ldi cnt, USBPID_ACK ;[-17]
259 | sendCntAndReti:
260 | mov x3, cnt ;[-16]
261 | sendX3AndReti:
262 | ldi YL, 20 ;[-15] x3==r20 address is 20
263 | ldi YH, 0 ;[-14]
264 | ldi cnt, 2 ;[-13]
265 | ; rjmp usbSendAndReti fallthrough
266 |
267 | ;usbSend:
268 | ;pointer to data in 'Y'
269 | ;number of bytes in 'cnt' -- including sync byte [range 2 ... 12]
270 | ;uses: x1...x4, btcnt, shift, cnt, Y
271 | ;Numbers in brackets are time since first bit of sync pattern is sent
272 | ;We don't match the transfer rate exactly (don't insert leap cycles every third
273 | ;byte) because the spec demands only 1.5% precision anyway.
274 | usbSendAndReti: ; 12 cycles until SOP
275 | in x2, USBDDR ;[-12]
276 | ori x2, USBMASK ;[-11]
277 | sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups)
278 | in x1, USBOUT ;[-8] port mirror for tx loop
279 | out USBDDR, x2 ;[-7] <- acquire bus
280 | ; need not init x2 (bitstuff history) because sync starts with 0
281 | ldi x4, USBMASK ;[-6] exor mask
282 | ldi shift, 0x80 ;[-5] sync byte is first byte sent
283 | txByteLoop:
284 | ldi bitcnt, 0x35 ;[-4] [6] binary 0011 0101
285 | txBitLoop:
286 | sbrs shift, 0 ;[-3] [7]
287 | eor x1, x4 ;[-2] [8]
288 | out USBOUT, x1 ;[-1] [9] <-- out N
289 | ror shift ;[0] [10]
290 | ror x2 ;[1]
291 | didStuffN:
292 | cpi x2, 0xfc ;[2]
293 | brcc bitstuffN ;[3]
294 | lsr bitcnt ;[4]
295 | brcc txBitLoop ;[5]
296 | brne txBitLoop ;[6]
297 |
298 | sbrs shift, 0 ;[7]
299 | eor x1, x4 ;[8]
300 | didStuff6:
301 | out USBOUT, x1 ;[-1] [9] <-- out 6
302 | ror shift ;[0] [10]
303 | ror x2 ;[1]
304 | cpi x2, 0xfc ;[2]
305 | brcc bitstuff6 ;[3]
306 | ror shift ;[4]
307 | didStuff7:
308 | ror x2 ;[5]
309 | sbrs x2, 7 ;[6]
310 | eor x1, x4 ;[7]
311 | nop ;[8]
312 | cpi x2, 0xfc ;[9]
313 | out USBOUT, x1 ;[-1][10] <-- out 7
314 | brcc bitstuff7 ;[0] [11]
315 | ld shift, y+ ;[1]
316 | dec cnt ;[3]
317 | brne txByteLoop ;[4]
318 | ;make SE0:
319 | cbr x1, USBMASK ;[5] prepare SE0 [spec says EOP may be 21 to 25 cycles]
320 | lds x2, usbNewDeviceAddr;[6]
321 | lsl x2 ;[8] we compare with left shifted address
322 | subi YL, 20 + 2 ;[9] Only assign address on data packets, not ACK/NAK in x3
323 | sbci YH, 0 ;[10]
324 | out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle
325 | ;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm:
326 | ;set address only after data packet was sent, not after handshake
327 | breq skipAddrAssign ;[0]
328 | sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer
329 | skipAddrAssign:
330 | ;end of usbDeviceAddress transfer
331 | ldi x2, 1<
38 | #ifndef __IAR_SYSTEMS_ASM__
39 | # include
40 | #endif
41 |
42 | #define __attribute__(arg) /* not supported on IAR */
43 |
44 | #ifdef __IAR_SYSTEMS_ASM__
45 | # define __ASSEMBLER__ /* IAR does not define standard macro for asm */
46 | #endif
47 |
48 | #ifdef __HAS_ELPM__
49 | # define PROGMEM __farflash
50 | #else
51 | # define PROGMEM __flash
52 | #endif
53 |
54 | #define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr))
55 |
56 | /* The following definitions are not needed by the driver, but may be of some
57 | * help if you port a gcc based project to IAR.
58 | */
59 | #define cli() __disable_interrupt()
60 | #define sei() __enable_interrupt()
61 | #define wdt_reset() __watchdog_reset()
62 | #define _BV(x) (1 << (x))
63 |
64 | /* assembler compatibility macros */
65 | #define nop2 rjmp $+2 /* jump to next instruction */
66 | #define XL r26
67 | #define XH r27
68 | #define YL r28
69 | #define YH r29
70 | #define ZL r30
71 | #define ZH r31
72 | #define lo8(x) LOW(x)
73 | #define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */
74 |
75 | /* Depending on the device you use, you may get problems with the way usbdrv.h
76 | * handles the differences between devices. Since IAR does not use #defines
77 | * for MCU registers, we can't check for the existence of a particular
78 | * register with an #ifdef. If the autodetection mechanism fails, include
79 | * definitions for the required USB_INTR_* macros in your usbconfig.h. See
80 | * usbconfig-prototype.h and usbdrv.h for details.
81 | */
82 |
83 | /* ------------------------------------------------------------------------- */
84 | #elif __CODEVISIONAVR__ /* check for CodeVision AVR */
85 | /* ------------------------------------------------------------------------- */
86 | /* This port is not working (yet) */
87 |
88 | /* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */
89 |
90 | #include
91 | #include
92 |
93 | #define __attribute__(arg) /* not supported on IAR */
94 |
95 | #define PROGMEM __flash
96 | #define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr))
97 |
98 | #ifndef __ASSEMBLER__
99 | static inline void cli(void)
100 | {
101 | #asm("cli");
102 | }
103 | static inline void sei(void)
104 | {
105 | #asm("sei");
106 | }
107 | #endif
108 | #define _delay_ms(t) delay_ms(t)
109 | #define _BV(x) (1 << (x))
110 | #define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */
111 |
112 | #define macro .macro
113 | #define endm .endmacro
114 | #define nop2 rjmp .+0 /* jump to next instruction */
115 |
116 | /* ------------------------------------------------------------------------- */
117 | #else /* default development environment is avr-gcc/avr-libc */
118 | /* ------------------------------------------------------------------------- */
119 |
120 | #include
121 | #ifdef __ASSEMBLER__
122 | # define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */
123 | #else
124 | # include
125 | #endif
126 |
127 | #if USB_CFG_DRIVER_FLASH_PAGE
128 | # define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr))
129 | #else
130 | # define USB_READ_FLASH(addr) pgm_read_byte(addr)
131 | #endif
132 |
133 | #define macro .macro
134 | #define endm .endm
135 | #define nop2 rjmp .+0 /* jump to next instruction */
136 |
137 | #endif /* development environment */
138 |
139 | /* for conveniecne, ensure that PRG_RDB exists */
140 | #ifndef PRG_RDB
141 | # define PRG_RDB(addr) USB_READ_FLASH(addr)
142 | #endif
143 | #endif /* __usbportability_h_INCLUDED__ */
144 |
--------------------------------------------------------------------------------
/ks0108/version.h:
--------------------------------------------------------------------------------
1 | /* version of this driver */
2 |
3 | #ifndef VERSION_H
4 | #define VERSION_H
5 |
6 | #define VERSION_MAJOR 1
7 | #define VERSION_MINOR 1
8 |
9 | #endif /* #ifndef VERSION_H */
10 |
--------------------------------------------------------------------------------
/lcd4linux/glcd2usb.h:
--------------------------------------------------------------------------------
1 | /*
2 | * glcd2usb.h - glcd2usb interface definitions
3 | */
4 |
5 | #ifndef GLCD2USB_H
6 | #define GLCD2USB_H
7 |
8 | #define FLAG_SIX_BIT (1<<0)
9 | #define FLAG_VERTICAL_UNITS (1<<1)
10 | #define FLAG_BOTTOM_START (1<<2)
11 | #define FLAG_VERTICAL_INC (1<<3)
12 | #define FLAG_BACKLIGHT (1<<4)
13 |
14 | #define GLCD2USB_RID_GET_INFO 1 /* get display info */
15 | #define GLCD2USB_RID_SET_ALLOC 2 /* allocate/free display */
16 | #define GLCD2USB_RID_GET_BUTTONS 3 /* get state of the four buttons */
17 | #define GLCD2USB_RID_SET_BL 4 /* set backlight brightness */
18 | #define GLCD2USB_RID_GET_IR 5 /* get last ir message */
19 | #define GLCD2USB_RID_WRITE 8 /* write some bitmap data to the display */
20 | #define GLCD2USB_RID_WRITE_4 (GLCD2USB_RID_WRITE+0)
21 | #define GLCD2USB_RID_WRITE_8 (GLCD2USB_RID_WRITE+1)
22 | #define GLCD2USB_RID_WRITE_16 (GLCD2USB_RID_WRITE+2)
23 | #define GLCD2USB_RID_WRITE_32 (GLCD2USB_RID_WRITE+3)
24 | #define GLCD2USB_RID_WRITE_64 (GLCD2USB_RID_WRITE+4)
25 | #define GLCD2USB_RID_WRITE_128 (GLCD2USB_RID_WRITE+5)
26 |
27 | typedef struct {
28 | unsigned char report_id;
29 | char name[32];
30 | unsigned short width, height;
31 | unsigned char flags;
32 | } __attribute__ ((packed)) display_info_t;
33 |
34 | #endif // GLCD2USB_H
35 |
--------------------------------------------------------------------------------
/lcd4linux/readme.txt:
--------------------------------------------------------------------------------
1 | This is only the GLCD2USB driver for lcd4linux. The full source code of lcd4linux incl. support for the GLCD2USB can be downloaded from SVN add descibed at http://ssl.bulix.org/projects/lcd4linux/wiki/Howto
2 |
3 |
--------------------------------------------------------------------------------
/testclient/Makefile:
--------------------------------------------------------------------------------
1 | # Name: Makefile
2 | # Project: Automator
3 | # Author: Christian Starkjohann
4 | # Creation Date: 2006-02-01
5 | # Tabsize: 4
6 | # Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 | # License: Proprietary, free under certain conditions. See Documentation.
8 | # This Revision: $Id: Makefile 281 2007-03-20 13:22:10Z cs $
9 |
10 | # Please read the definitions below and edit them as appropriate for your
11 | # system:
12 |
13 | # Use the following 3 lines on Unix and Mac OS X:
14 | USBFLAGS= `libusb-config --cflags`
15 | USBLIBS= `libusb-config --libs`
16 | EXE_SUFFIX=
17 |
18 | # Use the following 3 lines on Windows and comment out the 3 above:
19 | #USBFLAGS=
20 | #USBLIBS= -lhid -lusb -lsetupapi
21 | #EXE_SUFFIX= .exe
22 |
23 | CC= gcc
24 | CXX= g++
25 | CFLAGS= -O2 -Wall $(USBFLAGS)
26 | LIBS= $(USBLIBS)
27 | ARCH_COMPILE=
28 | ARCH_LINK=
29 |
30 | OBJ= main.o usbcalls.o
31 | PROGRAM= glcd2usb_test$(EXE_SUFFIX)
32 |
33 | all: $(PROGRAM)
34 |
35 | $(PROGRAM): $(OBJ)
36 | $(CC) $(ARCH_LINK) $(CFLAGS) -o $(PROGRAM) $(OBJ) $(LIBS)
37 |
38 |
39 | strip: $(PROGRAM)
40 | strip $(PROGRAM)
41 |
42 | clean:
43 | rm -f *~ $(OBJ) $(PROGRAM)
44 |
45 | .c.o:
46 | $(CC) $(ARCH_COMPILE) $(CFLAGS) -c $*.c -o $*.o
47 |
--------------------------------------------------------------------------------
/testclient/Makefile.mingw:
--------------------------------------------------------------------------------
1 | #
2 | # Makefile.mingw
3 | #
4 |
5 | CC = i586-mingw32msvc-gcc
6 | CFLAGS = -O2 -Wall -DWIN32
7 | LIBS = -lhid -lsetupapi
8 |
9 | OBJ = main.obj usbcalls.obj
10 | APP = glcd2usb_test.exe
11 |
12 | all: $(APP)
13 |
14 | $(APP): $(OBJ)
15 | $(CC) $(CFLAGS) -s -o $(APP) $(OBJ) $(LIBS)
16 |
17 | clean:
18 | rm -f $(OBJ) $(APP)
19 |
20 | %.obj: %.c
21 | $(CC) $(CFLAGS) -c $*.c -o $*.obj
22 |
--------------------------------------------------------------------------------
/testclient/hidsdi.h:
--------------------------------------------------------------------------------
1 | /* Name: hidsdi.h
2 | * Project: usbcalls library
3 | * Author: Christian Starkjohann
4 | * Creation Date: 2006-02-02
5 | * Tabsize: 4
6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 | * License: Proprietary, free under certain conditions. See Documentation.
8 | * This Revision: $Id: hidsdi.h 281 2007-03-20 13:22:10Z cs $
9 | */
10 |
11 | /*
12 | General Description
13 | This file is a replacement for hidsdi.h from the Windows DDK. It defines some
14 | of the types and function prototypes of this header for our project. If you
15 | have the Windows DDK version of this file or a version shipped with MinGW, use
16 | that instead.
17 | */
18 |
19 | #ifndef _HIDSDI_H
20 | #define _HIDSDI_H
21 |
22 | #include
23 |
24 | #include
25 | #include
26 |
27 | typedef struct{
28 | ULONG Size;
29 | USHORT VendorID;
30 | USHORT ProductID;
31 | USHORT VersionNumber;
32 | }HIDD_ATTRIBUTES;
33 |
34 | void __stdcall HidD_GetHidGuid(OUT LPGUID hidGuid);
35 |
36 | BOOLEAN __stdcall HidD_GetAttributes(IN HANDLE device, OUT HIDD_ATTRIBUTES *attributes);
37 |
38 | BOOLEAN __stdcall HidD_GetManufacturerString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
39 | BOOLEAN __stdcall HidD_GetProductString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
40 | BOOLEAN __stdcall HidD_GetSerialNumberString(IN HANDLE device, OUT void *buffer, IN ULONG bufferLen);
41 |
42 | BOOLEAN __stdcall HidD_GetFeature(IN HANDLE device, OUT void *reportBuffer, IN ULONG bufferLen);
43 | BOOLEAN __stdcall HidD_SetFeature(IN HANDLE device, IN void *reportBuffer, IN ULONG bufferLen);
44 |
45 | BOOLEAN __stdcall HidD_GetNumInputBuffers(IN HANDLE device, OUT ULONG *numBuffers);
46 | BOOLEAN __stdcall HidD_SetNumInputBuffers(IN HANDLE device, OUT ULONG numBuffers);
47 |
48 | #include
49 |
50 | #endif
51 |
--------------------------------------------------------------------------------
/testclient/main.c:
--------------------------------------------------------------------------------
1 | /*
2 | * Demo application for GLCD2USB
3 | * Till Harbaum
4 | * Licensed under GPL
5 | */
6 |
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include "usbcalls.h"
12 |
13 | #define IDENT_VENDOR_NUM 0x1c40
14 | #define IDENT_PRODUCT_NUM 0x0525
15 |
16 | #define IDENT_VENDOR_STRING "www.harbaum.org/till/glcd2usb"
17 | #define IDENT_PRODUCT_STRING "GLCD2USB"
18 |
19 | #define IDENT_VENDOR_NUM_OLD 0x0403
20 | #define IDENT_PRODUCT_NUM_OLD 0xc634
21 |
22 | /* ------------------------------------------------------------------------- */
23 |
24 | char *usbErrorMessage(int errCode) {
25 | static char buffer[80];
26 |
27 | switch(errCode){
28 | case USB_ERROR_ACCESS: return "Access to device denied";
29 | case USB_ERROR_NOTFOUND: return "The specified device was not found";
30 | case USB_ERROR_BUSY: return "The device is used by another application";
31 | case USB_ERROR_IO: return "Communication error with device";
32 | default:
33 | sprintf(buffer, "Unknown USB error %d", errCode);
34 | return buffer;
35 | }
36 | return NULL; /* not reached */
37 | }
38 |
39 | /* ------------------------------------------------------------------------- */
40 |
41 | /* this is placed in the lcd4linux directory to make sure lcd4linux can */
42 | /* still be compiled without the glcd2usb firmware being present */
43 | #include "../lcd4linux/glcd2usb.h"
44 |
45 | int main(int argc, char **argv)
46 | {
47 | usbDevice_t *dev = NULL;
48 | int err = 0, len;
49 | int bright = 0;
50 |
51 | /* message buffer for messages going forth and back between PC and */
52 | /* GLCD2USB unit */
53 | union {
54 | char bytes[132];
55 | display_info_t display_info;
56 | } buffer;
57 |
58 | /* open a connection to the device */
59 | if((err = usbOpenDevice(&dev, IDENT_VENDOR_NUM, IDENT_VENDOR_STRING,
60 | IDENT_PRODUCT_NUM, IDENT_PRODUCT_STRING, 1)) != 0){
61 | if((err = usbOpenDevice(&dev, IDENT_VENDOR_NUM_OLD, IDENT_VENDOR_STRING,
62 | IDENT_PRODUCT_NUM_OLD, IDENT_PRODUCT_STRING, 1)) != 0){
63 | fprintf(stderr, "Error opening GLCD2USB device: %s\n", usbErrorMessage(err));
64 | goto errorOccurred;
65 | }
66 | }
67 |
68 | /* request the buffer to be filled with display info */
69 | memset(&buffer, 0, sizeof(buffer));
70 | len = sizeof(display_info_t);
71 | if((err = usbGetReport(dev, USB_HID_REPORT_TYPE_FEATURE,
72 | GLCD2USB_RID_GET_INFO, buffer.bytes, &len)) != 0){
73 | fprintf(stderr, "Error getting display info: %s\n", usbErrorMessage(err));
74 | goto errorOccurred;
75 | }
76 |
77 | if(len < sizeof(buffer.display_info)){
78 | fprintf(stderr, "Not enough bytes in display info report (%d instead of %d)\n",
79 | len, (int)sizeof(buffer.display_info));
80 | err = -1;
81 | goto errorOccurred;
82 | }
83 |
84 | printf("Display name: %s\n", buffer.display_info.name);
85 | printf("Display resolution: %d * %d\n",
86 | buffer.display_info.width, buffer.display_info.height);
87 | printf("Display flags: %x\n", buffer.display_info.flags);
88 |
89 | /* this driver currently does not support all display memory arrangements */
90 | if(buffer.display_info.flags & FLAG_SIX_BIT) {
91 | fprintf(stderr, "Error: Six bit displays are not supported yet\n");
92 | err = -1;
93 | goto errorOccurred;
94 | }
95 |
96 | if(buffer.display_info.flags & FLAG_VERTICAL_INC) {
97 | fprintf(stderr, "Error: Vertical increase is not supported yet\n");
98 | err = -1;
99 | goto errorOccurred;
100 | }
101 |
102 | if(!(buffer.display_info.flags & FLAG_VERTICAL_UNITS)) {
103 | fprintf(stderr, "Error: Horizontal units are not supported yet\n");
104 | err = -1;
105 | goto errorOccurred;
106 | }
107 |
108 | /* get access to display */
109 | buffer.bytes[0] = GLCD2USB_RID_SET_ALLOC;
110 | buffer.bytes[1] = 1; /* 1 -> alloc display, 0 -> free it */
111 | if((err = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE,
112 | buffer.bytes, 2)) != 0) {
113 | fprintf(stderr, "Error allocating display: %s\n", usbErrorMessage(err));
114 | goto errorOccurred;
115 | }
116 | printf("Display allocated\n");
117 |
118 | printf("Press display button to stop ...\n");
119 |
120 | /* do some animation */
121 | do {
122 | int i, j;
123 |
124 | /* pattern repeats every 8 cycles */
125 | for(i=0;i<8;i++) {
126 |
127 | buffer.bytes[0] = GLCD2USB_RID_SET_BL;
128 | buffer.bytes[1] = bright & 0xff;
129 | if((err = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE,
130 | buffer.bytes, 2)) != 0) {
131 | fprintf(stderr, "Error freeing display: %s\n", usbErrorMessage(err));
132 | goto errorOccurred;
133 | }
134 |
135 | if(!(bright & 0x8000)) {
136 | bright += 10;
137 | if((bright&0x7fff) > 255)
138 | bright = 0x80ff;
139 | } else {
140 | bright -= 10;
141 | if((bright&0x7fff) > 255)
142 | bright = 0x0000;
143 | }
144 |
145 | /* the 128x64 display is filled in 8 transfers with 128 bytes each */
146 | for(j=0;j<8;j++) {
147 | int n;
148 |
149 | buffer.bytes[0] = GLCD2USB_RID_WRITE_128;
150 | buffer.bytes[1] = (j*128)%256;
151 | buffer.bytes[2] = (j*128)/256;
152 | buffer.bytes[3] = 128; // real length
153 |
154 | /* draw pattern */
155 | for(n=0;n<128;n++) {
156 | if(n%8 == i) buffer.bytes[4+n] = 0xff;
157 | else buffer.bytes[4+n] = 1<alloc, 0->free */
183 | if((err = usbSetReport(dev, USB_HID_REPORT_TYPE_FEATURE,
184 | buffer.bytes, 2)) != 0) {
185 | fprintf(stderr, "Error freeing display: %s\n", usbErrorMessage(err));
186 | goto errorOccurred;
187 | }
188 | printf("Display freed\n");
189 |
190 | errorOccurred:
191 | if(dev != NULL)
192 | usbCloseDevice(dev);
193 |
194 | #ifdef WIN32
195 | printf("Press key\n");
196 | getchar();
197 | #endif
198 |
199 | return 0;
200 | }
201 |
202 | /* ------------------------------------------------------------------------- */
203 |
204 |
205 |
--------------------------------------------------------------------------------
/testclient/usb-libusb.c:
--------------------------------------------------------------------------------
1 | /* Name: usb-libusb.c
2 | * Project: usbcalls library
3 | * Author: Christian Starkjohann
4 | * Creation Date: 2006-02-02
5 | * Tabsize: 4
6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 | * License: Proprietary, free under certain conditions. See Documentation.
8 | * This Revision: $Id: usb-libusb.c 323 2007-03-29 17:25:03Z cs $
9 | */
10 |
11 | /*
12 | General Description:
13 | This module implements USB HID report receiving/sending based on libusb. It
14 | does not read and parse the report descriptor. You must therefore be careful
15 | to pass correctly formatted data blocks of correct size. In order to be
16 | compatible with the Windows implementation, we add a zero report ID for all
17 | reports which don't have an ID. Since we don't parse the descriptor, the caller
18 | must tell us whether report IDs are used or not in usbOpenDevice().
19 |
20 | The implementation of dummy report IDs is a hack. Whether they are used is
21 | stored in a global variable, not in the device structure (just laziness, don't
22 | want to allocate memory for that). If you open more than one device and the
23 | devices differ in report ID usage, you must change the code.
24 | */
25 |
26 | #include
27 | #include
28 | #include
29 |
30 | #define usbDevice usb_dev_handle /* use libusb's device structure */
31 | #include "usbcalls.h"
32 |
33 | /* ------------------------------------------------------------------------- */
34 |
35 | #define USBRQ_HID_GET_REPORT 0x01
36 | #define USBRQ_HID_SET_REPORT 0x09
37 |
38 | static int usesReportIDs;
39 |
40 | /* ------------------------------------------------------------------------- */
41 |
42 | static int usbGetStringAscii(usb_dev_handle *dev, int index, int langid, char *buf, int buflen)
43 | {
44 | char buffer[256];
45 | int rval, i;
46 |
47 | if((rval = usb_control_msg(dev, USB_ENDPOINT_IN, USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, langid, buffer, sizeof(buffer), 1000)) < 0)
48 | return rval;
49 | if(buffer[1] != USB_DT_STRING)
50 | return 0;
51 | if((unsigned char)buffer[0] < rval)
52 | rval = (unsigned char)buffer[0];
53 | rval /= 2;
54 | /* lossy conversion to ISO Latin1 */
55 | for(i=1;i buflen) /* destination buffer overflow */
57 | break;
58 | buf[i-1] = buffer[2 * i];
59 | if(buffer[2 * i + 1] != 0) /* outside of ISO Latin1 range */
60 | buf[i-1] = '?';
61 | }
62 | buf[i-1] = 0;
63 | return i-1;
64 | }
65 |
66 | int usbOpenDevice(usbDevice_t **device, int vendor, char *vendorName, int product, char *productName, int _usesReportIDs)
67 | {
68 | struct usb_bus *bus;
69 | struct usb_device *dev;
70 | usb_dev_handle *handle = NULL;
71 | int errorCode = USB_ERROR_NOTFOUND;
72 | static int didUsbInit = 0;
73 |
74 | if(!didUsbInit){
75 | usb_init();
76 | didUsbInit = 1;
77 | }
78 | usb_find_busses();
79 | usb_find_devices();
80 | for(bus=usb_get_busses(); bus; bus=bus->next){
81 | for(dev=bus->devices; dev; dev=dev->next){
82 | if(dev->descriptor.idVendor == vendor && dev->descriptor.idProduct == product){
83 | char string[256];
84 | int len;
85 | handle = usb_open(dev); /* we need to open the device in order to query strings */
86 | if(!handle){
87 | errorCode = USB_ERROR_ACCESS;
88 | fprintf(stderr, "Warning: cannot open USB device: %s\n", usb_strerror());
89 | continue;
90 | }
91 | if(vendorName == NULL && productName == NULL){ /* name does not matter */
92 | break;
93 | }
94 | /* now check whether the names match: */
95 | len = usbGetStringAscii(handle, dev->descriptor.iManufacturer, 0x0409, string, sizeof(string));
96 | if(len < 0){
97 | errorCode = USB_ERROR_IO;
98 | fprintf(stderr, "Warning: cannot query manufacturer for device: %s\n", usb_strerror());
99 | }else{
100 | errorCode = USB_ERROR_NOTFOUND;
101 | /* fprintf(stderr, "seen device from vendor ->%s<-\n", string); */
102 | if(strcmp(string, vendorName) == 0){
103 | len = usbGetStringAscii(handle, dev->descriptor.iProduct, 0x0409, string, sizeof(string));
104 | if(len < 0){
105 | errorCode = USB_ERROR_IO;
106 | fprintf(stderr, "Warning: cannot query product for device: %s\n", usb_strerror());
107 | }else{
108 | errorCode = USB_ERROR_NOTFOUND;
109 | /* fprintf(stderr, "seen product ->%s<-\n", string); */
110 | if(strcmp(string, productName) == 0)
111 | break;
112 | }
113 | }
114 | }
115 | usb_close(handle);
116 | handle = NULL;
117 | }
118 | }
119 | if(handle)
120 | break;
121 | }
122 | if(handle != NULL){
123 | int rval, retries = 3;
124 | if(usb_set_configuration(handle, 1)){
125 | fprintf(stderr, "Warning: could not set configuration: %s\n", usb_strerror());
126 | }
127 | /* now try to claim the interface and detach the kernel HID driver on
128 | * linux and other operating systems which support the call.
129 | */
130 | while((rval = usb_claim_interface(handle, 0)) != 0 && retries-- > 0){
131 | #ifdef LIBUSB_HAS_DETACH_KERNEL_DRIVER_NP
132 | if(usb_detach_kernel_driver_np(handle, 0) < 0){
133 | fprintf(stderr, "Warning: could not detach kernel HID driver: %s\n", usb_strerror());
134 | }
135 | #endif
136 | }
137 | #ifndef __APPLE__
138 | if(rval != 0)
139 | fprintf(stderr, "Warning: could not claim interface\n");
140 | #endif
141 | /* Continue anyway, even if we could not claim the interface. Control transfers
142 | * should still work.
143 | */
144 | errorCode = 0;
145 | *device = handle;
146 | usesReportIDs = _usesReportIDs;
147 | }
148 | return errorCode;
149 | }
150 |
151 | /* ------------------------------------------------------------------------- */
152 |
153 | void usbCloseDevice(usbDevice_t *device)
154 | {
155 | if(device != NULL)
156 | usb_close(device);
157 | }
158 |
159 | /* ------------------------------------------------------------------------- */
160 |
161 | int usbSetReport(usbDevice_t *device, int reportType, char *buffer, int len)
162 | {
163 | int bytesSent;
164 |
165 | if(!usesReportIDs){
166 | buffer++; /* skip dummy report ID */
167 | len--;
168 | }
169 | bytesSent = usb_control_msg(device, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_ENDPOINT_OUT, USBRQ_HID_SET_REPORT, reportType << 8 | buffer[0], 0, buffer, len, 5000);
170 | if(bytesSent != len){
171 | if(bytesSent < 0)
172 | fprintf(stderr, "Error sending message: %s\n", usb_strerror());
173 | return USB_ERROR_IO;
174 | }
175 | return 0;
176 | }
177 |
178 | /* ------------------------------------------------------------------------- */
179 |
180 | int usbGetReport(usbDevice_t *device, int reportType, int reportNumber, char *buffer, int *len)
181 | {
182 | int bytesReceived, maxLen = *len;
183 |
184 | if(!usesReportIDs){
185 | buffer++; /* make room for dummy report ID */
186 | maxLen--;
187 | }
188 | bytesReceived = usb_control_msg(device, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT, reportType << 8 | reportNumber, 0, buffer, maxLen, 5000);
189 | if(bytesReceived < 0){
190 | fprintf(stderr, "Error sending message: %s\n", usb_strerror());
191 | return USB_ERROR_IO;
192 | }
193 | *len = bytesReceived;
194 | if(!usesReportIDs){
195 | buffer[-1] = reportNumber; /* add dummy report ID */
196 | (*len)++;
197 | }
198 | return 0;
199 | }
200 |
201 | /* ------------------------------------------------------------------------- */
202 |
203 |
204 |
--------------------------------------------------------------------------------
/testclient/usb-windows.c:
--------------------------------------------------------------------------------
1 | /* Name: usb-windows.c
2 | * Project: usbcalls library
3 | * Author: Christian Starkjohann
4 | * Creation Date: 2006-02-02
5 | * Tabsize: 4
6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 | * License: Proprietary, free under certain conditions. See Documentation.
8 | * This Revision: $Id: usb-windows.c 281 2007-03-20 13:22:10Z cs $
9 | */
10 |
11 | /*
12 | General Description:
13 | This module implements USB HID report receiving and sending with native
14 | Windows API functions. If you compile with MinGW, no software from Microsoft
15 | (no DDK) is needed. We supply the missing types and function prototypes in
16 | hidsdi.h.
17 | */
18 |
19 | #include
20 | #include
21 | #include
22 | #include "hidsdi.h"
23 | #include
24 |
25 | #include "usbcalls.h"
26 |
27 | #define DEBUG
28 |
29 | #ifdef DEBUG
30 | #define DEBUG_PRINT(arg) printf arg
31 | #else
32 | #define DEBUG_PRINT(arg)
33 | #endif
34 |
35 | /* ------------------------------------------------------------------------ */
36 |
37 | static void convertUniToAscii(char *buffer)
38 | {
39 | unsigned short *uni = (void *)buffer;
40 | char *ascii = buffer;
41 |
42 | while(*uni != 0){
43 | if(*uni >= 256){
44 | *ascii++ = '?';
45 | }else{
46 | *ascii++ = *uni++;
47 | }
48 | }
49 | *ascii++ = 0;
50 | }
51 |
52 | int usbOpenDevice(usbDevice_t **device, int vendor, char *vendorName, int product, char *productName, int usesReportIDs)
53 | {
54 | GUID hidGuid; /* GUID for HID driver */
55 | HDEVINFO deviceInfoList;
56 | SP_DEVICE_INTERFACE_DATA deviceInfo;
57 | SP_DEVICE_INTERFACE_DETAIL_DATA *deviceDetails = NULL;
58 | DWORD size;
59 | int i, openFlag = 0; /* may be FILE_FLAG_OVERLAPPED */
60 | int errorCode = USB_ERROR_NOTFOUND;
61 | HANDLE handle = INVALID_HANDLE_VALUE;
62 | HIDD_ATTRIBUTES deviceAttributes;
63 |
64 | HidD_GetHidGuid(&hidGuid);
65 | deviceInfoList = SetupDiGetClassDevs(&hidGuid, NULL, NULL, DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
66 | deviceInfo.cbSize = sizeof(deviceInfo);
67 | for(i=0;;i++){
68 | if(handle != INVALID_HANDLE_VALUE){
69 | CloseHandle(handle);
70 | handle = INVALID_HANDLE_VALUE;
71 | }
72 | if(!SetupDiEnumDeviceInterfaces(deviceInfoList, 0, &hidGuid, i, &deviceInfo))
73 | break; /* no more entries */
74 | /* first do a dummy call just to determine the actual size required */
75 | SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, NULL, 0, &size, NULL);
76 | if(deviceDetails != NULL)
77 | free(deviceDetails);
78 | deviceDetails = malloc(size);
79 | deviceDetails->cbSize = sizeof(*deviceDetails);
80 | /* this call is for real: */
81 | SetupDiGetDeviceInterfaceDetail(deviceInfoList, &deviceInfo, deviceDetails, size, &size, NULL);
82 | DEBUG_PRINT(("checking HID path \"%s\"\n", deviceDetails->DevicePath));
83 | /* attempt opening for R/W -- we don't care about devices which can't be accessed */
84 | handle = CreateFile(deviceDetails->DevicePath, GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, openFlag, NULL);
85 | if(handle == INVALID_HANDLE_VALUE){
86 | DEBUG_PRINT(("opening failed: %d (access = %d)\n", (int)GetLastError(), USB_ERROR_ACCESS));
87 | /* errorCode = USB_ERROR_ACCESS; opening will always fail for mouse -- ignore */
88 | continue;
89 | }
90 | deviceAttributes.Size = sizeof(deviceAttributes);
91 | HidD_GetAttributes(handle, &deviceAttributes);
92 | DEBUG_PRINT(("device attributes: vid=%d pid=%d\n", deviceAttributes.VendorID, deviceAttributes.ProductID));
93 | if(deviceAttributes.VendorID != vendor || deviceAttributes.ProductID != product)
94 | continue; /* ignore this device */
95 | errorCode = USB_ERROR_NOTFOUND;
96 | if(vendorName != NULL && productName != NULL){
97 | char buffer[512];
98 | if(!HidD_GetManufacturerString(handle, buffer, sizeof(buffer))){
99 | DEBUG_PRINT(("error obtaining vendor name\n"));
100 | errorCode = USB_ERROR_IO;
101 | continue;
102 | }
103 | convertUniToAscii(buffer);
104 | DEBUG_PRINT(("vendorName = \"%s\"\n", buffer));
105 | if(strcmp(vendorName, buffer) != 0)
106 | continue;
107 | if(!HidD_GetProductString(handle, buffer, sizeof(buffer))){
108 | DEBUG_PRINT(("error obtaining product name\n"));
109 | errorCode = USB_ERROR_IO;
110 | continue;
111 | }
112 | convertUniToAscii(buffer);
113 | DEBUG_PRINT(("productName = \"%s\"\n", buffer));
114 | if(strcmp(productName, buffer) != 0)
115 | continue;
116 | }
117 | break; /* we have found the device we are looking for! */
118 | }
119 | SetupDiDestroyDeviceInfoList(deviceInfoList);
120 | if(deviceDetails != NULL)
121 | free(deviceDetails);
122 | if(handle != INVALID_HANDLE_VALUE){
123 | *device = (usbDevice_t *)handle;
124 | errorCode = 0;
125 | }
126 | return errorCode;
127 | }
128 |
129 | /* ------------------------------------------------------------------------ */
130 |
131 | void usbCloseDevice(usbDevice_t *device)
132 | {
133 | CloseHandle((HANDLE)device);
134 | }
135 |
136 | /* ------------------------------------------------------------------------ */
137 |
138 | int usbSetReport(usbDevice_t *device, int reportType, char *buffer, int len)
139 | {
140 | HANDLE handle = (HANDLE)device;
141 | BOOLEAN rval = 0;
142 | DWORD bytesWritten;
143 |
144 | switch(reportType){
145 | case USB_HID_REPORT_TYPE_INPUT:
146 | break;
147 | case USB_HID_REPORT_TYPE_OUTPUT:
148 | rval = WriteFile(handle, buffer, len, &bytesWritten, NULL);
149 | break;
150 | case USB_HID_REPORT_TYPE_FEATURE:
151 | rval = HidD_SetFeature(handle, buffer, len);
152 | break;
153 | }
154 | return rval == 0 ? USB_ERROR_IO : 0;
155 | }
156 |
157 | /* ------------------------------------------------------------------------ */
158 |
159 | int usbGetReport(usbDevice_t *device, int reportType, int reportNumber, char *buffer, int *len)
160 | {
161 | HANDLE handle = (HANDLE)device;
162 | BOOLEAN rval = 0;
163 | DWORD bytesRead;
164 |
165 | switch(reportType){
166 | case USB_HID_REPORT_TYPE_INPUT:
167 | buffer[0] = reportNumber;
168 | rval = ReadFile(handle, buffer, *len, &bytesRead, NULL);
169 | if(rval)
170 | *len = bytesRead;
171 | break;
172 | case USB_HID_REPORT_TYPE_OUTPUT:
173 | break;
174 | case USB_HID_REPORT_TYPE_FEATURE:
175 | buffer[0] = reportNumber;
176 | rval = HidD_GetFeature(handle, buffer, *len);
177 | break;
178 | }
179 | return rval == 0 ? USB_ERROR_IO : 0;
180 | }
181 |
182 | /* ------------------------------------------------------------------------ */
183 |
--------------------------------------------------------------------------------
/testclient/usbcalls.c:
--------------------------------------------------------------------------------
1 | /* Name: usbcalls.c
2 | * Project: usbcalls library
3 | * Author: Christian Starkjohann
4 | * Creation Date: 2006-02-02
5 | * Tabsize: 4
6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 | * License: Proprietary, free under certain conditions. See Documentation.
8 | * This Revision: $Id: usbcalls.c 281 2007-03-20 13:22:10Z cs $
9 | */
10 |
11 | /* This file includes the appropriate implementation based on platform
12 | * specific defines.
13 | */
14 |
15 | #if defined(WIN32)
16 | # include "usb-windows.c"
17 | #else
18 | /* e.g. defined(__APPLE__) */
19 | # include "usb-libusb.c"
20 | #endif
21 |
--------------------------------------------------------------------------------
/testclient/usbcalls.h:
--------------------------------------------------------------------------------
1 | /* Name: usbcalls.h
2 | * Project: usbcalls library
3 | * Author: Christian Starkjohann
4 | * Creation Date: 2006-02-02
5 | * Tabsize: 4
6 | * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH
7 | * License: Proprietary, free under certain conditions. See Documentation.
8 | * This Revision: $Id: usbcalls.h 281 2007-03-20 13:22:10Z cs $
9 | */
10 |
11 | #ifndef __usbcalls_h_INCLUDED__
12 | #define __usbcalls_h_INCLUDED__
13 |
14 | /*
15 | General Description:
16 | This module implements an abstraction layer for access to USB/HID communication
17 | functions. An implementation based on libusb (portable to Linux, FreeBSD and
18 | Mac OS X) and a native implementation for Windows are provided.
19 | */
20 |
21 | /* ------------------------------------------------------------------------ */
22 |
23 | #define USB_HID_REPORT_TYPE_INPUT 1
24 | #define USB_HID_REPORT_TYPE_OUTPUT 2
25 | #define USB_HID_REPORT_TYPE_FEATURE 3
26 | /* Numeric constants for 'reportType' parameters */
27 |
28 | #define USB_ERROR_NONE 0
29 | #define USB_ERROR_ACCESS 1
30 | #define USB_ERROR_NOTFOUND 2
31 | #define USB_ERROR_BUSY 16
32 | #define USB_ERROR_IO 5
33 | /* These are the error codes which can be returned by functions of this
34 | * module.
35 | */
36 |
37 | /* ------------------------------------------------------------------------ */
38 |
39 | typedef struct usbDevice usbDevice_t;
40 | /* This type represents a USB device internally. Only opaque pointers to this
41 | * type are available outside the module implementation.
42 | */
43 |
44 | /* ------------------------------------------------------------------------ */
45 |
46 | int usbOpenDevice(usbDevice_t **device, int vendor, char *vendorName, int product, char *productName, int usesReportIDs);
47 | /* This function opens a USB device. 'vendor' and 'product' are the numeric
48 | * Vendor-ID and Product-ID of the device we want to open. If 'vendorName' and
49 | * 'productName' are both not NULL, only devices with matching manufacturer-
50 | * and product name strings are accepted. If the device uses report IDs,
51 | * 'usesReportIDs' must be set to a non-zero value.
52 | * Returns: If a matching device has been found, USB_ERROR_NONE is returned and
53 | * '*device' is set to an opaque pointer representing the device. The device
54 | * must be closed with usbCloseDevice(). If the device has not been found or
55 | * opening failed, an error code is returned.
56 | */
57 | void usbCloseDevice(usbDevice_t *device);
58 | /* Every device opened with usbOpenDevice() must be closed with this function.
59 | */
60 | int usbSetReport(usbDevice_t *device, int reportType, char *buffer, int len);
61 | /* This function sends a report to the device. 'reportType' specifies the type
62 | * of report (see USB_HID_REPORT_TYPE* constants). The report ID must be in the
63 | * first byte of buffer and the length 'len' of the report is specified
64 | * including this report ID. If no report IDs are used, buffer[0] must be set
65 | * to 0 (dummy report ID).
66 | * Returns: 0 on success, an error code otherwise.
67 | */
68 | int usbGetReport(usbDevice_t *device, int reportType, int reportID, char *buffer, int *len);
69 | /* This function obtains a report from the device. 'reportType' specifies the
70 | * type of report (see USB_HID_REPORT_TYPE* constants). The requested report ID
71 | * is passed in 'reportID'. The caller must pass a buffer of the size of the
72 | * expected report in 'buffer' and initialize the variable in '*len' to the
73 | * total size of this buffer. Upon successful return, the report (prefixed with
74 | * a report ID) is in 'buffer' and the actual length of the report is returned
75 | * in '*len'.
76 | * Returns: 0 on success, an error code otherwise.
77 | */
78 |
79 | /* ------------------------------------------------------------------------ */
80 |
81 | #endif /* __usbcalls_h_INCLUDED__ */
82 |
--------------------------------------------------------------------------------