1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Updated styling of file to be generated, generated the file.

This commit is contained in:
mikeller 2019-02-21 01:49:09 +13:00
parent 5cbdd51bf4
commit 541ba7072f
2 changed files with 173 additions and 13 deletions

View file

@ -89,6 +89,15 @@
#endif
#define DEFIO_PORT_G_OFFSET (DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT)
#if defined(TARGET_IO_PORTH)
# define DEFIO_PORT_H_USED_MASK TARGET_IO_PORTH
# define DEFIO_PORT_H_USED_COUNT BITCOUNT(DEFIO_PORT_H_USED_MASK)
#else
# define DEFIO_PORT_H_USED_MASK 0
# define DEFIO_PORT_H_USED_COUNT 0
#endif
#define DEFIO_PORT_H_OFFSET (DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
// DEFIO_GPIOID__<port> maps to port index
@ -99,6 +108,7 @@
#define DEFIO_GPIOID__E 4
#define DEFIO_GPIOID__F 5
#define DEFIO_GPIOID__G 6
#define DEFIO_GPIOID__H 7
// DEFIO_TAG__P<port><pin> will expand to TAG if defined for target, error is triggered otherwise
// DEFIO_TAG_E__P<port><pin> will expand to TAG if defined, to NONE otherwise (usefull for tables that are CPU-specific)
@ -1112,13 +1122,162 @@
# define DEFIO_TAG_E__PG15 DEFIO_TAG_E__NONE
# define DEFIO_REC__PG15 defio_error_PG15_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(0)
# define DEFIO_TAG__PH0 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 0)
# define DEFIO_TAG_E__PH0 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 0)
# define DEFIO_REC__PH0 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(0) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH0 defio_error_PH0_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH0 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH0 defio_error_PH0_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(1)
# define DEFIO_TAG__PH1 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 1)
# define DEFIO_TAG_E__PH1 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 1)
# define DEFIO_REC__PH1 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(1) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH1 defio_error_PH1_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH1 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH1 defio_error_PH1_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(2)
# define DEFIO_TAG__PH2 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 2)
# define DEFIO_TAG_E__PH2 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 2)
# define DEFIO_REC__PH2 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(2) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH2 defio_error_PH2_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH2 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH2 defio_error_PH2_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(3)
# define DEFIO_TAG__PH3 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 3)
# define DEFIO_TAG_E__PH3 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 3)
# define DEFIO_REC__PH3 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(3) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH3 defio_error_PH3_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH3 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH3 defio_error_PH3_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(4)
# define DEFIO_TAG__PH4 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 4)
# define DEFIO_TAG_E__PH4 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 4)
# define DEFIO_REC__PH4 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(4) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH4 defio_error_PH4_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH4 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH4 defio_error_PH4_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(5)
# define DEFIO_TAG__PH5 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 5)
# define DEFIO_TAG_E__PH5 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 5)
# define DEFIO_REC__PH5 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(5) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH5 defio_error_PH5_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH5 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH5 defio_error_PH5_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(6)
# define DEFIO_TAG__PH6 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 6)
# define DEFIO_TAG_E__PH6 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 6)
# define DEFIO_REC__PH6 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(6) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH6 defio_error_PH6_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH6 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH6 defio_error_PH6_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(7)
# define DEFIO_TAG__PH7 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 7)
# define DEFIO_TAG_E__PH7 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 7)
# define DEFIO_REC__PH7 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(7) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH7 defio_error_PH7_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH7 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH7 defio_error_PH7_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(8)
# define DEFIO_TAG__PH8 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 8)
# define DEFIO_TAG_E__PH8 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 8)
# define DEFIO_REC__PH8 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(8) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH8 defio_error_PH8_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH8 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH8 defio_error_PH8_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(9)
# define DEFIO_TAG__PH9 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 9)
# define DEFIO_TAG_E__PH9 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 9)
# define DEFIO_REC__PH9 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(9) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH9 defio_error_PH9_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH9 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH9 defio_error_PH9_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(10)
# define DEFIO_TAG__PH10 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 10)
# define DEFIO_TAG_E__PH10 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 10)
# define DEFIO_REC__PH10 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(10) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH10 defio_error_PH10_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH10 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH10 defio_error_PH10_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(11)
# define DEFIO_TAG__PH11 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 11)
# define DEFIO_TAG_E__PH11 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 11)
# define DEFIO_REC__PH11 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(11) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH11 defio_error_PH11_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH11 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH11 defio_error_PH11_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(12)
# define DEFIO_TAG__PH12 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 12)
# define DEFIO_TAG_E__PH12 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 12)
# define DEFIO_REC__PH12 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(12) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH12 defio_error_PH12_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH12 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH12 defio_error_PH12_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(13)
# define DEFIO_TAG__PH13 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 13)
# define DEFIO_TAG_E__PH13 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 13)
# define DEFIO_REC__PH13 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(13) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH13 defio_error_PH13_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH13 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH13 defio_error_PH13_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(14)
# define DEFIO_TAG__PH14 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 14)
# define DEFIO_TAG_E__PH14 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 14)
# define DEFIO_REC__PH14 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(14) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH14 defio_error_PH14_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH14 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH14 defio_error_PH14_is_not_supported_on_TARGET
#endif
#if DEFIO_PORT_H_USED_MASK & BIT(15)
# define DEFIO_TAG__PH15 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 15)
# define DEFIO_TAG_E__PH15 DEFIO_TAG_MAKE(DEFIO_GPIOID__H, 15)
# define DEFIO_REC__PH15 DEFIO_REC_INDEXED(BITCOUNT(DEFIO_PORT_H_USED_MASK & (BIT(15) - 1)) + DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#else
# define DEFIO_TAG__PH15 defio_error_PH15_is_not_supported_on_TARGET
# define DEFIO_TAG_E__PH15 DEFIO_TAG_E__NONE
# define DEFIO_REC__PH15 defio_error_PH15_is_not_supported_on_TARGET
#endif
// DEFIO_IO_USED_COUNT is number of io pins supported on target
#define DEFIO_IO_USED_COUNT (DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT)
#define DEFIO_IO_USED_COUNT (DEFIO_PORT_A_USED_COUNT+DEFIO_PORT_B_USED_COUNT+DEFIO_PORT_C_USED_COUNT+DEFIO_PORT_D_USED_COUNT+DEFIO_PORT_E_USED_COUNT+DEFIO_PORT_F_USED_COUNT+DEFIO_PORT_G_USED_COUNT+DEFIO_PORT_H_USED_COUNT)
// DEFIO_PORT_USED_LIST - comma separated list of bitmask for all used ports.
// DEFIO_PORT_OFFSET_LIST - comma separated list of port offsets (count of pins before this port)
// unused ports on end of list are skipped
#if !defined DEFIO_PORT_USED_LIST && DEFIO_PORT_H_USED_COUNT > 0
# define DEFIO_PORT_USED_COUNT 8
# define DEFIO_PORT_USED_LIST DEFIO_PORT_A_USED_MASK,DEFIO_PORT_B_USED_MASK,DEFIO_PORT_C_USED_MASK,DEFIO_PORT_D_USED_MASK,DEFIO_PORT_E_USED_MASK,DEFIO_PORT_F_USED_MASK,DEFIO_PORT_G_USED_MASK,DEFIO_PORT_H_USED_MASK
# define DEFIO_PORT_OFFSET_LIST DEFIO_PORT_A_OFFSET,DEFIO_PORT_B_OFFSET,DEFIO_PORT_C_OFFSET,DEFIO_PORT_D_OFFSET,DEFIO_PORT_E_OFFSET,DEFIO_PORT_F_OFFSET,DEFIO_PORT_G_OFFSET,DEFIO_PORT_H_OFFSET
#endif
#if !defined DEFIO_PORT_USED_LIST && DEFIO_PORT_G_USED_COUNT > 0
# define DEFIO_PORT_USED_COUNT 7
# define DEFIO_PORT_USED_LIST DEFIO_PORT_A_USED_MASK,DEFIO_PORT_B_USED_MASK,DEFIO_PORT_C_USED_MASK,DEFIO_PORT_D_USED_MASK,DEFIO_PORT_E_USED_MASK,DEFIO_PORT_F_USED_MASK,DEFIO_PORT_G_USED_MASK

25
src/utils/def_generated.pl Normal file → Executable file
View file

@ -16,20 +16,23 @@ $" = "\n";
chomp(my $license = <<"END");
/*
* This file is part of Cleanflight.
* This file is part of Cleanflight and Betaflight.
*
* Cleanflight 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 3 of the License, or
* (at your option) any later version.
* Cleanflight and Betaflight are free software. You can redistribute
* this software and/or modify this software under the terms of the
* GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* Cleanflight 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.
* Cleanflight and Betaflight are distributed in the hope that they
* 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 Cleanflight. If not, see <http://www.gnu.org/licenses/>.
* along with this software.
*
* If not, see <http://www.gnu.org/licenses/>.
*/
END
@ -112,7 +115,6 @@ END2
# define DEFIO_PORT_USED_LIST /* empty */
# define DEFIO_PORT_OFFSET_LIST /* empty */
#endif
END
exit; # only IO code is merged now
@ -183,4 +185,3 @@ END2
NULL // terminate the list
};
END