/*****************************************************************************/ /* _lock.h v15.4.0I15142 */ /* */ /* Copyright (c) 2000-2015 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* linkage.h v15.4.0I15142 */ /* */ /* Copyright (c) 1998-2015 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-19.4") /* macros required for implementation */ /* No modifiers are needed to access code or data */ /*--------------------------------------------------------------------------*/ /* Define _IDECL ==> how inline functions are declared */ /*--------------------------------------------------------------------------*/ #pragma diag_pop #pragma diag_push /* _nop(), _lock(), and _unlock() all accept zero or more optional arguments, which must remain as empty rather than (void) parameter lists to avoid breaking the API */ #pragma CHECK_MISRA("-16.5") void _nop(); extern void ( *_lock)(); extern void (*_unlock)(); void _register_lock (void ( *lock)()); void _register_unlock(void (*unlock)()); #pragma diag_pop /*****************************************************************************/ /* STDIO.H v15.4.0I15142 */ /* */ /* Copyright (c) 1993-2015 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* stdarg.h v15.4.0I15142 */ /* */ /* Copyright (c) 1996-2015 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ #pragma diag_push #pragma CHECK_MISRA("-20.2") /* standard headers must define standard names */ #pragma CHECK_MISRA("-19.10") /* need types as macro arguments */ typedef struct __va_list { void * __ap; } va_list; #pragma diag_pop #pragma diag_push /* using declarations must occur outside header guard to support including both C and C++-wrapped version of header; see _CPP_STYLE_HEADER check */ /* this code is for C++ mode only and thus also not relevant for MISRA */ #pragma CHECK_MISRA("-19.15") #pragma diag_pop /*---------------------------------------------------------------------------*/ /* Attributes are only available in relaxed ANSI mode. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* A header file conforming to ARM CLIB ABI (GENC-003539), should */ /* define _AEABI_PORTABLE when _AEABI_PORTABILITY_LEVEL is defined. */ /*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/ /* The macro definition that guards CLIB ABI (GENC-003539) requirements. */ /*---------------------------------------------------------------------------*/ /****************************************************************************/ /* TYPES THAT ANSI REQUIRES TO BE DEFINED */ /****************************************************************************/ typedef unsigned size_t; typedef struct { int fd; /* File descriptor */ unsigned char* buf; /* Pointer to start of buffer */ unsigned char* pos; /* Position in buffer */ unsigned char* bufend; /* Pointer to end of buffer */ unsigned char* buff_stop; /* Pointer to last read char in buffer */ unsigned int flags; /* File status flags (see below) */ } FILE; typedef long fpos_t; /****************************************************************************/ /* DEVICE AND STREAM RELATED MACROS */ /****************************************************************************/ /****************************************************************************/ /* MACROS THAT DEFINE AND USE FILE STATUS FLAGS */ /****************************************************************************/ /****************************************************************************/ /* MACROS THAT ANSI REQUIRES TO BE DEFINED */ /****************************************************************************/ /******** END OF ANSI MACROS ************************************************/ /****************************************************************************/ /* DEVICE AND STREAM RELATED DATA STRUCTURES AND MACROS */ /****************************************************************************/ extern FILE _ftable[10]; extern char __TI_tmpnams[10][16]; /****************************************************************************/ /* FUNCTION DEFINITIONS - ANSI */ /****************************************************************************/ /****************************************************************************/ /* OPERATIONS ON FILES */ /****************************************************************************/ extern int remove(const char *_file); extern int rename(const char *_old, const char *_new); extern FILE *tmpfile(void); extern char *tmpnam(char *_s); /****************************************************************************/ /* FILE ACCESS FUNCTIONS */ /****************************************************************************/ extern int fclose(FILE *_fp); extern FILE *fopen(const char *_fname, const char *_mode); extern FILE *freopen(const char *_fname, const char *_mode, register FILE *_fp); extern void setbuf(register FILE *_fp, char *_buf); extern int setvbuf(register FILE *_fp, register char *_buf, register int _type, register size_t _size); extern int fflush(register FILE *_fp); /****************************************************************************/ /* FORMATTED INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern int fprintf(FILE *_fp, const char *_format, ...) __attribute__((__format__ (__printf__, 2, 3))); extern int fscanf(FILE *_fp, const char *_fmt, ...) __attribute__((__format__ (__scanf__, 2, 3))); extern int printf(const char *_format, ...) __attribute__((__format__ (__printf__, 1, 2))); extern int scanf(const char *_fmt, ...) __attribute__((__format__ (__scanf__, 1, 2))); extern int sprintf(char *_string, const char *_format, ...) __attribute__((__format__ (__printf__, 2, 3))); extern int snprintf(char *_string, size_t _n, const char *_format, ...) __attribute__((__format__ (__printf__, 3, 4))); extern int sscanf(const char *_str, const char *_fmt, ...) __attribute__((__format__ (__scanf__, 2, 3))); extern int vfprintf(FILE *_fp, const char *_format, va_list _ap) __attribute__((__format__ (__printf__, 2, 0))); extern int vfscanf(FILE *_fp, const char *_fmt, va_list _ap) __attribute__((__format__ (__scanf__, 2, 0))); extern int vprintf(const char *_format, va_list _ap) __attribute__((__format__ (__printf__, 1, 0))); extern int vscanf(const char *_format, va_list _ap) __attribute__((__format__ (__scanf__, 1, 0))); extern int vsprintf(char *_string, const char *_format, va_list _ap) __attribute__((__format__ (__printf__, 2, 0))); extern int vsnprintf(char *_string, size_t _n, const char *_format, va_list _ap) __attribute__((__format__ (__printf__, 3, 0))); extern int vsscanf(const char *_str, const char *_fmt, va_list _ap) __attribute__((__format__ (__scanf__, 2, 0))); /****************************************************************************/ /* CHARACTER INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern int fgetc(register FILE *_fp); extern char *fgets(char *_ptr, register int _size, register FILE *_fp); extern int fputc(int _c, register FILE *_fp); extern int fputs(const char *_ptr, register FILE *_fp); extern int getc(FILE *_p); extern int getchar(void); extern char *gets(char *_ptr); extern int putc(int _x, FILE *_fp); extern int putchar(int _x); extern int puts(const char *_ptr); extern int ungetc(int _c, register FILE *_fp); /****************************************************************************/ /* DIRECT INPUT/OUTPUT FUNCTIONS */ /****************************************************************************/ extern size_t fread(void *_ptr, size_t _size, size_t _count, FILE *_fp); extern size_t fwrite(const void *_ptr, size_t _size, size_t _count, register FILE *_fp); /****************************************************************************/ /* FILE POSITIONING FUNCTIONS */ /****************************************************************************/ extern int fgetpos(FILE *_fp, fpos_t *_pos); extern int fseek(register FILE *_fp, long _offset, int _ptrname); extern int fsetpos(FILE *_fp, const fpos_t *_pos); extern long ftell(FILE *_fp); extern void rewind(register FILE *_fp); /****************************************************************************/ /* ERROR-HANDLING FUNCTIONS */ /****************************************************************************/ extern void clearerr(FILE *_fp); extern int feof(FILE *_fp); extern int ferror(FILE *_fp); extern void perror(const char *_s); /** * @Component: CONTROL * * @Filename: ../../CredDataBase/CONTROL_cred.h * ============================================================================ */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /*********************************************************************** * Register arrays Definition \***********************************************************************/ /*********************************************************************** * Bundle arrays Definition \***********************************************************************/ /*********************************************************************** * Bundles Definition \***********************************************************************/ /************************************************************************* * Registers Definition \*************************************************************************/ /************************************************************************** * Field Definition Macros \**************************************************************************/ /* CONTROL_REVISION */ /* CONTROL_HWINFO */ /* CONTROL_SYSCONFIG */ /* CONTROL_STATUS */ /* BOOTSTAT */ /* CONTROL_SEC_CTRL */ /* CONTROL_SEC_SW */ /* CONTROL_SEC_EMU */ /* SECURE_EMIF_SDRAM_CONFIG */ /* SECURE_EMIF_SDRAM_CONFIG_2 */ /* CONTROL_SW_CFG */ /* CONTROL_SW_CCFG */ /* CONTROL_MPK_0 */ /* CONTROL_MPK_1 */ /* CONTROL_MPK_2 */ /* CONTROL_MPK_3 */ /* CONTROL_MPK_4 */ /* CONTROL_MPK_5 */ /* CONTROL_MPK_6 */ /* CONTROL_MPK_7 */ /* CONTROL_SWRV_0 */ /* CONTROL_SWRV_1 */ /* CONTROL_SWRV_2 */ /* CONTROL_SWRV_3 */ /* CONTROL_SWRV_4 */ /* CONTROL_SWRV_5 */ /* CONTROL_SWRV_6 */ /* CONTROL_SEC_TAP */ /* CONTROL_SEC_TAP_CMDIN */ /* CONTROL_SEC_TAP_CMDOUT */ /* CONTROL_SEC_TAP_DATIN */ /* CONTROL_SEC_TAP_DATOUT */ /* CONTROL_MREQDOMAIN_EXP1 */ /* CONTROL_MREQDOMAIN_EXP2 */ /* L3_HW_FW_EXP_VAL_CONF0 */ /* L3_HW_FW_EXP_VAL_CONF1 */ /* L4_HW_FW_EXP_VAL_CONF */ /* CONTROL_SEC_LOAD_FW_EXP_VAL */ /* CONTROL_SEC_CTRL_RO */ /* EMIF_OBFUSCATION_KEY */ /* SEC_CLK_CTRL */ /* CONTROL_MREQDOMAIN_EXP3 */ /* CONTROL_CEK_0 */ /* CONTROL_CEK_1 */ /* CONTROL_CEK_2 */ /* CONTROL_CEK_3 */ /* CONTROL_CEK_BCH_0 */ /* CONTROL_CEK_BCH_1 */ /* CONTROL_CEK_BCH_2 */ /* CONTROL_CEK_BCH_3 */ /* CONTROL_CEK_BCH_4 */ /* CONTROL_MSV_0 */ /* CONTROL_MSV_BCH_0 */ /* CONTROL_MSV_BCH_1 */ /* CONTROL_SEC_STATUS */ /* CONTROL_SECMEM_STATUS */ /* CONTROL_SEC_ERR_STAT_FUNC0 */ /* CONTROL_SEC_ERR_STAT_FUNC1 */ /* CONTROL_SEC_ERR_STAT_DBUG0 */ /* CONTROL_SEC_ERR_STAT_DBUG1 */ /* CONTROL_KEK_SW_0 */ /* CONTROL_KEK_SW_1 */ /* CONTROL_KEK_SW_2 */ /* CONTROL_KEK_SW_3 */ /* CONTROL_CMPK_BCH_0 */ /* CONTROL_CMPK_BCH_1 */ /* CONTROL_CMPK_BCH_2 */ /* CONTROL_CMPK_BCH_3 */ /* CONTROL_CMPK_BCH_4 */ /* CONTROL_CMPK_BCH_5 */ /* CONTROL_CMPK_BCH_6 */ /* CONTROL_CMPK_BCH_7 */ /* CONTROL_CMPK_BCH_8 */ /* CONTROL_CMPK_0 */ /* CONTROL_CMPK_1 */ /* CONTROL_CMPK_2 */ /* CONTROL_CMPK_3 */ /* CONTROL_CMPK_4 */ /* CONTROL_CMPK_5 */ /* CONTROL_CMPK_6 */ /* CONTROL_CMPK_7 */ /* SSM_END_FAST_SECRAM */ /* SSM_FIREWALL_CONTROLLER */ /* SSM_START_SECURE_STACKED_RAM */ /* SSM_END_SECURE_STACKED_RAM */ /* SSM_START_SPM_STACK */ /* SSM_END_SPM_STACK */ /* SSM_START_MONITOR_RAMCODE */ /* SSM_END_MONITOR_RAMCODE */ /* SSM_END_MONITOR_RAMDATA */ /* SSM_START_MONITOR_CODE */ /* SSM_END_MONITOR_CODE */ /* SSM_START_MONITOR_PERIPH */ /* SSM_END_MONITOR_PERIPH */ /* SSM_START_MONITOR_STACK */ /* SSM_END_MONITOR_STACK */ /* SSM_START_MONITOR_RAMCODE_ETM */ /* SSM_END_MONITOR_RAMCODE_ETM */ /* SSM_END_MONITOR_RAMDATA_ETM */ /* SSM_START_MONITOR_CODE_ETM */ /* SSM_END_MONITOR_CODE_ETM */ /* SSM_START_MONITOR_STACK_ETM */ /* SSM_END_MONITOR_STACK_ETM */ /* SSM_START_MONITOR_SHARED_ETM */ /* SSM_END_MONITOR_SHARED_ETM */ /* SSM_START_MONITOR_PERIPH_ETM */ /* SSM_END_MONITOR_PERIPH_ETM */ /* SSM_CPSR_MODE_ENFC */ /* SSM_END_L3_SECRAM */ /* CORTEX_VBBLDO_CTRL */ /* CORE_SLDO_CTRL */ /* MPU_SLDO_CTRL */ /* REFCLK_LJCBLDO_CTRL */ /* CLK32KDIVRATIO_CTRL */ /* BANDGAP_CTRL */ /* BANDGAP_TRIM */ /* PLL_CLKINPULOW_CTRL */ /* MOSC_CTRL */ /* RCOSC_CTRL */ /* DEEPSLEEP_CTRL */ /* PE_SCRATCHPAD_0 */ /* PE_SCRATCHPAD_1 */ /* PE_SCRATCHPAD_2 */ /* PE_SCRATCHPAD_3 */ /* DEVICE_ID */ /* DEV_FEATURE */ /* INIT_PRIORITY_0 */ /* INIT_PRIORITY_1 */ /* MMU_CFG */ /* TPTC_CFG */ /* OCMC_CFG */ /* USB_CTRL0 */ /* USB_STS0 */ /* USB_CTRL1 */ /* USB_STS1 */ /* MAC_ID0_LO */ /* MAC_ID0_HI */ /* MAC_ID1_LO */ /* MAC_ID1_HI */ /* DCAN_RAMINIT */ /* USB_WKUP_CTRL */ /* GMII_SEL */ /* PWMSS_CTRL */ /* MREQPRIO_0 */ /* MREQPRIO_1 */ /* HW_EVENT_SEL_GRP1 */ /* HW_EVENT_SEL_GRP2 */ /* HW_EVENT_SEL_GRP3 */ /* HW_EVENT_SEL_GRP4 */ /* SMRT_CTRL */ /* SABTOOTH_HW_DEBUG_SEL */ /* SABTOOTH_HW_DBG_INFO */ /* MRGN_MODE0 */ /* MRGN_MODE1 */ /* VDD_MPU_OPP_050 */ /* VDD_MPU_OPP_100 */ /* VDD_MPU_OPP_119 */ /* VDD_MPU_OPP_TURBO */ /* VDD_CORE_OPP_050 */ /* VDD_CORE_OPP_100 */ /* BB_SCALE */ /* USB_VID_PID */ /* EFUSE_SMA */ /* CONF_GPMC_ADx */ /* CONF_GPMC_AD0 */ /* CONF_GPMC_AD1 */ /* CONF_GPMC_AD2 */ /* CONF_GPMC_AD3 */ /* CONF_GPMC_AD4 */ /* CONF_GPMC_AD5 */ /* CONF_GPMC_AD6 */ /* CONF_GPMC_AD7 */ /* CONF_GPMC_AD8 */ /* CONF_GPMC_AD9 */ /* CONF_GPMC_AD10 */ /* CONF_GPMC_AD11 */ /* CONF_GPMC_AD12 */ /* CONF_GPMC_AD13 */ /* CONF_GPMC_AD14 */ /* CONF_GPMC_AD15 */ /* CONF_GPMC_A0 */ /* CONF_GPMC_A1 */ /* CONF_GPMC_A2 */ /* CONF_GPMC_A3 */ /* CONF_GPMC_A4 */ /* CONF_GPMC_A5 */ /* CONF_GPMC_A6 */ /* CONF_GPMC_A7 */ /* CONF_GPMC_A8 */ /* CONF_GPMC_A9 */ /* CONF_GPMC_A10 */ /* CONF_GPMC_A11 */ /* CONF_GPMC_WAIT0 */ /* CONF_GPMC_WPN */ /* CONF_GPMC_BE1N */ /* CONF_GPMC_CSN0 */ /* CONF_GPMC_CSN1 */ /* CONF_GPMC_CSN2 */ /* CONF_GPMC_CSN3 */ /* CONF_GPMC_CLK */ /* CONF_GPMC_ADVN_ALE */ /* CONF_GPMC_OEN_REN */ /* CONF_GPMC_WEN */ /* CONF_GPMC_BE0N_CLE */ /* CONF_LCD_DATA0 */ /* CONF_LCD_DATA1 */ /* CONF_LCD_DATA2 */ /* CONF_LCD_DATA3 */ /* CONF_LCD_DATA4 */ /* CONF_LCD_DATA5 */ /* CONF_LCD_DATA6 */ /* CONF_LCD_DATA7 */ /* CONF_LCD_DATA8 */ /* CONF_LCD_DATA9 */ /* CONF_LCD_DATA10 */ /* CONF_LCD_DATA11 */ /* CONF_LCD_DATA12 */ /* CONF_LCD_DATA13 */ /* CONF_LCD_DATA14 */ /* CONF_LCD_DATA15 */ /* CONF_LCD_DATA16 */ /* CONF_LCD_DATA17 */ /* CONF_LCD_DATA18 */ /* CONF_LCD_DATA19 */ /* CONF_LCD_DATA20 */ /* CONF_LCD_DATA21 */ /* CONF_LCD_DATA22 */ /* CONF_LCD_DATA20 */ /* CONF_LCD_VSYNC */ /* CONF_LCD_HSYNC */ /* CONF_LCD_PCLK */ /* CONF_LCD_AC_BIAS_EN */ /* CONF_MMC0_DAT3 */ /* CONF_MMC0_DAT2 */ /* CONF_MMC0_DAT1 */ /* CONF_MMC0_DAT0 */ /* CONF_MMC0_CLK */ /* CONF_MMC0_CMD */ /* CONF_MII1_COL */ /* CONF_MII1_CRS */ /* CONF_MII1_RXERR */ /* CONF_MII1_TXEN */ /* CONF_MII1_RXDV */ /* CONF_MII1_TXD3 */ /* CONF_MII1_TXD2 */ /* CONF_MII1_TXD1 */ /* CONF_MII1_TXD0 */ /* CONF_MII1_TXCLK */ /* CONF_MII1_RXCLK */ /* CONF_MII1_RXD3 */ /* CONF_MII1_RXD2 */ /* CONF_MII1_RXD1 */ /* CONF_MII1_RXD0 */ /* CONF_RMII1_REFCLK */ /* CONF_MDIO_DATA */ /* CONF_MDIO_CLK */ /* CONF_SPI0_SCLK */ /* CONF_SPI0_D0 */ /* CONF_SPI0_D1 */ /* CONF_SPI0_CS0 */ /* CONF_SPI0_CS1 */ /* CONF_ECAP0_IN_PWM0_OUT */ /* CONF_UART0_CTSN */ /* CONF_UART0_RTSN */ /* CONF_UART0_RXD */ /* CONF_UART0_TXD */ /* CONF_UART1_CTSN */ /* CONF_UART1_RTSN */ /* CONF_UART1_RXD */ /* CONF_UART1_TXD */ /* CONF_I2C0_SDA */ /* CONF_I2C0_SCL */ /* CONF_I2C0_SDA */ /* CONF_I2C0_SCL */ /* CONF_MCASP0_ACLKX */ /* CONF_MCASP0_FSX */ /* CONF_MCASP0_AXR0 */ /* CONF_MCASP0_AHCLKR */ /* CONF_MCASP0_ACLKR */ /* CONF_MCASP0_FSR */ /* CONF_MCASP0_AXR1 */ /* CONF_MCASP0_AHCLKX */ /* CONF_XDMA_EVENT_INTR0 */ /* CONF_XDMA_EVENT_INTR1 */ /* CONF_NRESETIN_OUT */ /* CONF_PORZ */ /* CONF_NNMI */ /* CONF_OSC0_IN */ /* CONF_OSC0_OUT */ /* CONF_OSC0_VSS */ /* CONF_TMS */ /* CONF_TDI */ /* CONF_TDO */ /* CONF_TCK */ /* CONF_NTRST */ /* CONF_EMU0 */ /* CONF_EMU1 */ /* CONF_OSC1_IN */ /* CONF_OSC1_OUT */ /* CONF_OSC1_VSS */ /* CONF_RTC_PORZ */ /* CONF_PMIC_POWER_EN */ /* CONF_EXT_WAKEUP */ /* CONF_ENZ_KALDO_1P8V */ /* CONF_USB0_DM */ /* CONF_USB0_DP */ /* CONF_USB0_CE */ /* CONF_USB0_ID */ /* CONF_USB0_VBUS */ /* CONF_USB0_DRVVBUS */ /* CONF_USB1_DM */ /* CONF_USB1_DP */ /* CONF_USB1_CE */ /* CONF_USB1_ID */ /* CONF_USB1_VBUS */ /* CONF_USB1_DRVVBUS */ /* CONF_DDR_RESETN */ /* CONF_DDR_CSN0 */ /* CONF_DDR_CKE */ /* CONF_DDR_NCK */ /* CONF_DDR_CASN */ /* CONF_DDR_RASN */ /* CONF_DDR_WEN */ /* CONF_DDR_BA0 */ /* CONF_DDR_BA1 */ /* CONF_DDR_BA2 */ /* CONF_DDR_A0 */ /* CONF_DDR_A1 */ /* CONF_DDR_A2 */ /* CONF_DDR_A3 */ /* CONF_DDR_A4 */ /* CONF_DDR_A5 */ /* CONF_DDR_A6 */ /* CONF_DDR_A7 */ /* CONF_DDR_A8 */ /* CONF_DDR_A9 */ /* CONF_DDR_A10 */ /* CONF_DDR_A11 */ /* CONF_DDR_A12 */ /* CONF_DDR_A13 */ /* CONF_DDR_A14 */ /* CONF_DDR_A15 */ /* CONF_DDR_ODT */ /* CONF_DDR_D0 */ /* CONF_DDR_D1 */ /* CONF_DDR_D2 */ /* CONF_DDR_D3 */ /* CONF_DDR_D4 */ /* CONF_DDR_D5 */ /* CONF_DDR_D6 */ /* CONF_DDR_D7 */ /* CONF_DDR_D8 */ /* CONF_DDR_D9 */ /* CONF_DDR_D10 */ /* CONF_DDR_D11 */ /* CONF_DDR_D12 */ /* CONF_DDR_D13 */ /* CONF_DDR_D14 */ /* CONF_DDR_D15 */ /* CONF_DDR_DQM0 */ /* CONF_DDR_DQM1 */ /* CONF_DDR_DQS0 */ /* CONF_DDR_DQSN0 */ /* CONF_DDR_DQS1 */ /* CONF_DDR_DQSN1 */ /* CONF_DDR_VREF */ /* CONF_DDR_VTP */ /* CONF_DDR_STRBEN0 */ /* CONF_DDR_STRBEN1 */ /* CONF_AIN7 */ /* CONF_AIN6 */ /* CONF_AIN5 */ /* CONF_AIN4 */ /* CONF_AIN3 */ /* CONF_AIN2 */ /* CONF_AIN1 */ /* CONF_AIN0 */ /* CONF_VREFP */ /* CONF_VREFN */ /* CONF_AVDD */ /* CONF_AVSS */ /* CONF_IFORCE */ /* CONF_VSENSE */ /* CONF_TESTOUT */ /* CQDETECT_STATUS */ /* DDR_IO_CTRL */ /* VTP_CTRL */ /* VREF_CTRL */ /* SERDES_REFCLK_CTL */ /* TPCC_EVT_MUX_0_3 */ /* TPCC_EVT_MUX_4_7 */ /* TPCC_EVT_MUX_8_11 */ /* TPCC_EVT_MUX_12_15 */ /* TPCC_EVT_MUX_16_19 */ /* TPCC_EVT_MUX_20_23 */ /* TPCC_EVT_MUX_24_27 */ /* TPCC_EVT_MUX_28_31 */ /* TPCC_EVT_MUX_32_35 */ /* TPCC_EVT_MUX_36_39 */ /* TPCC_EVT_MUX_40_43 */ /* TPCC_EVT_MUX_44_47 */ /* TPCC_EVT_MUX_48_51 */ /* TPCC_EVT_MUX_52_55 */ /* TPCC_EVT_MUX_56_59 */ /* TPCC_EVT_MUX_60_63 */ /* TIMER_EVT_CAPT */ /* ECAP_EVT_CAPT */ /* ADC_EVT_CAPT */ /* RESET_ISO */ /* SMA0 */ /* DDR_CKE_CTRL */ /* SMA2 */ /* M3_TXEV_EOI */ /* IPC_MSG_REG0 */ /* IPC_MSG_REG1 */ /* IPC_MSG_REG2 */ /* IPC_MSG_REG3 */ /* IPC_MSG_REG4 */ /* IPC_MSG_REG5 */ /* IPC_MSG_REG6 */ /* IPC_MSG_REG7 */ /* DDR_CMD0_IOCTRL */ /* DDR_CMD1_IOCTRL */ /* DDR_CMD2_IOCTRL */ /* DDR_DATA0_IOCTRL */ /* DDR_DATA1_IOCTRL */ /* DDR_DATA2_IOCTRL */ /* DDR_DATA3_IOCTRL */ /* DDR_DATA4_IOCTRL */ /** ============================================================================ * \file soc_AM33XX.h * * \brief This file contains the peripheral information for AM33XX SoC * * ============================================================================ */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /** Cache Line size in ARM Cortex-A8. */ /** @brief Base address of AINTC memory mapped registers */ /** @brief Base addresses of UART memory mapped registers */ /** @brief Base addresses of USB memory mapped registers */ /** @brief Base addresses of SPI memory mapped registers */ /** @brief Base addresses of GPIO memory mapped registers */ /** @brief Base addresses of DMTIMER memory mapped registers */ /** @brief Base address of MMC memory mapped registers */ /** @brief Base address of GPMC memory mapped registers */ /** @brief Base address of GPMC memory mapped registers */ /** @brief Base address of I2C memory mapped registers */ /** @brief Base address of Timer 1ms memory mapped registers */ /** @brief Base address of WDT memory mapped registers */ /** @brief Base address of WDT memory mapped registers */ /** @brief Base address of McASP memory mapped registers */ /** @brief Base address of EMIF memory mapped registers */ /** @brief Base addresses of RTC memory mapped registers */ /** @brief Base addresses of PRCM memory mapped registers */ /** @brief Base address of control module memory mapped registers */ /** @brief Base address of Channel controller memory mapped registers */ /** @brief Base address of DCAN module memory mapped registers */ /******************************************************************************* Parameterizable Configuration:- These are fed directly from the RTL * parameters for the given SOC \******************************************************************************/ /** @brief Base addresses of PWMSS memory mapped registers. */ /** * \file evmAM335x.h * * \brief This file contains prototype declarations of functions which * performs EVM configurations. */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /***************************************************************************** ** INTERNAL MACRO DEFINITIONS *****************************************************************************/ /* ** Structure to map selection of IO Pad for power down configuration */ typedef struct ioPadMap { unsigned int ioPad; unsigned int sel; }tIOPadMap; /* ** Structure to store the control register context. More registers ** can be added to this if need to be saved. */ typedef struct ctrlRegContext { unsigned int pwmssctrl; unsigned int gmiisel; tIOPadMap ioPadMap[(211)]; }CTRLREGCONTEXT; /***************************************************************************** ** FUNCTION PROTOTYPES *****************************************************************************/ extern unsigned int BoardInfoCheck(unsigned char *boardId, unsigned char *boardVer); extern void ControlRegContextSave(CTRLREGCONTEXT *contextPtr); extern void ControlRegContextRestore(CTRLREGCONTEXT *contextPtr); extern void EVMMACAddrGet(unsigned int addrIdx, unsigned char *macAddr); extern int McSPIPinMuxSetup(unsigned int instanceNum); extern int McSPI0CSPinMuxSetup(unsigned int csPinNum); extern void UARTPinMuxSetup(unsigned int instanceNum); extern unsigned int I2CPinMuxSetup(unsigned int instanceNum); extern void I2C0ModuleClkConfig(void); extern void I2C1ModuleClkConfig(void); extern void EDMAModuleClkConfig(void); extern unsigned int RTCRevisionInfoGet(void); extern void DMTimer2ModuleClkConfig(void); extern void DMTimer3ModuleClkConfig(void); extern void DMTimer4ModuleClkConfig(void); extern void DMTimer5_Module_Clk_Config(void); extern void DMTimer6ModuleClkConfig(void); extern void DMTimer7ModuleClkConfig(void); void DMTimer_1ms_Module_Clk_Config(void); extern void EVMPortRGMIIModeSelect(void); extern void McSPI0ModuleClkConfig(void); extern void McSPI1_Module_Clk_Config(void); extern unsigned int EVMProfileGet(void); extern unsigned int McASP1PinMuxSetup(void); extern void McASP0ModuleClkConfig(void); extern void McASP1ModuleClkConfig(void); extern unsigned int CPSWPinMuxSetup(void); extern unsigned int LCDPinMuxSetup(void); extern unsigned int GPIO0Pin6PinMuxSetup(void); extern unsigned int GPIO1Pin2PinMuxSetup(void); extern unsigned int GPIO0Pin2PinMuxSetup(void); extern unsigned int GPIO1PinMuxSetup(unsigned int pinNo); extern unsigned int GPIO1Pin30PinMuxSetup(void); extern void GPIO0ModuleClkConfig(void); extern void GPIO1ModuleClkConfig(void); extern void GPIO2_Module_Clk_Config(void); extern void GPIO3_Module_Clk_Config(void); extern void UART0ModuleClkConfig(void); extern void UART1_Module_Clk_Config(void); extern void UART2_Module_Clk_Config(void); extern void UART3_Module_Clk_Config(void); void UART_Baud_Rate_Set(unsigned long base_addr,unsigned long baud); extern void RTCModuleClkConfig(void); extern void EEPROMI2CSetUp(unsigned int slaveAddr); extern void EEPROMI2CRead(unsigned char *data, unsigned int length, unsigned short offset); extern unsigned int ECAPPinMuxSetup(unsigned int instanceNum); extern void WatchdogTimer1ModuleClkConfig(void); extern unsigned int RTCRevisionInfoGet(void); extern void DMTimer2ModuleClkConfig(void); extern unsigned int GPIO1Pin16PinMuxSetup(void); extern unsigned int EVMProfileGet(void); extern void GPIO1ModuleClkConfig(void); extern void LCDModuleClkConfig(void); extern unsigned int LCDPinMuxSetup(void); extern void LCDBackLightEnable(void); extern void TSCADCModuleClkConfig(void); extern void LCDBackLightDisable(void); extern void PWMSSModuleClkConfig(unsigned int instanceNum); extern unsigned int GPIO0Pin7PinMuxSetup(void); extern void CPSWClkEnable(void); extern unsigned int EPWM2PinMuxSetup(void); extern void PWMSSClockEnable(unsigned int instance, unsigned int module); extern unsigned int NANDPinMuxSetup(void); extern void GPMCClkConfig(void); extern unsigned int GPIO1Pin23PinMuxSetup(void); extern void EPWMSSModuleClkConfig(unsigned int instanceNum); extern unsigned int GPIO0Pin19PinMuxSetup(void); extern unsigned int GPIO1Pin28PinMuxSetup(void); extern void HSMMCSDModuleClkConfig(void); extern unsigned int HSMMCSDPinMuxSetup(void); extern unsigned int TSCADCPinMuxSetUp(void); extern void UPDNPinControl(void); extern unsigned int DCANPinMuxSetUp(unsigned int instanceNum); extern void DCANMsgRAMInit(unsigned int instanceNum); extern void DCANModuleClkConfig(void); extern void USB0ModuleClkConfig(void); extern void USBModuleClkEnable(unsigned int ulIndex, unsigned int ulBase); extern void USBModuleClkDisable(unsigned int ulIndex, unsigned int ulBase); extern unsigned int GPIO0PinMuxSetup(unsigned int pinNum); extern unsigned int GPIO1Pin20PinMuxSetup(void); extern unsigned int GPIO2Pin24PinMuxSetup(void); extern void PWMSSTBClkEnable(unsigned int); extern void PWMSSClockStop(unsigned int instance, unsigned int module); extern unsigned int PWMSSClockStopStatusGet(unsigned int instance, unsigned int module); unsigned int PWMSSClockEnableStatusGet(unsigned int instance, unsigned int module); extern void IOPadContextSave(CTRLREGCONTEXT *contextPtr, unsigned int ioPadOff); extern void IOPadContextRestore(CTRLREGCONTEXT *contextPtr, unsigned int ioPadOff); void IOPadConfigure(unsigned int ioPadOff, unsigned int ioPadValue); void IOPadSelConfigure(CTRLREGCONTEXT *contextPtr, unsigned int ioPadValue); void IOPadSel(CTRLREGCONTEXT *contextPtr, unsigned int ioPadOff, unsigned int ioPadSel); void GpioPinMuxSetup(unsigned int offsetAddr, unsigned int padConfValue); /******************************** End of file *******************************/ /* ************************************************************************************************************************ * uC/OS-III * The Real-Time Kernel * * (c) Copyright 2009-2011; Micrium, Inc.; Weston, FL * All rights reserved. Protected by international copyright laws. * * File : OS.H * By : JJL * Version : V3.02.00 * * LICENSING TERMS: * --------------- * uC/OS-III is provided in source form for FREE short-term evaluation, for educational use or * for peaceful research. If you plan or intend to use uC/OS-III in a commercial application/ * product then, you need to contact Micrium to properly license uC/OS-III for its use in your * application/product. We provide ALL the source code for your convenience and to help you * experience uC/OS-III. The fact that the source is provided does NOT mean that you can use * it commercially without paying a licensing fee. * * Knowledge of the source code may NOT be used to develop a similar product. * * Please help us continue to provide the embedded community with the finest software available. * Your honesty is greatly appreciated. * * You can contact us at www.micrium.com, or by phone at +1 (954) 217-2036. ************************************************************************************************************************ * Note(s) : (1) Assumes the following versions (or more recent) of software modules are included in the project build: * * (a) uC/LIB V1.26 * (b) uC/CPU V1.25 ************************************************************************************************************************ */ /* ************************************************************************************************************************ * uC/OS-III VERSION NUMBER ************************************************************************************************************************ */ /* ************************************************************************************************************************ * INCLUDE HEADER FILES ************************************************************************************************************************ */ /* ************************************************************************************************************************ * uC/OS-III * The Real-Time Kernel * * (c) Copyright 2009-2012; Micrium, Inc.; Weston, FL * All rights reserved. Protected by international copyright laws. * * CONFIGURATION FILE * * File : OS_CFG.H * By : JJL * Version : V3.03.00 * * LICENSING TERMS: * --------------- * uC/OS-III is provided in source form for FREE short-term evaluation, for educational use or * for peaceful research. If you plan or intend to use uC/OS-III in a commercial application/ * product then, you need to contact Micrium to properly license uC/OS-III for its use in your * application/product. We provide ALL the source code for your convenience and to help you * experience uC/OS-III. The fact that the source is provided does NOT mean that you can use * it commercially without paying a licensing fee. * * Knowledge of the source code may NOT be used to develop a similar product. * * Please help us continue to provide the embedded community with the finest software available. * Your honesty is greatly appreciated. * * You can contact us at www.micrium.com, or by phone at +1 (954) 217-2036. ************************************************************************************************************************ */ /* ---------------------------- MISCELLANEOUS -------------------------- */ /* ----------------------------- EVENT FLAGS --------------------------- */ /* -------------------------- MEMORY MANAGEMENT ------------------------ */ /* --------------------- MUTUAL EXCLUSION SEMAPHORES ------------------- */ /* --------------------------- MESSAGE QUEUES -------------------------- */ /* ----------------------------- SEMAPHORES ---------------------------- */ /* -------------------------- TASK MANAGEMENT -------------------------- */ /* -------------------------- TIME MANAGEMENT -------------------------- */ /* ------------------- TASK LOCAL STORAGE MANAGEMENT ------------------- */ /* ------------------------- TIMER MANAGEMENT -------------------------- */ /* ********************************************************************************************************* * uC/CPU * CPU CONFIGURATION & PORT LAYER * * (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/CPU is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * CPU PORT FILE * * ARM Cortex-A8 * CODE COMPOSER STUDIO (CCS) * * Filename : cpu.h * Version : V1.28.00.00 * Programmer(s) : FT ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE ********************************************************************************************************* */ /* ********************************************************************************************************* * CPU INCLUDE FILES * * Note(s) : (1) The following CPU files are located in the following directories : * * (a) \\cpu_cfg.h * * (b) \\cpu_def.h * * (c) \\\\cpu*.* * * where * directory path for Your Product's Application * directory path for common CPU-compiler software * directory name for specific CPU * directory name for specific compiler * * (2) Compiler MUST be configured to include the '\\' directory the * specific CPU-compiler directory, & '\\' as additional include * path directories. * * (3) Since NO custom library modules are included, 'cpu.h' may ONLY use configurations from * CPU configuration file 'cpu_cfg.h' that do NOT reference any custom library definitions. * * In other words, 'cpu.h' may use 'cpu_cfg.h' configurations that are #define'd to numeric * constants or to NULL (i.e. NULL-valued #define's); but may NOT use configurations to * custom library #define's (e.g. DEF_DISABLED or DEF_ENABLED). ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/CPU * CPU CONFIGURATION & PORT LAYER * * (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/CPU is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * CPU CONFIGURATION DEFINES * * Filename : cpu_def.h * Version : V1.29.01 * Programmer(s) : ITJ ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE * * Note(s) : (1) This CPU definition header file is protected from multiple pre-processor inclusion * through use of the CPU definition module present pre-processor macro definition. ********************************************************************************************************* */ /* ********************************************************************************************************* * CORE CPU MODULE VERSION NUMBER * * Note(s) : (1) (a) The core CPU module software version is denoted as follows : * * Vx.yy.zz * * where * V denotes 'Version' label * x denotes major software version revision number * yy denotes minor software version revision number * zz denotes sub-minor software version revision number * * (b) The software version label #define is formatted as follows : * * ver = x.yyzz * 100 * 100 * * where * ver denotes software version number scaled as an integer value * x.yyzz denotes software version number, where the unscaled integer * portion denotes the major version number & the unscaled * fractional portion denotes the (concatenated) minor * version numbers ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * CPU WORD CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_ADDR_SIZE & CPU_CFG_DATA_SIZE in 'cpu.h' with CPU's word sizes : * * CPU_WORD_SIZE_08 8-bit word size * CPU_WORD_SIZE_16 16-bit word size * CPU_WORD_SIZE_32 32-bit word size * CPU_WORD_SIZE_64 64-bit word size * * (2) Configure CPU_CFG_ENDIAN_TYPE in 'cpu.h' with CPU's data-word-memory order : * * (a) CPU_ENDIAN_TYPE_BIG Big- endian word order (CPU words' most significant * octet @ lowest memory address) * (b) CPU_ENDIAN_TYPE_LITTLE Little-endian word order (CPU words' least significant * octet @ lowest memory address) ********************************************************************************************************* */ /* ---------------------- CPU WORD SIZE ----------------------- */ /* ------------------ CPU WORD-ENDIAN ORDER ------------------- */ /* ********************************************************************************************************* * CPU STACK CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_STK_GROWTH in 'cpu.h' with CPU's stack growth order : * * (a) CPU_STK_GROWTH_LO_TO_HI CPU stack pointer increments to the next higher stack * memory address after data is pushed onto the stack * (b) CPU_STK_GROWTH_HI_TO_LO CPU stack pointer decrements to the next lower stack * memory address after data is pushed onto the stack ********************************************************************************************************* */ /* ------------------ CPU STACK GROWTH ORDER ------------------ */ /*$PAGE*/ /* ********************************************************************************************************* * CRITICAL SECTION CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_CRITICAL_METHOD with CPU's/compiler's critical section method : * * Enter/Exit critical sections by ... * * CPU_CRITICAL_METHOD_INT_DIS_EN Disable/Enable interrupts * CPU_CRITICAL_METHOD_STATUS_STK Push/Pop interrupt status onto stack * CPU_CRITICAL_METHOD_STATUS_LOCAL Save/Restore interrupt status to local variable * * (a) CPU_CRITICAL_METHOD_INT_DIS_EN is NOT a preferred method since it does NOT support * multiple levels of interrupts. However, with some CPUs/compilers, this is the only * available method. * * (b) CPU_CRITICAL_METHOD_STATUS_STK is one preferred method since it supports multiple * levels of interrupts. However, this method assumes that the compiler provides C-level * &/or assembly-level functionality for the following : * * ENTER CRITICAL SECTION : * (1) Push/save interrupt status onto a local stack * (2) Disable interrupts * * EXIT CRITICAL SECTION : * (3) Pop/restore interrupt status from a local stack * * (c) CPU_CRITICAL_METHOD_STATUS_LOCAL is one preferred method since it supports multiple * levels of interrupts. However, this method assumes that the compiler provides C-level * &/or assembly-level functionality for the following : * * ENTER CRITICAL SECTION : * (1) Save interrupt status into a local variable * (2) Disable interrupts * * EXIT CRITICAL SECTION : * (3) Restore interrupt status from a local variable * * (2) Critical section macro's most likely require inline assembly. If the compiler does NOT * allow inline assembly in C source files, critical section macro's MUST call an assembly * subroutine defined in a 'cpu_a.asm' file located in the following software directory : * * \\\* * where * directory path for common CPU-compiler software * directory name for specific CPU * directory name for specific compiler * * (3) (a) To save/restore interrupt status, a local variable 'cpu_sr' of type 'CPU_SR' MAY need * to be declared (e.g. if 'CPU_CRITICAL_METHOD_STATUS_LOCAL' method is configured). * * (1) 'cpu_sr' local variable SHOULD be declared via the CPU_SR_ALLOC() macro which, * if used, MUST be declared following ALL other local variables (see any 'cpu.h * CRITICAL SECTION CONFIGURATION Note #3a1'). * * Example : * * void Fnct (void) * { * CPU_INT08U val_08; * CPU_INT16U val_16; * CPU_INT32U val_32; * CPU_SR_ALLOC(); MUST be declared after ALL other local variables * : * : * } * * (b) Configure 'CPU_SR' data type with the appropriate-sized CPU data type large enough to * completely store the CPU's/compiler's status word. ********************************************************************************************************* */ /* --------------- CPU CRITICAL SECTION METHODS --------------- */ /*$PAGE*/ /* ********************************************************************************************************* * MODULE END * * Note(s) : (1) See 'cpu_def.h MODULE'. ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/CPU * CPU CONFIGURATION & PORT LAYER * * (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/CPU is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * CPU CONFIGURATION FILE * * TEMPLATE * * Filename : cpu_cfg.h * Version : V1.28.00 * Programmer(s) : SR * ITJ ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE ********************************************************************************************************* */ /* ********************************************************************************************************* * CPU NAME CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_NAME_EN to enable/disable CPU host name feature : * * (a) CPU host name storage * (b) CPU host name API functions * * (2) Configure CPU_CFG_NAME_SIZE with the desired ASCII string size of the CPU host name, * including the terminating NULL character. * * See also 'cpu_core.h GLOBAL VARIABLES Note #1'. ********************************************************************************************************* */ /* Configure CPU host name feature (see Note #1) : */ /* DEF_DISABLED CPU host name DISABLED */ /* DEF_ENABLED CPU host name ENABLED */ /* Configure CPU host name ASCII string size ... */ /*$PAGE*/ /* ********************************************************************************************************* * CPU TIMESTAMP CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_TS_xx_EN to enable/disable CPU timestamp features : * * (a) CPU_CFG_TS_32_EN enable/disable 32-bit CPU timestamp feature * (b) CPU_CFG_TS_64_EN enable/disable 64-bit CPU timestamp feature * * (2) (a) Configure CPU_CFG_TS_TMR_SIZE with the CPU timestamp timer's word size : * * CPU_WORD_SIZE_08 8-bit word size * CPU_WORD_SIZE_16 16-bit word size * CPU_WORD_SIZE_32 32-bit word size * CPU_WORD_SIZE_64 64-bit word size * * (b) If the size of the CPU timestamp timer is not a binary multiple of 8-bit octets * (e.g. 20-bits or even 24-bits), then the next lower, binary-multiple octet word * size SHOULD be configured (e.g. to 16-bits). However, the minimum supported word * size for CPU timestamp timers is 8-bits. * * See also 'cpu_core.h FUNCTION PROTOTYPES CPU_TS_TmrRd() Note #2a'. ********************************************************************************************************* */ /* Configure CPU timestamp features (see Note #1) : */ /* DEF_DISABLED CPU timestamps DISABLED */ /* DEF_ENABLED CPU timestamps ENABLED */ /* Configure CPU timestamp timer word size ... */ /* ... (see Note #2) : */ /* ********************************************************************************************************* * CPU INTERRUPTS DISABLED TIME MEASUREMENT CONFIGURATION * * Note(s) : (1) (a) Configure CPU_CFG_INT_DIS_MEAS_EN to enable/disable measuring CPU's interrupts * disabled time : * * (a) Enabled, if CPU_CFG_INT_DIS_MEAS_EN #define'd in 'cpu_cfg.h' * * (b) Disabled, if CPU_CFG_INT_DIS_MEAS_EN NOT #define'd in 'cpu_cfg.h' * * See also 'cpu_core.h FUNCTION PROTOTYPES Note #1'. * * (b) Configure CPU_CFG_INT_DIS_MEAS_OVRHD_NBR with the number of times to measure & * average the interrupts disabled time measurements overhead. * * Recommend a single (1) overhead time measurement, even for instruction-cache-enabled * CPUs, since critical sections are NOT typically called within instruction-cached loops. * Thus, a single non-cached/non-averaged time measurement is a more realistic overhead * for the majority of non-cached interrupts disabled time measurements. * * See also 'cpu_core.c CPU_IntDisMeasInit() Note #3a'. ********************************************************************************************************* */ /* Configure number of interrupts disabled overhead ... */ /*$PAGE*/ /* ********************************************************************************************************* * CPU COUNT LEADING ZEROS CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_LEAD_ZEROS_ASM_PRESENT to prototype/define count leading zeros bits * function(s) in : * * (a) 'cpu.h'/'cpu_a.asm', if CPU_CFG_LEAD_ZEROS_ASM_PRESENT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable assembly-version function * * (b) 'cpu_core.h'/'cpu_core.c', if CPU_CFG_LEAD_ZEROS_ASM_PRESENT NOT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable C-source-version function otherwise * * See also 'cpu_core.h FUNCTION PROTOTYPES Note #2'. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * MODULE END ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * CONFIGURE STANDARD DATA TYPES * * Note(s) : (1) Configure standard data types according to CPU-/compiler-specifications. * * (2) (a) (1) 'CPU_FNCT_VOID' data type defined to replace the commonly-used function pointer * data type of a pointer to a function which returns void & has no arguments. * * (2) Example function pointer usage : * * CPU_FNCT_VOID FnctName; * * FnctName(); * * (b) (1) 'CPU_FNCT_PTR' data type defined to replace the commonly-used function pointer * data type of a pointer to a function which returns void & has a single void * pointer argument. * * (2) Example function pointer usage : * * CPU_FNCT_PTR FnctName; * void *p_obj * * FnctName(p_obj); ********************************************************************************************************* */ typedef void CPU_VOID; typedef char CPU_CHAR; /* 8-bit character */ typedef unsigned char CPU_BOOLEAN; /* 8-bit boolean or logical */ typedef unsigned char CPU_INT08U; /* 8-bit unsigned integer */ typedef signed char CPU_INT08S; /* 8-bit signed integer */ typedef unsigned short CPU_INT16U; /* 16-bit unsigned integer */ typedef signed short CPU_INT16S; /* 16-bit signed integer */ typedef unsigned int CPU_INT32U; /* 32-bit unsigned integer */ typedef signed int CPU_INT32S; /* 32-bit signed integer */ typedef unsigned long long CPU_INT64U; /* 64-bit unsigned integer */ typedef signed long long CPU_INT64S; /* 64-bit signed integer */ typedef float CPU_FP32; /* 32-bit floating point */ typedef double CPU_FP64; /* 64-bit floating point */ typedef volatile CPU_INT08U CPU_REG08; /* 8-bit register */ typedef volatile CPU_INT16U CPU_REG16; /* 16-bit register */ typedef volatile CPU_INT32U CPU_REG32; /* 32-bit register */ typedef volatile CPU_INT64U CPU_REG64; /* 64-bit register */ typedef void (*CPU_FNCT_VOID)(void); /* See Note #2a. */ typedef void (*CPU_FNCT_PTR )(void *p_obj); /* See Note #2b. */ /*$PAGE*/ /* ********************************************************************************************************* * CPU WORD CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_ADDR_SIZE & CPU_CFG_DATA_SIZE with CPU's word sizes : * * CPU_WORD_SIZE_08 8-bit word size * CPU_WORD_SIZE_16 16-bit word size * CPU_WORD_SIZE_32 32-bit word size * CPU_WORD_SIZE_64 64-bit word size See Note #1a * * (a) 64-bit word size NOT currently supported. * * (2) Configure CPU_CFG_ENDIAN_TYPE with CPU's data-word-memory order : * * (a) CPU_ENDIAN_TYPE_BIG Big- endian word order (CPU words' most significant * octet @ lowest memory address) * (b) CPU_ENDIAN_TYPE_LITTLE Little-endian word order (CPU words' least significant * octet @ lowest memory address) * * (3) '__LITTLE_ENDIAN__' is an IAR compiler #define that reflects the '--endian' option, * indicating the data word-memory order : * * (a) '0' for big endian word-memory order * (b) '1' for little endian word-memory order ********************************************************************************************************* */ /* Define CPU word sizes (see Note #1) : */ /* Defines CPU data word-memory order (see Note #2). */ /* ********************************************************************************************************* * CONFIGURE CPU ADDRESS & DATA TYPES ********************************************************************************************************* */ /* CPU address type based on address bus size. */ typedef CPU_INT32U CPU_ADDR; /* CPU data type based on data bus size. */ typedef CPU_INT32U CPU_DATA; typedef CPU_DATA CPU_ALIGN; /* Defines CPU data-word-alignment size. */ typedef CPU_ADDR CPU_SIZE_T; /* Defines CPU standard 'size_t' size. */ /* ********************************************************************************************************* * CPU STACK CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_STK_GROWTH in 'cpu.h' with CPU's stack growth order : * * (a) CPU_STK_GROWTH_LO_TO_HI CPU stack pointer increments to the next higher stack * memory address after data is pushed onto the stack * (b) CPU_STK_GROWTH_HI_TO_LO CPU stack pointer decrements to the next lower stack * memory address after data is pushed onto the stack ********************************************************************************************************* */ typedef CPU_INT32U CPU_STK; /* Defines CPU stack word size (in octets). */ typedef CPU_ADDR CPU_STK_SIZE; /* Defines CPU stack size (in number of CPU_STKs). */ /*$PAGE*/ /* ********************************************************************************************************* * CRITICAL SECTION CONFIGURATION * * Note(s) : (1) Configure CPU_CFG_CRITICAL_METHOD with CPU's/compiler's critical section method : * * Enter/Exit critical sections by ... * * CPU_CRITICAL_METHOD_INT_DIS_EN Disable/Enable interrupts * CPU_CRITICAL_METHOD_STATUS_STK Push/Pop interrupt status onto stack * CPU_CRITICAL_METHOD_STATUS_LOCAL Save/Restore interrupt status to local variable * * (a) CPU_CRITICAL_METHOD_INT_DIS_EN is NOT a preferred method since it does NOT support * multiple levels of interrupts. However, with some CPUs/compilers, this is the only * available method. * * (b) CPU_CRITICAL_METHOD_STATUS_STK is one preferred method since it supports multiple * levels of interrupts. However, this method assumes that the compiler provides C-level * &/or assembly-level functionality for the following : * * ENTER CRITICAL SECTION : * (1) Push/save interrupt status onto a local stack * (2) Disable interrupts * * EXIT CRITICAL SECTION : * (3) Pop/restore interrupt status from a local stack * * (c) CPU_CRITICAL_METHOD_STATUS_LOCAL is one preferred method since it supports multiple * levels of interrupts. However, this method assumes that the compiler provides C-level * &/or assembly-level functionality for the following : * * ENTER CRITICAL SECTION : * (1) Save interrupt status into a local variable * (2) Disable interrupts * * EXIT CRITICAL SECTION : * (3) Restore interrupt status from a local variable * * (2) Critical section macro's most likely require inline assembly. If the compiler does NOT * allow inline assembly in C source files, critical section macro's MUST call an assembly * subroutine defined in a 'cpu_a.asm' file located in the following software directory : * * \\\* * where * directory path for common CPU-compiler software * directory name for specific CPU * directory name for specific compiler * * (3) (a) To save/restore interrupt status, a local variable 'cpu_sr' of type 'CPU_SR' MAY need * to be declared (e.g. if 'CPU_CRITICAL_METHOD_STATUS_LOCAL' method is configured). * * (1) 'cpu_sr' local variable SHOULD be declared via the CPU_SR_ALLOC() macro which, if * used, MUST be declared following ALL other local variables. * * Example : * * void Fnct (void) * { * CPU_INT08U val_08; * CPU_INT16U val_16; * CPU_INT32U val_32; * CPU_SR_ALLOC(); MUST be declared after ALL other local variables * : * : * } * * (b) Configure 'CPU_SR' data type with the appropriate-sized CPU data type large enough to * completely store the CPU's/compiler's status word. ********************************************************************************************************* */ /*$PAGE*/ /* Configure CPU critical method (see Note #1) : */ typedef CPU_INT32U CPU_SR; /* Defines CPU status register size (see Note #3b). */ /* Allocates CPU status register word (see Note #3a). */ /* Disable interrupts, ... */ /* & start interrupts disabled time measurement.*/ /* Stop & measure interrupts disabled time, */ /* ... & re-enable interrupts. */ /*$PAGE*/ /* ********************************************************************************************************* * ARM EXCEPTIONS VECTORS * * Note(s) : (1) Exceptions are taken whenever the normal flow of a program MUST temporarily halt, * for example, to service an interrupt from a peripheral. The ARM architecture has * the following execption vectors. * * CPU_ARM_EXCEPT_RST Reset exception. * CPU_ARM_EXCEPT_UND Undefined instruction. * CPU_ARM_EXCEPT_SWI Software interrupt. * CPU_ARM_EXCEPT_ABORT_PREFETCH Prefetch Abort. * CPU_ARM_EXCEPT_ABORT_DATA Data Abort. * CPU_ARM_EXCEPT_IRQ Interrupt request. * CPU_ARM_EXCEPT_FIQ Fast Interrupt Request. ********************************************************************************************************* */ /* ********************************************************************************************************* * ARM CORTEX-A8 PROGRAM STATUS REGISTER BIT & BIT-FIELDS DEFINES ********************************************************************************************************* */ /* ********************************************************************************************************* * ARM CORTEX-A8 FLOATING POINT UNIT BIT DEFINES ********************************************************************************************************* */ /* ********************************************************************************************************* * ARM CORTEX-A8 EVENTS AND PERFORMANCE MONITOR * * Note(s) : (1) The Performance Monitoring Unit (PMU) includes logic to detect various events * that can occur. This events can be counted using the registers in the PMU. ********************************************************************************************************* */ /* ... executed. */ /* ... instruction architecturally executed. */ /* ... than exception returns. */ /* ... an instruction. */ /* .. could have been predicted by the branch ... */ /* .. prediction Resources of the processor */ /* ... architecturally executed. */ /* ... from the prefetch unit. */ /* ... from the load/store unit. */ /* ... because of a resource shortage. */ /* ... slots have data in same cache line but with ... */ /* ... different attributes. */ /* ... conversion instruction executed. */ /* ... exception at exception vector.a */ /* ... unit. */ /* ... slave interface. */ /* ... interface. */ /* ********************************************************************************************************* * ARM CORTEX-A8 MEMORY PROTECTION UNIT DEFINES ********************************************************************************************************* */ /* ------------- ACCESS PERMISSION DEFINES ------------ */ /* ----------- MEMORY ACCESS TYPE ATTRIBUTES ---------- */ /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES * * Note(s) : (1) CPU_CntLeadZeros() prototyped/defined respectively in : * * (a) 'cpu.h'/'cpu_a.asm', if CPU_CFG_LEAD_ZEROS_ASM_PRESENT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable assembly-version function * * (b) 'cpu_core.h'/'cpu_core.c', if CPU_CFG_LEAD_ZEROS_ASM_PRESENT NOT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable C-source-version function otherwise * * See also 'cpu_core.h FUNCTION PROTOTYPES Note #2'. * * (2) CPU_PMU_xxx() functions are intended to manage the Event & Performanace Monitor unit (PMU). ********************************************************************************************************* */ CPU_SR CPU_SR_Save (void); void CPU_SR_Restore (CPU_SR cpu_sr); void CPU_IntEn (void); void CPU_IntDis (void); void CPU_IRQ_En (void); void CPU_IRQ_Dis (void); void CPU_FIQ_En (void); void CPU_FIQ_Dis (void); CPU_DATA CPU_CntLeadZeros (CPU_DATA val); /* See Note #2 */ void CPU_PMU_Dis (void); void CPU_PMU_En (void); void CPU_PMU_Rst (void); /* Event counter functions. */ void CPU_PMU_CtrDis (CPU_INT08U ctr); void CPU_PMU_CtrEn (CPU_INT08U ctr); void CPU_PMU_CtrEventSet(CPU_INT08U ctr, CPU_INT08U event); CPU_DATA CPU_PMU_CtrGet (CPU_INT08U ctr); void CPU_PMU_CtrRst (CPU_INT08U ctr); /* Cycle counter functions. */ void CPU_PMU_CtrCycleDis(void); void CPU_PMU_CtrCycleEn (void); CPU_DATA CPU_PMU_CtrCycleGet(void); CPU_DATA CPU_PMU_CtrCycleRst(void); /* MMU functions */ void CPU_MMU_Init (void); void CPU_MMU_En (void); void CPU_MMU_Dis (void); CPU_BOOLEAN CPU_MMU_RegionEn (CPU_INT08U nbr, CPU_ADDR addr, CPU_INT08U sub_reg_en, CPU_INT32U size, CPU_INT32U acess_attrib); void CPU_MMU_RegionDis (CPU_INT08U nbr); void CPU_CtxID_Set (CPU_INT32U ctx_id); CPU_INT32U CPU_CtxID_Get (void); /*$PAGE*/ /* ********************************************************************************************************* * CONFIGURATION ERRORS ********************************************************************************************************* */ extern unsigned long IRQ_Status[4]; /*$PAGE*/ /* ********************************************************************************************************* * MODULE END ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/CPU * CPU CONFIGURATION & PORT LAYER * * (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/CPU is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * CORE CPU MODULE * * Filename : cpu_core.h * Version : V1.29.01 * Programmer(s) : SR * ITJ ********************************************************************************************************* * Note(s) : (1) Assumes the following versions (or more recent) of software modules are included in * the project build : * * (a) uC/LIB V1.35.00 ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE * * Note(s) : (1) This core CPU header file is protected from multiple pre-processor inclusion through use of * the core CPU module present pre-processor macro definition. ********************************************************************************************************* */ /* ********************************************************************************************************* * EXTERNS ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * INCLUDE FILES * * Note(s) : (1) CPU-configuration software files are located in the following directories : * * (a) \\cpu_cfg.h * * (b) (1) \\cpu_*.* * (2) \\\\cpu*.* * * where * directory path for Your Product's Application * directory path for common CPU-compiler software * directory name for specific processor (CPU) * directory name for specific compiler * * (2) NO compiler-supplied standard library functions SHOULD be used. * * (a) Standard library functions are implemented in the custom library module(s) : * * \\lib_*.* * * where * directory path for custom library software * * (3) Compiler MUST be configured to include as additional include path directories : * * (a) '\\' directory See Note #1a * * (b) (1) '\\' directory See Note #1b1 * (2) '\\\\' directory See Note #1b2 * * (c) '\\' directory See Note #2a ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/LIB * CUSTOM LIBRARY MODULES * * (c) Copyright 2004-2012; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/LIB is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * CORE CUSTOM LIBRARY MODULE * * Filename : lib_def.h * Version : V1.37.01 * Programmer(s) : ITJ * FBJ ********************************************************************************************************* * Note(s) : (1) Assumes the following versions (or more recent) of software modules are included in * the project build : * * (a) uC/CPU V1.29.00 * * * (2) NO compiler-supplied standard library functions are used in library or product software. * * (a) ALL standard library functions are implemented in the custom library modules : * * (1) \\lib_*.* * * (2) \\Ports\\\lib*_a.* * * where * directory path for custom library software * directory name for specific processor (CPU) * directory name for specific compiler * * (b) Product-specific library functions are implemented in individual products. ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE * * Note(s) : (1) This library definition header file is protected from multiple pre-processor inclusion * through use of the library definition module present pre-processor macro definition. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * CUSTOM LIBRARY MODULE VERSION NUMBER * * Note(s) : (1) (a) The custom library module software version is denoted as follows : * * Vx.yy.zz * * where * V denotes 'Version' label * x denotes major software version revision number * yy denotes minor software version revision number * zz denotes sub-minor software version revision number * * (b) The software version label #define is formatted as follows : * * ver = x.yyzz * 100 * 100 * * where * ver denotes software version number scaled as an integer value * x.yyzz denotes software version number, where the unscaled integer * portion denotes the major version number & the unscaled * fractional portion denotes the (concatenated) minor * version numbers ********************************************************************************************************* */ /* ********************************************************************************************************* * INCLUDE FILES * * Note(s) : (1) The custom library software files are located in the following directories : * * (a) \\lib_*.* * * where * directory path for custom library software * * (2) CPU-configuration software files are located in the following directories : * * (a) \\cpu_*.* * (b) \\\\cpu*.* * * where * directory path for common CPU-compiler software * directory name for specific processor (CPU) * directory name for specific compiler * * (3) Compiler MUST be configured to include as additional include path directories : * * (a) '\\' directory See Note #1a * * (b) (1) '\\' directory See Note #2a * (2) '\\\\' directory See Note #2b ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * STANDARD DEFINES ********************************************************************************************************* */ /* ----------------- BOOLEAN DEFINES ------------------ */ /* ------------------- BIT DEFINES -------------------- */ /*$PAGE*/ /* ------------------ ALIGN DEFINES ------------------- */ /* ------------------ OCTET DEFINES ------------------- */ /* --------------- NUMBER BASE DEFINES ---------------- */ /*$PAGE*/ /* ----------------- INTEGER DEFINES ------------------ */ /*$PAGE*/ /* --------------- CPU INTEGER DEFINES ---------------- */ /*$PAGE*/ /* ------------------- TIME DEFINES ------------------- */ /*$PAGE*/ /* ********************************************************************************************************* * ERROR CODES * * Note(s) : (1) All library error codes are #define'd in 'lib_def.h'; ********************************************************************************************************* */ typedef enum lib_err { LIB_ERR_NONE = 0u, LIB_MEM_ERR_NONE = 10000u, LIB_MEM_ERR_NULL_PTR = 10001u, /* Ptr arg(s) passed NULL ptr(s). */ LIB_MEM_ERR_INVALID_MEM_SIZE = 10100u, /* Invalid mem size. */ LIB_MEM_ERR_INVALID_MEM_ALIGN = 10101u, /* Invalid mem align. */ LIB_MEM_ERR_INVALID_SEG_SIZE = 10110u, /* Invalid mem seg size. */ LIB_MEM_ERR_INVALID_SEG_OVERLAP = 10111u, /* Invalid mem seg overlaps other mem seg(s). */ LIB_MEM_ERR_INVALID_POOL = 10120u, /* Invalid mem pool. */ LIB_MEM_ERR_INVALID_BLK_NBR = 10130u, /* Invalid mem pool blk nbr. */ LIB_MEM_ERR_INVALID_BLK_SIZE = 10131u, /* Invalid mem pool blk size. */ LIB_MEM_ERR_INVALID_BLK_ALIGN = 10132u, /* Invalid mem pool blk align. */ LIB_MEM_ERR_INVALID_BLK_IX = 10133u, /* Invalid mem pool ix. */ LIB_MEM_ERR_INVALID_BLK_ADDR = 10135u, /* Invalid mem pool blk addr. */ LIB_MEM_ERR_INVALID_BLK_ADDR_IN_POOL = 10136u, /* Mem pool blk addr already in mem pool. */ LIB_MEM_ERR_SEG_EMPTY = 10200u, /* Mem seg empty; i.e. NO avail mem in seg. */ LIB_MEM_ERR_SEG_OVF = 10201u, /* Mem seg ovf; i.e. req'd mem ovfs rem mem in seg. */ LIB_MEM_ERR_POOL_FULL = 10205u, /* Mem pool full; i.e. all mem blks avail in mem pool. */ LIB_MEM_ERR_POOL_EMPTY = 10206u, /* Mem pool empty; i.e. NO mem blks avail in mem pool. */ LIB_MEM_ERR_HEAP_EMPTY = 10210u, /* Heap seg empty; i.e. NO avail mem in heap. */ LIB_MEM_ERR_HEAP_OVF = 10211u, /* Heap seg ovf; i.e. req'd mem ovfs rem mem in heap. */ LIB_MEM_ERR_HEAP_NOT_FOUND = 10215u /* Heap seg NOT found. */ } LIB_ERR; /*$PAGE*/ /* ********************************************************************************************************* * DATA TYPES ********************************************************************************************************* */ /* ********************************************************************************************************* * GLOBAL VARIABLES ********************************************************************************************************* */ /* ********************************************************************************************************* * TRACING ********************************************************************************************************* */ /* Trace level, default to TRACE_LEVEL_OFF. */ /*$PAGE*/ /* ********************************************************************************************************* * BIT MACRO'S ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BIT() * * Description : Create bit mask with single, specified bit set. * * Argument(s) : bit Bit number of bit to set. * * Return(s) : Bit mask with single, specified bit set. * * Caller(s) : Application. * * Note(s) : (1) 'bit' SHOULD be a non-negative integer. * * (2) (a) 'bit' values that overflow the target CPU &/or compiler environment (e.g. negative * or greater-than-CPU-data-size values) MAY generate compiler warnings &/or errors. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BITxx() * * Description : Create bit mask of specified bit size with single, specified bit set. * * Argument(s) : bit Bit number of bit to set. * * Return(s) : Bit mask with single, specified bit set. * * Caller(s) : Application. * * Note(s) : (1) 'bit' SHOULD be a non-negative integer. * * (2) (a) 'bit' values that overflow the target CPU &/or compiler environment (e.g. negative * or greater-than-CPU-data-size values) MAY generate compiler warnings &/or errors. * * (b) To avoid overflowing any target CPU &/or compiler's integer data type, unsigned * bit constant '1' is cast to specified integer data type size. * * (3) Ideally, DEF_BITxx() macro's should be named DEF_BIT_xx(); however, these names already * previously-released for bit constant #define's (see 'STANDARD DEFINES BIT DEFINES'). ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_BIT_MASK() * * Description : Shift a bit mask. * * Argument(s) : bit_mask Bit mask to shift. * * bit_shift Number of bit positions to left-shift bit mask. * * Return(s) : Shifted bit mask. * * Caller(s) : Application. * * Note(s) : (1) (a) 'bit_mask' SHOULD be an unsigned integer. * * (b) 'bit_shift' SHOULD be a non-negative integer. * * (2) 'bit_shift' values that overflow the target CPU &/or compiler environment (e.g. negative * or greater-than-CPU-data-size values) MAY generate compiler warnings &/or errors. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BIT_MASK_xx() * * Description : Shift a bit mask of specified bit size. * * Argument(s) : bit_mask Bit mask to shift. * * bit_shift Number of bit positions to left-shift bit mask. * * Return(s) : Shifted bit mask. * * Caller(s) : Application. * * Note(s) : (1) (a) 'bit_mask' SHOULD be an unsigned integer. * * (b) 'bit_shift' SHOULD be a non-negative integer. * * (2) 'bit_shift' values that overflow the target CPU &/or compiler environment (e.g. negative * or greater-than-CPU-data-size values) MAY generate compiler warnings &/or errors. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_BIT_FIELD() * * Description : Create & shift a contiguous bit field. * * Argument(s) : bit_field Number of contiguous bits to set in the bit field. * * bit_shift Number of bit positions to left-shift bit field. * * Return(s) : Shifted bit field. * * Caller(s) : Application. * * Note(s) : (1) 'bit_field' & 'bit_shift' SHOULD be non-negative integers. * * (2) (a) 'bit_field'/'bit_shift' values that overflow the target CPU &/or compiler * environment (e.g. negative or greater-than-CPU-data-size values) MAY generate * compiler warnings &/or errors. * * (b) To avoid overflowing any target CPU &/or compiler's integer data type, unsigned * bit constant '1' is suffixed with 'L'ong integer modifier. * * This may still be insufficient for CPUs &/or compilers that support 'long long' * integer data types, in which case 'LL' integer modifier should be suffixed. * However, since almost all 16- & 32-bit CPUs & compilers support 'long' integer * data types but many may NOT support 'long long' integer data types, only 'long' * integer data types & modifiers are supported. * * See also 'DEF_BIT_FIELD_xx() Note #1b'. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BIT_FIELD_xx() * * Description : Create & shift a contiguous bit field of specified bit size. * * Argument(s) : bit_field Number of contiguous bits to set in the bit field. * * bit_shift Number of bit positions to left-shift bit field. * * Return(s) : Shifted bit field. * * Caller(s) : Application. * * Note(s) : (1) 'bit_field' & 'bit_shift' SHOULD be non-negative integers. * * (2) (a) 'bit_field'/'bit_shift' values that overflow the target CPU &/or compiler * environment (e.g. negative or greater-than-CPU-data-size values) MAY generate * compiler warnings &/or errors. * * (b) To avoid overflowing any target CPU &/or compiler's integer data type, unsigned * bit constant '1' is cast to specified integer data type size. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_BIT_SET_xx() * * Description : Set specified bit(s) in a value of specified bit size. * * Argument(s) : val Value to modify by setting specified bit(s). * * mask Mask of bits to set. * * Return(s) : Modified value with specified bit(s) set. * * Caller(s) : Application. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BIT_SET() * * Description : Set specified bit(s) in a value. * * Argument(s) : val Value to modify by setting specified bit(s). * * mask Mask of bits to set. * * Return(s) : Modified value with specified bit(s) set. * * Caller(s) : Application. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_BIT_CLR_xx() * * Description : Clear specified bit(s) in a value of specified bit size. * * Argument(s) : val Value to modify by clearing specified bit(s). * * mask Mask of bits to clear. * * Return(s) : Modified value with specified bit(s) clear. * * Caller(s) : Application. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BIT_CLR() * * Description : Clear specified bit(s) in a value. * * Argument(s) : val Value to modify by clearing specified bit(s). * * mask Mask of bits to clear. * * Return(s) : Modified value with specified bit(s) clear. * * Caller(s) : Application. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_BIT_IS_SET() * * Description : Determine if specified bit(s) in a value are set. * * Argument(s) : val Value to check for specified bit(s) set. * * mask Mask of bits to check if set (see Note #2). * * Return(s) : DEF_YES, if ALL specified bit(s) are set in value. * * DEF_NO, if ALL specified bit(s) are NOT set in value. * * Caller(s) : Application. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. * * (2) NULL 'mask' allowed; returns 'DEF_NO' since NO mask bits specified. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BIT_IS_CLR() * * Description : Determine if specified bit(s) in a value are clear. * * Argument(s) : val Value to check for specified bit(s) clear. * * mask Mask of bits to check if clear (see Note #2). * * Return(s) : DEF_YES, if ALL specified bit(s) are clear in value. * * DEF_NO, if ALL specified bit(s) are NOT clear in value. * * Caller(s) : Application. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. * * (2) NULL 'mask' allowed; returns 'DEF_NO' since NO mask bits specified. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_BIT_IS_SET_ANY() * * Description : Determine if any specified bit(s) in a value are set. * * Argument(s) : val Value to check for specified bit(s) set. * * mask Mask of bits to check if set (see Note #2). * * Return(s) : DEF_YES, if ANY specified bit(s) are set in value. * * DEF_NO, if ALL specified bit(s) are NOT set in value. * * Caller(s) : Application. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. * * (2) NULL 'mask' allowed; returns 'DEF_NO' since NO mask bits specified. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_BIT_IS_CLR_ANY() * * Description : Determine if any specified bit(s) in a value are clear. * * Argument(s) : val Value to check for specified bit(s) clear. * * mask Mask of bits to check if clear (see Note #2). * * Return(s) : DEF_YES, if ANY specified bit(s) are clear in value. * * DEF_NO, if ALL specified bit(s) are NOT clear in value. * * Note(s) : (1) 'val' & 'mask' SHOULD be unsigned integers. * * (2) NULL 'mask' allowed; returns 'DEF_NO' since NO mask bits specified. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * VALUE MACRO'S ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_CHK_VAL_MIN() * * Description : Validate a value as greater than or equal to a specified minimum value. * * Argument(s) : val Value to validate. * * val_min Minimum value to test. * * Return(s) : DEF_OK, Value is greater than or equal to minimum value. * * DEF_FAIL, otherwise. * * Caller(s) : Application. * * Note(s) : (1) DEF_CHK_VAL_MIN() avoids directly comparing any two values if only one of the values * is negative since the negative value might be incorrectly promoted to an arbitrary * unsigned value if the other value to compare is unsigned. * * (2) Validation of values is limited to the range supported by the compiler &/or target * environment. All other values that underflow/overflow the supported range will * modulo/wrap into the supported range as arbitrary signed or unsigned values. * * Therefore, any values that underflow the most negative signed value or overflow * the most positive unsigned value supported by the compiler &/or target environment * cannot be validated : * * ( N-1 N ] * ( -(2 ) , 2 - 1 ] * ( ] * * where * N Number of data word bits supported by the compiler * &/or target environment * * (a) Note that the most negative value, -2^(N-1), is NOT included in the supported * range since many compilers do NOT always correctly handle this value. * * (3) 'val' and 'val_min' are compared to 1 instead of 0 to avoid warning generated for * unsigned numbers. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_CHK_VAL_MAX() * * Description : Validate a value as less than or equal to a specified maximum value. * * Argument(s) : val Value to validate. * * val_max Maximum value to test. * * Return(s) : DEF_OK, Value is less than or equal to maximum value. * * DEF_FAIL, otherwise. * * Caller(s) : Application. * * Note(s) : (1) DEF_CHK_VAL_MAX() avoids directly comparing any two values if only one of the values * is negative since the negative value might be incorrectly promoted to an arbitrary * unsigned value if the other value to compare is unsigned. * * (2) Validation of values is limited to the range supported by the compiler &/or target * environment. All other values that underflow/overflow the supported range will * modulo/wrap into the supported range as arbitrary signed or unsigned values. * * Therefore, any values that underflow the most negative signed value or overflow * the most positive unsigned value supported by the compiler &/or target environment * cannot be validated : * * ( N-1 N ] * ( -(2 ) , 2 - 1 ] * ( ] * * where * N Number of data word bits supported by the compiler * &/or target environment * * (a) Note that the most negative value, -2^(N-1), is NOT included in the supported * range since many compilers do NOT always correctly handle this value. * * (3) 'val' and 'val_max' are compared to 1 instead of 0 to avoid warning generated for * unsigned numbers. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_CHK_VAL() * * Description : Validate a value as greater than or equal to a specified minimum value & less than or * equal to a specified maximum value. * * Argument(s) : val Value to validate. * * val_min Minimum value to test. * * val_max Maximum value to test. * * Return(s) : DEF_OK, Value is greater than or equal to minimum value AND * less than or equal to maximum value. * * DEF_FAIL, otherwise. * * Caller(s) : Application. * * Note(s) : (1) DEF_CHK_VAL() avoids directly comparing any two values if only one of the values * is negative since the negative value might be incorrectly promoted to an arbitrary * unsigned value if the other value to compare is unsigned. * * (2) Validation of values is limited to the range supported by the compiler &/or target * environment. All other values that underflow/overflow the supported range will * modulo/wrap into the supported range as arbitrary signed or unsigned values. * * Therefore, any values that underflow the most negative signed value or overflow * the most positive unsigned value supported by the compiler &/or target environment * cannot be validated : * * ( N-1 N ] * ( -(2 ) , 2 - 1 ] * ( ] * * where * N Number of data word bits supported by the compiler * &/or target environment * * (a) Note that the most negative value, -2^(N-1), is NOT included in the supported * range since many compilers do NOT always correctly handle this value. * * (3) DEF_CHK_VAL() does NOT validate that the maximum value ('val_max') is greater than * or equal to the minimum value ('val_min'). ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_GET_U_MAX_VAL() * * Description : Get the maximum unsigned value that can be represented in an unsigned integer variable * of the same data type size as an object. * * Argument(s) : obj Object or data type to return maximum unsigned value (see Note #1). * * Return(s) : Maximum unsigned integer value that can be represented by the object, if NO error(s). * * 0, otherwise. * * Caller(s) : Application. * * Note(s) : (1) 'obj' SHOULD be an integer object or data type but COULD also be a character or * pointer object or data type. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * MATH MACRO'S * * Note(s) : (1) Ideally, ALL mathematical macro's & functions SHOULD be defined in the custom mathematics * library ('lib_math.*'). #### However, to maintain backwards compatibility with previously- * released modules, mathematical macro & function definitions should only be moved to the * custom mathematics library once all previously-released modules are updated to include the * custom mathematics library. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_MIN() * * Description : Determine the minimum of two values. * * Argument(s) : a First value. * * b Second value. * * Return(s) : Minimum of the two values. * * Caller(s) : Application. * * Note(s) : none. ********************************************************************************************************* */ /* ********************************************************************************************************* * DEF_MAX() * * Description : Determine the maximum of two values. * * Argument(s) : a First value. * * b Second value. * * Return(s) : Maximum of the two values. * * Note(s) : none. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEF_ABS() * * Description : Determine the absolute value of a value. * * Argument(s) : a Value to calculate absolute value. * * Return(s) : Absolute value of the value. * * Caller(s) : Application. * * Note(s) : none. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES ********************************************************************************************************* */ /* ********************************************************************************************************* * CONFIGURATION ERRORS ********************************************************************************************************* */ /* ********************************************************************************************************* * LIBRARY CONFIGURATION ERRORS ********************************************************************************************************* */ /* See 'lib_def.h Note #1a'. */ /* ********************************************************************************************************* * MODULE END * * Note(s) : (1) See 'lib_def.h MODULE'. ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/LIB * CUSTOM LIBRARY MODULES * * (c) Copyright 2004-2013; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/LIB is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * STANDARD MEMORY OPERATIONS * * Filename : lib_mem.h * Version : V1.37.01 * Programmer(s) : ITJ * FBJ ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * * (a) ALL standard library functions are implemented in the custom library modules : * * (1) \\lib_*.* * * (2) \\Ports\\\lib*_a.* * * where * directory path for custom library software * directory name for specific processor (CPU) * directory name for specific compiler * * (b) Product-specific library functions are implemented in individual products. * * (2) Assumes the following versions (or more recent) of software modules are included in * the project build : * * (a) uC/CPU V1.27 ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE * * Note(s) : (1) This memory library header file is protected from multiple pre-processor inclusion through * use of the memory library module present pre-processor macro definition. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * INCLUDE FILES * * Note(s) : (1) The custom library software files are located in the following directories : * * (a) \\lib_cfg.h * * (b) \\lib_*.* * * where * directory path for Your Product's Application * directory path for custom library software * * (2) CPU-configuration software files are located in the following directories : * * (a) \\cpu_*.* * (b) \\\\cpu*.* * * where * directory path for common CPU-compiler software * directory name for specific processor (CPU) * directory name for specific compiler * * (3) Compiler MUST be configured to include as additional include path directories : * * (a) '\\' directory See Note #1a * * (b) '\\' directory See Note #1b * * (c) (1) '\\' directory See Note #2a * (2) '\\\\' directory See Note #2b * * (4) NO compiler-supplied standard library functions SHOULD be used. ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/CPU * CPU CONFIGURATION & PORT LAYER * * (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/CPU is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * CORE CPU MODULE * * Filename : cpu_core.h * Version : V1.29.01 * Programmer(s) : SR * ITJ ********************************************************************************************************* * Note(s) : (1) Assumes the following versions (or more recent) of software modules are included in * the project build : * * (a) uC/LIB V1.35.00 ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE * * Note(s) : (1) This core CPU header file is protected from multiple pre-processor inclusion through use of * the core CPU module present pre-processor macro definition. ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/LIB * CUSTOM LIBRARY MODULES * * (c) Copyright 2004-2011; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/LIB is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * CUSTOM LIBRARY CONFIGURATION FILE * * TEMPLATE * * Filename : lib_cfg.h * Version : V1.35.00 * Programmer(s) : ITJ ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* ********************************************************************************************************* * MEMORY LIBRARY CONFIGURATION ********************************************************************************************************* ********************************************************************************************************* */ /* ********************************************************************************************************* * MEMORY LIBRARY ARGUMENT CHECK CONFIGURATION * * Note(s) : (1) Configure LIB_MEM_CFG_ARG_CHK_EXT_EN to enable/disable the memory library suite external * argument check feature : * * (a) When ENABLED, arguments received from any port interface provided by the developer * or application are checked/validated. * * (b) When DISABLED, NO arguments received from any port interface provided by the developer * or application are checked/validated. ********************************************************************************************************* */ /* Configure external argument check feature (see Note #1) : */ /* DEF_DISABLED Argument check DISABLED */ /* DEF_ENABLED Argument check ENABLED */ /* ********************************************************************************************************* * MEMORY LIBRARY ASSEMBLY OPTIMIZATION CONFIGURATION * * Note(s) : (1) Configure LIB_MEM_CFG_OPTIMIZE_ASM_EN to enable/disable assembly-optimized memory function(s). ********************************************************************************************************* */ /* Configure assembly-optimized function(s) [see Note #1] : */ /* DEF_DISABLED Assembly-optimized function(s) DISABLED */ /* DEF_ENABLED Assembly-optimized function(s) ENABLED */ /* ********************************************************************************************************* * MEMORY ALLOCATION CONFIGURATION * * Note(s) : (1) Configure LIB_MEM_CFG_ALLOC_EN to enable/disable memory allocation functions. * * (2) (a) Configure LIB_MEM_CFG_HEAP_SIZE with the desired size of heap memory (in octets). * * (b) Configure LIB_MEM_CFG_HEAP_BASE_ADDR to specify a base address for heap memory : * * (1) Heap initialized to specified application memory, if LIB_MEM_CFG_HEAP_BASE_ADDR * #define'd in 'app_cfg.h'; * CANNOT #define to address 0x0 * * (2) Heap declared to Mem_Heap[] in 'lib_mem.c', if LIB_MEM_CFG_HEAP_BASE_ADDR * NOT #define'd in 'app_cfg.h' ********************************************************************************************************* */ /* Configure memory allocation feature (see Note #1) : */ /* DEF_DISABLED Memory allocation DISABLED */ /* DEF_ENABLED Memory allocation ENABLED */ /*$PAGE*/ /* ********************************************************************************************************* ********************************************************************************************************* * STRING LIBRARY CONFIGURATION ********************************************************************************************************* ********************************************************************************************************* */ /* ********************************************************************************************************* * STRING FLOATING POINT CONFIGURATION * * Note(s) : (1) Configure LIB_STR_CFG_FP_EN to enable/disable floating point string function(s). * * (2) Configure LIB_STR_CFG_FP_MAX_NBR_DIG_SIG to configure the maximum number of significant * digits to calculate &/or display for floating point string function(s). * * See also 'lib_str.h STRING FLOATING POINT DEFINES Note #1'. ********************************************************************************************************* */ /* Configure floating point feature(s) [see Note #1] : */ /* DEF_DISABLED Floating point functions DISABLED */ /* DEF_ENABLED Floating point functions ENABLED */ /* Configure floating point feature(s)' number of ... */ /* ... significant digits (see Note #2). */ /*$PAGE*/ /* ********************************************************************************************************* * MODULE END ********************************************************************************************************* */ /* ********************************************************************************************************* * EXTERNS ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEFAULT CONFIGURATION ********************************************************************************************************* */ /* ********************************************************************************************************* * MEMORY LIBRARY ARGUMENT CHECK CONFIGURATION * * Note(s) : (1) Configure LIB_MEM_CFG_ARG_CHK_EXT_EN to enable/disable the memory library suite external * argument check feature : * * (a) When ENABLED, arguments received from any port interface provided by the developer * or application are checked/validated. * * (b) When DISABLED, NO arguments received from any port interface provided by the developer * or application are checked/validated. ********************************************************************************************************* */ /* Configure external argument check feature (see Note #1) : */ /* ********************************************************************************************************* * MEMORY LIBRARY ASSEMBLY OPTIMIZATION CONFIGURATION * * Note(s) : (1) Configure LIB_MEM_CFG_OPTIMIZE_ASM_EN to enable/disable assembly-optimized memory functions. ********************************************************************************************************* */ /* Configure assembly-optimized function(s) [see Note #1] : */ /* ********************************************************************************************************* * MEMORY ALLOCATION CONFIGURATION * * Note(s) : (1) Configure LIB_MEM_CFG_ALLOC_EN to enable/disable memory allocation functions. ********************************************************************************************************* */ /* Configure memory allocation feature (see Note #1) : */ /*$PAGE*/ /* ********************************************************************************************************* * DEFINES ********************************************************************************************************* */ /* ********************************************************************************************************* * MEMORY LIBRARY TYPE DEFINES * * Note(s) : (1) LIB_MEM_TYPE_&&& #define values specifically chosen as ASCII representations of the memory * library types. Memory displays of memory library objects will display the library TYPEs * with their chosen ASCII names. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DATA TYPES ********************************************************************************************************* */ /* ********************************************************************************************************* * LIB MEM TYPE * * Note(s) : (1) 'LIB_MEM_TYPE' declared as 'CPU_INT32U' & all 'LIB_MEM_TYPE's #define'd with large, non-trivial * values to trap & discard invalid/corrupted library memory objects based on 'LIB_MEM_TYPE'. ********************************************************************************************************* */ typedef CPU_INT32U LIB_MEM_TYPE; /* ********************************************************************************************************* * MEMORY POOL BLOCK QUANTITY DATA TYPE ********************************************************************************************************* */ typedef CPU_SIZE_T MEM_POOL_BLK_QTY; /* ********************************************************************************************************* * MEMORY POOL TABLE IX TYPE ********************************************************************************************************* */ typedef MEM_POOL_BLK_QTY MEM_POOL_IX; /*$PAGE*/ /* ********************************************************************************************************* * MEMORY POOL DATA TYPES * * MEMORY SEGMENT * ---------------- * MEMORY POOL'S | | <---- * POINTERS TO | MEMORY | | * MEM_POOL MEMORY BLOCKS | BLOCKS | | * |----------------| |---------| | -------- | | * | O------------------> | O--------------------> | | | | * |----------------| |---------| | | | | | * | Pool Addr Ptrs | | O------------- | -------- | | * | Pool Size | |---------| | | | | * |----------------| | | | | -------- | | * | Blk Size | | | --------> | | | | * | Blk Nbr | | | | | | | | * | Blk Ix | | . | | -------- | | * |----------------| | . | | | | * |----------------| | . | | . | | * | O----------------- | | | . | | * |----------------| | | | | . | | * | O------------ | | | | | | * |----------------| | | |---------| | -------- | | * | Seg Size Tot | | | | O--------------------> | | | | * | Seg Size Rem | | | |---------| | | | | | * |----------------| | | | | | -------- | | * | Seg List Ptrs | | | |---------| | | | * |----------------| | | | ------------ | | * | | | | <-------- * | | | | | | * | | | | | | * | | | | | | * | | | | | | * | | | | | | * | | ---------------- | | * | | | | * | -------------------------------------------------- | * | | * ----------------------------------------------------------- * ********************************************************************************************************* */ typedef struct mem_pool MEM_POOL; /* --------------------- MEM POOL --------------------- */ struct mem_pool { LIB_MEM_TYPE Type; /* Pool type : LIB_TYPE_POOL or LIB_TYPE_HEAP. */ MEM_POOL *SegHeadPtr; /* Ptr to head mem seg. */ MEM_POOL *SegPrevPtr; /* Ptr to PREV mem seg. */ MEM_POOL *SegNextPtr; /* Ptr to NEXT mem seg. */ MEM_POOL *PoolPrevPtr; /* Ptr to PREV mem pool. */ MEM_POOL *PoolNextPtr; /* Ptr to NEXT mem pool. */ void *PoolAddrStart; /* Ptr to start of mem seg for mem pool blks. */ void *PoolAddrEnd; /* Ptr to end of mem seg for mem pool blks. */ void **PoolPtrs; /* Ptr to mem pool's array of blk ptrs. */ MEM_POOL_IX BlkIx; /* Ix into mem pool's array of blk ptrs. */ CPU_SIZE_T PoolSize; /* Size of mem pool (in octets). */ MEM_POOL_BLK_QTY BlkNbr; /* Nbr of mem pool blks. */ CPU_SIZE_T BlkSize; /* Size of mem pool blks (in octets). */ CPU_SIZE_T BlkAlign; /* Align of mem pool blks (in octets). */ /* --------------------- MEM SEG ---------------------- */ void *SegAddr; /* Ptr to mem seg's base/start addr. */ void *SegAddrNextAvail; /* Ptr to mem seg's next avail addr. */ CPU_SIZE_T SegSizeTot; /* Tot size of mem seg (in octets). */ CPU_SIZE_T SegSizeRem; /* Rem size of mem seg (in octets). */ }; /*$PAGE*/ /* ********************************************************************************************************* * GLOBAL VARIABLES ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * MACRO'S ********************************************************************************************************* */ /* ********************************************************************************************************* * MEMORY DATA VALUE MACRO'S * * Note(s) : (1) (a) Some variables & variable buffers to pass & receive data values MUST start on appropriate * CPU word-aligned addresses. This is required because most word-aligned processors are more * efficient & may even REQUIRE that multi-octet words start on CPU word-aligned addresses. * * (1) For 16-bit word-aligned processors, this means that * * all 16- & 32-bit words MUST start on addresses that are multiples of 2 octets * * (2) For 32-bit word-aligned processors, this means that * * all 16-bit words MUST start on addresses that are multiples of 2 octets * all 32-bit words MUST start on addresses that are multiples of 4 octets * * (b) However, some data values macro's appropriately access data values from any CPU addresses, * word-aligned or not. Thus for processors that require data word alignment, data words can * be accessed to/from any CPU address, word-aligned or not, without generating data-word- * alignment exceptions/faults. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ENDIAN WORD ORDER MACRO'S * * Description : Convert data values to & from big-, little, or host-endian CPU word order. * * Argument(s) : val Data value to convert (see Notes #1 & #2). * * Return(s) : Converted data value (see Notes #1 & #2). * * Caller(s) : Application. * * Note(s) : (1) Convert data values to the desired data-word order : * * MEM_VAL_BIG_TO_LITTLE_xx() Convert big- endian data values * to little- endian data values * MEM_VAL_LITTLE_TO_BIG_xx() Convert little- endian data values * to big- endian data values * MEM_VAL_xxx_TO_HOST_xx() Convert big-/little-endian data values * to host- endian data values * MEM_VAL_HOST_TO_xxx_xx() Convert host- endian data values * to big-/little-endian data values * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) 'val' data value to convert & any variable to receive the returned conversion MUST * start on appropriate CPU word-aligned addresses. * * See also 'MEMORY DATA VALUE MACRO'S Note #1a'. * * (3) MEM_VAL_COPY_xxx() macro's are more efficient than generic endian word order macro's & * are also independent of CPU data-word-alignment & SHOULD be used whenever possible. * * See also 'MEM_VAL_COPY_GET_xxx() Note #4' * & 'MEM_VAL_COPY_SET_xxx() Note #4'. * * (4) Generic endian word order macro's are NOT atomic operations & MUST NOT be used on any * non-static (i.e. volatile) variables, registers, hardware, etc.; without the caller of * the macro's providing some form of additional protection (e.g. mutual exclusion). * * (5) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/ * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is * included as an extra precaution in case 'cpu.h' is incorrectly configured. ********************************************************************************************************* */ /*$PAGE*/ /*$PAGE*/ /* ********************************************************************************************************* * MEM_VAL_GET_xxx() * * Description : Decode data values from any CPU memory address. * * Argument(s) : addr Lowest CPU memory address of data value to decode (see Notes #2 & #3a). * * Return(s) : Decoded data value from CPU memory address (see Notes #1 & #3b). * * Caller(s) : Application. * * Note(s) : (1) Decode data values based on the values' data-word order in CPU memory : * * MEM_VAL_GET_xxx_BIG() Decode big- endian data values -- data words' most * significant octet @ lowest memory address * MEM_VAL_GET_xxx_LITTLE() Decode little-endian data values -- data words' least * significant octet @ lowest memory address * MEM_VAL_GET_xxx() Decode data values using CPU's native or configured * data-word order * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) CPU memory addresses/pointers NOT checked for NULL. * * (3) (a) MEM_VAL_GET_xxx() macro's decode data values without regard to CPU word-aligned addresses. * Thus for processors that require data word alignment, data words can be decoded from any * CPU address, word-aligned or not, without generating data-word-alignment exceptions/faults. * * (b) However, any variable to receive the returned data value MUST start on an appropriate CPU * word-aligned address. * * See also 'MEMORY DATA VALUE MACRO'S Note #1'. * * (4) MEM_VAL_COPY_GET_xxx() macro's are more efficient than MEM_VAL_GET_xxx() macro's & are * also independent of CPU data-word-alignment & SHOULD be used whenever possible. * * See also 'MEM_VAL_COPY_GET_xxx() Note #4'. * * (5) MEM_VAL_GET_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-static * (i.e. volatile) variables, registers, hardware, etc.; without the caller of the macro's * providing some form of additional protection (e.g. mutual exclusion). * * (6) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/ * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is * included as an extra precaution in case 'cpu.h' is incorrectly configured. ********************************************************************************************************* */ /*$PAGE*/ /*$PAGE*/ /* ********************************************************************************************************* * MEM_VAL_SET_xxx() * * Description : Encode data values to any CPU memory address. * * Argument(s) : addr Lowest CPU memory address to encode data value (see Notes #2 & #3a). * * val Data value to encode (see Notes #1 & #3b). * * Return(s) : none. * * Caller(s) : Application. * * Note(s) : (1) Encode data values into CPU memory based on the values' data-word order : * * MEM_VAL_SET_xxx_BIG() Encode big- endian data values -- data words' most * significant octet @ lowest memory address * MEM_VAL_SET_xxx_LITTLE() Encode little-endian data values -- data words' least * significant octet @ lowest memory address * MEM_VAL_SET_xxx() Encode data values using CPU's native or configured * data-word order * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) CPU memory addresses/pointers NOT checked for NULL. * * (3) (a) MEM_VAL_SET_xxx() macro's encode data values without regard to CPU word-aligned addresses. * Thus for processors that require data word alignment, data words can be encoded to any * CPU address, word-aligned or not, without generating data-word-alignment exceptions/faults. * * (b) However, 'val' data value to encode MUST start on an appropriate CPU word-aligned address. * * See also 'MEMORY DATA VALUE MACRO'S Note #1'. * * (4) MEM_VAL_COPY_SET_xxx() macro's are more efficient than MEM_VAL_SET_xxx() macro's & are * also independent of CPU data-word-alignment & SHOULD be used whenever possible. * * See also 'MEM_VAL_COPY_SET_xxx() Note #4'. * * (5) MEM_VAL_SET_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-static * (i.e. volatile) variables, registers, hardware, etc.; without the caller of the macro's * providing some form of additional protection (e.g. mutual exclusion). * * (6) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/ * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is * included as an extra precaution in case 'cpu.h' is incorrectly configured. ********************************************************************************************************* */ /*$PAGE*/ /*$PAGE*/ /* ********************************************************************************************************* * MEM_VAL_COPY_GET_xxx() * * Description : Copy & decode data values from any CPU memory address to any CPU memory address. * * Argument(s) : addr_dest Lowest CPU memory address to copy/decode source address's data value * (see Notes #2 & #3). * * addr_src Lowest CPU memory address of data value to copy/decode * (see Notes #2 & #3). * * Return(s) : none. * * Caller(s) : Application. * * Note(s) : (1) Copy/decode data values based on the values' data-word order : * * MEM_VAL_COPY_GET_xxx_BIG() Decode big- endian data values -- data words' most * significant octet @ lowest memory address * MEM_VAL_COPY_GET_xxx_LITTLE() Decode little-endian data values -- data words' least * significant octet @ lowest memory address * MEM_VAL_COPY_GET_xxx() Decode data values using CPU's native or configured * data-word order * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) (a) CPU memory addresses/pointers NOT checked for NULL. * * (b) CPU memory addresses/buffers NOT checked for overlapping. * * (1) IEEE Std 1003.1, 2004 Edition, Section 'memcpy() : DESCRIPTION' states that * "copying ... between objects that overlap ... is undefined". * * (3) MEM_VAL_COPY_GET_xxx() macro's copy/decode data values without regard to CPU word-aligned * addresses. Thus for processors that require data word alignment, data words can be copied/ * decoded to/from any CPU address, word-aligned or not, without generating data-word-alignment * exceptions/faults. * * (4) MEM_VAL_COPY_GET_xxx() macro's are more efficient than MEM_VAL_GET_xxx() macro's & are * also independent of CPU data-word-alignment & SHOULD be used whenever possible. * * See also 'MEM_VAL_GET_xxx() Note #4'. * * (5) Since octet-order copy/conversion are inverse operations, MEM_VAL_COPY_GET_xxx() & * MEM_VAL_COPY_SET_xxx() macros are inverse, but identical, operations & are provided * in both forms for semantics & consistency. * * See also 'MEM_VAL_COPY_SET_xxx() Note #5'. * * (6) MEM_VAL_COPY_GET_xxx() macro's are NOT atomic operations & MUST NOT be used on any non- * static (i.e. volatile) variables, registers, hardware, etc.; without the caller of the * macro's providing some form of additional protection (e.g. mutual exclusion). * * (7) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/ * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is * included as an extra precaution in case 'cpu.h' is incorrectly configured. ********************************************************************************************************* */ /*$PAGE*/ /*$PAGE*/ /* ********************************************************************************************************* * MEM_VAL_COPY_GET_INTU_xxx() * * Description : Copy & decode data values from any CPU memory address to any CPU memory address for * any sized data values. * * Argument(s) : addr_dest Lowest CPU memory address to copy/decode source address's data value * (see Notes #2 & #3). * * addr_src Lowest CPU memory address of data value to copy/decode * (see Notes #2 & #3). * * val_size Number of data value octets to copy/decode. * * Return(s) : none. * * Caller(s) : Application. * * Note(s) : (1) Copy/decode data values based on the values' data-word order : * * MEM_VAL_COPY_GET_INTU_BIG() Decode big- endian data values -- data words' most * significant octet @ lowest memory address * MEM_VAL_COPY_GET_INTU_LITTLE() Decode little-endian data values -- data words' least * significant octet @ lowest memory address * MEM_VAL_COPY_GET_INTU() Decode data values using CPU's native or configured * data-word order * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) (a) CPU memory addresses/pointers NOT checked for NULL. * * (b) CPU memory addresses/buffers NOT checked for overlapping. * * (1) IEEE Std 1003.1, 2004 Edition, Section 'memcpy() : DESCRIPTION' states that * "copying ... between objects that overlap ... is undefined". * * (3) MEM_VAL_COPY_GET_INTU_xxx() macro's copy/decode data values without regard to CPU word- * aligned addresses. Thus for processors that require data word alignment, data words * can be copied/decoded to/from any CPU address, word-aligned or not, without generating * data-word-alignment exceptions/faults. * * (4) MEM_VAL_COPY_GET_xxx() macro's are more efficient than MEM_VAL_COPY_GET_INTU_xxx() * macro's & SHOULD be used whenever possible. * * See also 'MEM_VAL_COPY_GET_xxx() Note #4'. * * (5) Since octet-order copy/conversion are inverse operations, MEM_VAL_COPY_GET_INTU_xxx() & * MEM_VAL_COPY_SET_INTU_xxx() macros are inverse, but identical, operations & are provided * in both forms for semantics & consistency. * * See also 'MEM_VAL_COPY_SET_INTU_xxx() Note #5'. * * (6) MEM_VAL_COPY_GET_INTU_xxx() macro's are NOT atomic operations & MUST NOT be used on any * non-static (i.e. volatile) variables, registers, hardware, etc.; without the caller of * the macro's providing some form of additional protection (e.g. mutual exclusion). * * (7) MISRA-C 2004 Rule 5.2 states that "identifiers in an inner scope shall not use the same * name as an indentifier in an outer scope, and therefore hide that identifier". * * Therefore, to avoid possible redeclaration of commonly-used loop counter identifier names, * 'i' & 'j', MEM_VAL_COPY_GET_INTU_xxx() loop counter identifier names are prefixed with a * single underscore. * * (8) The 'CPU_CFG_ENDIAN_TYPE' pre-processor 'else'-conditional code SHOULD never be compiled/ * linked since each 'cpu.h' SHOULD ensure that the CPU data-word-memory order configuration * constant (CPU_CFG_ENDIAN_TYPE) is configured with an appropriate data-word-memory order * value (see 'cpu.h CPU WORD CONFIGURATION Note #2'). The 'else'-conditional code is * included as an extra precaution in case 'cpu.h' is incorrectly configured. ********************************************************************************************************* */ /*$PAGE*/ /*$PAGE*/ /* ********************************************************************************************************* * MEM_VAL_COPY_SET_xxx() * * Description : Copy & encode data values from any CPU memory address to any CPU memory address. * * Argument(s) : addr_dest Lowest CPU memory address to copy/encode source address's data value * (see Notes #2 & #3). * * addr_src Lowest CPU memory address of data value to copy/encode * (see Notes #2 & #3). * * Return(s) : none. * * Caller(s) : Application. * * Note(s) : (1) Copy/encode data values based on the values' data-word order : * * MEM_VAL_COPY_SET_xxx_BIG() Encode big- endian data values -- data words' most * significant octet @ lowest memory address * MEM_VAL_COPY_SET_xxx_LITTLE() Encode little-endian data values -- data words' least * significant octet @ lowest memory address * MEM_VAL_COPY_SET_xxx() Encode data values using CPU's native or configured * data-word order * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) (a) CPU memory addresses/pointers NOT checked for NULL. * * (b) CPU memory addresses/buffers NOT checked for overlapping. * * (1) IEEE Std 1003.1, 2004 Edition, Section 'memcpy() : DESCRIPTION' states that * "copying ... between objects that overlap ... is undefined". * * (3) MEM_VAL_COPY_SET_xxx() macro's copy/encode data values without regard to CPU word-aligned * addresses. Thus for processors that require data word alignment, data words can be copied/ * encoded to/from any CPU address, word-aligned or not, without generating data-word-alignment * exceptions/faults. * * (4) MEM_VAL_COPY_SET_xxx() macro's are more efficient than MEM_VAL_SET_xxx() macro's & are * also independent of CPU data-word-alignment & SHOULD be used whenever possible. * * See also 'MEM_VAL_SET_xxx() Note #4'. * * (5) Since octet-order copy/conversion are inverse operations, MEM_VAL_COPY_GET_xxx() & * MEM_VAL_COPY_SET_xxx() macros are inverse, but identical, operations & are provided * in both forms for semantics & consistency. * * See also 'MEM_VAL_COPY_GET_xxx() Note #5'. * * (6) MEM_VAL_COPY_SET_xxx() macro's are NOT atomic operations & MUST NOT be used on any * non-static (i.e. volatile) variables, registers, hardware, etc.; without the caller * of the macro's providing some form of additional protection (e.g. mutual exclusion). ********************************************************************************************************* */ /* See Note #5. */ /*$PAGE*/ /* ********************************************************************************************************* * MEM_VAL_COPY_SET_INTU_xxx() * * Description : Copy & encode data values from any CPU memory address to any CPU memory address for * any sized data values. * * Argument(s) : addr_dest Lowest CPU memory address to copy/encode source address's data value * (see Notes #2 & #3). * * addr_src Lowest CPU memory address of data value to copy/encode * (see Notes #2 & #3). * * val_size Number of data value octets to copy/encode. * * Return(s) : none. * * Caller(s) : Application. * * Note(s) : (1) Copy/encode data values based on the values' data-word order : * * MEM_VAL_COPY_SET_INTU_BIG() Encode big- endian data values -- data words' most * significant octet @ lowest memory address * MEM_VAL_COPY_SET_INTU_LITTLE() Encode little-endian data values -- data words' least * significant octet @ lowest memory address * MEM_VAL_COPY_SET_INTU() Encode data values using CPU's native or configured * data-word order * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) (a) CPU memory addresses/pointers NOT checked for NULL. * * (b) CPU memory addresses/buffers NOT checked for overlapping. * * (1) IEEE Std 1003.1, 2004 Edition, Section 'memcpy() : DESCRIPTION' states that * "copying ... between objects that overlap ... is undefined". * * (3) MEM_VAL_COPY_SET_INTU_xxx() macro's copy/encode data values without regard to CPU word- * aligned addresses. Thus for processors that require data word alignment, data words * can be copied/encoded to/from any CPU address, word-aligned or not, without generating * data-word-alignment exceptions/faults. * * (4) MEM_VAL_COPY_SET_xxx() macro's are more efficient than MEM_VAL_COPY_SET_INTU_xxx() * macro's & SHOULD be used whenever possible. * * See also 'MEM_VAL_COPY_SET_xxx() Note #4'. * * (5) Since octet-order copy/conversion are inverse operations, MEM_VAL_COPY_GET_INTU_xxx() & * MEM_VAL_COPY_SET_INTU_xxx() macros are inverse, but identical, operations & are provided * in both forms for semantics & consistency. * * See also 'MEM_VAL_COPY_GET_INTU_xxx() Note #5'. * * (6) MEM_VAL_COPY_SET_INTU_xxx() macro's are NOT atomic operations & MUST NOT be used on any * non-static (i.e. volatile) variables, registers, hardware, etc.; without the caller of * the macro's providing some form of additional protection (e.g. mutual exclusion). ********************************************************************************************************* */ /* See Note #5. */ /*$PAGE*/ /* ********************************************************************************************************* * MEM_VAL_COPY_xxx() * * Description : Copy data values from any CPU memory address to any CPU memory address. * * Argument(s) : addr_dest Lowest CPU memory address to copy source address's data value * (see Notes #2 & #3). * * addr_src Lowest CPU memory address of data value to copy * (see Notes #2 & #3). * * val_size Number of data value octets to copy. * * Return(s) : none. * * Caller(s) : Application. * * Note(s) : (1) MEM_VAL_COPY_xxx() macro's copy data values based on CPU's native data-word order. * * See also 'cpu.h CPU WORD CONFIGURATION Note #2'. * * (2) (a) CPU memory addresses/pointers NOT checked for NULL. * * (b) CPU memory addresses/buffers NOT checked for overlapping. * * (1) IEEE Std 1003.1, 2004 Edition, Section 'memcpy() : DESCRIPTION' states that * "copying ... between objects that overlap ... is undefined". * * (3) MEM_VAL_COPY_xxx() macro's copy data values without regard to CPU word-aligned addresses. * Thus for processors that require data word alignment, data words can be copied to/from any * CPU address, word-aligned or not, without generating data-word-alignment exceptions/faults. * * (4) MEM_VAL_COPY_xxx() macro's are more efficient than MEM_VAL_COPY() macro & SHOULD be * used whenever possible. * * (5) MEM_VAL_COPY_xxx() macro's are NOT atomic operations & MUST NOT be used on any non-static * (i.e. volatile) variables, registers, hardware, etc.; without the caller of the macro's * providing some form of additional protection (e.g. mutual exclusion). * * (6) MISRA-C 2004 Rule 5.2 states that "identifiers in an inner scope shall not use the same * name as an indentifier in an outer scope, and therefore hide that identifier". * * Therefore, to avoid possible redeclaration of commonly-used loop counter identifier name, * 'i', MEM_VAL_COPY() loop counter identifier name is prefixed with a single underscore. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES ********************************************************************************************************* */ void Mem_Init ( void); /* ---------------- MEM API FNCTS ---------------- */ void Mem_Clr ( void *pmem, CPU_SIZE_T size); void Mem_Set ( void *pmem, CPU_INT08U data_val, CPU_SIZE_T size); void Mem_Copy ( void *pdest, const void *psrc, CPU_SIZE_T size); void Mem_Move ( void *pdest, const void *psrc, CPU_SIZE_T size); CPU_BOOLEAN Mem_Cmp (const void *p1_mem, const void *p2_mem, CPU_SIZE_T size); /*$PAGE*/ /* ********************************************************************************************************* * CONFIGURATION ERRORS ********************************************************************************************************* */ /* ********************************************************************************************************* * LIBRARY CONFIGURATION ERRORS ********************************************************************************************************* */ /* See 'lib_mem.h Note #2a'. */ /*$PAGE*/ /* ********************************************************************************************************* * MODULE END * * Note(s) : (1) See 'lib_mem.h MODULE'. ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/LIB * CUSTOM LIBRARY MODULES * * (c) Copyright 2004-2013; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/LIB is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * ASCII STRING MANAGEMENT * * Filename : lib_str.h * Version : V1.37.01 * Programmer(s) : ITJ * JDH ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * * (a) ALL standard library functions are implemented in the custom library modules : * * (1) \\lib_*.* * * (2) \\Ports\\\lib*_a.* * * where * directory path for custom library software * directory name for specific processor (CPU) * directory name for specific compiler * * (b) Product-specific library functions are implemented in individual products. ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE * * Note(s) : (1) This string library header file is protected from multiple pre-processor inclusion through * use of the string library module present pre-processor macro definition. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ASCII STRING CONFIGURATION DEFINES * * Note(s) : (1) Some ASCII string configuration #define's MUST be available PRIOR to including any * application configuration (see 'INCLUDE FILES Note #1a'). ********************************************************************************************************* */ /* ********************************************************************************************************* * STRING FLOATING POINT DEFINES * * Note(s) : (1) (a) (1) The maximum accuracy for 32-bit floating-point numbers : * * * Maximum Accuracy log [Internal-Base ^ (Number-Internal-Base-Digits)] * 32-bit Floating-point Number = ----------------------------------------------------- * log [External-Base] * * log [2 ^ 24] * = -------------- * log [10] * * < 7.225 Base-10 Digits * * where * Internal-Base Internal number base of floating- * point numbers (i.e. 2) * External-Base External number base of floating- * point numbers (i.e. 10) * Number-Internal-Base-Digits Number of internal number base * significant digits (i.e. 24) * * (2) Also, since some 32-bit floating-point calculations are converted to 32-bit * unsigned numbers, the maximum accuracy is limited to the maximum accuracy * for 32-bit unsigned numbers of 9 digits. * * (b) Some CPUs' &/or compilers' floating-point implementations MAY further reduce the * maximum accuracy. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * INCLUDE FILES * * Note(s) : (1) The custom library software files are located in the following directories : * * (a) \\lib_cfg.h * * (b) \\lib_*.* * * where * directory path for Your Product's Application * directory path for custom library software * * (2) CPU-configuration software files are located in the following directories : * * (a) \\cpu_*.* * (b) \\\\cpu*.* * * where * directory path for common CPU-compiler software * directory name for specific processor (CPU) * directory name for specific compiler * * (3) Compiler MUST be configured to include as additional include path directories : * * (a) '\\' directory See Note #1a * * (b) '\\' directory See Note #1b * * (c) (1) '\\' directory See Note #2a * (2) '\\\\' directory See Note #2b * * (4) NO compiler-supplied standard library functions SHOULD be used. * * #### The reference to standard library header files SHOULD be removed once all custom * library functions are implemented WITHOUT reference to ANY standard library function(s). * * See also 'STANDARD LIBRARY MACRO'S Note #1'. ********************************************************************************************************* */ /* ********************************************************************************************************* * uC/LIB * CUSTOM LIBRARY MODULES * * (c) Copyright 2004-2013; Micrium, Inc.; Weston, FL * * All rights reserved. Protected by international copyright laws. * * uC/LIB is provided in source form to registered licensees ONLY. It is * illegal to distribute this source code to any third party unless you receive * written permission by an authorized Micrium representative. Knowledge of * the source code may NOT be used to develop a similar product. * * Please help us continue to provide the Embedded community with the finest * software available. Your honesty is greatly appreciated. * * You can contact us at www.micrium.com. ********************************************************************************************************* */ /* ********************************************************************************************************* * * ASCII CHARACTER OPERATIONS * * Filename : lib_ascii.h * Version : V1.37.01 * Programmer(s) : BAN ********************************************************************************************************* * Note(s) : (1) NO compiler-supplied standard library functions are used in library or product software. * * (a) ALL standard library functions are implemented in the custom library modules : * * (1) \\lib_*.* * * (2) \\Ports\\\lib*_a.* * * where * directory path for custom library software * directory name for specific processor (CPU) * directory name for specific compiler * * (b) Product-specific library functions are implemented in individual products. * * * (2) (a) ECMA-6 '7-Bit coded Character Set' (6th edition), which corresponds to the * 3rd edition of ISO 646, specifies several versions of a 7-bit character set : * * (1) THE GENERAL VERSION, which allows characters at 0x23 and 0x24 to be given a * set alternate form and allows the characters 0x40, 0x5B, 0x5D, 0x60, 0x7B & * 0x7D to be assigned a "unique graphic character" or to be declared as unused. * All other characters are explicitly specified. * * (2) THE INTERNATIONAL REFERENCE VERSION, which explicitly specifies all characters * in the 7-bit character set. * * (3) NATIONAL & APPLICATION-ORIENTED VERSIONS, which may be derived from the * standard in specified ways. * * (b) The character set represented in this file reproduces the Internation Reference * Version. This is identical to the 7-bit character set which occupies Unicode * characters 0x0000 through 0x007F. The character names are taken from v5.0 of the * Unicode specification, with certain abbreviations so that the resulting #define * names will not violate ANSI C naming restriction : * * (1) For the Latin capital & lowercase letters, the name components 'LETTER_CAPITAL' * & 'LETTER_SMALL' are replaced by 'UPPER' & 'LOWER', respectively. ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE * * Note(s) : (1) This ASCII library header file is protected from multiple pre-processor inclusion through * use of the ASCII library module present pre-processor macro definition. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * INCLUDE FILES * * Note(s) : (1) The custom library software files are located in the following directories : * * (a) \\lib_*.* * * where * directory path for custom library software * * (2) CPU-configuration software files are located in the following directories : * * (a) \\cpu_*.* * (b) \\\\cpu*.* * * where * directory path for common CPU-compiler software * directory name for specific processor (CPU) * directory name for specific compiler * * (3) Compiler MUST be configured to include as additional include path directories : * * (a) '\\' directory See Note #1a * * (b) (1) '\\' directory See Note #2a * (2) '\\\\' directory See Note #2b * * (4) NO compiler-supplied standard library functions SHOULD be used. ********************************************************************************************************* */ /* ********************************************************************************************************* * EXTERNS ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEFINES ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII CHARACTER DEFINES ********************************************************************************************************* */ /* -------------------- C0 CONTROLS ------------------- */ /*$PAGE*/ /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */ /* ------------------- ASCII DIGITS ------------------- */ /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */ /*$PAGE*/ /* ------------- UPPERCASE LATIN ALPHABET ------------- */ /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */ /* ------------- LOWERCASE LATIN ALPHABET ------------- */ /* ------------ ASCII PUNCTUATION & SYMBOLS ----------- */ /* ---------------- CONTROL CHARACTERS ---------------- */ /*$PAGE*/ /* ********************************************************************************************************* * DATA TYPES ********************************************************************************************************* */ /* ********************************************************************************************************* * GLOBAL VARIABLES ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * MACRO'S ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII CHARACTER CLASSIFICATION MACRO's * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.(1) states that "character classification functions ... * return nonzero (true) if and only if the value of the argument 'c' conforms to ... the * description of the function." ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_DIG() * * Description : Determine whether a character is a decimal-digit character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a decimal-digit character. * * DEF_NO, if character is NOT a decimal-digit character. * * Caller(s) : Application. * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.5.(2) states that "isdigit() ... tests for any * decimal-digit character". ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_DIG_OCT() * * Description : Determine whether a character is an octal-digit character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is an octal-digit character. * * DEF_NO, if character is NOT an octal-digit character. * * Caller(s) : Application. * * Note(s) : none. ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_DIG_HEX() * * Description : Determine whether a character is a hexadecimal-digit character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a hexadecimal-digit character. * * DEF_NO, if character is NOT a hexadecimal-digit character. * * Caller(s) : Application. * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.12.(2) states that "isxdigit() ... tests for any * hexadecimal-digit character". ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ASCII_IS_LOWER() * * Description : Determine whether a character is a lowercase alphabetic character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a lowercase alphabetic character. * * DEF_NO, if character is NOT a lowercase alphabetic character. * * Caller(s) : Application. * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.7.(2) states that "islower() returns true only for * the lowercase letters". ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_UPPER() * * Description : Determine whether a character is an uppercase alphabetic character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is an uppercase alphabetic character. * * DEF_NO, if character is NOT an uppercase alphabetic character. * * Caller(s) : Application. * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.11.(2) states that "isupper() returns true only for * the uppercase letters". ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ASCII_IS_ALPHA() * * Description : Determine whether a character is an alphabetic character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is an alphabetic character. * * DEF_NO, if character is NOT an alphabetic character. * * Caller(s) : Application. * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.2.(2) states that "isalpha() returns true only for the * characters for which isupper() or islower() is true". ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_ALPHA_NUM() * * Description : Determine whether a character is an alphanumeric character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is an alphanumeric character. * * DEF_NO, if character is NOT an alphanumeric character. * * Caller(s) : Application. * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.1.(2) states that "isalnum() ... tests for any character * for which isalpha() or isdigit() is true". ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ASCII_IS_BLANK() * * Description : Determine whether a character is a standard blank character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a standard blank character. * * DEF_NO, if character is NOT a standard blank character. * * Caller(s) : Application. * * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.3.(2) states that "isblank() returns true only for * the standard blank characters". * * (b) ISO/IEC 9899:TC2, Section 7.4.1.3.(2) defines "the standard blank characters" as * the "space (' '), and horizontal tab ('\t')". ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_SPACE() * * Description : Determine whether a character is a white-space character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a white-space character. * * DEF_NO, if character is NOT a white-space character. * * Caller(s) : Application. * * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.10.(2) states that "isspace() returns true only * for the standard white-space characters". * * (b) ISO/IEC 9899:TC2, Section 7.4.1.10.(2) defines "the standard white-space characters" * as the "space (' '), form feed ('\f'), new-line ('\n'), carriage return ('\r'), * horizontal tab ('\t'), and vertical tab ('\v')". ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ASCII_IS_PRINT() * * Description : Determine whether a character is a printing character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a printing character. * * DEF_NO, if character is NOT a printing character. * * Caller(s) : Application. * * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.8.(2) states that "isprint() ... tests for any * printing character including space (' ')". * * (b) ISO/IEC 9899:TC2, Section 7.4.(3), Note 169, states that in "the seven-bit US * ASCII character set, the printing characters are those whose values lie from * 0x20 (space) through 0x7E (tilde)". ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_GRAPH() * * Description : Determine whether a character is any printing character except a space character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a graphic character. * * DEF_NO, if character is NOT a graphic character. * * Caller(s) : Application. * * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.6.(2) states that "isgraph() ... tests for any * printing character except space (' ')". * * (b) ISO/IEC 9899:TC2, Section 7.4.(3), Note 169, states that in "the seven-bit US * ASCII character set, the printing characters are those whose values lie from * 0x20 (space) through 0x7E (tilde)". ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ASCII_IS_PUNCT() * * Description : Determine whether a character is a punctuation character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a punctuation character. * * DEF_NO, if character is NOT a punctuation character. * * Caller(s) : Application. * * Note(s) : (1) ISO/IEC 9899:TC2, Section 7.4.1.9.(2) states that "ispunct() returns true for every * printing character for which neither isspace() nor isalnum() is true". ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_IS_CTRL() * * Description : Determine whether a character is a control character. * * Argument(s) : c Character to examine. * * Return(s) : DEF_YES, if character is a control character. * * DEF_NO, if character is NOT a control character. * * Caller(s) : Application. * * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.1.4.(2) states that "iscntrl() ... tests for any * control character". * * (b) ISO/IEC 9899:TC2, Section 7.4.(3), Note 169, states that in "the seven-bit US * ASCII character set, ... the control characters are those whose values lie from * 0 (NUL) through 0x1F (US), and the character 0x7F (DEL)". ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * ASCII CHARACTER CASE MAPPING MACRO's ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_TO_LOWER() * * Description : Convert uppercase alphabetic character to its corresponding lowercase alphabetic character. * * Argument(s) : c Character to convert. * * Return(s) : Lowercase equivalent of 'c', if character 'c' is an uppercase character (see Note #1b1). * * Character 'c', otherwise (see Note #1b2). * * Caller(s) : Application. * * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.2.1.(2) states that "tolower() ... converts an * uppercase letter to a corresponding lowercase letter". * * (b) ISO/IEC 9899:TC2, Section 7.4.2.1.(3) states that : * * (1) (A) "if the argument is a character for which isupper() is true and there are * one or more corresponding characters ... for which islower() is true," ... * (B) "tolower() ... returns one of the corresponding characters;" ... * * (2) "otherwise, the argument is returned unchanged." ********************************************************************************************************* */ /* ********************************************************************************************************* * ASCII_TO_UPPER() * * Description : Convert lowercase alphabetic character to its corresponding uppercase alphabetic character. * * Argument(s) : c Character to convert. * * Return(s) : Uppercase equivalent of 'c', if character 'c' is a lowercase character (see Note #1b1). * * Character 'c', otherwise (see Note #1b2). * * Caller(s) : Application. * * Note(s) : (1) (a) ISO/IEC 9899:TC2, Section 7.4.2.2.(2) states that "toupper() ... converts a * lowercase letter to a corresponding uppercase letter". * * (b) ISO/IEC 9899:TC2, Section 7.4.2.2.(3) states that : * * (1) (A) "if the argument is a character for which islower() is true and there are * one or more corresponding characters ... for which isupper() is true," ... * (B) "toupper() ... returns one of the corresponding characters;" ... * * (2) "otherwise, the argument is returned unchanged." ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES ********************************************************************************************************* */ CPU_BOOLEAN ASCII_IsAlpha (CPU_CHAR c); CPU_BOOLEAN ASCII_IsAlphaNum(CPU_CHAR c); CPU_BOOLEAN ASCII_IsLower (CPU_CHAR c); CPU_BOOLEAN ASCII_IsUpper (CPU_CHAR c); CPU_BOOLEAN ASCII_IsDig (CPU_CHAR c); CPU_BOOLEAN ASCII_IsDigOct (CPU_CHAR c); CPU_BOOLEAN ASCII_IsDigHex (CPU_CHAR c); CPU_BOOLEAN ASCII_IsBlank (CPU_CHAR c); CPU_BOOLEAN ASCII_IsSpace (CPU_CHAR c); CPU_BOOLEAN ASCII_IsPrint (CPU_CHAR c); CPU_BOOLEAN ASCII_IsGraph (CPU_CHAR c); CPU_BOOLEAN ASCII_IsPunct (CPU_CHAR c); CPU_BOOLEAN ASCII_IsCtrl (CPU_CHAR c); CPU_CHAR ASCII_ToLower (CPU_CHAR c); CPU_CHAR ASCII_ToUpper (CPU_CHAR c); CPU_BOOLEAN ASCII_Cmp (CPU_CHAR c1, CPU_CHAR c2); /*$PAGE*/ /* ********************************************************************************************************* * CONFIGURATION ERRORS ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE END * * Note(s) : (1) See 'lib_ascii.h MODULE'. ********************************************************************************************************* */ /* ********************************************************************************************************* * EXTERNS ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DEFAULT CONFIGURATION ********************************************************************************************************* */ /* ********************************************************************************************************* * STRING FLOATING POINT CONFIGURATION * * Note(s) : (1) Configure LIB_STR_CFG_FP_EN to enable/disable floating point string function(s). * * (2) Configure LIB_STR_CFG_FP_MAX_NBR_DIG_SIG to configure the maximum number of significant * digits to calculate &/or display for floating point string function(s). * * See also 'STRING FLOATING POINT DEFINES Note #1'. ********************************************************************************************************* */ /* Configure floating point feature(s) [see Note #1] : */ /* Configure floating point feature(s)' number of ... */ /* ... significant digits (see Note #2). */ /* ********************************************************************************************************* * DEFINES ********************************************************************************************************* */ /* ********************************************************************************************************* * DATA TYPES ********************************************************************************************************* */ /* ********************************************************************************************************* * GLOBAL VARIABLES ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * MACRO'S ********************************************************************************************************* */ /* ********************************************************************************************************* * STANDARD LIBRARY MACRO'S * * Note(s) : (1) NO compiler-supplied standard library functions SHOULD be used. * * #### The reference to standard memory functions SHOULD be removed once all custom library * functions are implemented WITHOUT reference to ANY standard library function(s). * * See also 'INCLUDE FILES Note #3'. ********************************************************************************************************* */ /* See Note #1. */ /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES ********************************************************************************************************* */ /* ------------------ STR LEN FNCTS ------------------ */ CPU_SIZE_T Str_Len (const CPU_CHAR *pstr); CPU_SIZE_T Str_Len_N (const CPU_CHAR *pstr, CPU_SIZE_T len_max); /* ------------------ STR COPY FNCTS ------------------ */ CPU_CHAR *Str_Copy ( CPU_CHAR *pstr_dest, const CPU_CHAR *pstr_src); CPU_CHAR *Str_Copy_N ( CPU_CHAR *pstr_dest, const CPU_CHAR *pstr_src, CPU_SIZE_T len_max); CPU_CHAR *Str_Cat ( CPU_CHAR *pstr_dest, const CPU_CHAR *pstr_cat); CPU_CHAR *Str_Cat_N ( CPU_CHAR *pstr_dest, const CPU_CHAR *pstr_cat, CPU_SIZE_T len_max); /* ------------------ STR CMP FNCTS ------------------ */ CPU_INT16S Str_Cmp (const CPU_CHAR *p1_str, const CPU_CHAR *p2_str); CPU_INT16S Str_Cmp_N (const CPU_CHAR *p1_str, const CPU_CHAR *p2_str, CPU_SIZE_T len_max); CPU_INT16S Str_CmpIgnoreCase (const CPU_CHAR *p1_str, const CPU_CHAR *p2_str); CPU_INT16S Str_CmpIgnoreCase_N(const CPU_CHAR *p1_str, const CPU_CHAR *p2_str, CPU_SIZE_T len_max); /* ------------------ STR SRCH FNCTS ------------------ */ CPU_CHAR *Str_Char (const CPU_CHAR *pstr, CPU_CHAR srch_char); CPU_CHAR *Str_Char_N (const CPU_CHAR *pstr, CPU_SIZE_T len_max, CPU_CHAR srch_char); CPU_CHAR *Str_Char_Last (const CPU_CHAR *pstr, CPU_CHAR srch_char); CPU_CHAR *Str_Char_Last_N (const CPU_CHAR *pstr, CPU_SIZE_T len_max, CPU_CHAR srch_char); CPU_CHAR *Str_Char_Replace ( CPU_CHAR *pstr, CPU_CHAR char_srch, CPU_CHAR char_replace); CPU_CHAR *Str_Char_Replace_N ( CPU_CHAR *pstr, CPU_CHAR char_srch, CPU_CHAR char_replace, CPU_SIZE_T len_max); CPU_CHAR *Str_Str (const CPU_CHAR *pstr, const CPU_CHAR *pstr_srch); CPU_CHAR *Str_Str_N (const CPU_CHAR *pstr, const CPU_CHAR *pstr_srch, CPU_SIZE_T len_max); /*$PAGE*/ /* ------------------ STR FMT FNCTS ------------------ */ CPU_CHAR *Str_FmtNbr_Int32U ( CPU_INT32U nbr, CPU_INT08U nbr_dig, CPU_INT08U nbr_base, CPU_CHAR lead_char, CPU_BOOLEAN lower_case, CPU_BOOLEAN nul, CPU_CHAR *pstr); CPU_CHAR *Str_FmtNbr_Int32S ( CPU_INT32S nbr, CPU_INT08U nbr_dig, CPU_INT08U nbr_base, CPU_CHAR lead_char, CPU_BOOLEAN lower_case, CPU_BOOLEAN nul, CPU_CHAR *pstr); /* ----------------- STR PARSE FNCTS ------------------ */ CPU_INT32U Str_ParseNbr_Int32U(const CPU_CHAR *pstr, CPU_CHAR **pstr_next, CPU_INT08U nbr_base); CPU_INT32S Str_ParseNbr_Int32S(const CPU_CHAR *pstr, CPU_CHAR **pstr_next, CPU_INT08U nbr_base); /*$PAGE*/ /* ********************************************************************************************************* * CONFIGURATION ERRORS ********************************************************************************************************* */ /* ********************************************************************************************************* * MODULE END * * Note(s) : (1) See 'lib_str.h MODULE'. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * CPU CONFIGURATION * * Note(s) : (1) The following pre-processor directives correctly configure CPU parameters. DO NOT MODIFY. * * (2) CPU timestamp timer feature is required for : * * (a) CPU timestamps * (b) CPU interrupts disabled time measurement * * See also 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #1' * & 'cpu_cfg.h CPU INTERRUPTS DISABLED TIME MEASUREMENT CONFIGURATION Note #1'. ********************************************************************************************************* */ //#else //#define CPU_CFG_TS_EN DEF_DISABLED //#else //#define CPU_CFG_TS_TMR_EN DEF_DISABLED /* ********************************************************************************************************* * DEFINES ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * DATA TYPES ********************************************************************************************************* */ /* ********************************************************************************************************* * CPU ERROR CODES ********************************************************************************************************* */ typedef enum cpu_err { CPU_ERR_NONE = 0u, CPU_ERR_NULL_PTR = 10u, CPU_ERR_NAME_SIZE = 1000u, CPU_ERR_TS_FREQ_INVALID = 2000u } CPU_ERR; /* ********************************************************************************************************* * CPU TIMESTAMP DATA TYPES * * Note(s) : (1) CPU timestamp timer data type defined to the binary-multiple of 8-bit octets as configured * by 'CPU_CFG_TS_TMR_SIZE' (see 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #2'). ********************************************************************************************************* */ typedef CPU_INT32U CPU_TS32; typedef CPU_INT64U CPU_TS64; typedef CPU_TS32 CPU_TS; /* Req'd for backwards-compatibility. */ typedef CPU_INT32U CPU_TS_TMR; /* ********************************************************************************************************* * CPU TIMESTAMP TIMER FREQUENCY DATA TYPE ********************************************************************************************************* */ typedef CPU_INT32U CPU_TS_TMR_FREQ; /* ********************************************************************************************************* * GLOBAL VARIABLES ********************************************************************************************************* */ extern CPU_CHAR CPU_Name[16]; /* CPU host name. */ extern CPU_TS_TMR_FREQ CPU_TS_TmrFreq_Hz; /* CPU ts tmr freq (in Hz). */ extern CPU_INT16U CPU_IntDisMeasCtr; /* Nbr tot ints dis'd ctr. */ extern CPU_INT16U CPU_IntDisNestCtr; /* Nbr nested ints dis'd ctr. */ /* Ints dis'd time (in ts tmr cnts) : ... */ extern CPU_TS_TMR CPU_IntDisMeasStart_cnts; /* ... start time. */ extern CPU_TS_TMR CPU_IntDisMeasStop_cnts; /* ... stop time. */ extern CPU_TS_TMR CPU_IntDisMeasOvrhd_cnts; /* ... time meas ovrhd. */ extern CPU_TS_TMR CPU_IntDisMeasMaxCur_cnts; /* ... resetable max time dis'd. */ extern CPU_TS_TMR CPU_IntDisMeasMax_cnts; /* ... non-resetable max time dis'd. */ /*$PAGE*/ /* ********************************************************************************************************* * MACRO'S ********************************************************************************************************* */ /* ********************************************************************************************************* * CPU_SW_EXCEPTION() * * Description : Trap unrecoverable software exception. * * Argument(s) : err_rtn_val Error type &/or value of the calling function to return (see Note #2b). * * Return(s) : none. * * Caller(s) : various. * * Note(s) : (1) CPU_SW_EXCEPTION() deadlocks the current code execution -- whether multi-tasked/ * -processed/-threaded or single-threaded -- when the current code execution cannot * gracefully recover or report a fault or exception condition. * * Example CPU_SW_EXCEPTION() call : * * void Fnct (CPU_ERR *p_err) * { * : * * if (p_err == (CPU_ERR *)0) { If 'p_err' NULL, cannot return error ... * CPU_SW_EXCEPTION(;); ... so trap invalid argument exception. * } * * : * } * * See also 'cpu_core.c CPU_SW_Exception() Note #1'. * * (2) (a) CPU_SW_EXCEPTION() MAY be developer-implemented to output &/or handle any error or * exception conditions; but since CPU_SW_EXCEPTION() is intended to trap unrecoverable * software conditions, it is recommended that developer-implemented versions prevent * execution of any code following calls to CPU_SW_EXCEPTION() by deadlocking the code * (see Note #1). * * Example CPU_SW_EXCEPTION() : * * #define CPU_SW_EXCEPTION(err_rtn_val) do { * Log(__FILE__, __LINE__); * CPU_SW_Exception(); * } while (0) * * (b) (1) However, if execution of code following calls to CPU_SW_EXCEPTION() is required * (e.g. for automated testing); it is recommended that the last statement in * developer-implemented versions be to return from the current function to prevent * possible software exception(s) in the current function from triggering CPU &/or * hardware exception(s). * * Example CPU_SW_EXCEPTION() : * * #define CPU_SW_EXCEPTION(err_rtn_val) do { * Log(__FILE__, __LINE__); * return err_rtn_val; * } while (0) * * (A) Note that 'err_rtn_val' in the return statement MUST NOT be enclosed in * parentheses. This allows CPU_SW_EXCEPTION() to return from functions that * return 'void', i.e. NO return type or value (see also Note #2b2A). *$PAGE* * (2) In order for CPU_SW_EXCEPTION() to return from functions with various return * types/values, each caller function MUST pass an appropriate error return type * & value to CPU_SW_EXCEPTION(). * * (A) Note that CPU_SW_EXCEPTION() MUST NOT be passed any return type or value * for functions that return 'void', i.e. NO return type or value; but SHOULD * instead be passed a single semicolon. This prevents possible compiler * warnings that CPU_SW_EXCEPTION() is passed too few arguments. However, * the compiler may warn that CPU_SW_EXCEPTION() does NOT prevent creating * null statements on lines with NO other code statements. * * Example CPU_SW_EXCEPTION() calls : * * void Fnct (CPU_ERR *p_err) * { * : * * if (p_err == (CPU_ERR *)0) { * CPU_SW_EXCEPTION(;); Exception macro returns NO value * } (see Note #2b2A) * * : * } * * CPU_BOOLEAN Fnct (CPU_ERR *p_err) * { * : * * if (p_err == (CPU_ERR *)0) { * CPU_SW_EXCEPTION(DEF_FAIL); Exception macro returns 'DEF_FAIL' * } * * : * } * * OBJ *Fnct (CPU_ERR *p_err) * { * : * * if (p_err == (CPU_ERR *)0) { * CPU_SW_EXCEPTION((OBJ *)0); Exception macro returns NULL 'OBJ *' * } * * : * } * ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * CPU_VAL_UNUSED() * * Description : * * Argument(s) : none. * * Return(s) : none. * * Caller(s) : #### various. * * Note(s) : none. ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * CPU_TYPE_CREATE() * * Description : Creates a generic type value. * * Argument(s) : char_1 1st ASCII character to create generic type value. * * char_2 2nd ASCII character to create generic type value. * * char_3 3rd ASCII character to create generic type value. * * char_4 4th ASCII character to create generic type value. * * Return(s) : 32-bit generic type value. * * Caller(s) : various. * * Note(s) : (1) (a) Generic type values should be #define'd with large, non-trivial values to trap * & discard invalid/corrupted objects based on type value. * * In other words, by assigning large, non-trivial values to valid objects' type * fields; the likelihood that an object with an unassigned &/or corrupted type * field will contain a value is highly improbable & therefore the object itself * will be trapped as invalid. * * (b) (1) CPU_TYPE_CREATE() creates a 32-bit type value from four values. * * (2) Ideally, generic type values SHOULD be created from 'CPU_CHAR' characters to * represent ASCII string abbreviations of the specific object types. Memory * displays of object type values will display the specific object types with * their chosen ASCII names. * * Examples : * * #define FILE_TYPE CPU_TYPE_CREATE('F', 'I', 'L', 'E') * #define BUF_TYPE CPU_TYPE_CREATE('B', 'U', 'F', ' ') ********************************************************************************************************* */ /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES * * Note(s) : (1) CPU interrupts disabled time measurement functions prototyped/defined only if * CPU_CFG_INT_DIS_MEAS_EN #define'd in 'cpu_cfg.h'. * * (2) (a) CPU_CntLeadZeros() defined in : * * (1) 'cpu_a.asm', if CPU_CFG_LEAD_ZEROS_ASM_PRESENT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable assembly-optimized function(s) * * (2) 'cpu_core.c', if CPU_CFG_LEAD_ZEROS_ASM_PRESENT NOT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable C-source-optimized function(s) * * (b) CPU_CntTrailZeros() defined in : * * (1) 'cpu_a.asm', if CPU_CFG_TRAIL_ZEROS_ASM_PRESENT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable assembly-optimized function(s) * * (2) 'cpu_core.c', if CPU_CFG_TRAIL_ZEROS_ASM_PRESENT NOT #define'd in 'cpu.h'/ * 'cpu_cfg.h' to enable C-source-optimized function(s) ********************************************************************************************************* */ void CPU_Init (void); void CPU_SW_Exception (void); void CPU_NameClr (void); void CPU_NameGet ( CPU_CHAR *p_name, CPU_ERR *p_err); void CPU_NameSet (const CPU_CHAR *p_name, CPU_ERR *p_err); /* --------------- CPU TS FNCTS --------------- */ CPU_TS32 CPU_TS_Get32 (void); void CPU_TS_Update (void); CPU_TS_TMR_FREQ CPU_TS_TmrFreqGet (CPU_ERR *p_err); void CPU_TS_TmrFreqSet (CPU_TS_TMR_FREQ freq_hz); /* See Note #1. */ CPU_TS_TMR CPU_IntDisMeasMaxCurReset(void); CPU_TS_TMR CPU_IntDisMeasMaxCurGet (void); CPU_TS_TMR CPU_IntDisMeasMaxGet (void); void CPU_IntDisMeasStart (void); void CPU_IntDisMeasStop (void); /* ----------- CPU CNT ZEROS FNCTS ------------ */ CPU_DATA CPU_CntLeadZeros (CPU_DATA val); CPU_DATA CPU_CntLeadZeros08 (CPU_INT08U val); CPU_DATA CPU_CntLeadZeros16 (CPU_INT16U val); CPU_DATA CPU_CntLeadZeros32 (CPU_INT32U val); CPU_DATA CPU_CntLeadZeros64 (CPU_INT64U val); CPU_DATA CPU_CntTrailZeros (CPU_DATA val); CPU_DATA CPU_CntTrailZeros08 (CPU_INT08U val); CPU_DATA CPU_CntTrailZeros16 (CPU_INT16U val); CPU_DATA CPU_CntTrailZeros32 (CPU_INT32U val); CPU_DATA CPU_CntTrailZeros64 (CPU_INT64U val); /*$PAGE*/ /* ********************************************************************************************************* * FUNCTION PROTOTYPES * DEFINED IN PRODUCT'S BSP ********************************************************************************************************* */ /* ********************************************************************************************************* * CPU_TS_TmrInit() * * Description : Initialize & start CPU timestamp timer. * * Argument(s) : none. * * Return(s) : none. * * Caller(s) : CPU_TS_Init(). * * This function is an INTERNAL CPU module function & MUST be implemented by application/ * BSP function(s) [see Note #1] but MUST NOT be called by application function(s). * * Note(s) : (1) CPU_TS_TmrInit() is an application/BSP function that MUST be defined by the developer * if either of the following CPU features is enabled : * * (a) CPU timestamps * (b) CPU interrupts disabled time measurements * * See 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #1' * & 'cpu_cfg.h CPU INTERRUPTS DISABLED TIME MEASUREMENT CONFIGURATION Note #1a'. * * (2) (a) Timer count values MUST be returned via word-size-configurable 'CPU_TS_TMR' * data type. * * (1) If timer has more bits, truncate timer values' higher-order bits greater * than the configured 'CPU_TS_TMR' timestamp timer data type word size. * * (2) Since the timer MUST NOT have less bits than the configured 'CPU_TS_TMR' * timestamp timer data type word size; 'CPU_CFG_TS_TMR_SIZE' MUST be * configured so that ALL bits in 'CPU_TS_TMR' data type are significant. * * In other words, if timer size is not a binary-multiple of 8-bit octets * (e.g. 20-bits or even 24-bits), then the next lower, binary-multiple * octet word size SHOULD be configured (e.g. to 16-bits). However, the * minimum supported word size for CPU timestamp timers is 8-bits. * * See also 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #2' * & 'cpu_core.h CPU TIMESTAMP DATA TYPES Note #1'. * * (b) Timer SHOULD be an 'up' counter whose values increase with each time count. * * (c) When applicable, timer period SHOULD be less than the typical measured time * but MUST be less than the maximum measured time; otherwise, timer resolution * inadequate to measure desired times. * * See also 'CPU_TS_TmrRd() Note #2'. ********************************************************************************************************* */ void CPU_TS_TmrInit(void); /*$PAGE*/ /* ********************************************************************************************************* * CPU_TS_TmrRd() * * Description : Get current CPU timestamp timer count value. * * Argument(s) : none. * * Return(s) : Timestamp timer count (see Notes #2a & #2b). * * Caller(s) : CPU_TS_Init(), * CPU_TS_Get32(), * CPU_TS_Get64(), * CPU_IntDisMeasStart(), * CPU_IntDisMeasStop(). * * This function is an INTERNAL CPU module function & MUST be implemented by application/ * BSP function(s) [see Note #1] but SHOULD NOT be called by application function(s). * * Note(s) : (1) CPU_TS_TmrRd() is an application/BSP function that MUST be defined by the developer * if either of the following CPU features is enabled : * * (a) CPU timestamps * (b) CPU interrupts disabled time measurements * * See 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #1' * & 'cpu_cfg.h CPU INTERRUPTS DISABLED TIME MEASUREMENT CONFIGURATION Note #1a'. * * (2) (a) Timer count values MUST be returned via word-size-configurable 'CPU_TS_TMR' * data type. * * (1) If timer has more bits, truncate timer values' higher-order bits greater * than the configured 'CPU_TS_TMR' timestamp timer data type word size. * * (2) Since the timer MUST NOT have less bits than the configured 'CPU_TS_TMR' * timestamp timer data type word size; 'CPU_CFG_TS_TMR_SIZE' MUST be * configured so that ALL bits in 'CPU_TS_TMR' data type are significant. * * In other words, if timer size is not a binary-multiple of 8-bit octets * (e.g. 20-bits or even 24-bits), then the next lower, binary-multiple * octet word size SHOULD be configured (e.g. to 16-bits). However, the * minimum supported word size for CPU timestamp timers is 8-bits. * * See also 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #2' * & 'cpu_core.h CPU TIMESTAMP DATA TYPES Note #1'. * * (b) Timer SHOULD be an 'up' counter whose values increase with each time count. * * (1) If timer is a 'down' counter whose values decrease with each time count, * then the returned timer value MUST be ones-complemented. * * (c) (1) When applicable, the amount of time measured by CPU timestamps is * calculated by either of the following equations : * * (A) Time measured = Number timer counts * Timer period * * where * * Number timer counts Number of timer counts measured * Timer period Timer's period in some units of * (fractional) seconds * Time measured Amount of time measured, in same * units of (fractional) seconds * as the Timer period * * Number timer counts * (B) Time measured = --------------------- * Timer frequency * * where * * Number timer counts Number of timer counts measured * Timer frequency Timer's frequency in some units * of counts per second * Time measured Amount of time measured, in seconds * * (2) Timer period SHOULD be less than the typical measured time but MUST be less * than the maximum measured time; otherwise, timer resolution inadequate to * measure desired times. ********************************************************************************************************* */ CPU_TS_TMR CPU_TS_TmrRd(void); /*$PAGE*/ /* ********************************************************************************************************* * CPU_TSxx_to_uSec() * * Description : Convert a 32-/64-bit CPU timestamp from timer counts to microseconds. * * Argument(s) : ts_cnts CPU timestamp (in timestamp timer counts [see Note #2aA]). * * Return(s) : Converted CPU timestamp (in microseconds [see Note #2aD]). * * Caller(s) : Application. * * This function is an (optional) CPU module application programming interface (API) * function which MAY be implemented by application/BSP function(s) [see Note #1] & * MAY be called by application function(s). * * Note(s) : (1) CPU_TS32_to_uSec()/CPU_TS64_to_uSec() are application/BSP functions that MAY be * optionally defined by the developer when either of the following CPU features is * enabled : * * (a) CPU timestamps * (b) CPU interrupts disabled time measurements * * See 'cpu_cfg.h CPU TIMESTAMP CONFIGURATION Note #1' * & 'cpu_cfg.h CPU INTERRUPTS DISABLED TIME MEASUREMENT CONFIGURATION Note #1a'. * * (2) (a) The amount of time measured by CPU timestamps is calculated by either of * the following equations : * * 10^6 microseconds * (1) Time measured = Number timer counts * ------------------- * Timer period * 1 second * * Number timer counts 10^6 microseconds * (2) Time measured = --------------------- * ------------------- * Timer frequency 1 second * * where * * (A) Number timer counts Number of timer counts measured * (B) Timer frequency Timer's frequency in some units * of counts per second * (C) Timer period Timer's period in some units of * (fractional) seconds * (D) Time measured Amount of time measured, * in microseconds * * (b) Timer period SHOULD be less than the typical measured time but MUST be less * than the maximum measured time; otherwise, timer resolution inadequate to * measure desired times. * * (c) Specific implementations may convert any number of CPU_TS32 or CPU_TS64 bits * -- up to 32 or 64, respectively -- into microseconds. ********************************************************************************************************* */ CPU_INT64U CPU_TS32_to_uSec(CPU_TS32 ts_cnts); /*$PAGE*/ /* ********************************************************************************************************* * CONFIGURATION ERRORS ********************************************************************************************************* */ /* Correctly configured in 'cpu_core.h'; DO NOT MODIFY. */ /*$PAGE*/ /* Correctly configured in 'cpu_core.h'; DO NOT MODIFY. */ /*$PAGE*/ /* ********************************************************************************************************* * CPU PORT CONFIGURATION ERRORS ********************************************************************************************************* */ /* ********************************************************************************************************* * LIBRARY CONFIGURATION ERRORS ********************************************************************************************************* */ /* See 'cpu_core.h Note #1a'. */ /* ********************************************************************************************************* * MODULE END * * Note(s) : (1) See 'cpu_core.h MODULE'. ********************************************************************************************************* */ /* ************************************************************************************************************************ * uC/OS-III * The Real-Time Kernel * * (c) Copyright 2009-2011; Micrium, Inc.; Weston, FL * All rights reserved. Protected by international copyright laws. * * File : OS_TYPE.H * By : JJL * Version : V3.02.00 * * LICENSING TERMS: * --------------- * uC/OS-III is provided in source form for FREE short-term evaluation, for educational use or * for peaceful research. If you plan or intend to use uC/OS-III in a commercial application/ * product then, you need to contact Micrium to properly license uC/OS-III for its use in your * application/product. We provide ALL the source code for your convenience and to help you * experience uC/OS-III. The fact that the source is provided does NOT mean that you can use * it commercially without paying a licensing fee. * * Knowledge of the source code may NOT be used to develop a similar product. * * Please help us continue to provide the embedded community with the finest software available. * Your honesty is greatly appreciated. * * You can contact us at www.micrium.com, or by phone at +1 (954) 217-2036. ************************************************************************************************************************ */ /* ************************************************************************************************************************ * INCLUDE HEADER FILES ************************************************************************************************************************ */ /* Description # Bits */ /* */ /* ----------------------------------------------------------- */ typedef CPU_INT08U OS_CPU_USAGE; /* CPU Usage 0..100% <8>/16/32 */ typedef CPU_INT32U OS_CTR; /* Counter, 32 */ typedef CPU_INT32U OS_CTX_SW_CTR; /* Counter of context switches, 32 */ typedef CPU_INT32U OS_CYCLES; /* CPU clock cycles, <32>/64 */ typedef CPU_INT32U OS_FLAGS; /* Event flags, 8/16/<32> */ typedef CPU_INT32U OS_IDLE_CTR; /* Holds the number of times the idle task runs, <32>/64 */ typedef CPU_INT16U OS_MEM_QTY; /* Number of memory blocks, <16>/32 */ typedef CPU_INT16U OS_MEM_SIZE; /* Size in bytes of a memory block, <16>/32 */ typedef CPU_INT16U OS_MSG_QTY; /* Number of OS_MSGs in the msg pool, <16>/32 */ typedef CPU_INT16U OS_MSG_SIZE; /* Size of messages in number of bytes, <16>/32 */ typedef CPU_INT08U OS_NESTING_CTR; /* Interrupt and scheduler nesting, <8>/16/32 */ typedef CPU_INT16U OS_OBJ_QTY; /* Number of kernel objects counter, <16>/32 */ typedef CPU_INT32U OS_OBJ_TYPE; /* Special flag to determine object type, 32 */ typedef CPU_INT16U OS_OPT; /* Holds function options <16>/32 */ typedef CPU_INT08U OS_PRIO; /* Priority of a task, <8>/16/32 */ typedef CPU_INT16U OS_QTY; /* Quantity <16>/32 */ typedef CPU_INT32U OS_RATE_HZ; /* Rate in Hertz 32 */ typedef CPU_INT32U OS_REG; /* Task register 8/16/<32> */ typedef CPU_INT08U OS_REG_ID; /* Index to task register <8>/16/32 */ typedef CPU_INT32U OS_SEM_CTR; /* Semaphore value 16/<32> */ typedef CPU_INT08U OS_STATE; /* State variable <8>/16/32 */ typedef CPU_INT08U OS_STATUS; /* Status <8>/16/32 */ typedef CPU_INT32U OS_TICK; /* Clock tick counter <32>/64 */ typedef CPU_INT16U OS_TICK_SPOKE_IX; /* Tick wheel spoke position 8/<16>/32 */ typedef CPU_INT16U OS_TMR_SPOKE_IX; /* Timer wheel spoke position 8/<16>/32 */ /* ********************************************************************************************************* * include ********************************************************************************************************* */ //Jimmy#include /* ********************************************************************************************************* * IRQ¤¤?°ï?¤j¤p ********************************************************************************************************* */ extern CPU_STK OS_CPU_ExceptStk[768u]; extern CPU_STK *OS_CPU_ExceptStkBase; extern CPU_STK *OS_CPU_ExceptStkPtr; /* ********************************************************************************************************* * DEFINES ********************************************************************************************************* */ /* ********************************************************************************************************* * ARM EXCEPTION DEFINES ********************************************************************************************************* */ /* ARM exception IDs */ /* ARM exception vectors addresses */ /* ARM exception handlers addresses */ /* ARM "Jump To Self" asm instruction */ /* ARM "Jump To Exception Handler" asm instruction */ /* ********************************************************************************************************* * MACROS ********************************************************************************************************* */ /* ********************************************************************************************************* * TIMESTAMP CONFIGURATION * * Note(s) : (1) OS_TS_GET() is generally defined as CPU_TS_Get32() to allow CPU timestamp timer to be of * any data type size. * * (2) For architectures that provide 32-bit or higher precision free running counters * (i.e. cycle count registers): * * (a) OS_TS_GET() may be defined as CPU_TS_TmrRd() to improve performance when retrieving * the timestamp. * * (b) CPU_TS_TmrRd() MUST be configured to be greater or equal to 32-bits to avoid * truncation of TS. ********************************************************************************************************* */ /* ********************************************************************************************************* * FUNCTION PROTOTYPES ********************************************************************************************************* */ void OSCtxSw (void); void OSIntCtxSw (void); void OSStartHighRdy (void); void OS_CPU_ARM_ExceptUndefInstrHndlr (void); void OS_CPU_ARM_ExceptSwiHndlr (void); void OS_CPU_ARM_ExceptPrefetchAbortHndlr(void); void OS_CPU_ARM_ExceptDataAbortHndlr (void); void OS_CPU_ARM_ExceptIrqHndlr (void); void OS_CPU_ARM_ExceptFiqHndlr (void); void OS_CPU_IntHandler (CPU_INT32U src_id); void OS_CPU_InitExceptVect (void); CPU_INT32U OS_CPU_ExceptStkChk (void); /* ************************************************************************************************************************ * CRITICAL SECTION HANDLING ************************************************************************************************************************ */ /* ************************************************************************************************************************ * MISCELLANEOUS ************************************************************************************************************************ */ /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * # D E F I N E S ************************************************************************************************************************ ************************************************************************************************************************ */ /* ======================================================================================================================== * TASK STATUS ======================================================================================================================== */ /* ------------------- TASK STATES ------------------ */ /* | */ /* | | */ /* | | | */ /* V V V */ /* ----------------- PENDING ON ... ----------------- */ /* ------------------------------------------------------------------------------------------------------------------------ * TASK PEND STATUS * (Status codes for OS_TCBs field .PendStatus) ------------------------------------------------------------------------------------------------------------------------ */ /* ======================================================================================================================== * OS OBJECT TYPES * * Note(s) : (1) OS_OBJ_TYPE_&&& #define values specifically chosen as ASCII representations of the kernel * object types. Memory displays of kernel objects will display the kernel object TYPEs with * their chosen ASCII names. ======================================================================================================================== */ /* ======================================================================================================================== * Possible values for 'opt' argument ======================================================================================================================== */ /* ------------------------------------------------------------------------------------------------------------------------ * DELETE OPTIONS ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * PEND OPTIONS ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * PEND ABORT OPTIONS ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * POST OPTIONS ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * TASK OPTIONS ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * TIME OPTIONS ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * TIMER OPTIONS ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * TIMER STATES ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * PRIORITY ------------------------------------------------------------------------------------------------------------------------ */ /* Dflt prio to init task TCB */ /* ------------------------------------------------------------------------------------------------------------------------ * TIMER TICK THRESHOLDS ------------------------------------------------------------------------------------------------------------------------ */ /* Threshold to init previous tick time */ /* Threshold to check if tick time already ready */ /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * E N U M E R A T I O N S ************************************************************************************************************************ ************************************************************************************************************************ */ /* ------------------------------------------------------------------------------------------------------------------------ * ERROR CODES ------------------------------------------------------------------------------------------------------------------------ */ typedef enum os_err { OS_ERR_NONE = 0u, OS_ERR_A = 10000u, OS_ERR_ACCEPT_ISR = 10001u, OS_ERR_B = 11000u, OS_ERR_C = 12000u, OS_ERR_CREATE_ISR = 12001u, OS_ERR_D = 13000u, OS_ERR_DEL_ISR = 13001u, OS_ERR_E = 14000u, OS_ERR_F = 15000u, OS_ERR_FATAL_RETURN = 15001u, OS_ERR_FLAG_GRP_DEPLETED = 15101u, OS_ERR_FLAG_NOT_RDY = 15102u, OS_ERR_FLAG_PEND_OPT = 15103u, OS_ERR_FLUSH_ISR = 15104u, OS_ERR_G = 16000u, OS_ERR_H = 17000u, OS_ERR_I = 18000u, OS_ERR_ILLEGAL_CREATE_RUN_TIME = 18001u, OS_ERR_INT_Q = 18002u, OS_ERR_INT_Q_FULL = 18003u, OS_ERR_INT_Q_SIZE = 18004u, OS_ERR_J = 19000u, OS_ERR_K = 20000u, OS_ERR_L = 21000u, OS_ERR_LOCK_NESTING_OVF = 21001u, OS_ERR_M = 22000u, OS_ERR_MEM_CREATE_ISR = 22201u, OS_ERR_MEM_FULL = 22202u, OS_ERR_MEM_INVALID_P_ADDR = 22203u, OS_ERR_MEM_INVALID_BLKS = 22204u, OS_ERR_MEM_INVALID_PART = 22205u, OS_ERR_MEM_INVALID_P_BLK = 22206u, OS_ERR_MEM_INVALID_P_MEM = 22207u, OS_ERR_MEM_INVALID_P_DATA = 22208u, OS_ERR_MEM_INVALID_SIZE = 22209u, OS_ERR_MEM_NO_FREE_BLKS = 22210u, OS_ERR_MSG_POOL_EMPTY = 22301u, OS_ERR_MSG_POOL_NULL_PTR = 22302u, OS_ERR_MUTEX_NOT_OWNER = 22401u, OS_ERR_MUTEX_OWNER = 22402u, OS_ERR_MUTEX_NESTING = 22403u, OS_ERR_N = 23000u, OS_ERR_NAME = 23001u, OS_ERR_O = 24000u, OS_ERR_OBJ_CREATED = 24001u, OS_ERR_OBJ_DEL = 24002u, OS_ERR_OBJ_PTR_NULL = 24003u, OS_ERR_OBJ_TYPE = 24004u, OS_ERR_OPT_INVALID = 24101u, OS_ERR_OS_NOT_RUNNING = 24201u, OS_ERR_OS_RUNNING = 24202u, OS_ERR_P = 25000u, OS_ERR_PEND_ABORT = 25001u, OS_ERR_PEND_ABORT_ISR = 25002u, OS_ERR_PEND_ABORT_NONE = 25003u, OS_ERR_PEND_ABORT_SELF = 25004u, OS_ERR_PEND_DEL = 25005u, OS_ERR_PEND_ISR = 25006u, OS_ERR_PEND_LOCKED = 25007u, OS_ERR_PEND_WOULD_BLOCK = 25008u, OS_ERR_POST_NULL_PTR = 25101u, OS_ERR_POST_ISR = 25102u, OS_ERR_PRIO_EXIST = 25201u, OS_ERR_PRIO = 25202u, OS_ERR_PRIO_INVALID = 25203u, OS_ERR_PTR_INVALID = 25301u, OS_ERR_Q = 26000u, OS_ERR_Q_FULL = 26001u, OS_ERR_Q_EMPTY = 26002u, OS_ERR_Q_MAX = 26003u, OS_ERR_Q_SIZE = 26004u, OS_ERR_R = 27000u, OS_ERR_REG_ID_INVALID = 27001u, OS_ERR_ROUND_ROBIN_1 = 27002u, OS_ERR_ROUND_ROBIN_DISABLED = 27003u, OS_ERR_S = 28000u, OS_ERR_SCHED_INVALID_TIME_SLICE = 28001u, OS_ERR_SCHED_LOCK_ISR = 28002u, OS_ERR_SCHED_LOCKED = 28003u, OS_ERR_SCHED_NOT_LOCKED = 28004u, OS_ERR_SCHED_UNLOCK_ISR = 28005u, OS_ERR_SEM_OVF = 28101u, OS_ERR_SET_ISR = 28102u, OS_ERR_STAT_RESET_ISR = 28201u, OS_ERR_STATE_INVALID = 28202u, OS_ERR_STATUS_INVALID = 28203u, OS_ERR_STK_INVALID = 28204u, OS_ERR_STK_SIZE_INVALID = 28205u, OS_ERR_STK_LIMIT_INVALID = 28206u, OS_ERR_T = 29000u, OS_ERR_TASK_CHANGE_PRIO_ISR = 29001u, OS_ERR_TASK_CREATE_ISR = 29002u, OS_ERR_TASK_DEL = 29003u, OS_ERR_TASK_DEL_IDLE = 29004u, OS_ERR_TASK_DEL_INVALID = 29005u, OS_ERR_TASK_DEL_ISR = 29006u, OS_ERR_TASK_INVALID = 29007u, OS_ERR_TASK_NO_MORE_TCB = 29008u, OS_ERR_TASK_NOT_DLY = 29009u, OS_ERR_TASK_NOT_EXIST = 29010u, OS_ERR_TASK_NOT_SUSPENDED = 29011u, OS_ERR_TASK_OPT = 29012u, OS_ERR_TASK_RESUME_ISR = 29013u, OS_ERR_TASK_RESUME_PRIO = 29014u, OS_ERR_TASK_RESUME_SELF = 29015u, OS_ERR_TASK_STK_CHK_ISR = 29016u, OS_ERR_TASK_SUSPENDED = 29017u, OS_ERR_TASK_SUSPEND_IDLE = 29018u, OS_ERR_TASK_SUSPEND_INT_HANDLER = 29019u, OS_ERR_TASK_SUSPEND_ISR = 29020u, OS_ERR_TASK_SUSPEND_PRIO = 29021u, OS_ERR_TASK_WAITING = 29022u, OS_ERR_TCB_INVALID = 29101u, OS_ERR_TICK_WHEEL_SIZE = 29201u, OS_ERR_TIME_DLY_ISR = 29301u, OS_ERR_TIME_DLY_RESUME_ISR = 29302u, OS_ERR_TIME_GET_ISR = 29303u, OS_ERR_TIME_INVALID_HOURS = 29304u, OS_ERR_TIME_INVALID_MINUTES = 29305u, OS_ERR_TIME_INVALID_SECONDS = 29306u, OS_ERR_TIME_INVALID_MILLISECONDS = 29307u, OS_ERR_TIME_NOT_DLY = 29308u, OS_ERR_TIME_SET_ISR = 29309u, OS_ERR_TIME_ZERO_DLY = 29310u, OS_ERR_TIMEOUT = 29401u, OS_ERR_TMR_INACTIVE = 29501u, OS_ERR_TMR_INVALID_DEST = 29502u, OS_ERR_TMR_INVALID_DLY = 29503u, OS_ERR_TMR_INVALID_PERIOD = 29504u, OS_ERR_TMR_INVALID_STATE = 29505u, OS_ERR_TMR_INVALID = 29506u, OS_ERR_TMR_ISR = 29507u, OS_ERR_TMR_NO_CALLBACK = 29508u, OS_ERR_TMR_NON_AVAIL = 29509u, OS_ERR_TMR_STK_INVALID = 29510u, OS_ERR_TMR_STOPPED = 29511u, OS_ERR_U = 30000u, OS_ERR_V = 31000u, OS_ERR_W = 32000u, OS_ERR_X = 33000u, OS_ERR_Y = 34000u, OS_ERR_YIELD_ISR = 34001u, OS_ERR_Z = 35000u } OS_ERR; /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * D A T A T Y P E S ************************************************************************************************************************ ************************************************************************************************************************ */ typedef struct os_flag_grp OS_FLAG_GRP; typedef struct os_mem OS_MEM; typedef struct os_msg OS_MSG; typedef struct os_msg_pool OS_MSG_POOL; typedef struct os_msg_q OS_MSG_Q; typedef struct os_mutex OS_MUTEX; typedef struct os_int_q OS_INT_Q; typedef struct os_q OS_Q; typedef struct os_sem OS_SEM; typedef void (*OS_TASK_PTR)(void *p_arg); typedef struct os_tcb OS_TCB; typedef struct os_rdy_list OS_RDY_LIST; typedef struct os_tick_spoke OS_TICK_SPOKE; typedef void (*OS_TMR_CALLBACK_PTR)(void *p_tmr, void *p_arg); typedef struct os_tmr OS_TMR; typedef struct os_tmr_spoke OS_TMR_SPOKE; typedef struct os_pend_data OS_PEND_DATA; typedef struct os_pend_list OS_PEND_LIST; typedef struct os_pend_obj OS_PEND_OBJ; typedef void (*OS_APP_HOOK_VOID)(void); typedef void (*OS_APP_HOOK_TCB)(OS_TCB *p_tcb); /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * D A T A S T R U C T U R E S ************************************************************************************************************************ ************************************************************************************************************************ */ /* ------------------------------------------------------------------------------------------------------------------------ * ISR POST DATA ------------------------------------------------------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------------------------------------------------------ * READY LIST ------------------------------------------------------------------------------------------------------------------------ */ struct os_rdy_list { OS_TCB *HeadPtr; /* Pointer to task that will run at selected priority */ OS_TCB *TailPtr; /* Pointer to last task at selected priority */ OS_OBJ_QTY NbrEntries; /* Number of entries at selected priority */ }; /* ------------------------------------------------------------------------------------------------------------------------ * PEND DATA, PEND LIST and PEND OBJ ------------------------------------------------------------------------------------------------------------------------ */ struct os_pend_data { OS_PEND_DATA *PrevPtr; OS_PEND_DATA *NextPtr; OS_TCB *TCBPtr; OS_PEND_OBJ *PendObjPtr; OS_PEND_OBJ *RdyObjPtr; void *RdyMsgPtr; OS_MSG_SIZE RdyMsgSize; CPU_TS RdyTS; }; struct os_pend_list { OS_PEND_DATA *HeadPtr; OS_PEND_DATA *TailPtr; OS_OBJ_QTY NbrEntries; }; struct os_pend_obj { OS_OBJ_TYPE Type; CPU_CHAR *NamePtr; OS_PEND_LIST PendList; /* List of tasks pending on object */ void *DbgPrevPtr; void *DbgNextPtr; CPU_CHAR *DbgNamePtr; }; /* ------------------------------------------------------------------------------------------------------------------------ * EVENT FLAGS ------------------------------------------------------------------------------------------------------------------------ */ struct os_flag_grp { /* Event Flag Group */ OS_OBJ_TYPE Type; /* Should be set to OS_OBJ_TYPE_FLAG */ CPU_CHAR *NamePtr; /* Pointer to Event Flag Name (NUL terminated ASCII) */ OS_PEND_LIST PendList; /* List of tasks waiting on event flag group */ OS_FLAG_GRP *DbgPrevPtr; OS_FLAG_GRP *DbgNextPtr; CPU_CHAR *DbgNamePtr; OS_FLAGS Flags; /* 8, 16 or 32 bit flags */ CPU_TS TS; /* Timestamp of when last post occurred */ }; /*$PAGE*/ /* ------------------------------------------------------------------------------------------------------------------------ * MEMORY PARTITIONS ------------------------------------------------------------------------------------------------------------------------ */ struct os_mem { /* MEMORY CONTROL BLOCK */ OS_OBJ_TYPE Type; /* Should be set to OS_OBJ_TYPE_MEM */ void *AddrPtr; /* Pointer to beginning of memory partition */ CPU_CHAR *NamePtr; void *FreeListPtr; /* Pointer to list of free memory blocks */ OS_MEM_SIZE BlkSize; /* Size (in bytes) of each block of memory */ OS_MEM_QTY NbrMax; /* Total number of blocks in this partition */ OS_MEM_QTY NbrFree; /* Number of memory blocks remaining in this partition */ OS_MEM *DbgPrevPtr; OS_MEM *DbgNextPtr; }; /*$PAGE*/ /* ------------------------------------------------------------------------------------------------------------------------ * MESSAGES ------------------------------------------------------------------------------------------------------------------------ */ struct os_msg { /* MESSAGE CONTROL BLOCK */ OS_MSG *NextPtr; /* Pointer to next message */ void *MsgPtr; /* Actual message */ OS_MSG_SIZE MsgSize; /* Size of the message (in # bytes) */ CPU_TS MsgTS; /* Time stamp of when message was sent */ }; struct os_msg_pool { /* OS_MSG POOL */ OS_MSG *NextPtr; /* Pointer to next message */ OS_MSG_QTY NbrFree; /* Number of messages available from this pool */ OS_MSG_QTY NbrUsed; /* Number of messages used */ }; struct os_msg_q { /* OS_MSG_Q */ OS_MSG *InPtr; /* Pointer to next OS_MSG to be inserted in the queue */ OS_MSG *OutPtr; /* Pointer to next OS_MSG to be extracted from the queue */ OS_MSG_QTY NbrEntriesSize; /* Maximum allowable number of entries in the queue */ OS_MSG_QTY NbrEntries; /* Current number of entries in the queue */ OS_MSG_QTY NbrEntriesMax; /* Peak number of entries in the queue */ }; /*$PAGE*/ /* ------------------------------------------------------------------------------------------------------------------------ * MUTUAL EXCLUSION SEMAPHORES ------------------------------------------------------------------------------------------------------------------------ */ struct os_mutex { OS_OBJ_TYPE Type; /* Mutual Exclusion Semaphore */ CPU_CHAR *NamePtr; /* Should be set to OS_OBJ_TYPE_MUTEX */ OS_PEND_LIST PendList; /* Pointer to Mutex Name (NUL terminated ASCII) */ OS_MUTEX *DbgPrevPtr; OS_MUTEX *DbgNextPtr; CPU_CHAR *DbgNamePtr; OS_TCB *OwnerTCBPtr; /* List of tasks waiting on event flag group */ OS_PRIO OwnerOriginalPrio; OS_NESTING_CTR OwnerNestingCtr; /* Mutex is available when the counter is 0 */ CPU_TS TS; }; /*$PAGE*/ /* ------------------------------------------------------------------------------------------------------------------------ * MESSAGE QUEUES ------------------------------------------------------------------------------------------------------------------------ */ struct os_q { OS_OBJ_TYPE Type; /* Message Queue */ CPU_CHAR *NamePtr; /* Should be set to OS_OBJ_TYPE_Q */ OS_PEND_LIST PendList; /* Pointer to Message Queue (NUL terminated ASCII) */ OS_Q *DbgPrevPtr; OS_Q *DbgNextPtr; CPU_CHAR *DbgNamePtr; OS_MSG_Q MsgQ; /* List of tasks waiting on event flag group */ }; /*$PAGE*/ /* ------------------------------------------------------------------------------------------------------------------------ * SEMAPHORES ------------------------------------------------------------------------------------------------------------------------ */ struct os_sem { OS_OBJ_TYPE Type; /* Semaphore */ CPU_CHAR *NamePtr; /* Should be set to OS_OBJ_TYPE_SEM */ OS_PEND_LIST PendList; /* Pointer to Semaphore Name (NUL terminated ASCII) */ OS_SEM *DbgPrevPtr; OS_SEM *DbgNextPtr; CPU_CHAR *DbgNamePtr; OS_SEM_CTR Ctr; /* List of tasks waiting on event flag group */ CPU_TS TS; }; /*$PAGE*/ /* ------------------------------------------------------------------------------------------------------------------------ * TASK CONTROL BLOCK ------------------------------------------------------------------------------------------------------------------------ */ struct os_tcb { CPU_STK *StkPtr; /* Pointer to current top of stack */ void *ExtPtr; /* Pointer to user definable data for TCB extension */ CPU_STK *StkLimitPtr; /* Pointer used to set stack 'watermark' limit */ OS_TCB *NextPtr; /* Pointer to next TCB in the TCB list */ OS_TCB *PrevPtr; /* Pointer to previous TCB in the TCB list */ OS_TCB *TickNextPtr; OS_TCB *TickPrevPtr; OS_TICK_SPOKE *TickSpokePtr; /* Pointer to tick spoke if task is in the tick list */ CPU_CHAR *NamePtr; /* Pointer to task name */ CPU_STK *StkBasePtr; /* Pointer to base address of stack */ OS_TASK_PTR TaskEntryAddr; /* Pointer to task entry point address */ void *TaskEntryArg; /* Argument passed to task when it was created */ OS_PEND_DATA *PendDataTblPtr; /* Pointer to list containing objects pended on */ OS_STATE PendOn; /* Indicates what task is pending on */ OS_STATUS PendStatus; /* Pend status */ OS_STATE TaskState; /* See OS_TASK_STATE_xxx */ OS_PRIO Prio; /* Task priority (0 == highest) */ CPU_STK_SIZE StkSize; /* Size of task stack (in number of stack elements) */ OS_OPT Opt; /* Task options as passed by OSTaskCreate() */ OS_OBJ_QTY PendDataTblEntries; /* Size of array of objects to pend on */ CPU_TS TS; /* Timestamp */ OS_SEM_CTR SemCtr; /* Task specific semaphore counter */ /* DELAY / TIMEOUT */ OS_TICK TickCtrPrev; /* Previous time when task was ready */ OS_TICK TickCtrMatch; /* Absolute time when task is going to be ready */ OS_TICK TickRemain; /* Number of ticks remaining for a match (updated at ... */ /* ... run-time by OS_StatTask() */ OS_TICK TimeQuanta; OS_TICK TimeQuantaCtr; void *MsgPtr; /* Message received */ OS_MSG_SIZE MsgSize; OS_MSG_Q MsgQ; /* Message queue associated with task */ CPU_TS MsgQPendTime; /* Time it took for signal to be received */ CPU_TS MsgQPendTimeMax; /* Max amount of time it took for signal to be received */ OS_REG RegTbl[1u]; /* Task specific registers */ OS_FLAGS FlagsPend; /* Event flag(s) to wait on */ OS_FLAGS FlagsRdy; /* Event flags that made task ready to run */ OS_OPT FlagsOpt; /* Options (See OS_OPT_FLAG_xxx) */ OS_NESTING_CTR SuspendCtr; /* Nesting counter for OSTaskSuspend() */ OS_CPU_USAGE CPUUsage; /* CPU Usage of task (0-100%) */ OS_CTX_SW_CTR CtxSwCtr; /* Number of time the task was switched in */ CPU_TS CyclesDelta; /* value of OS_TS_GET() - .CyclesStart */ CPU_TS CyclesStart; /* Snapshot of cycle counter at start of task resumption */ OS_CYCLES CyclesTotal; /* Total number of # of cycles the task has been running */ OS_CYCLES CyclesTotalPrev; /* Snapshot of previous # of cycles */ CPU_TS SemPendTime; /* Time it took for signal to be received */ CPU_TS SemPendTimeMax; /* Max amount of time it took for signal to be received */ CPU_STK_SIZE StkUsed; /* Number of stack elements used from the stack */ CPU_STK_SIZE StkFree; /* Number of stack elements free on the stack */ CPU_TS IntDisTimeMax; /* Maximum interrupt disable time */ CPU_TS SchedLockTimeMax; /* Maximum scheduler lock time */ OS_TCB *DbgPrevPtr; OS_TCB *DbgNextPtr; CPU_CHAR *DbgNamePtr; }; /*$PAGE*/ /* ------------------------------------------------------------------------------------------------------------------------ * TICK DATA TYPE ------------------------------------------------------------------------------------------------------------------------ */ struct os_tick_spoke { OS_TCB *FirstPtr; /* Pointer to list of tasks in tick spoke */ OS_OBJ_QTY NbrEntries; /* Current number of entries in the tick spoke */ OS_OBJ_QTY NbrEntriesMax; /* Peak number of entries in the tick spoke */ }; /* ------------------------------------------------------------------------------------------------------------------------ * TIMER DATA TYPES ------------------------------------------------------------------------------------------------------------------------ */ struct os_tmr { OS_OBJ_TYPE Type; CPU_CHAR *NamePtr; /* Name to give the timer */ OS_TMR_CALLBACK_PTR CallbackPtr; /* Function to call when timer expires */ void *CallbackPtrArg; /* Argument to pass to function when timer expires */ OS_TMR *NextPtr; /* Double link list pointers */ OS_TMR *PrevPtr; OS_TICK Match; /* Timer expires when OSTmrTickCtr matches this value */ OS_TICK Remain; /* Amount of time remaining before timer expires */ OS_TICK Dly; /* Delay before start of repeat */ OS_TICK Period; /* Period to repeat timer */ OS_OPT Opt; /* Options (see OS_OPT_TMR_xxx) */ OS_STATE State; OS_TMR *DbgPrevPtr; OS_TMR *DbgNextPtr; }; struct os_tmr_spoke { OS_TMR *FirstPtr; /* Pointer to first timer in linked list */ OS_OBJ_QTY NbrEntries; OS_OBJ_QTY NbrEntriesMax; }; typedef enum { OS_HISTORY_INT=1, OS_HISTORY_THREAD }os_history_type_s; typedef struct { os_history_type_s type; unsigned long tick; unsigned long int_num; char thread_name[16]; }os_history_item_s; typedef struct { unsigned short History_Size; unsigned short Count; os_history_item_s item[2048]; }os_history_s; /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * G L O B A L V A R I A B L E S ************************************************************************************************************************ ************************************************************************************************************************ */ extern OS_APP_HOOK_TCB OS_AppTaskCreateHookPtr; /* Application hooks */ extern OS_APP_HOOK_TCB OS_AppTaskDelHookPtr; extern OS_APP_HOOK_TCB OS_AppTaskReturnHookPtr; extern OS_APP_HOOK_VOID OS_AppIdleTaskHookPtr; extern OS_APP_HOOK_VOID OS_AppStatTaskHookPtr; extern OS_APP_HOOK_VOID OS_AppTaskSwHookPtr; extern OS_APP_HOOK_VOID OS_AppTimeTickHookPtr; /* IDLE TASK ---------------------------------- */ extern OS_IDLE_CTR OSIdleTaskCtr; extern OS_TCB OSIdleTaskTCB; /* MISCELLANEOUS ------------------------------ */ extern OS_NESTING_CTR OSIntNestingCtr; /* Interrupt nesting level */ extern CPU_TS OSIntDisTimeMax; /* Overall interrupt disable time */ extern OS_STATE OSRunning; /* Flag indicating that kernel is running */ /* ISR HANDLER TASK --------------------------- */ /* FLAGS -------------------------------------- */ extern OS_FLAG_GRP *OSFlagDbgListPtr; extern OS_OBJ_QTY OSFlagQty; /* MEMORY MANAGEMENT -------------------------- */ extern OS_MEM *OSMemDbgListPtr; extern OS_OBJ_QTY OSMemQty; /* Number of memory partitions created */ /* OS_MSG POOL -------------------------------- */ extern OS_MSG_POOL OSMsgPool; /* Pool of OS_MSG */ /* MUTEX MANAGEMENT --------------------------- */ extern OS_MUTEX *OSMutexDbgListPtr; extern OS_OBJ_QTY OSMutexQty; /* Number of mutexes created */ /* PRIORITIES --------------------------------- */ extern OS_PRIO OSPrioCur; /* Priority of current task */ extern OS_PRIO OSPrioHighRdy; /* Priority of highest priority task */ extern OS_PRIO OSPrioSaved; /* Saved priority level when Post Deferred */ extern CPU_DATA OSPrioTbl[(((32u - 1u) / (4 * 8u)) + 1u)]; /* QUEUES ------------------------------------- */ extern OS_Q *OSQDbgListPtr; extern OS_OBJ_QTY OSQQty; /* Number of message queues created */ /* READY LIST --------------------------------- */ extern OS_RDY_LIST OSRdyList[32u]; /* Table of tasks ready to run */ /* SCHEDULER ---------------------------------- */ extern CPU_TS_TMR OSSchedLockTimeBegin; /* Scheduler lock time measurement */ extern CPU_TS_TMR OSSchedLockTimeMax; extern CPU_TS_TMR OSSchedLockTimeMaxCur; extern OS_NESTING_CTR OSSchedLockNestingCtr; /* Lock nesting level */ extern OS_TICK OSSchedRoundRobinDfltTimeQuanta; extern CPU_BOOLEAN OSSchedRoundRobinEn; /* Enable/Disable round-robin scheduling */ /* SEMAPHORES --------------------------------- */ extern OS_SEM *OSSemDbgListPtr; extern OS_OBJ_QTY OSSemQty; /* Number of semaphores created */ /* STATISTICS --------------------------------- */ extern OS_CPU_USAGE OSStatTaskCPUUsage; /* CPU Usage in % */ extern OS_TICK OSStatTaskCtr; extern OS_TICK OSStatTaskCtrMax; extern OS_TICK OSStatTaskCtrRun; extern CPU_BOOLEAN OSStatTaskRdy; extern OS_TCB OSStatTaskTCB; extern CPU_TS OSStatTaskTimeMax; extern CPU_BOOLEAN OSStatResetFlag; /* Force the reset of the computed statistics */ /* TASKS -------------------------------------- */ extern OS_CTX_SW_CTR OSTaskCtxSwCtr; /* Number of context switches */ extern OS_TCB *OSTaskDbgListPtr; extern OS_OBJ_QTY OSTaskQty; /* Number of tasks created */ /* TICK TASK ---------------------------------- */ extern OS_TICK OSTickCtr; /* Counts the #ticks since startup or last set */ extern OS_TCB OSTickTaskTCB; extern CPU_TS OSTickTaskTimeMax; extern OS_TMR *OSTmrDbgListPtr; extern OS_OBJ_QTY OSTmrQty; /* Number of timers created */ extern OS_TCB OSTmrTaskTCB; /* TCB of timer task */ extern CPU_TS OSTmrTaskTimeMax; extern OS_TICK OSTmrTickCtr; /* Current time for the timers */ extern OS_CTR OSTmrUpdateCnt; /* Counter for updating timers */ extern OS_CTR OSTmrUpdateCtr; /* TCBs --------------------------------------- */ extern OS_TCB *OSTCBCurPtr; /* Pointer to currently running TCB */ extern OS_TCB *OSTCBHighRdyPtr; /* Pointer to highest priority TCB */ /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * E X T E R N A L S ************************************************************************************************************************ ************************************************************************************************************************ */ extern CPU_STK * const OSCfg_IdleTaskStkBasePtr; extern CPU_STK_SIZE const OSCfg_IdleTaskStkLimit; extern CPU_STK_SIZE const OSCfg_IdleTaskStkSize; extern CPU_INT32U const OSCfg_IdleTaskStkSizeRAM; extern OS_INT_Q * const OSCfg_IntQBasePtr; extern OS_OBJ_QTY const OSCfg_IntQSize; extern CPU_INT32U const OSCfg_IntQSizeRAM; extern CPU_STK * const OSCfg_IntQTaskStkBasePtr; extern CPU_STK_SIZE const OSCfg_IntQTaskStkLimit; extern CPU_STK_SIZE const OSCfg_IntQTaskStkSize; extern CPU_INT32U const OSCfg_IntQTaskStkSizeRAM; extern CPU_STK * const OSCfg_ISRStkBasePtr; extern CPU_STK_SIZE const OSCfg_ISRStkSize; extern CPU_INT32U const OSCfg_ISRStkSizeRAM; extern OS_MSG_SIZE const OSCfg_MsgPoolSize; extern CPU_INT32U const OSCfg_MsgPoolSizeRAM; extern OS_MSG * const OSCfg_MsgPoolBasePtr; extern OS_PRIO const OSCfg_StatTaskPrio; extern OS_RATE_HZ const OSCfg_StatTaskRate_Hz; extern CPU_STK * const OSCfg_StatTaskStkBasePtr; extern CPU_STK_SIZE const OSCfg_StatTaskStkLimit; extern CPU_STK_SIZE const OSCfg_StatTaskStkSize; extern CPU_INT32U const OSCfg_StatTaskStkSizeRAM; extern CPU_STK_SIZE const OSCfg_StkSizeMin; extern OS_RATE_HZ const OSCfg_TickRate_Hz; extern OS_PRIO const OSCfg_TickTaskPrio; extern CPU_STK * const OSCfg_TickTaskStkBasePtr; extern CPU_STK_SIZE const OSCfg_TickTaskStkLimit; extern CPU_STK_SIZE const OSCfg_TickTaskStkSize; extern CPU_INT32U const OSCfg_TickTaskStkSizeRAM; extern OS_OBJ_QTY const OSCfg_TickWheelSize; extern CPU_INT32U const OSCfg_TickWheelSizeRAM; extern OS_PRIO const OSCfg_TmrTaskPrio; extern OS_RATE_HZ const OSCfg_TmrTaskRate_Hz; extern CPU_STK * const OSCfg_TmrTaskStkBasePtr; extern CPU_STK_SIZE const OSCfg_TmrTaskStkLimit; extern CPU_STK_SIZE const OSCfg_TmrTaskStkSize; extern CPU_INT32U const OSCfg_TmrTaskStkSizeRAM; extern OS_OBJ_QTY const OSCfg_TmrWheelSize; extern CPU_INT32U const OSCfg_TmrSizeRAM; extern CPU_STK OSCfg_IdleTaskStk[]; extern CPU_STK OSCfg_ISRStk[]; extern OS_MSG OSCfg_MsgPool[]; extern CPU_STK OSCfg_StatTaskStk[]; extern CPU_STK OSCfg_TickTaskStk[]; extern OS_TICK_SPOKE OSCfg_TickWheel[]; extern CPU_STK OSCfg_TmrTaskStk[]; extern OS_TMR_SPOKE OSCfg_TmrWheel[]; extern os_history_s os_history; extern unsigned short Int_Queue[100]; extern unsigned short Int_Queue_Cnt; /* ************************************************************************************************************************ ************************************************************************************************************************ * F U N C T I O N P R O T O T Y P E S ************************************************************************************************************************ ************************************************************************************************************************ */ /* ================================================================================================================== */ /* EVENT FLAGS */ /* ================================================================================================================== */ void OSFlagCreate (OS_FLAG_GRP *p_grp, CPU_CHAR *p_name, OS_FLAGS flags, OS_ERR *p_err); OS_FLAGS OSFlagPend (OS_FLAG_GRP *p_grp, OS_FLAGS flags, OS_TICK timeout, OS_OPT opt, CPU_TS *p_ts, OS_ERR *p_err); OS_FLAGS OSFlagPendGetFlagsRdy (OS_ERR *p_err); OS_FLAGS OSFlagPost (OS_FLAG_GRP *p_grp, OS_FLAGS flags, OS_OPT opt, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_FlagClr (OS_FLAG_GRP *p_grp); void OS_FlagBlock (OS_PEND_DATA *p_pend_data, OS_FLAG_GRP *p_grp, OS_FLAGS flags, OS_OPT opt, OS_TICK timeout); void OS_FlagDbgListAdd (OS_FLAG_GRP *p_grp); void OS_FlagDbgListRemove (OS_FLAG_GRP *p_grp); void OS_FlagInit (OS_ERR *p_err); OS_FLAGS OS_FlagPost (OS_FLAG_GRP *p_grp, OS_FLAGS flags, OS_OPT opt, CPU_TS ts, OS_ERR *p_err); void OS_FlagTaskRdy (OS_TCB *p_tcb, OS_FLAGS flags_rdy, CPU_TS ts); /*$PAGE*/ /* ================================================================================================================== */ /* FIXED SIZE MEMORY BLOCK MANAGEMENT */ /* ================================================================================================================== */ void OSMemCreate (OS_MEM *p_mem, CPU_CHAR *p_name, void *p_addr, OS_MEM_QTY n_blks, OS_MEM_SIZE blk_size, OS_ERR *p_err); void *OSMemGet (OS_MEM *p_mem, OS_ERR *p_err); void OSMemPut (OS_MEM *p_mem, void *p_blk, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_MemDbgListAdd (OS_MEM *p_mem); void OS_MemInit (OS_ERR *p_err); /*$PAGE*/ /* ================================================================================================================== */ /* MUTUAL EXCLUSION SEMAPHORES */ /* ================================================================================================================== */ void OSMutexCreate (OS_MUTEX *p_mutex, CPU_CHAR *p_name, OS_ERR *p_err); OS_OBJ_QTY OSMutexDel (OS_MUTEX *p_mutex, OS_OPT opt, OS_ERR *p_err); void OSMutexPend (OS_MUTEX *p_mutex, OS_TICK timeout, OS_OPT opt, CPU_TS *p_ts, OS_ERR *p_err); void OSMutexPost (OS_MUTEX *p_mutex, OS_OPT opt, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_MutexClr (OS_MUTEX *p_mutex); void OS_MutexDbgListAdd (OS_MUTEX *p_mutex); void OS_MutexDbgListRemove (OS_MUTEX *p_mutex); void OS_MutexInit (OS_ERR *p_err); /*$PAGE*/ /* ================================================================================================================== */ /* MESSAGE QUEUES */ /* ================================================================================================================== */ OS_OBJ_QTY OSPendMulti (OS_PEND_DATA *p_pend_data_tbl, OS_OBJ_QTY tbl_size, OS_TICK timeout, OS_OPT opt, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ OS_OBJ_QTY OS_PendMultiGetRdy (OS_PEND_DATA *p_pend_data_tbl, OS_OBJ_QTY tbl_size); CPU_BOOLEAN OS_PendMultiValidate (OS_PEND_DATA *p_pend_data_tbl, OS_OBJ_QTY tbl_size); void OS_PendMultiWait (OS_PEND_DATA *p_pend_data_tbl, OS_OBJ_QTY tbl_size, OS_TICK timeout); /* ================================================================================================================== */ /* MESSAGE QUEUES */ /* ================================================================================================================== */ void OSQCreate (OS_Q *p_q, CPU_CHAR *p_name, OS_MSG_QTY max_qty, OS_ERR *p_err); OS_OBJ_QTY OSQDel (OS_Q *p_q, OS_OPT opt, OS_ERR *p_err); void *OSQPend (OS_Q *p_q, OS_TICK timeout, OS_OPT opt, OS_MSG_SIZE *p_msg_size, CPU_TS *p_ts, OS_ERR *p_err); OS_OBJ_QTY OSQPendAbort (OS_Q *p_q, OS_OPT opt, OS_ERR *p_err); void OSQPost (OS_Q *p_q, void *p_void, OS_MSG_SIZE msg_size, OS_OPT opt, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_QClr (OS_Q *p_q); void OS_QDbgListAdd (OS_Q *p_q); void OS_QDbgListRemove (OS_Q *p_q); void OS_QInit (OS_ERR *p_err); void OS_QPost (OS_Q *p_q, void *p_void, OS_MSG_SIZE msg_size, OS_OPT opt, CPU_TS ts, OS_ERR *p_err); /*$PAGE*/ /* ================================================================================================================== */ /* SEMAPHORES */ /* ================================================================================================================== */ void OSSemCreate (OS_SEM *p_sem, CPU_CHAR *p_name, OS_SEM_CTR cnt, OS_ERR *p_err); OS_OBJ_QTY OSSemDel (OS_SEM *p_sem, OS_OPT opt, OS_ERR *p_err); OS_SEM_CTR OSSemPend (OS_SEM *p_sem, OS_TICK timeout, OS_OPT opt, CPU_TS *p_ts, OS_ERR *p_err); OS_OBJ_QTY OSSemPendAbort (OS_SEM *p_sem, OS_OPT opt, OS_ERR *p_err); OS_SEM_CTR OSSemPost (OS_SEM *p_sem, OS_OPT opt, OS_ERR *p_err); void OSSemSet (OS_SEM *p_sem, OS_SEM_CTR cnt, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_SemClr (OS_SEM *p_sem); void OS_SemDbgListAdd (OS_SEM *p_sem); void OS_SemDbgListRemove (OS_SEM *p_sem); void OS_SemInit (OS_ERR *p_err); OS_SEM_CTR OS_SemPost (OS_SEM *p_sem, OS_OPT opt, CPU_TS ts, OS_ERR *p_err); /*$PAGE*/ /* ================================================================================================================== */ /* TASK MANAGEMENT */ /* ================================================================================================================== */ void OSTaskChangePrio (OS_TCB *p_tcb, OS_PRIO prio_new, OS_ERR *p_err); void OSTaskCreate (OS_TCB *p_tcb, CPU_CHAR *p_name, OS_TASK_PTR p_task, void *p_arg, OS_PRIO prio, CPU_STK *p_stk_base, CPU_STK_SIZE stk_limit, CPU_STK_SIZE stk_size, OS_MSG_QTY q_size, OS_TICK time_quanta, void *p_ext, OS_OPT opt, OS_ERR *p_err); void OSTaskDel (OS_TCB *p_tcb, OS_ERR *p_err); OS_MSG_QTY OSTaskQFlush (OS_TCB *p_tcb, OS_ERR *p_err); void *OSTaskQPend (OS_TICK timeout, OS_OPT opt, OS_MSG_SIZE *p_msg_size, CPU_TS *p_ts, OS_ERR *p_err); CPU_BOOLEAN OSTaskQPendAbort (OS_TCB *p_tcb, OS_OPT opt, OS_ERR *p_err); void OSTaskQPost (OS_TCB *p_tcb, void *p_void, OS_MSG_SIZE msg_size, OS_OPT opt, OS_ERR *p_err); void OSTaskResume (OS_TCB *p_tcb, OS_ERR *p_err); void OSTaskSuspend (OS_TCB *p_tcb, OS_ERR *p_err); OS_REG OSTaskRegGet (OS_TCB *p_tcb, OS_REG_ID id, OS_ERR *p_err); void OSTaskRegSet (OS_TCB *p_tcb, OS_REG_ID id, OS_REG value, OS_ERR *p_err); OS_SEM_CTR OSTaskSemPend (OS_TICK timeout, OS_OPT opt, CPU_TS *p_ts, OS_ERR *p_err); CPU_BOOLEAN OSTaskSemPendAbort (OS_TCB *p_tcb, OS_OPT opt, OS_ERR *p_err); OS_SEM_CTR OSTaskSemPost (OS_TCB *p_tcb, OS_OPT opt, OS_ERR *p_err); OS_SEM_CTR OSTaskSemSet (OS_TCB *p_tcb, OS_SEM_CTR cnt, OS_ERR *p_err); void OSTaskStkChk (OS_TCB *p_tcb, CPU_STK_SIZE *p_free, CPU_STK_SIZE *p_used, OS_ERR *p_err); void OSTaskTimeQuantaSet (OS_TCB *p_tcb, OS_TICK time_quanta, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_TaskBlock (OS_TCB *p_tcb, OS_TICK timeout); void OS_TaskDbgListAdd (OS_TCB *p_tcb); void OS_TaskDbgListRemove (OS_TCB *p_tcb); void OS_TaskInit (OS_ERR *p_err); void OS_TaskInitTCB (OS_TCB *p_tcb); void OS_TaskQPost (OS_TCB *p_tcb, void *p_void, OS_MSG_SIZE msg_size, OS_OPT opt, CPU_TS ts, OS_ERR *p_err); void OS_TaskRdy (OS_TCB *p_tcb); void OS_TaskReturn (void); OS_SEM_CTR OS_TaskSemPost (OS_TCB *p_tcb, OS_OPT opt, CPU_TS ts, OS_ERR *p_err); /*$PAGE*/ /* ================================================================================================================== */ /* TIME MANAGEMENT */ /* ================================================================================================================== */ void OSTimeDly (OS_TICK dly, OS_OPT opt, OS_ERR *p_err); void OSTimeDlyHMSM (CPU_INT16U hours, CPU_INT16U minutes, CPU_INT16U seconds, CPU_INT32U milli, OS_OPT opt, OS_ERR *p_err); OS_TICK OSTimeGet (OS_ERR *p_err); void OSTimeSet (OS_TICK ticks, OS_ERR *p_err); void OSTimeTick (void); /*$PAGE*/ /* ================================================================================================================== */ /* TIMER MANAGEMENT */ /* ================================================================================================================== */ void OSTmrCreate (OS_TMR *p_tmr, CPU_CHAR *p_name, OS_TICK dly, OS_TICK period, OS_OPT opt, OS_TMR_CALLBACK_PTR p_callback, void *p_callback_arg, OS_ERR *p_err); CPU_BOOLEAN OSTmrDel (OS_TMR *p_tmr, OS_ERR *p_err); OS_TICK OSTmrRemainGet (OS_TMR *p_tmr, OS_ERR *p_err); CPU_BOOLEAN OSTmrStart (OS_TMR *p_tmr, OS_ERR *p_err); OS_STATE OSTmrStateGet (OS_TMR *p_tmr, OS_ERR *p_err); CPU_BOOLEAN OSTmrStop (OS_TMR *p_tmr, OS_OPT opt, void *p_callback_arg, OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_TmrClr (OS_TMR *p_tmr); void OS_TmrDbgListAdd (OS_TMR *p_tmr); void OS_TmrDbgListRemove (OS_TMR *p_tmr); void OS_TmrInit (OS_ERR *p_err); void OS_TmrLink (OS_TMR *p_tmr, OS_OPT opt); void OS_TmrResetPeak (void); void OS_TmrUnlink (OS_TMR *p_tmr); void OS_TmrTask (void *p_arg); /*$PAGE*/ /* ================================================================================================================== */ /* MISCELLANEOUS */ /* ================================================================================================================== */ /*$PAGE*/ /* ************************************************************************************************************************ * OS INITIALIZATION * * Description: OSInit() initializes £gC/OS-III and it must be called prior to calling any other £gC/OS-III function. * Including OSStart() which will start multitasking * * * Argument(s): p_err is a pointer to an error code and can be: * * OS_ERR_NONE initialization was successful. * OS_ERR_???? some other OS_ERR_???? value returned by a sub-function of OSInit(). * * Returns : none * * Note(s) : 1) OSInit() must be called before OSStart(). * * 2) OSInit() returns as soon as it detects an error in any of the sub-functions it calls. For example, if OSInit() encounters a problem initializing the task manager, an appropriate error code will be returned and OSInit() will not go any further. It is therefore important that the user checks the error code before starting multitasking. ************************************************************************************************************************ */ void OSInit (OS_ERR *p_err); void OSIntEnter (void); void OSIntExit (void); void OSMsgPoolExtend (OS_MSG *p_msg, OS_MSG_QTY size, OS_ERR *p_err); void OSSchedRoundRobinCfg (CPU_BOOLEAN en, OS_TICK dflt_time_quanta, OS_ERR *p_err); void OSSchedRoundRobinYield (OS_ERR *p_err); void OSSched (void); void OSSchedLock (OS_ERR *p_err); void OSSchedUnlock (OS_ERR *p_err); void OS_Oscillator_Set (unsigned long Freq); void OSStart (OS_ERR *p_err); void OSStatReset (OS_ERR *p_err); void OSStatTaskCPUUsageInit (OS_ERR *p_err); CPU_INT16U OSVersion (OS_ERR *p_err); /* ------------------------------------------------ INTERNAL FUNCTIONS ---------------------------------------------- */ void OS_IdleTask (void *p_arg); void OS_IdleTaskInit (OS_ERR *p_err); void OS_StatTask (void *p_arg); void OS_StatTaskInit (OS_ERR *p_err); void OS_TickTask (void *p_arg); void OS_TickTaskInit (OS_ERR *p_err); /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * T A R G E T S P E C I F I C F U N C T I O N S ************************************************************************************************************************ ************************************************************************************************************************ */ void OSInitHook (void); void OSTaskCreateHook (OS_TCB *p_tcb); void OSTaskDelHook (OS_TCB *p_tcb); void OSIdleTaskHook (void); void OSTaskReturnHook (OS_TCB *p_tcb); void OSStatTaskHook (void); CPU_STK *OSTaskStkInit (OS_TASK_PTR p_task, void *p_arg, CPU_STK *p_stk_base, CPU_STK *p_stk_limit, CPU_STK_SIZE stk_size, OS_OPT opt); void OSTaskSwHook (void); void OSTimeTickHook (void); /*$PAGE*/ /* ************************************************************************************************************************ ************************************************************************************************************************ * u C / O S - I I I I N T E R N A L F U N C T I O N P R O T O T Y P E S ************************************************************************************************************************ ************************************************************************************************************************ */ void OSCfg_Init (void); void OS_Dbg_Init (void); /* ----------------------------------------------- MESSAGE MANAGEMENT ----------------------------------------------- */ void OS_MsgPoolCreate (OS_MSG *p_msg, OS_MSG_QTY size); void OS_MsgPoolInit (OS_ERR *p_err); void OS_MsgQEntriesPeakReset (OS_MSG_Q *p_msg_q); OS_MSG_QTY OS_MsgQFreeAll (OS_MSG_Q *p_msg_q); void *OS_MsgQGet (OS_MSG_Q *p_msg_q, OS_MSG_SIZE *p_msg_size, CPU_TS *p_ts, OS_ERR *p_err); void OS_MsgQInit (OS_MSG_Q *p_msg_q, OS_MSG_QTY size); void OS_MsgQPut (OS_MSG_Q *p_msg_q, void *p_void, OS_MSG_SIZE msg_size, OS_OPT opt, CPU_TS ts, OS_ERR *p_err); /* ---------------------------------------------- PEND/POST MANAGEMENT ---------------------------------------------- */ void OS_Pend (OS_PEND_DATA *p_pend_data, OS_PEND_OBJ *p_obj, OS_STATE pending_on, OS_TICK timeout); void OS_PendAbort (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb, CPU_TS ts); void OS_PendAbort1 (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb, CPU_TS ts); void OS_PendObjDel (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb, CPU_TS ts); void OS_PendObjDel1 (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb, CPU_TS ts); void OS_Post (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb, void *p_void, OS_MSG_SIZE msg_size, CPU_TS ts); void OS_Post1 (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb, void *p_void, OS_MSG_SIZE msg_size, CPU_TS ts); /* ----------------------------------------------- PRIORITY MANAGEMENT ---------------------------------------------- */ void OS_PrioInit (void); void OS_PrioInsert (OS_PRIO prio); void OS_PrioRemove (OS_PRIO prio); OS_PRIO OS_PrioGetHighest (void); /* --------------------------------------------------- SCHEDULING --------------------------------------------------- */ void OS_SchedLockTimeMeasStart (void); void OS_SchedLockTimeMeasStop (void); void OS_SchedRoundRobin (OS_RDY_LIST *p_rdy_list); /* --------------------------------------------- READY LIST MANAGEMENT ---------------------------------------------- */ void OS_RdyListInit (void); void OS_RdyListInsert (OS_TCB *p_tcb); void OS_RdyListInsertHead (OS_TCB *p_tcb); void OS_RdyListInsertTail (OS_TCB *p_tcb); void OS_RdyListMoveHeadToTail (OS_RDY_LIST *p_rdy_list); void OS_RdyListRemove (OS_TCB *p_tcb); /* ---------------------------------------------- PEND LIST MANAGEMENT ---------------------------------------------- */ void OS_PendDataInit (OS_TCB *p_tcb, OS_PEND_DATA *p_pend_data_tbl, OS_OBJ_QTY tbl_size); void OS_PendDbgNameAdd (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb); void OS_PendDbgNameRemove (OS_PEND_OBJ *p_obj, OS_TCB *p_tcb); OS_PEND_LIST *OS_PendListGetPtr (OS_PEND_OBJ *p_obj); void OS_PendListInit (OS_PEND_LIST *p_pend_list); void OS_PendListInsertHead (OS_PEND_LIST *p_pend_list, OS_PEND_DATA *p_pend_data); void OS_PendListInsertPrio (OS_PEND_LIST *p_pend_list, OS_PEND_DATA *p_pend_data); void OS_PendListChangePrio (OS_TCB *p_tcb, OS_PRIO prio_new); void OS_PendListRemove (OS_TCB *p_tcb); void OS_PendListRemove1 (OS_PEND_LIST *p_pend_list, OS_PEND_DATA *p_pend_data); /* ---------------------------------------------- TICK LIST MANAGEMENT ---------------------------------------------- */ void OS_TickListInit (void); void OS_TickListInsert (OS_TCB *p_tcb, OS_TICK time, OS_OPT opt, OS_ERR *p_err); void OS_TickListRemove (OS_TCB *p_tcb); void OS_TickListResetPeak (void); void OS_TickListUpdate (void); /*$PAGE*/ /* ************************************************************************************************************************ * LOOK FOR MISSING #define CONSTANTS * * This section is used to generate ERROR messages at compile time if certain #define constants are * MISSING in OS_CFG.H. This allows you to quickly determine the source of the error. * * You SHOULD NOT change this section UNLESS you would like to add more comments as to the source of the * compile time error. ************************************************************************************************************************ */ /* ************************************************************************************************************************ * MISCELLANEOUS ************************************************************************************************************************ */ /* ************************************************************************************************************************ * EVENT FLAGS ************************************************************************************************************************ */ /* ************************************************************************************************************************ * MEMORY MANAGEMENT ************************************************************************************************************************ */ /* ************************************************************************************************************************ * MUTUAL EXCLUSION SEMAPHORES ************************************************************************************************************************ */ /* ************************************************************************************************************************ * MESSAGE QUEUES ************************************************************************************************************************ */ /* ************************************************************************************************************************ * SEMAPHORES ************************************************************************************************************************ */ /* ************************************************************************************************************************ * TASK MANAGEMENT ************************************************************************************************************************ */ /* ************************************************************************************************************************ * TIME MANAGEMENT ************************************************************************************************************************ */ /* ************************************************************************************************************************ * TIMER MANAGEMENT ************************************************************************************************************************ */ /* ************************************************************************************************************************ * LIBRARY CONFIGURATION ERRORS ************************************************************************************************************************ */ /* See 'os.h Note #1a'. */ /* See 'os.h Note #1b'. */ /* ************************************************************************************************************************ * uC/OS-III MODULE END ************************************************************************************************************************ */ /** * \file interrupt.h * * \brief Interrupt related API declarations. * * This file contains the API prototypes for configuring INTC for * ARM Cortex-A8 */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /** * @Component: INTC * * @Filename: intc_header.h * * @Description: Component description is not available * * Generated by: Genesis 2.0.1.3 * Autogen 2.4.0.0 * *//* ====================================================================== */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /************************************************************************* * Registers Definition \*************************************************************************/ /*************************************************************************** Field Definition Macros \**************************************************************************/ /* REVISION */ /* SYSCONFIG */ /* SYSSTATUS */ /* SIR_IRQ */ /* SIR_FIQ */ /* CONTROL */ /* PROTECTION */ /* IDLE */ /* IRQ_PRIORITY */ /* FIQ_PRIORITY */ /* THRESHOLD */ /* SICR */ /* SCR0 */ /* SCR1 */ /* SCR2 */ /* ITR0 */ /* MIR0 */ /* MIR_CLEAR0 */ /* MIR_SET0 */ /* ISR_SET0 */ /* ISR_CLEAR0 */ /* PENDING_IRQ0 */ /* PENDING_FIQ0 */ /* ITR1 */ /* MIR1 */ /* MIR_CLEAR1 */ /* MIR_SET1 */ /* ISR_SET1 */ /* ISR_CLEAR1 */ /* PENDING_IRQ1 */ /* PENDING_FIQ1 */ /* ITR2 */ /* MIR2 */ /* MIR_CLEAR2 */ /* MIR_SET2 */ /* ISR_SET2 */ /* ISR_CLEAR2 */ /* PENDING_IRQ2 */ /* PENDING_FIQ2 */ /* ILR */ /** * \file hw_types.h * * \brief Common type definitions and macros */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ //***************************************************************************** // // Define a boolean type, and values for true and false. // //***************************************************************************** typedef unsigned char tBoolean; //***************************************************************************** // // Macros for hardware access, both direct and via the bit-band region. // //***************************************************************************** /**************************************************************************** ** MACRO DEFINITIONS ****************************************************************************/ /* ** Macros which can be passed to IntPrioritySet API as hostIntRoute. */ /* To route an interrupt to IRQ */ /* To route an interrupt to FIQ */ /* ** Interrupt number list */ /***************************************************************************** ** API FUNCTION PROTOTYPES *****************************************************************************/ extern void IntAINTCInit (void); extern void IntIfClkFreeRunSet(void); extern void IntIfClkAutoGateSet(void); extern void IntProtectionEnable(void); extern void IntProtectionDisable(void); extern void IntSyncClkFreeRunSet(void); extern void IntSyncClkAutoGateSet(void); extern void IntFuncClkFreeRunSet(void); extern void IntFuncClkAutoGateSet(void); extern void IntPriorityThresholdSet(unsigned int threshold); extern void IntSoftwareIntSet(unsigned int intrNum); extern void IntSoftwareIntClear(unsigned int intrNum); extern void IntMasterIRQEnable(void); extern void IntMasterIRQDisable(void); extern void IntMasterFIQEnable(void); extern void IntMasterFIQDisable(void); extern void IntSystemEnable(unsigned int intrNum); extern void IntSystemDisable(unsigned int intrNum); extern void IntUnRegister(unsigned int intrNum); extern void IntEnable(unsigned char status); extern void IntRegister(unsigned int intrNum, void (*pfnHandler)(void)); extern void IntPrioritySet(unsigned int intrNum, unsigned int priority, unsigned int hostIntRoute); extern unsigned char IntDisable(void); extern unsigned int IntMasterStatusGet(void); extern unsigned int IntActiveIrqNumGet(void); extern unsigned int IntActiveFiqNumGet(void); extern unsigned int IntSpurIrqFlagGet(void); extern unsigned int IntSpurFiqFlagGet(void); extern unsigned int IntCurrIrqPriorityGet(void); extern unsigned int IntCurrFiqPriorityGet(void); extern unsigned int IntPriorityThresholdGet(void); extern unsigned int IntRawStatusGet(unsigned int intrNum); extern unsigned int IntPendingIrqMaskedStatusGet(unsigned int intrNum); extern unsigned int IntPendingFiqMaskedStatusGet(unsigned int intrNum); void Init_Main_Thread(void); void HW_MCU_Version_Get(void); void HW_AMP_Version_Get(void); /** * \file gpio_v2.h * * \brief This file contains the prototypes of the APIs present in the * device abstraction layer file of GPIO belonging to AM335X SoC. * This also contains some related macros. */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /** * @Component: GPIO * * @Filename: ../../CredDataBase/gpio_v2_cred.h * ============================================================================ */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /*********************************************************************** * Register arrays Definition \***********************************************************************/ /*********************************************************************** * Bundle arrays Definition \***********************************************************************/ /*********************************************************************** * Bundles Definition \***********************************************************************/ /************************************************************************* * Registers Definition \*************************************************************************/ /************************************************************************** * Field Definition Macros \**************************************************************************/ /* REVISION */ /* SYSCONFIG */ /* IRQSTATUS_RAW_0 */ /* IRQSTATUS_RAW_1 */ /* IRQSTATUS_0 */ /* IRQSTATUS_1 */ /* IRQSTATUS_SET_0 */ /* IRQSTATUS_SET_1 */ /* IRQSTATUS_CLR_0 */ /* IRQSTATUS_CLR_1 */ /* SYSSTATUS */ /* CTRL */ /* OE */ /* DATAIN */ /* DATAOUT */ /* LEVELDETECT0 */ /* LEVELDETECT1 */ /* RISINGDETECT */ /* FALLINGDETECT */ /* DEBOUNCENABLE */ /* DEBOUNCINGTIME */ /* CLEARDATAOUT */ /* SETDATAOUT */ /***************************************************************************** ** MACRO DEFINITIONS *****************************************************************************/ /* Values used to configure the direction of GPIO pins. */ /* Values helping to decide the value on a GPIO pin. */ /* Values denoting the Interrupt Line number to be used. */ /* Values denoting the Smart Wakeup Interrupt Line to be used. */ /* ** Values used to enable/disable interrupt generation due to level ** detection on an input GPIO pin. */ /* ** Values used to enable/disable interrupt generation due to edge ** detection on an input GPIO pin. */ /* Values used for Idle Mode configurations. */ /* Values used to enable/disable Auto-Idle mode. */ /* Values used to configure the Gating Ratio. */ /* Values used to enable/disable Debouncing feature for an input pin. */ /* ** Structure to store the GPIO context */ typedef struct gpioContext{ unsigned int ctrl; unsigned int dir; unsigned int data; }GPIOCONTEXT; /***************************************************************************** ** FUNCTION PROTOTYPES *****************************************************************************/ extern void GPIOModuleReset(unsigned int baseAdd); extern void GPIOModuleEnable(unsigned int baseAdd); extern void GPIOModuleDisable(unsigned int baseAdd); extern void GPIODirModeSet(unsigned int baseAdd, unsigned int pinNumber, unsigned int pinDirection); extern unsigned int GPIODirModeGet(unsigned int baseAdd, unsigned int pinNumber); extern void GPIOPinWrite(unsigned int baseAdd, unsigned int pinNumber, unsigned int pinValue); extern unsigned int GPIOPinRead(unsigned int baseAdd, unsigned int pinNumber); extern void GPIOMultiplePinsWrite(unsigned int baseAdd, unsigned int setMask, unsigned int clrMask); extern unsigned int GPIOMultiplePinsRead(unsigned int baseAdd, unsigned int readMask); extern void GPIOPinIntEnable(unsigned int baseAdd, unsigned int intLine, unsigned int pinNumber); extern void GPIOPinIntDisable(unsigned int baseAdd, unsigned int intLine, unsigned int pinNumber); extern void GPIOIntTypeSet(unsigned int baseAdd, unsigned int pinNumber, unsigned int eventType); extern unsigned int GPIOIntTypeGet(unsigned int baseAdd, unsigned int pinNumber); extern unsigned int GPIOPinIntStatus(unsigned int baseAdd, unsigned int intLine, unsigned int pinNumber); extern void GPIOPinIntClear(unsigned int baseAdd, unsigned int intLine, unsigned int pinNumber); extern unsigned int GPIORawIntStatus(unsigned int baseAdd, unsigned int intLine, unsigned int readMask); extern void GPIOTriggerPinInt(unsigned int baseAdd, unsigned int intLine, unsigned int pinNumber); extern void GPIOWakeupGlobalEnable(unsigned int baseAdd); extern void GPIOWakeupGlobalDisable(unsigned int baseAdd); extern void GPIOPinIntWakeUpEnable(unsigned int baseAdd, unsigned int intLine, unsigned int pinNumber); extern void GPIOPinIntWakeUpDisable(unsigned int baseAdd, unsigned int intLine, unsigned int pinNumber); extern void GPIOAutoIdleModeControl(unsigned int baseAdd, unsigned int modeFlag); extern void GPIOIdleModeConfigure(unsigned int baseAdd, unsigned int modeFlag); extern void GPIOGatingRatioConfigure(unsigned int baseAdd, unsigned int configFlag); extern void GPIODebounceFuncControl(unsigned int baseAdd, unsigned int pinNumber, unsigned int controlFlag); extern void GPIODebounceTimeConfig(unsigned int baseAdd, unsigned int debounceTime); extern unsigned int GPIORevisionInfoGet(unsigned int baseAdd); extern void gpioContextSave(unsigned int baseAdd, GPIOCONTEXT *contextPtr); extern void gpioContextRestore(unsigned int baseAdd, GPIOCONTEXT *contextPtr); /********************************* End Of File ******************************/ /** * \file ecap.h * * \brief This file contains the function prototypes for the device * abstraction layer for ECAP. It also contains some * related macro definitions and some files to be included. */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /** * \file hw_ecap.h * * \brief ECAP register definitions */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /*************************************************************************** Field Definition Macros \**************************************************************************/ /* TSCTR */ /* CTRPHS */ /* CAP1 */ /* CAP2 */ /* CAP3 */ /* CAP4 */ /* ECCTL1 */ /* ECCTL2 */ /* ECEINT */ /* ECFLG */ /* ECCLR */ /* ECFRC */ /* REVID */ /****************************************************************************/ /* ** Values that can be passed to ECAPOperatingModeSelect API as modeSelect ** to select type operating mode. */ /****************************************************************************/ /* ** Values that can be passed to ECAPTimeStampRead API as capEvtFlag ** to determine for which capture event time-stamp has to be returned */ /****************************************************************************/ /* ** Values that can be passed to ECAPOneShotModeConfig API as stopVal ** which determines number of captures allowed to occur before ** Capture register(1-4) frozen.\n */ /****************************************************************************/ /* ** Values that can be passed to ECAPAPWMPolarityConfig API as flag ** which determines the output polarity for APWM output */ /****************************************************************************/ /* ** Values that can be passed to ECAPCounterControl API as flag ** which determines whether counter to be configured to stop ** or free running */ /****************************************************************************/ /* ** Values that can be passed to ECAPSyncInOutSelect API as syncIn ** to disable syncIn or to enable counter to be loaded from ** CNTPHS register upon a SYNCI signal */ /****************************************************************************/ /* ** Values that can be passed to ECAPSyncInOutSelect API as syncOut ** to select syncIn event to be the Sync-Out signal or select ** PRD_eq event to be Sync-Out signal or to disaqble syncOut ** signal */ /****************************************************************************/ /* ** Values that can be passed to ECAPIntEnable/Disable API ** to enable or disable interrupt or it can be passed ** ECAPIntStatus to get the interrupt or it can be passed ** to ECAPIntStatusClear to clear the interrupt status */ /* It can be passed to ECAPIntStatusClear to clear global interrupt flag */ /****************************************************************************/ /* ** Values that can be passed to ECAPStandByModeConfig API ** to configure ECAP module in different stand by mode. ** */ /****************************************************************************/ /* ** Values that can be passed to ECAPIdleModeConfig API ** to configure ECAP module in different Idle mode. ** */ /* ** Structure to save the ECAP context */ typedef struct ecapContext { unsigned short ecctl2; unsigned short ecclr; unsigned short eceint; unsigned int pwm0ssclkconfig; unsigned int tsctr; unsigned int cap1; unsigned int cap2; }ECAPCONTEXT; void ECAPClockStop(unsigned int baseAdd); void ECAPClockEnable(unsigned int baseAdd); void ECAPOneShotREARM(unsigned int baseAdd); void ECAPGlobalIntEnable(unsigned int baseAdd); void ECAPContinousModeConfig(unsigned int baseAdd); void ECAPCaptureLoadingEnable(unsigned int baseAdd); void ECAPCaptureLoadingDisable(unsigned int baseAdd); unsigned int ECAPPeripheralIdGet(unsigned int baseAdd); unsigned int ECAPClockStopStatusGet(unsigned int baseAdd); unsigned int ECAPClockEnableStatusGet(unsigned int baseAdd); void ECAPIntEnable(unsigned int baseAdd, unsigned int flag); void ECAPIntDisable(unsigned int baseAdd, unsigned int flag); void ECAPIntStatusClear(unsigned int baseAdd, unsigned int flag); void ECAPCounterControl(unsigned int baseAdd, unsigned int flag); void ECAPCounterConfig(unsigned int baseAdd, unsigned int countVal); unsigned int ECAPIntStatus(unsigned int baseAdd, unsigned int flag); void ECAPAPWMPolarityConfig(unsigned int baseAdd, unsigned int flag); void ECAPSyncInOutSelect(unsigned int baseAdd, unsigned int syncIn, unsigned int syncOut); void ECAPPrescaleConfig(unsigned int baseAdd, unsigned int prescale); void ECAPOneShotModeConfig(unsigned int baseAdd, unsigned int stopVal); void ECAPAPWMCaptureConfig(unsigned int baseAdd, unsigned int compareVal, unsigned int periodVal); void ECAPAPWMShadowCaptureConfig(unsigned int baseAdd, unsigned int compareVal, unsigned int periodVal); void ECAPOperatingModeSelect(unsigned int baseAdd, unsigned int modeSelect); unsigned int ECAPTimeStampRead(unsigned int baseAdd, unsigned int capEvtFlag); void ECAPCounterPhaseValConfig(unsigned int baseAdd, unsigned int cntPhaseVal); void ECAPCapeEvtPolarityConfig(unsigned int baseAdd, unsigned int capEvt1pol, unsigned int capEvt2pol, unsigned int capEvt3pol, unsigned int capEvt4pol); void ECAPCaptureEvtCntrRstConfig(unsigned int baseAdd, unsigned int CounterRst1, unsigned int CounterRst2,unsigned int CounterRst3, unsigned int CounterRst4); void ECAPClockEnable(unsigned int baseAdd); void ECAPClockDisable(unsigned int baseAdd); unsigned int ECAPClockEnableStatusGet(unsigned int baseAdd); unsigned int ECAPClockDisableStatusGet(unsigned int baseAdd); extern void EcapContextSave(unsigned int ecapBase, unsigned int pwmssBase, ECAPCONTEXT *contextPtr); extern void EcapContextRestore(unsigned int ecapBase, unsigned int pwmssBase, ECAPCONTEXT *contextPtr); extern unsigned short Mcu_Board_Ver; void GPIO_Init(void); void GPIO2ModuleClkConfig(void); void GPIO3ModuleClkConfig(void); void MMCSDPinMuxSetup(void); void EcapInit(void); /* * \file cache.h * * \brief Cache related function prototypes * * This file contains the API prototypes for configuring ARMv7a Cache. */ /* * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ */ /* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ /*****************************************************************************/ /* ** Macros which can be passed to CacheDisable/Enable APIs */ /*****************************************************************************/ /* ** API prototypes */ extern void CacheEnable(unsigned int enFlag); extern void CacheDisable(unsigned int disFlag); extern void CacheInstInvalidateAll(void); extern void CacheInstInvalidateBuff(unsigned int startAddr, unsigned int numBytes); extern void CacheDataCleanInvalidateAll(void); extern void CacheDataCleanAll(void); extern void CacheDataInvalidateAll(void); extern void CacheDataCleanBuff(unsigned int startAddr, unsigned int numBytes); extern void CacheDataInvalidateBuff(unsigned int startAddr, unsigned int numBytes); extern void CacheDataCleanInvalidateBuff(unsigned int startAddr, unsigned int numBytes); int Cache_Init(void); void MMU_Init(void); /*****************************************************************************/ /* STDINT.H v15.4.0I15142 */ /* */ /* Copyright (c) 2002-2015 Texas Instruments Incorporated */ /* http://www.ti.com/ */ /* */ /* Redistribution and use in source and binary forms, with or without */ /* modification, are permitted provided that the following conditions */ /* are met: */ /* */ /* Redistributions of source code must retain the above copyright */ /* notice, this list of conditions and the following disclaimer. */ /* */ /* Redistributions in binary form must reproduce the above copyright */ /* notice, this list of conditions and the following disclaimer in */ /* the documentation and/or other materials provided with the */ /* distribution. */ /* */ /* Neither the name of Texas Instruments Incorporated nor the names */ /* of its contributors may be used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ /* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ /* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR */ /* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ /* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ /* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT */ /* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, */ /* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY */ /* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT */ /* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE */ /* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*****************************************************************************/ /* 7.18.1.1 Exact-width integer types */ typedef signed char int8_t; typedef unsigned char uint8_t; typedef short int16_t; typedef unsigned short uint16_t; typedef int int32_t; typedef unsigned int uint32_t; typedef long long int64_t; typedef unsigned long long uint64_t; /* 7.18.1.2 Minimum-width integer types */ typedef int8_t int_least8_t; typedef uint8_t uint_least8_t; typedef int16_t int_least16_t; typedef uint16_t uint_least16_t; typedef int32_t int_least32_t; typedef uint32_t uint_least32_t; typedef int64_t int_least64_t; typedef uint64_t uint_least64_t; /* 7.18.1.3 Fastest minimum-width integer types */ typedef int32_t int_fast8_t; typedef uint32_t uint_fast8_t; typedef int32_t int_fast16_t; typedef uint32_t uint_fast16_t; typedef int32_t int_fast32_t; typedef uint32_t uint_fast32_t; typedef int64_t int_fast64_t; typedef uint64_t uint_fast64_t; /* 7.18.1.4 Integer types capable of holding object pointers */ typedef int intptr_t; typedef unsigned int uintptr_t; /* 7.18.1.5 Greatest-width integer types */ typedef long long intmax_t; typedef unsigned long long uintmax_t; /* According to footnotes in the 1999 C standard, "C++ implementations should define these macros only when __STDC_LIMIT_MACROS is defined before is included." */ /* 7.18.2 Limits of specified width integer types */ /* 7.18.3 Limits of other integer types */ /* 7.18.4.1 Macros for minimum-width integer constants */ /* There is a defect report filed against the C99 standard concerning how the (U)INTN_C macros should be implemented. Please refer to -- http://wwwold.dkuug.dk/JTC1/SC22/WG14/www/docs/dr_209.htm for more information. These macros are implemented according to the suggestion given at this web site. */ /* 7.18.4.2 Macros for greatest-width integer constants */ int main(void) { OS_ERR err = OS_ERR_NONE; char a[5]; a[0] = 1; a[1] = 2; a[2] = 3; a[3] = 4; a[4] = 5; uint32_t* ptr; ptr = &a[1]; uint32_t result = *ptr; // uint32_t cpu_sr = 0; // CPU_CRITICAL_ENTER(); // CPU_CRITICAL_EXIT(); IntAINTCInit(); CPU_Init(); /* Initialize the uC/CPU services */ Cache_Init(); IntMasterIRQEnable(); GPIO_Init(); _register_lock(IntMasterIRQDisable); _register_unlock(IntMasterIRQEnable); Init_Main_Thread(); OSStart(&err); if (err != OS_ERR_NONE) printf("OS Operator Fail, Back to Main"); return 0; }