From: Uwe Hermann Date: Sat, 8 Oct 2016 14:41:10 +0000 (+0200) Subject: Add and use macros to simplify USB descriptor files. X-Git-Tag: sigrok-firmware-fx2lafw-0.1.4~7 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=01c919588b6ba25f926d97f899cfd2a5a082f453;p=sigrok-firmware-fx2lafw.git Add and use macros to simplify USB descriptor files. The macros in include/common.inc were provided by Stefan Brüns , thanks! --- diff --git a/Makefile.am b/Makefile.am index afafb2e5..38d2e1a8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -69,6 +69,7 @@ firmware_binaries = \ fx2lafw_headers = \ include/command.h \ include/dscr.inc \ + include/common.inc \ include/fx2lafw.h \ include/gpif-acquisition.h @@ -81,7 +82,8 @@ fx2lafw_objects = \ gpif-acquisition.rel hantek_6022be_headers = \ - include/dscr_hantek_6022be.inc + include/dscr_hantek_6022be.inc \ + include/common.inc hantek_6022be_sources = \ hantek_6022be.c @@ -90,7 +92,8 @@ hantek_6022be_objects = \ hantek_6022be.rel sainsmart_dds120_headers = \ - include/dscr_hantek_6022be.inc + include/dscr_hantek_6022be.inc \ + include/common.inc sainsmart_dds120_sources = \ sainsmart_dds120.c diff --git a/include/common.inc b/include/common.inc new file mode 100644 index 00000000..55520d1a --- /dev/null +++ b/include/common.inc @@ -0,0 +1,36 @@ +;; +;; This file is part of the sigrok-firmware-fx2lafw project. +;; +;; Copyright (C) 2016 Stefan Brüns +;; +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2 of the License, or +;; (at your option) any later version. +;; +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, write to the Free Software +;; Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +;; + +.macro string_descriptor_a n,str +_string'n: + .nchr len,"'str" + .db len * 2 + 2 + .db 3 + .irpc i,^"'str" + .db ''i, 0 + .endm +.endm + +.macro string_descriptor_lang n,l +_string'n: + .db 4 + .db 3 + .dw >l + (