1 /* 2 * Copyright 2019 NXP 3 * All rights reserved. 4 * 5 * SPDX-License-Identifier: BSD-3-Clause 6 */ 7 8 #ifndef __CONFIG_IMX_INC__ 9 #define __CONFIG_IMX_INC__ 10 11 #include "tfa2_dsp_fw.h" 12 13 #ifndef EPERM 14 #define EPERM 1 /* Not super-user */ 15 #endif 16 #ifndef ENOENT 17 #define ENOENT 2 /* No such file or directory */ 18 #endif 19 #ifndef EIO 20 #define EIO 5 /* I/O error */ 21 #endif 22 #ifndef ENXIO 23 #define ENXIO 6 /* No such device or address */ 24 #endif 25 #ifndef E2BIG 26 #define E2BIG 7 /* Arg list too long */ 27 #endif 28 #ifndef ENOMEM 29 #define ENOMEM 12 /* Not enough core */ 30 #endif 31 #ifndef EFAULT 32 #define EFAULT 14 /* Bad address */ 33 #endif 34 #ifndef ENODEV 35 #define ENODEV 19 /* No such device */ 36 #endif 37 #ifndef EINVAL 38 #define EINVAL 22 /* Invalid argument */ 39 #endif 40 #ifndef ERANGE 41 #define ERANGE 34 /* Math result not representable */ 42 #endif 43 #ifndef ETIME 44 #define ETIME 62 /* Timer expired */ 45 #endif 46 #ifndef ETIMEDOUT 47 #define ETIMEDOUT 116 /* Connection timed out */ 48 #endif 49 50 /* this is the I2C RPC buffer size */ 51 #define TFADSP_COMMAND_BUFFER_MAX_WORDS 250 52 #define TFADSP_COMMAND_BUFFER_MAX_SIZE (TFADSP_COMMAND_BUFFER_MAX_WORDS * sizeof(int)) 53 54 #define kmalloc(ptr, flags) TFA9XXX_GetDSPMessageBuffer() 55 #define kfree(ptr) (void)0 56 57 void TFA9XXX_NOP(const char *format, ...); 58 //#define TFA9XXX_DEBUG 59 #ifdef TFA9XXX_DEBUG 60 #include "fsl_debug_console.h" 61 #if defined(SDK_DEBUGCONSOLE) && (SDK_DEBUGCONSOLE < 1) 62 #define TFA9XXX_Printf printf 63 #else 64 #define TFA9XXX_Printf DbgConsole_Printf 65 #endif 66 #else 67 #define TFA9XXX_Printf TFA9XXX_NOP 68 #endif 69 70 #define TFA9XXX_LOG_LEVEL \ 71 LOG_DEBUG /* verbose level of the TFA log: LOG_NONE, LOG_ERR, LOG_WARN, LOG_INFO or LOG_DEBUG */ 72 73 #define tfaprintf(LOG_LEVEL, I, ...) \ 74 do \ 75 { \ 76 if (LOG_LEVEL <= TFA9XXX_LOG_LEVEL) \ 77 TFA9XXX_Printf(__VA_ARGS__); \ 78 } while (0) 79 80 #define le16toh(x) (x) 81 #define msleep_interruptible(val) TFA9XXX_WaitMS(val) 82 get_unaligned_le16(const void * p)83static inline uint16_t get_unaligned_le16(const void *p) 84 { 85 return le16toh(*(uint16_t *)p); 86 } 87 88 void usleep(uint32_t microSeconds); 89 90 uint8_t *TFA9XXX_GetDSPMessageBuffer(void); 91 92 /* wait in milli seconds */ 93 void TFA9XXX_WaitMS(uint32_t val); 94 95 #endif /* __CONFIG_IMX_INC__ */ 96