3 /* State management variables. */
4 EXTERN re_t re_table
[RE_PORT_NR
];
6 /* Custom states definition. */
7 #define RL_STATE_READ_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 0)
8 #define RL_STATE_WRITE_PROTOCOL_FREE (SEF_LU_STATE_CUSTOM_BASE + 1)
9 #define RL_STATE_IS_CUSTOM(s) \
10 ((s) >= RL_STATE_READ_PROTOCOL_FREE && (s) <= RL_STATE_WRITE_PROTOCOL_FREE)
12 /* State management helpers. */
13 PRIVATE
int is_reading
;
14 PRIVATE
int is_writing
;
15 PRIVATE
void load_state_info(void)
17 int i
, found_processing
;
20 /* Check if we are reading or writing. */
23 found_processing
= FALSE
;
24 for (i
= 0; i
<RE_PORT_NR
&& !found_processing
; i
++) {
27 if (rep
->re_flags
& REF_READING
) {
31 if (rep
->re_flags
& REF_SEND_AVAIL
) {
35 found_processing
= (is_reading
&& is_writing
);
39 /*===========================================================================*
41 *===========================================================================*/
42 PUBLIC
void sef_cb_lu_prepare(int state
)
46 /* Load state information. */
49 /* Check if we are ready for the target state. */
52 /* Standard states. */
53 case SEF_LU_STATE_REQUEST_FREE
:
57 case SEF_LU_STATE_PROTOCOL_FREE
:
58 is_ready
= (!is_reading
&& !is_writing
);
62 case RL_STATE_READ_PROTOCOL_FREE
:
63 is_ready
= (!is_reading
);
66 case RL_STATE_WRITE_PROTOCOL_FREE
:
67 is_ready
= (!is_writing
);
71 /* Tell SEF if we are ready. */
77 /*===========================================================================*
78 * sef_cb_lu_state_isvalid *
79 *===========================================================================*/
80 PUBLIC
int sef_cb_lu_state_isvalid(int state
)
82 return SEF_LU_STATE_IS_STANDARD(state
) || RL_STATE_IS_CUSTOM(state
);
85 /*===========================================================================*
86 * sef_cb_lu_state_dump *
87 *===========================================================================*/
88 PUBLIC
void sef_cb_lu_state_dump(int state
)
90 /* Load state information. */
93 sef_lu_dprint("rtl8139: live update state = %d\n", state
);
94 sef_lu_dprint("rtl8139: is_reading = %d\n", is_reading
);
95 sef_lu_dprint("rtl8139: is_writing = %d\n", is_writing
);
97 sef_lu_dprint("rtl8139: SEF_LU_STATE_WORK_FREE(%d) reached = %d\n",
98 SEF_LU_STATE_WORK_FREE
, TRUE
);
99 sef_lu_dprint("rtl8139: SEF_LU_STATE_REQUEST_FREE(%d) reached = %d\n",
100 SEF_LU_STATE_REQUEST_FREE
, TRUE
);
101 sef_lu_dprint("rtl8139: SEF_LU_STATE_PROTOCOL_FREE(%d) reached = %d\n",
102 SEF_LU_STATE_PROTOCOL_FREE
, (!is_reading
&& !is_writing
));
103 sef_lu_dprint("rtl8139: RL_STATE_READ_PROTOCOL_FREE(%d) reached = %d\n",
104 RL_STATE_READ_PROTOCOL_FREE
, (!is_reading
));
105 sef_lu_dprint("rtl8139: RL_STATE_WRITE_PROTOCOL_FREE(%d) reached = %d\n",
106 RL_STATE_WRITE_PROTOCOL_FREE
, (!is_writing
));