⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 app_intr.h

📁 ST公司的upsd34XX评估板固定源程序
💻 H
字号:
/////////////////////////////////////////////////////////////////////////////
// app_intr.h
//
// Constants and structures for application interface to USB
// example firmware.
//
// Note that all 16 and 32 bit integers (uint16 and uint32) are in big endian
// format and a x86 app needs to swap the bytes to convert to little endian.

/*---------------------------------------------------------------------------
Copyright (c) 2004 ST Microelectronics
This example demo code is provided as is and has no warranty,
implied or otherwise.  You are free to use/modify any of the provided
code at your own risk in your applications with the expressed limitation
of liability (see below) so long as your product using the code contains
at least one uPSD products (device).

LIMITATION OF LIABILITY:   NEITHER STMicroelectronics NOR ITS VENDORS OR 
AGENTS SHALL BE LIABLE FOR ANY LOSS OF PROFITS, LOSS OF USE, LOSS OF DATA,
INTERRUPTION OF BUSINESS, NOR FOR INDIRECT, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES OF ANY KIND WHETHER UNDER THIS AGREEMENT OR
OTHERWISE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
--------------------------------------------------------------------------*/

#ifndef APP_INTR_H
#define APP_INTR_H

#define CMD_RESET           0x01
#define CMD_ERASE           0x02
#define CMD_WRITE           0x03
#define CMD_READ            0x04
#define CMD_STATUS          0x05
#define CMD_SET_REGS        0x06
#define CMD_SET_PAGE        0x07
#define CMD_SET_VM          0x08

#define PRIMARY_FLASH       0
#define SECONDARY_FLASH     1

#define INPUT_REPORT_SIZE   8

#define OUTPUT_REPORT_SIZE  64
#define FEATURE_REPORT_SIZE (OUTPUT_REPORT_SIZE)
#define CMD_SIZE            (OUTPUT_REPORT_SIZE)

#ifdef WIN32
 typedef unsigned char uchar;
 typedef unsigned short uint16;
 typedef unsigned int uint32;
#else
 typedef unsigned int uint16;
 typedef unsigned long uint32;
#endif


/////////////////// MCU_CMD
//
// Feature and output report structure.

typedef struct
{
    union
    {
        uchar  cmd;             // CMD_xxx code
        struct 
        {
            uchar  cmd;         // CMD_ERASE
            uchar  flash;       // PRIMARY_FLASH or SECONDARY_FLASH
            uint16 address;     // Any address in any sector
        } erase;
        struct
        {
            uchar  cmd;         // CMD_READ or CMD_WRITE
            uchar  flash;       // PRIMARY_FLASH or SECONDARY_FLASH
            uint16 address;     // Target xdata address
            uint16 nBytes;      // Num bytes to read/write
        } rw;
        struct
        {
            uchar cmd;          // CMD_SET_xxx
            uchar page;         // Desired page register value
            uchar vm;           // Desired VM register value
        } setRegs;
        struct
        {
            uchar cmd;          // CMD_GET_STATUS
            uchar currentCmd;   // Returns current command being processed
            uchar page;         // Returns page register value
            uchar vm;           // Returns VM register value
            uchar ret;          // Return value from flash routine
            uchar checkSum;     // Check sum for write commands
        } status;
        uchar buffer[CMD_SIZE];
    } u;
} MCU_CMD, *PMCU_CMD;

#endif // ifndef APP_INTR_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -