misc: respect standard __ASSEMBLER__ define in CPU headers

The JZ47xx and S5L87xx processor families used their own
special defines (__ASSEMBLY__ and ASM respectively) in
their CPU headers to check if they were included from an
assembly source file.

For GCC the standard seems to be __ASSEMBLER__, so check
for that instead and remove the non-standard symbols.
Being more consistent across platforms makes it easier to
include cpu.h from cross-platform files (eg. plugin.lds).

Change-Id: I282930cad34e1a2ff18166f3b4338548b34f4a49
This commit is contained in:
Aidan MacDonald 2026-03-05 19:59:03 +00:00
parent 5a236963e4
commit f44b6c78e0
15 changed files with 19 additions and 23 deletions

View file

@ -40,13 +40,13 @@
#ifndef __JZ4740_H__ #ifndef __JZ4740_H__
#define __JZ4740_H__ #define __JZ4740_H__
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLER__
#define REG8(addr) (*(volatile unsigned char *)(addr)) #define REG8(addr) (*(volatile unsigned char *)(addr))
#define REG16(addr) (*(volatile unsigned short *)(addr)) #define REG16(addr) (*(volatile unsigned short *)(addr))
#define REG32(addr) (*(volatile unsigned int *)(addr)) #define REG32(addr) (*(volatile unsigned int *)(addr))
#endif /* !ASSEMBLY */ #endif /* !__ASSEMBLER__ */
/************************************************************************* /*************************************************************************
* Boot ROM Specification * Boot ROM Specification
@ -2528,7 +2528,7 @@
// Module Operation Definitions // Module Operation Definitions
// //
//---------------------------------------------------------------------- //----------------------------------------------------------------------
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLER__
/*************************************************************************** /***************************************************************************
* GPIO * GPIO
@ -4975,7 +4975,7 @@ do{ \
}while(0) }while(0)
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLER__ */
#ifndef _IPU_H_ #ifndef _IPU_H_
@ -4986,7 +4986,7 @@ do{ \
#define IPU_V_BASE 0xB3080000 #define IPU_V_BASE 0xB3080000
#define IPU__SIZE 0x00001000 #define IPU__SIZE 0x00001000
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLER__
struct ipu_module struct ipu_module
{ {
unsigned int reg_ctrl; // 0x0 unsigned int reg_ctrl; // 0x0
@ -5023,7 +5023,7 @@ struct Ration2m
float ratio; float ratio;
int n, m; int n, m;
}; };
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLER__ */
// Register offset // Register offset
#define REG_CTRL 0x0 #define REG_CTRL 0x0

View file

@ -37,7 +37,7 @@
#ifndef __JZ4760B_H__ #ifndef __JZ4760B_H__
#define __JZ4760B_H__ #define __JZ4760B_H__
#if defined(__ASSEMBLY__) || defined(__LANGUAGE_ASSEMBLY) #if defined(__ASSEMBLER__)
#ifndef __MIPS_ASSEMBLER #ifndef __MIPS_ASSEMBLER
#define __MIPS_ASSEMBLER #define __MIPS_ASSEMBLER
#endif #endif

View file

@ -485,7 +485,7 @@
#define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */ #define CEB_KERNEL 2 /* Count events in kernel mode EXL = ERL = 0 */
#define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */ #define CEB_EXL 1 /* Count events with EXL = 1, ERL = 0 */
#ifndef __ASSEMBLY__ #ifndef __ASSEMBLER__
#define CAUSE_EXCCODE(x) ((CAUSEF_EXCCODE & (x->cp0_cause)) >> CAUSEB_EXCCODE) #define CAUSE_EXCCODE(x) ((CAUSEF_EXCCODE & (x->cp0_cause)) >> CAUSEB_EXCCODE)
#define CAUSE_EPC(x) (x->cp0_epc + (((x->cp0_cause & CAUSEF_BD) >> CAUSEB_BD) << 2)) #define CAUSE_EPC(x) (x->cp0_epc + (((x->cp0_cause & CAUSEF_BD) >> CAUSEB_BD) << 2))
@ -959,6 +959,6 @@ __BUILD_SET_C0(config,CP0_CONFIG)
#define set_cp0_cause(x) set_c0_cause(x) #define set_cp0_cause(x) set_c0_cause(x)
#define set_cp0_config(x) set_c0_config(x) #define set_cp0_config(x) set_c0_config(x)
#endif /* !__ASSEMBLY__ */ #endif /* !__ASSEMBLER__ */
#endif /* _ASM_MIPSREGS_H */ #endif /* _ASM_MIPSREGS_H */

View file

@ -22,7 +22,7 @@
#ifndef __S5L87XX_H__ #ifndef __S5L87XX_H__
#define __S5L87XX_H__ #define __S5L87XX_H__
#ifndef ASM #ifndef __ASSEMBLER__
#include <stdint.h> #include <stdint.h>
#endif #endif

View file

@ -18,7 +18,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#define ASM
#include "config.h" #include "config.h"
#include "cpu.h" #include "cpu.h"

View file

@ -19,7 +19,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#define ASM
#include "config.h" #include "config.h"
#include "cpu.h" #include "cpu.h"

View file

@ -1,4 +1,4 @@
#define ASM #define __ASSEMBLER__
#include "config.h" #include "config.h"
#include "cpu.h" #include "cpu.h"

View file

@ -1,4 +1,4 @@
#define ASM #define __ASSEMBLER__
#include "config.h" #include "config.h"
#include "cpu.h" #include "cpu.h"
#include "crypto-s5l8702.h" /* IM3HDR_SZ */ #include "crypto-s5l8702.h" /* IM3HDR_SZ */

View file

@ -19,7 +19,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#define ASM
#include "config.h" #include "config.h"
#include "cpu.h" #include "cpu.h"

View file

@ -40,7 +40,7 @@
#define SHA1_SZ 20 /* bytes */ #define SHA1_SZ 20 /* bytes */
#define SIGN_SZ 16 #define SIGN_SZ 16
#ifndef ASM #ifndef __ASSEMBLER__
#define IM3INFO_SZ (sizeof(struct Im3Info)) #define IM3INFO_SZ (sizeof(struct Im3Info))
#define IM3INFOSIGN_SZ (offsetof(struct Im3Info, info_sign)) #define IM3INFOSIGN_SZ (offsetof(struct Im3Info, info_sign))
@ -92,6 +92,6 @@ void im3_sign(uint32_t keyidx, void* data, uint32_t size, void* sign);
void im3_crypt(enum hwkeyaes_direction direction, void im3_crypt(enum hwkeyaes_direction direction,
struct Im3Info *hinfo, void *fw_addr); struct Im3Info *hinfo, void *fw_addr);
#endif /* ASM */ #endif /* !__ASSEMBLER__ */
#endif /* __CRYPTO_S5L8702_H__ */ #endif /* __CRYPTO_S5L8702_H__ */

View file

@ -50,7 +50,6 @@
#define YUV2RGB_VERSION VERSION_ARMV5TE_WST #define YUV2RGB_VERSION VERSION_ARMV5TE_WST
#define ASM
#include "config.h" #include "config.h"
#include "cpu.h" #include "cpu.h"

View file

@ -1,5 +1,5 @@
#define __ASSEMBLER__
#include "config.h" #include "config.h"
#define __ASSEMBLY__
#include "cpu.h" #include "cpu.h"
OUTPUT_FORMAT("elf32-littlemips") OUTPUT_FORMAT("elf32-littlemips")

View file

@ -15,7 +15,7 @@
#ifndef __JZ4760B_H__ #ifndef __JZ4760B_H__
#define __JZ4760B_H__ #define __JZ4760B_H__
#if defined(__ASSEMBLY__) || defined(__LANGUAGE_ASSEMBLY) #if defined(__ASSEMBLER__)
#ifndef __MIPS_ASSEMBLER #ifndef __MIPS_ASSEMBLER
#define __MIPS_ASSEMBLER #define __MIPS_ASSEMBLER
#endif #endif

View file

@ -1,4 +1,4 @@
#define ASM #define __ASSEMBLER__
#include "config.h" #include "config.h"
#include "cpu.h" #include "cpu.h"
#include "mks5lboot.h" #include "mks5lboot.h"

View file

@ -30,7 +30,7 @@
#define BIN_OFFSET (CERT_OFFSET + ((CERT_SIZE + 0x3) & ~ 0x3)) #define BIN_OFFSET (CERT_OFFSET + ((CERT_SIZE + 0x3) & ~ 0x3))
#define MAX_PAYLOAD (DFU_MAXSIZE - BIN_OFFSET) #define MAX_PAYLOAD (DFU_MAXSIZE - BIN_OFFSET)
#ifndef ASM #ifndef __ASSEMBLER__
#include <stddef.h> #include <stddef.h>
#include <stdint.h> #include <stdint.h>
@ -124,6 +124,6 @@ void ipoddfu_debug(int debug);
#ifdef __cplusplus #ifdef __cplusplus
}; };
#endif #endif
#endif /* ASM */ #endif /* __ASSEMBLER__ */
#endif /* __MK6GBOOT_H__ */ #endif /* __MK6GBOOT_H__ */