QP/C  7.0.0
Real-Time Embedded Framework
qs_64bit.c
Go to the documentation of this file.
1/*============================================================================
2* QP/C Real-Time Embedded Framework (RTEF)
3* Copyright (C) 2005 Quantum Leaps, LLC. All rights reserved.
4*
5* SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-QL-commercial
6*
7* This software is dual-licensed under the terms of the open source GNU
8* General Public License version 3 (or any later version), or alternatively,
9* under the terms of one of the closed source Quantum Leaps commercial
10* licenses.
11*
12* The terms of the open source GNU General Public License version 3
13* can be found at: <www.gnu.org/licenses/gpl-3.0>
14*
15* The terms of the closed source Quantum Leaps commercial licenses
16* can be found at: <www.state-machine.com/licensing>
17*
18* Redistributions in source code must retain this top-level comment block.
19* Plagiarizing this software to sidestep the license obligations is illegal.
20*
21* Contact information:
22* <www.state-machine.com>
23* <info@state-machine.com>
24============================================================================*/
32#define QP_IMPL /* this is QP implementation */
33#include "qs_port.h" /* QS port */
34
35#include "qs_pkg.h"
36
37/*==========================================================================*/
43void QS_u64_raw_(uint64_t d) {
44 uint8_t chksum = QS_priv_.chksum;
45 uint8_t * const buf = QS_priv_.buf;
46 QSCtr head = QS_priv_.head;
47 QSCtr const end = QS_priv_.end;
48
49 QS_priv_.used += 8U; /* 8 bytes are about to be added */
50 uint_fast8_t i;
51 for (i = 8U; i != 0U; --i) {
52 uint8_t const b = (uint8_t)d;
54 d >>= 8U;
55 }
56
57 QS_priv_.head = head; /* save the head */
58 QS_priv_.chksum = chksum; /* save the checksum */
59}
60
61/*==========================================================================*/
67void QS_u64_fmt_(uint8_t format, uint64_t d) {
68 uint8_t chksum = QS_priv_.chksum;
69 uint8_t * const buf = QS_priv_.buf;
70 QSCtr head = QS_priv_.head;
71 QSCtr const end = QS_priv_.end;
72
73 QS_priv_.used += 9U; /* 9 bytes are about to be added */
74 QS_INSERT_ESC_BYTE_(format) /* insert the format byte */
75
76 /* output 8 bytes of data... */
77 uint_fast8_t i;
78 for (i = 8U; i != 0U; --i) {
79 format = (uint8_t)d;
81 d >>= 8U;
82 }
83
84 QS_priv_.head = head; /* save the head */
85 QS_priv_.chksum = chksum; /* save the checksum */
86}
QSPrivAttr QS_priv_
Definition: qs.c:41
uint8_t volatile chksum
Definition: qs.h:920
uint8_t * buf
Definition: qs.h:914
QSCtr volatile used
Definition: qs.h:918
uint_fast16_t QSCtr
Definition: qs.h:892
QSCtr end
Definition: qs.h:915
QSCtr volatile head
Definition: qs.h:916
Internal (package scope) QS/C interface.
#define QS_INSERT_ESC_BYTE_(b_)
Definition: qs_pkg.h:281
void QS_u64_fmt_(uint8_t format, uint64_t d)
Definition: qs_64bit.c:67
void QS_u64_raw_(uint64_t d)
Definition: qs_64bit.c:43