]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-rtos/mcsdk-tools.git/blob - post/include/qm_api.h
updated teh scripts to convert from dos
[keystone-rtos/mcsdk-tools.git] / post / include / qm_api.h
1 #ifndef _QM_API_H
2 #define _QM_API_H
3 /*******************************************************************************************
4  * FILE PURPOSE: Boot loader queue manager API definition
5  *******************************************************************************************
6  * FILE NAME: qm_api.h
7  *
8  * DESCRIPTION: Defines the stripped down QM driver API to the boot loader.
9  *
10  ********************************************************************************************/
11  
12 /* return values */
13 #define QM_OK                                0
14 #define QM_INVALID_LINKRAM_ALIGNMENT        -1
15 #define QM_INVALID_MEMREGION_ALIGNMENT      -2
16 #define QM_INVALID_LINKRAM_SIZE             -3
17 #define QM_INVALID_LINKRAM_RAM_SIZE         -4      /* Not enough link ram for the number of descriptors */
20 /* Memory alignment requirements (bytes) */
21 #define QM_LINKRAM_ALIGN        4 
22 #define QM_MEMR_ALIGN           16      /* Not specified in the doc */
24 /* The driver supports only a single descriptor size */
25 #define QM_DESC_SIZE_BYTES      64
27 /* QM setup configuration */
28 typedef struct qmConfig_s  {
30     uint32_t linkRamBase;
31     uint32_t linkRamSize;
32     
33     uint32_t memRegionBase;
34     uint32_t memRegNumDescriptors;
35     
36     uint32_t destQ;       /* Where the initialized descriptors are placed */
37     
38 } qmConfig_t;
40 typedef struct qmHostDesc_s {
41     /** Descriptor type, packet type, protocol specific region location, packet length */
42     uint32_t          descInfo;
43     /** Source tag, Destination tag */
44     uint32_t          tagInfo;
45     /** EPIB present, PS valid word count, error flags, PS flags, return policy, return push policy, 
46      * packet return QM number, packet return queue number */
47     uint32_t          packetInfo;
48     /** Number of valid data bytes in the buffer */
49     uint32_t          buffLen;
50     /** Byte aligned memory address of the buffer associated with this descriptor */
51     uint32_t          buffPtr;
52     /** 32-bit word aligned memory address of the next buffer descriptor */
53     uint32_t          nextBDPtr;
54     /** Completion tag, original buffer size */
55     uint32_t          origBufferLen;
56     /** Original buffer pointer */
57     uint32_t          origBuffPtr;
58     /** Optional EPIB word0 */
59     uint32_t          timeStamp;
60     /** Optional EPIB word1 */
61     uint32_t          softwareInfo0;
62     /** Optional EPIB word2 */
63     uint32_t          softwareInfo1;
64     /** Optional EPIB word3 */
65     uint32_t          softwareInfo2;
66     /** Optional protocol specific data */
67     uint32_t          psData;
68 } qmHostDesc_t;
71 /* Descriptor values */
72 /* Descriptor Info: Descriptor type is host with any protocol specific info in the descriptor */
73 #define QM_DESC_TYPE_HOST           0
74 #define QM_DESC_PSINFO_IN_DESCR     0
75 #define QM_DESC_DEFAULT_DESCINFO       (QM_DESC_TYPE_HOST << 30)    |  \
76                                        (QM_DESC_PSINFO_IN_DESCR << 22)
77 #define QM_DESC_INFO_GET_PSINFO_LOC(x)  BOOT_READ_BITFIELD((x), 22, 22)
78                                                                         
79 #define QM_DESC_DESCINFO_SET_PKT_LEN(x,v)  (x) = BOOT_SET_BITFIELD((x), (v), 21, 0)
80 #define QM_DESC_DESCINFO_GET_PKT_LEN(x)    BOOT_READ_BITFIELD((x), 21, 0)
81                                         
82                                         
83 /* Packet Info */
84 #define QM_DESC_PINFO_EPIB              1
85 #define QM_DESC_PINFO_RETURN_OWN        1
86 #define QM_DESC_DEFAULT_PINFO           (QM_DESC_PINFO_EPIB << 31)          |   \
87                                         (QM_DESC_PINFO_RETURN_OWN << 15) 
88 #define QM_PKT_INFO_GET_EPIB(x)         BOOT_READ_BITFIELD((x), 31, 31)
89 #define QM_PKT_INFO_SET_PSINFO_SIZE(x,v)    (x) = BOOT_SET_BITFIELD((x), (v), 29, 24)                                      
90                                         
91                                                                              
92                                         
93 #define QM_DESC_PINFO_SET_QM(x,v)       (x) = BOOT_SET_BITFIELD((x), (v), 13, 12)
94 #define QM_DESC_PINFO_SET_QUEUE(x,v)    (x) = BOOT_SET_BITFIELD((x), (v), 11,  0)
95                                         
96                                         
97 /*  prototypes */
98 qmHostDesc_t *hwQmQueuePop (uint32_t qnum);
99 void hwQmQueuePush (qmHostDesc_t *hd, uint32_t qnum, uint32_t descSize);
100 int16_t hwQmSetup (qmConfig_t *cfg);
101 uint32_t  hwQmQueueCount (uint32_t qnum);
102 void hwQmTeardown (void);
103 int16_t hwQmInitThreshold (uint32_t qnum);
108 #endif /* _QM_API_H */