1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="agl"
fetch="https://gerrit.automotivelinux.org/gerrit/"
review="https://gerrit.automotivelinux.org/gerrit/"
pushurl="ssh://gerrit.automotivelinux.org:29418"
/>
<remote name="yocto" fetch="https://git.yoctoproject.org/git/" />
<!-- meta-updater --> <!-- freescale bsp --> <!-- 01.org -->
<remote name="github" fetch="https://github.com/" />
<!-- meta-qt5 -->
<remote name="qt.io" fetch="git://code.qt.io/" />
<default remote="agl" sync-j="4" revision="refs/tags/guppy/7.0.4"/>
<!-- AGL things. -->
<project name="AGL/meta-agl" path="meta-agl" /*------------------------------------------------------------------------------------------------*/
/* UNICENS V2.1.0-3491 */
/* Copyright (c) 2017 Microchip Technology Germany II GmbH & Co. KG. */
/* */
/* This program is free software: you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation, either version 2 of the License, or */
/* (at your option) any later version. */
/* */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* */
/* You should have received a copy of the GNU General Public License */
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* */
/* You may also obtain this software under a propriety license from Microchip. */
/* Please contact Microchip for further information. */
/*------------------------------------------------------------------------------------------------*/
/*!
* \file
* \brief Implementation of class CPmCommand
*
* \cond UCS_INTERNAL_DOC
* \addtogroup G_PM_CMD
* @{
*/
/*------------------------------------------------------------------------------------------------*/
/* Includes */
/*------------------------------------------------------------------------------------------------*/
#include "ucs_pmcmd.h"
#include "ucs_misc.h"
/*------------------------------------------------------------------------------------------------*/
/* Implementation */
/*------------------------------------------------------------------------------------------------*/
/*! \brief Constructor of CPmCommand class
* \param self The instance
* \param fifo The dedicated FIFO
* \param type The port message type
*/
void Pmcmd_Ctor(CPmCommand *self, Pmp_FifoId_t fifo, Pmp_MsgType_t type)
{
MISC_MEM_SET(self, 0, sizeof(*self)); /* setup attributes */
self->memory.data_ptr = &self->data[0];
self->tx_obj.lld_msg.memory_ptr = &self->memory;
self->tx_obj.msg_ptr = NULL; /* label message as command by setting */
self->tx_obj.owner_ptr = NULL; /* msg_ptr and owner_ptr to NULL */
self->trigger = false;
Pmp_SetPmhl(self->data, 3U); /* PMHL is always "3" for control/status messages */
Pmp_SetFph(self->data, fifo, type);
}
/*! \brief Retrieves reference to the LLD Tx message object required to call Pmch_Transmit()
* \param self The instance
* \return Returns a reference to the LLD Tx message object
*/
Ucs_Lld_TxMsg_t* Pmcmd_GetLldTxObject(CPmCommand *self)
{
return (Ucs_Lld_TxMsg_t*)(void*)self;
}
/*! \brief Sets the content of a command/status message
* \param self The instance
* \param sid The sequence id
* \param ext_type The ExtType type
* \param ext_code The ExtType code
* \param add_data_ptr Additional payload data
* \param add_data_sz The size of additional payload data, valid values: 0..4
*/
void Pmcmd_SetContent(CPmCommand *self, uint8_t sid, uint8_t ext_type, uint8_t ext_code, uint8_t add_data_ptr[], uint8_t add_data_sz)
{
if ((add_data_ptr != NULL) && (add_data_sz != 0U))
{
MISC_MEM_CPY(&self->data[6U], add_data_ptr, (size_t)add_data_sz);
}
self->memory.data_size = 6U + (uint16_t)add_data_sz;
self->memory.total_size = 6U + (uint16_t)add_data_sz;
Pmp_SetPml(self->data, 4U + add_data_sz);
Pmp_SetSid(self->data, sid);
Pmp_SetExtType(self->data, ext_type, ext_code);
}
/*! \brief Updates the content of a command/status message
* \details The length and the content of the payload is not modified.
* It is important to call Pmcmd_SetContent() before.
* \param self The instance
* \param sid The sequence id
* \param ext_type The ExtType type
* \param ext_code The ExtType code
*/
void Pmcmd_UpdateContent(CPmCommand *self, uint8_t sid, uint8_t ext_type, uint8_t ext_code)
{
Pmp_SetSid(self->data, sid);
Pmp_SetExtType(self->data, ext_type, ext_code);
}
/*! \brief Reserves the command object if it is available
* \param self The instance
* \return \c true if the command object is available, \c false
* if the command object is (still) in usage
*/
bool Pmcmd_Reserve(CPmCommand *self)
{
bool succ = false;
if (self->reserved
|