all_share.h 8.04 KB
//------------------------------------------------------------------------------
// 화일명   : all_share.h
// 프로젝트 :
// 설  명   : 공유 메모리 구조체를 선언한다.
//
// 저작권   : FA리눅스주식회사
// 주  의   :
//------------------------------------------------------------------------------
#ifndef _ALL__SHARE_HEADER_
#define _ALL__SHARE_HEADER_

#define STRUCT_PACK     __attribute__ ((packed))
#define SHM_METER_KEY   0xFA1234

#define TRUE                1
#define FALSE               0

#define SWITCH_ON           1
#define SWITCH_OFF          0

typedef unsigned char       U8;
typedef unsigned short      U16;
typedef unsigned int        U32;
typedef unsigned long long  U64;
typedef signed short        I16;

enum command_enum_t {
    CMD_VALUE   = 0,                                                // 오븐 값 변경
    CMD_ONOFF,                                                      // 오븐 스위치 ON/OFF
    CMD_CLEAR_ERROR_CNT                                             // 에러 카운트를 초기화
};

enum target_value_t {
    TG_OVEN_MODE = 0,
    TG_HEAT,
    TG_HUMIDITY,
    TG_TIME,
    TG_CONV_RPM,
    TG_INNER_TEMP,
    TG_COOK_MODE,
    TG_CLEAN_TYPE,
    TG_BUNNER1_RPM,
    TG_BUNNER2_RPM,
    TG_BUNNER3_RPM,
    TG_FAN1_RPM,
    TG_FAN2_RPM,
    TG_FAN1_DIRECTOIN,
    TG_FAN2_DIRECTOIN,
    TG_BURNER1_1_RPM,
    TG_BURNER1_2_RPM,
    TG_BURNER23_1_RPM,
    TG_BURNER23_2_RPM,
    TG_PRODUCT_TYPE,
    TG_MODEL_TYPE,
    TG_ERROR_CLEAR
};

enum target_onoff_t {
    TG_COOKING = 0,
    TG_CLEANING,
    TG_SYSTEM,
    TG_PREHEAT,
    TG_OUTHUMIDITY,
    TG_INNERWATER,
    TG_COOLDOWN,
    TG_BITONOFF,                    //
    TG_MANUAL_BURNER1,
    TG_MANUAL_BURNER2,
    TG_MANUAL_BURNER3,
    TG_MANUAL_FAN1,
    TG_MANUAL_FAN2,
    TG_MANUAL_RELAY,
    TG_BUNNER1_MANUAL,
    TG_BUNNER2_MANUAL,
    TG_BUNNER3_MANUAL,
    TG_BUNNER1_FAN,
    TG_BUNNER2_FAN,
    TG_BUNNER3_FAN,
    TG_FAN1_MANUAL,
    TG_FAN2_MANUAL,
    TG_DV,
    TG_CFAN,
    TG_WSV,
    TG_QNV,
    TG_SSV,
    TG_SNV,
    TG_HL,
    TG_DP,
    TG_SSP,
    TG_UNP,
    TG_HDM,
    TG_SGNV,
    TG_INV
};

enum {
    HDR_OVEN_CONTROL  = 0,                                          // 40000 번지 값, 컨트롤 제어
    HDR_OVEN_STATE,                                                 // 30000 번지 값, 오븐 상태
    HDR_ERROR_CODE                                                  // 에러 코드
};

enum {
    ERR_SEND_COMMAND    = 0,                                        // 명령 전송에 대한 응답이 없음
    ERR_RECEIVE_80                                                  // 0x80 코드를 수신했음
};

//
// 시스템 전체 공유 구조체 구조체
//

typedef struct
{
    int     cmd;
    int     target;
    int     value;
} STRUCT_PACK command_t;

typedef struct {
    U16     reserved00;             // 00
    U16     reserved01;             // 01
    U16     reserved02;             // 02
    U16     reserved03;             // 03
    U16     reserved04;             // 04
    U16     oven_mode;              // 05
    U16     cooking;                // 06
    U16     cleaning;               // 07
    U16     system;                 // 08
    I16     heat;                   // 09
    U16     humidity;               // 0A
    U16     time;                   // 0B
    U16     preheat;                // 0C
    U16     outhumidity;            // 0D
    U16     innerwater;             // 0E
    U16     conv_rpm;               // 0F
    U16     cooldown;               // 10
    I16     inner_temp;             // 11
    U16     reserved12;             // 12
    U16     cook_mode;              // 13
    U16     clean_type;             // 14
    U16     clean_total;            // 15
    U16     clean_step;             // 16
    U16     clean_step_type;        // 17
    U16     reserved18;             // 18
    U16     manual_auto;            // 19
    U16     bunner1_rpm;            // 1A
    U16     bunner2_rpm;            // 1B
    U16     bunner3_rpm;            // 1C
    U16     fan1_rpm;               // 1D
    U16     fan2_rpm;               // 1E
    U16     fan1_direction;         // 1F
    U16     fan2_direction;         // 20
    U16     manual_onoff21;         // 21
    U16     manual_onoff22;         // 22
    U16     reserved23;             // 23
    U16     reserved24;             // 24
    U16     reserved25;             // 25
    U16     reserved26;             // 26
    U16     reserved27;             // 27
    U16     burner1_1_rpm;          // 28
    U16     burner1_2_rpm;          // 29
    U16     burner23_1_rpm;         // 2A
    U16     burner23_2_rpm;         // 2B
    U16     product_type;           // 2C
    U16     model_type;             // 2D
    U16     reserved2e;             // 2E
    U16     reserved2f;             // 2F
    U16     reserved30;             // 30
    U16     error_clear;            // 31
} STRUCT_PACK oven_control_t;

typedef struct {
    U16     firmware_version;       // 00
    U16     firmware_year;          // 01
    U16     firmware_month;         // 02
    U16     firmware_day;           // 03
    U16     cooking_mode;           // 04
    I16     cooking_heat;           // 05
    U16     cooking_humidity;       // 06
    U16     cooking_time;           // 07
    I16     curr_heat;              // 08
    U16     curr_humidity;          // 09
    U16     curr_time;              // 0A
    U16     cleaning_sate;          // 0B
    U16     cleaning_mode;          // 0C
    U16     cleaning_statge;        // 0D
    U16     cleaning_sec;           // 0E
    U16     cleaning_min;           // 0F
    U16     door_state;             // 10
    U16     reserved11;             // 11
    U16     burner1_rpm;            // 12
    U16     burner2_rpm;            // 13
    U16     burner3_rpm;            // 14
    U16     fan1_rpm;               // 15
    U16     fan2_rpm;               // 16
    U16     fan1_direction;         // 17
    U16     fan2_direction;         // 18
    U16     onoff_state1;           // 19
    U16     onoff_state2;           // 1A
    I16     sensor1;                // 1B
    I16     sensor2;                // 1C
    I16     sensor3;                // 1D
    I16     sensor4;                // 1E
    I16     sensor5;                // 1F
    I16     sensor6;                // 20
    I16     sensor7;                // 21
    I16     sensor8;                // 22
    I16     sensor9;                // 23
    I16     sensor10;               // 24
    U16     sensor11;               // 25
    U16     sensor12;               // 26
    I16     sensor13;               // 27
    I16     sensor14;               // 28
    U16     sensor15;               // 29
    U16     sensor16;               // 2A
    U16     onoff_relay_load;       // 2B
    U16     reserved2c;             // 2C
    U16     reserved2d;             // 2D
    U16     system_error;           // 2E
    U16     communication_error;    // 2F
    U16     sensor_error;           // 30
    U16     reserved31;             // 31
    U16     burner1_ignition_rpm;   // 32
    U16     burner2_ignition_rpm;   // 33
    U16     burner3_ignition_rpm;   // 34
    U16     burner1_current_rpm;    // 35
    U16     burner2_current_rpm;    // 36
    U16     burner3_current_rpm;    // 37
    U16     controller_error;       // 38
    U16     error_cnt[16];          // 에러 카운트
} STRUCT_PACK oven_state_t;

typedef struct {
    int             header;
    oven_control_t  control;
} STRUCT_PACK gui_oven_control_t;

typedef struct {
    int             header;
    oven_state_t    state;
} STRUCT_PACK gui_oven_state_t;

typedef struct {
    int             header;
    int             code;
} STRUCT_PACK gui_error_t;

//------------------------------------------------------------------------------
//
// 프레임, 페이로드
//
//------------------------------------------------------------------------------

//------------------------------------------------------------------------------
//
// 전역 변수 정의
//
//------------------------------------------------------------------------------

#define INI_SYSTEM      "system.ini"

#endif