TYW_stdint.h 13.7 KB
Newer Older
时昊's avatar
时昊 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470
#ifndef TYWTYPES_H
#define TYWTYPES_H

#include "TYW_Config.h"
#include "r_typedefs.h"
/*

   变量长度(byte)      XHY      324     3360      rh850   SAMC21
   unsigned int        2       4       4         4       4
   unsigned short      2       2       2         2       2
   unsigned char       1       1       1         1       1
   unsigned long       4       4       4         4       4
   unsigned long long  4       8       8         8       8
   float               4       4       4         4       4
   double              4       8       8         8       8
*/


typedef char INT8;
typedef short INT16;
typedef unsigned char INT8U;
typedef volatile unsigned char VINT8U;
typedef unsigned int INT16U;
typedef volatile unsigned int VINT16U;
typedef unsigned long INT32U;
typedef volatile unsigned long VINT32U;

#if ( ! defined(__cplusplus) )

    #ifndef false
        #define false (0U)
    #endif

    #ifndef true
        #define true (1U)
    #endif

    #ifndef TRUE
        #define TRUE (1U)
    #endif

    #ifndef FALSE
        #define FALSE (0U)
    #endif

#endif

#define NULL ((void *)0)
#define NOP( ) __asm("NOP")

#if defined(Platform_XHY)

    #ifndef uint8_t
typedef unsigned char uint8_t;
typedef unsigned int  uint16_t;
/*typedef unsigned short      uint16_t;*/
typedef unsigned long uint32_t;
/*typedef unsigned long long  uint32_t;*/

typedef char int8_t;
typedef int  int16_t;
/*typedef short               int16_t;*/
typedef long int32_t;
/*typedef long long           int32_t;*/

typedef float         float32_T;
typedef double        double32_T;
typedef unsigned char boolean_t;
    #endif /* uint8_t */

    #define MAX_int8_t  (( int8_t )(127))
    #define MIN_int8_t  (( int8_t )(-128))
    #define MAX_uint8_T (( uint8_t )(255U))

    #define MAX_int16_t  (( int16_t )(32767))
    #define MIN_int16_t  (( int16_t )(-32768))
    #define MAX_uint16_t (( uint16_t )(65535U))

    #define MAX_int32_t  (( int32_t )(2147483647))
    #define MIN_int32_t  (( int32_t )(-2147483647 - 1))
    #define MAX_uint32_t (( uint32_t )(0xFFFFFFFFU))

    #define MAX_int64_t  (( int64_t )(9223372036854775807LL))
    #define MIN_int64_t  (( int64_t )(-9223372036854775807LL - 1LL))
    #define MAX_uint64_t (( uint64_t )(0xFFFFFFFFFFFFFFFFULL))

#elif defined(Platform_S6J3360)

    #define int8_t   signed char
    #define int16_t  signed short
    #define int32_t  signed int
    #define int64_t  signed long long
    #define uint8_t  unsigned char
    #define uint16_t unsigned short
    #define uint32_t unsigned int
    #define uint64_t unsigned long long

typedef float         float32_T;
typedef double        double64;
typedef unsigned char boolean_t;

    #define MAX_int8_t  (( int8_t )(127))
    #define MIN_int8_t  (( int8_t )(-128))
    #define MAX_uint8_T (( uint8_t )(255U))

    #define MAX_int16_t  (( int16_t )(32767))
    #define MIN_int16_t  (( int16_t )(-32768))
    #define MAX_uint16_t (( uint16_t )(65535U))

    #define MAX_int32_t  (( int32_t )(2147483647))
    #define MIN_int32_t  (( int32_t )(-2147483647 - 1))
    #define MAX_uint32_t (( uint32_t )(0xFFFFFFFFU))

    #define MAX_int64_t  (( int64_t )(9223372036854775807LL))
    #define MIN_int64_t  (( int64_t )(-9223372036854775807LL - 1LL))
    #define MAX_uint64_t (( uint64_t )(0xFFFFFFFFFFFFFFFFULL))

#elif defined(Platform_S6J324)

    #define int8_t   signed char
    #define int16_t  signed short
    #define int32_t  signed int
    #define int64_t  signed long long
    #define uint8_t  unsigned char
    #define uint16_t unsigned short
    #define uint32_t unsigned int
    #define uint64_t unsigned long long

typedef float         float32_T;
typedef double        double64;
typedef unsigned char boolean_t;

    #define MAX_int8_t  (( int8_t )(127))
    #define MIN_int8_t  (( int8_t )(-128))
    #define MAX_uint8_T (( uint8_t )(255U))

    #define MAX_int16_t  (( int16_t )(32767))
    #define MIN_int16_t  (( int16_t )(-32768))
    #define MAX_uint16_t (( uint16_t )(65535U))

    #define MAX_int32_t  (( int32_t )(2147483647))
    #define MIN_int32_t  (( int32_t )(-2147483647 - 1))
    #define MAX_uint32_t (( uint32_t )(0xFFFFFFFFU))

    #define MAX_int64_t  (( int64_t )(9223372036854775807LL))
    #define MIN_int64_t  (( int64_t )(-9223372036854775807LL - 1LL))
    #define MAX_uint64_t (( uint64_t )(0xFFFFFFFFFFFFFFFFULL))

#elif defined(Platform_RH850)

    #define int8_t   signed char
    #define int16_t  signed short
    #define int32_t  signed int
    #define int64_t  signed long long
    #define uint8_t  unsigned char
    #define uint16_t unsigned short
    #define uint32_t unsigned int
    #define uint64_t unsigned long long

typedef float         float32_T;
typedef double        double64;
typedef unsigned char boolean_t;

    #define MAX_int8_t  (( int8_t )(127))
    #define MIN_int8_t  (( int8_t )(-128))
    #define MAX_uint8_T (( uint8_t )(255U))

    #define MAX_int16_t  (( int16_t )(32767))
    #define MIN_int16_t  (( int16_t )(-32768))
    #define MAX_uint16_t (( uint16_t )(65535U))

    #define MAX_int32_t  (( int32_t )(2147483647))
    #define MIN_int32_t  (( int32_t )(-2147483647 - 1))
    #define MAX_uint32_t (( uint32_t )(0xFFFFFFFFU))

    #define MAX_int64_t  (( int64_t )(9223372036854775807LL))
    #define MIN_int64_t  (( int64_t )(-9223372036854775807LL - 1LL))
    #define MAX_uint64_t (( uint64_t )(0xFFFFFFFFFFFFFFFFULL))

#elif defined(Platform_SAMC21)

    #define int8_t   signed char
    #define int16_t  signed short
    #define int32_t  signed int
    #define int64_t  signed long long
    #define uint8_t  unsigned char
    #define uint16_t unsigned short
    #define uint32_t unsigned int
    #define uint64_t unsigned long long

typedef float         float32_T;
typedef double        double64;
typedef unsigned char boolean_t;

    #define MAX_int8_t  (( int8_t )(127))
    #define MIN_int8_t  (( int8_t )(-128))
    #define MAX_uint8_T (( uint8_t )(255U))

    #define MAX_int16_t  (( int16_t )(32767))
    #define MIN_int16_t  (( int16_t )(-32768))
    #define MAX_uint16_t (( uint16_t )(65535U))

    #define MAX_int32_t  (( int32_t )(2147483647))
    #define MIN_int32_t  (( int32_t )(-2147483647 - 1))
    #define MAX_uint32_t (( uint32_t )(0xFFFFFFFFU))

    #define MAX_int64_t  (( int64_t )(9223372036854775807LL))
    #define MIN_int64_t  (( int64_t )(-9223372036854775807LL - 1LL))
    #define MAX_uint64_t (( uint64_t )(0xFFFFFFFFFFFFFFFFULL))

#elif defined(Platform_S32K)

    #define int8_t   signed char
    #define int16_t  signed short
    #define int32_t  signed int
    #define int64_t  signed long long
    #define uint8_t  unsigned char
    #define uint16_t unsigned short
    #define uint32_t unsigned int
    #define uint64_t unsigned long long

typedef float         float32_T;
typedef double        double64;
typedef unsigned char boolean_t;

    #define MAX_int8_t  (( int8_t )(127))
    #define MIN_int8_t  (( int8_t )(-128))
    #define MAX_uint8_T (( uint8_t )(255U))

    #define MAX_int16_t  (( int16_t )(32767))
    #define MIN_int16_t  (( int16_t )(-32768))
    #define MAX_uint16_t (( uint16_t )(65535U))

    #define MAX_int32_t  (( int32_t )(2147483647))
    #define MIN_int32_t  (( int32_t )(-2147483647 - 1))
    #define MAX_uint32_t (( uint32_t )(0xFFFFFFFFU))

    #define MAX_int64_t  (( int64_t )(9223372036854775807LL))
    #define MIN_int64_t  (( int64_t )(-9223372036854775807LL - 1LL))
    #define MAX_uint64_t (( uint64_t )(0xFFFFFFFFFFFFFFFFULL))

#elif defined(Platform_KEA64)

    #define int8_t   signed char
    #define int16_t  signed short
    #define int32_t  signed int
    #define int64_t  signed long long
    #define uint8_t  unsigned char
    #define uint16_t unsigned short
    #define uint32_t unsigned int
    #define uint64_t unsigned long long

typedef float         float32_T;
typedef double        double64;
typedef unsigned char boolean_t;

    #define MAX_int8_t  (( int8_t )(127))
    #define MIN_int8_t  (( int8_t )(-128))
    #define MAX_uint8_T (( uint8_t )(255U))

    #define MAX_int16_t  (( int16_t )(32767))
    #define MIN_int16_t  (( int16_t )(-32768))
    #define MAX_uint16_t (( uint16_t )(65535U))

    #define MAX_int32_t  (( int32_t )(2147483647))
    #define MIN_int32_t  (( int32_t )(-2147483647 - 1))
    #define MAX_uint32_t (( uint32_t )(0xFFFFFFFFU))

    #define MAX_int64_t  (( int64_t )(9223372036854775807LL))
    #define MIN_int64_t  (( int64_t )(-9223372036854775807LL - 1LL))
    #define MAX_uint64_t (( uint64_t )(0xFFFFFFFFFFFFFFFFULL))

    // #else

    // #error NO_Platform_Found

#endif /* Logical type definitions */

typedef enum
{
    /* Generic error codes */
    STATUS_SUCCESS     = 0x000U, /*!< Generic operation success status */
    STATUS_ERROR       = 0x001U, /*!< Generic operation failure status */
    STATUS_BUSY        = 0x002U, /*!< Generic operation busy status */
    STATUS_TIMEOUT     = 0x003U, /*!< Generic operation timeout status */
    STATUS_UNSUPPORTED = 0x004U, /*!< Generic operation unsupported status */
    STATUS_NEGATIVE    = 0x005U, /* 负数                 */
    STATUS_NONNEGATIVE = 0x006U, /* 非负数               */

    /* CAN specific error codes */
    STATUS_CAN_BUFF_OUT_OF_RANGE       = 0x300U, /*!< The specified MB index is out of the configurable range */
    STATUS_CAN_NO_TRANSFER_IN_PROGRESS = 0x301U, /*!< There is no transmission or reception in progress */

    SBC_COMM_ERROR = 0x802U, /*!< Data transfer was aborted */
    SBC_CMD_ERROR  = 0x804U, /*!< Wrong command. */
    SBC_ERR_NA     = 0x808U, /*!< Feature/device not available */

} status_t;

#define Telltales_SelfCheckOffset (uint32_t)(2ul)
#define StartAnimationStart       (uint32_t)(2ul)
#define StartAnimationEnd         (uint32_t)(3000ul)
#define PopupStart                (uint32_t)(4000ul)
#define BackLightStart            (uint32_t)(2ul)

typedef enum
{
    LINE_IN_LEVEL_LOW = 0U,
    LINE_IN_LEVEL_HIGH,
} LINE_IN_TriggerLevel_en_t; /*物理电平数值*/

/*逻辑电平,硬线是否有效,是否触发*/
//typedef enum
//{
//    LINE_IN_LOGIC_INVALID = 0U, /*逻辑低电平,硬线信号无效,未触发*/
//    LINE_IN_LOGIC_VALID,        /*逻辑高电平,硬线信号有效,已触发*/
//} LineIn_LogicLevel_en_t;

/*硬线相关电源状态*/
//typedef enum
//{
//    LINE_IN_IG_OFF = 0U,
//    LINE_IN_IG_ON,
//    LINE_IN_IG_ONOFF,
//} LINE_IN_WorkSt_en_t;

//typedef enum
//{
//    LEVEL_LOW = 0u,
//    LEVEL_HIGH,
//} _LINE_IN_TriggerLevel_;

/*LineIn Module END*/

/*CAN TX Module*/

typedef enum
{
    CAN_MSG_TX_CYCLE = 0u,
    CAN_MSG_TX_CYCKE_EVENT,
} CAN_TX_Type_t;

typedef enum
{
    MSG_STD = 0u,
    MSG_EXT,
} CAN_MSG_FORMAT_t;

typedef enum
{
    CAN_APP_TX_DISABLE = 0u,
    CAN_APP_TX_ENABLE  = 0X55u,
} CAN_APP_TX_Status_t;

/*CAN TX Module END*/

/*CAN RX Module*/
typedef enum
{
    CAN_BUFF_EMPTY,
    CAN_BUFF_FULL,
} CAN_BUFF_Status_t;

typedef enum
{
    CAN_MSG_UNLOCK,
    CAN_MSG_LOCKING,
} CAN_MSG_Mutex_t;

typedef enum
{
    CAN_SIG_NORMAL = 0u,
    CAN_SIG_LOST   = 0x55U,
} CAN_MSG_Status_t;
/*CAN RX Module END*/

/*COMMON INTERFACE*/

typedef enum
{
    COMMON_POWER_OFF    = 0x00u,
    COMMON_POWER_ON     = 0x01u,
    COMMON_POWER_UNKNOW = 0xFFu,
} COMMON_PowerStatus_t;

typedef enum
{
    COMMON_InValid      = 0X00U,
    COMMON_Valid        = 0X01U,
    COMMON_Valid_UNKNOW = 0XFFU,
} DataValid_t;

/*COMMON INTERFACE END*/

typedef enum
{
    GUI_DISP_MODE_NORMAL = 0, /*正常*/
    GUI_DISP_MODE_BLANK,      /*空白*/
    GUI_DISP_MODE_INVALID,    /*无效*/
    GUI_DISP_MODE_FLASH,      /*闪烁*/

} Dis_Sta_t;
typedef enum {
    /*标题*/
    Title_Charging_connect = 0, /* 充电连接中*/
    Title_Charging,/*充电中*/
    Title_Charging_Stop,/*充电暂停*/
    Title_Charging_end,/*充电结束*/
    Title_Charging_set_OK,/*预约充电等待中......*/

    /*子标题*/
    Charge_Sub_title_08,/*计划用车时间*/
    Charge_Sub_title_07,/*安全电量*/
    Charge_Sub_title_01,/*充电功率*/
    Charge_Sub_title_02,/*预计充满时间*/
    Charge_Sub_title_04,/*正在计算中*/

    Charge_Sub_title_03,/*预计充电开始时间*/
    /*温馨提示*/
    Charge_Hint_01, /*本车有预约充电功能,可在多媒体上设置*/
    Charge_Hint_02, /*当前车辆电量过低,为保护车辆,已开始充电,如需取消充电,请断开充电枪*/
    Charge_Hint_03, /*充电插座接地不良,请使用接地良好的插座*/
    Charge_Hint_04, /*为保证充电效率,请关闭大功率用电设备*/
    Charge_Hint_05, /*因充电环境严酷,限功率充电中*/
    Charge_Hint_06, /*交流枪电子锁未闭锁,限功率充电中*/
    Charge_Hint_07, /*动力电池温度低电量高,充电效率低*/
    Charge_Hint_08, /*动力电池智能温控系统工作中*/
    Charge_Hint_09, /*最近的预约充电计划超过24H,今日不生效*/
    Charge_Hint_10, /*预约成功,保底充电中*/
    Charge_Hint_11, /*电池加热中*/
    Charge_Hint_12, /*为保证动力电池智能温控效果,空调功能受限*/
    Charge_Hint_13, /*温馨提示:充电已暂停,继续充电请稍后*/
    Charge_Hint_14, /*温馨提示:本车已开启预约充电可在多媒体上修改*/
}ChargeStringIndex;
typedef enum
{
    NM_Mode_Sleep,
    NM_Mode_Wakeup,
} NM_Mode_t;
/*语言,缩写参考ISO 639-1*/
#define NVM_LANGUAGE_ZH 0x01 /*中文*/
#define NVM_LANGUAGE_EN 0x03 /*英语*/
/*时间格式*/
#define NVM_TIME_FORMAT_24H 0x01u /*24小时制*/
#define NVM_TIME_FORMAT_12H 0x00u /*12小时制*/
/*距离单位*/
#define NVM_DIST_UNIT_KM   0x00u
#define NVM_DIST_UNIT_MILE 0x01u
typedef struct{
    char * pString;
    uint16_t X;
    uint16_t Y;
    uint8_t Length;
}ImageString;

typedef struct
{
    ImageString CnFont[3];
    ImageString EnFont[3];
} ImageAttribute;



#define Clr_Bit(p, b)    (p) &= (~(1u << (b)))
#define Set_Bit(p, b)    (p) |= (1u << (b))
#define Bit_Is_Set(p, b) ((p) & (1u << (b)))
#define Bit_Is_Clr(p, b) (! ((p) & (1u << (b))))


#endif