2 * Copyright (C) 2013 Freescale Semiconductor, Inc.
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
11 * The above copyright notice and this permission notice shall be included
12 * in all copies or substantial portions of the Software.
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
26 // globally initialized
27 bool MSEState::start_optimized_message_
= false;
29 // initialize the state transition table
30 void MSEState::initialize_transitions(MSEState
*new_state_00
,
31 MSEState
*new_state_01
, MSEState
*new_state_10
, MSEState
*new_state_11
)
33 next_state_
[0] = new_state_00
;
34 next_state_
[1] = new_state_01
;
35 next_state_
[2] = new_state_10
;
36 next_state_
[3] = new_state_11
;
39 // update to the next state
40 MSEState
*MSEState::nextState(uint32_t index
)
42 assert(index
< MAX_STATE_TRANSITIONS
);
45 return next_state_
[index
];
48 // update to the next state
49 MSEState
* MSEIdle::nextState(uint32_t mse
)
51 if (mse
== 0x1 || mse
== 0x2) {
52 MSEState::start_optimized_message_
= true;
55 return MSEState::nextState(mse
);
57 // perform the action on the MDO for this state
58 bool MSEIdle::act(uint32_t mdo
, NxPacketSet
&pkt_set
)
60 if (MSEState::start_optimized_message_
) {
62 MSEState::start_optimized_message_
= false;
67 bool MSEStartMessage::act(uint32_t mdo
, NxPacketSet
&pkt_set
)
70 bool ret
= pkt_set
.addToCurrent(mdo
);
74 bool MSENormalTransfer::act(uint32_t mdo
, NxPacketSet
&pkt_set
)
76 bool ret
= pkt_set
.addToCurrent(mdo
);
80 bool MSEEndPacket::act(uint32_t mdo
, NxPacketSet
&pkt_set
)
82 if (MSEState::start_optimized_message_
) {
84 MSEState::start_optimized_message_
= false;
86 bool ret
= pkt_set
.addToCurrent(mdo
);
88 ret
= pkt_set
.nextPacket();
92 bool MSEEndMessage::act(uint32_t mdo
, NxPacketSet
&pkt_set
)
94 if (MSEState::start_optimized_message_
) {
96 MSEState::start_optimized_message_
= false;
98 bool ret
= pkt_set
.addToCurrent(mdo
);
102 // update to the next state
103 MSEState
*MSEEndMessage::nextState(uint32_t mse
)
105 if (mse
== 0x1 || mse
== 0x2) {
106 MSEState::start_optimized_message_
= true;
108 // set the next state
109 return MSEState::nextState(mse
);
This page took 0.032429 seconds and 4 git commands to generate.