WS63 SDK 文档 7021f4f@fbb_ws63
ws63 和 ws63e 解决方案的 SDK 文档
载入中...
搜索中...
未找到
los_rpqueue_pri.h
浏览该文件的文档.
1/* ----------------------------------------------------------------------------
2 * Copyright (c) Huawei Technologies Co., Ltd. 2022-2022. All rights reserved.
3 * Description: Remote Processor Queue Private HeadFile
4 * Author: Huawei LiteOS Team
5 * Create: 2022-11-11
6 * Redistribution and use in source and binary forms, with or without modification,
7 * are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice, this list of
9 * conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list
11 * of conditions and the following disclaimer in the documentation and/or other materials
12 * provided with the distribution.
13 * 3. Neither the name of the copyright holder nor the names of its contributors may be used
14 * to endorse or promote products derived from this software without specific prior written
15 * permission.
16 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
18 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
23 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
25 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
26 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 * --------------------------------------------------------------------------- */
28
29#ifndef LOS_RPQUEUE_PRI_H
30#define LOS_RPQUEUE_PRI_H
31
32#include "los_rpqueue.h"
33
34#ifdef __cplusplus
35extern "C" {
36#endif /* __cplusplus */
37
38#define RPQUEUE_LOCK() LOS_IntLock()
39#define RPQUEUE_UNLOCK(x) LOS_IntRestore(x)
40#define RPQUEUE_DELAY(x) LOS_TaskDelay(x)
41
42#define OS_RPQUEUE_EMPTY_BYTE 1 /* One byte can't be written */
43#define OS_RPQUEUE_SIZE_MAX 0xFFF7U
44
45#define OS_RPQUEUE_WRITE_IDLE 0xE1U
46#define OS_RPQUEUE_WRITE_BUSY 0xE2U
47
48#define OS_RPQUEUE_DATA_OK 0xE3U
49#define OS_RPQUEUE_HEADER_ERROR 0xE4U
50#define OS_RPQUEUE_CB_ERROR 0xE5U
51
52#define OS_RPQUEUE_READ_LOCK 0xE6U
53#define OS_RPQUEUE_READ_UNLOCK 0xE7U
54
55#define OS_RPQUEUE_INFO_MAGIC 0xC3C9CACEU
56
57#define OS_RPQUEUE_HEADER_CHECK_SIZE 6U
58
59#define RPQUEUE_TX_MAGIC_GET(obj) ((obj)->txMagic = OsRpqueueTxMagicGet(obj))
60#define RPQUEUE_RX_MAGIC_GET(obj) ((obj)->rxMagic = OsRpqueueRxMagicGet(obj))
61
62#define RPQUEUE_ADDR_ALIGN(addr) (((UINTPTR)(addr) + (LOS_RPQUEUE_ALIGN_SIZE - 1)) & (~(LOS_RPQUEUE_ALIGN_SIZE - 1)))
63
64typedef struct {
65 volatile UINT32 magic; /* Use to check the queue is initialized or not. */
66 volatile UINT16 rxMagic; /* Verification area: queueSize, readPos. */
67 volatile UINT16 txMagic; /* Verification area: queueSize, writeEnd, writePos, writeStatus, readLock. */
68 volatile UINT16 queueSize; /* The buffer size which is used to write sending data. */
69 volatile UINT16 writeEnd; /* Tail of actual data. */
70 volatile UINT16 readPos; /* The read position. */
71 volatile UINT16 writePos; /* The write position. */
72 volatile UINT8 writeStatus; /* When this parameter is set to busy,
73 other tasks are not allowed to send messages. */
74 volatile UINT8 readLock; /* When this parameter is set to lock,
75 the receiver is not allowed to receive messages. */
76 volatile UINT8 dataError; /* Receiver sets this parameter to error when xor error,
77 the transmitter will re-init the queue before sending. */
78 UINT8 reserved[5]; /* Reserved for 8 bytes alignment. */
79 UINT8 queue[0]; /* Queue buffer, the buffer length is 0 to facilitate
80 the calculation of offset. */
82
83typedef struct {
84 UINT8 cmd; /* Packet command. */
85 UINT8 option; /* Packet option. */
86 UINT16 sequence; /* Packet sequence, used for synchronous communication. */
87 UINT16 len; /* Packet payload length. */
88 UINT8 magic; /* The magic byte to check data. */
89 UINT8 reserved; /* Reserved for 8 bytes alignment. */
90 UINT8 payload[0]; /* Payload buffer, the buffer length is 0 to facilitate
91 the calculation of offset. */
93
94#ifdef __cplusplus
95}
96#endif /* __cplusplus */
97
98#endif /* LOS_RPQUEUE_PRI_H */
unsigned short UINT16
Definition los_typedef.h:51
unsigned char UINT8
Definition los_typedef.h:50
unsigned int UINT32
Definition los_typedef.h:52
osal_u16 reserved
Definition oal_net.h:4
Definition los_rpqueue_pri.h:64
volatile UINT8 readLock
Definition los_rpqueue_pri.h:74
volatile UINT16 writePos
Definition los_rpqueue_pri.h:71
volatile UINT8 dataError
Definition los_rpqueue_pri.h:76
volatile UINT16 readPos
Definition los_rpqueue_pri.h:70
volatile UINT16 writeEnd
Definition los_rpqueue_pri.h:69
volatile UINT16 txMagic
Definition los_rpqueue_pri.h:67
volatile UINT32 magic
Definition los_rpqueue_pri.h:65
volatile UINT16 rxMagic
Definition los_rpqueue_pri.h:66
volatile UINT8 writeStatus
Definition los_rpqueue_pri.h:72
volatile UINT16 queueSize
Definition los_rpqueue_pri.h:68
Definition los_rpqueue_pri.h:83
UINT8 magic
Definition los_rpqueue_pri.h:88
UINT8 option
Definition los_rpqueue_pri.h:85
UINT8 cmd
Definition los_rpqueue_pri.h:84
UINT8 reserved
Definition los_rpqueue_pri.h:89
UINT16 len
Definition los_rpqueue_pri.h:87
UINT16 sequence
Definition los_rpqueue_pri.h:86