S32 SDK
lin_common_api.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015-2016, Freescale Semiconductor, Inc.
3  * Copyright 2016-2017 NXP
4  * All rights reserved.
5  *
6  * THIS SOFTWARE IS PROVIDED BY NXP "AS IS" AND ANY EXPRESSED OR
7  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
8  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
9  * IN NO EVENT SHALL NXP OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
10  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
11  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
12  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
13  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
14  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
15  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
16  * THE POSSIBILITY OF SUCH DAMAGE.
17  */
34 #include "lin_common_api.h"
35 #include "lin_common_proto.h"
36 #include "lin_lin21_proto.h"
37 #include "lin_j2602_proto.h"
38 
39 /*******************************************************************************
40  * Code
41  ******************************************************************************/
42 
43 /*******************************************************************************
44  * Static function prototypes
45  ******************************************************************************/
46 #if (SUPPORT_MASTER_MODE == 1U)
47 static void lin_master_update_signal(l_ifc_handle iii);
48 
49 static void lin_master_update_frame_before_transmit(l_ifc_handle iii, l_u8 cur_id, l_u8 frame_index);
50 #endif /* End (SUPPORT_MASTER_MODE == 1U) */
51 
52 /*FUNCTION**********************************************************************
53  *
54  * Function Name : l_sys_init
55  * Description : This function performs the initialization of the LIN core.
56  * The implementation of this function can be replaced by user if needed.
57  *
58  * Implements : l_sys_init_Activity
59  *END**************************************************************************/
61 {
62  return (l_bool)0;
63 }
64 
65 #if (SUPPORT_MASTER_MODE == 1U)
66 /*FUNCTION**********************************************************************
67  *
68  * Function Name : l_sch_set
69  * Description : This function sets up the next schedule to be followed by the
70  * l_sch_tick function for a certain interface iii. The new schedule will be activated as soon as the current schedule reaches
71  * its next schedule entry point. The entry defines the starting entry point in the new schedule table. The value should
72  * be in the range 0 to N if the schedule table has N entries
73  *
74  * Implements : l_sch_set_Activity
75  *END**************************************************************************/
76 void l_sch_set(l_ifc_handle iii,
77  l_schedule_handle schedule_iii,
78  l_u8 entry)
79 {
80  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
81  DEV_ASSERT((l_u8)schedule_iii < LIN_NUM_OF_SCHD_TBL);
82  const lin_protocol_user_config_t * prot_user_config_ptr = &g_lin_protocol_user_cfg_array[iii];
83 
84  /* Check if the interface is LIN Master */
85  if (prot_user_config_ptr->function == (bool)LIN_MASTER)
86  {
87  /* Check if input entry is in range from 0 to N = (Number of frame slots) */
88  if (entry <= prot_user_config_ptr->schedule_tbl[schedule_iii].num_slots)
89  {
90  l_u8 tmp_entry = entry;
92  /* save the new schedule which is activated after the */
93  /* current schedule reaches its next schedule entry point */
94  master_data_ptr->previous_schedule_id = master_data_ptr->active_schedule_id;
95  /* Insert new schedule at that point of the current schedule */
96  master_data_ptr->active_schedule_id = (l_u8)schedule_iii;
97 
98  /* if entry is 0 or 1 the new schedule table will be started from the beginning. */
99  if (tmp_entry == 0U)
100  {
101  /* Set entry equal to 1 */
102  tmp_entry = 1U;
103  }
104 
105  /* Assign the start entry of new schedule table by argument entry */
106  master_data_ptr->schedule_start_entry_ptr[schedule_iii] = (l_u8)(tmp_entry - 1U);
107  }
108  }
109 }
110 
111 /*FUNCTION**********************************************************************
112  *
113  * Function Name : lin_master_update_signal
114  * Description : This function handles update signal for master node.
115  * This function is implemented for Master.
116  *
117  * Implements : lin_master_update_signal_Activity
118  *END**************************************************************************/
119 static void lin_master_update_signal(l_ifc_handle iii)
120 {
121  l_u8 i;
122  l_u8 size;
123  l_u16 offset;
124  lin_master_data_t * master_data_ptr;
126 
127  if (master_data_ptr->frm_offset != 0xFFFFU)
128  {
129  /* Copy data from master_data_buffer to g_lin_frame_data_buffer */
130  /* Do this to satisfy Requirement: The master node updates its
131  * received signals periodically at the time base start */
132  size = master_data_ptr->frm_size;
133  offset = master_data_ptr->frm_offset;
134 
135  /* Check if size and offset are valid */
136  if ((size <= 8U) && ((size + offset) <= LIN_FRAME_BUF_SIZE))
137  {
138  /* Copy data from master_data_buffer to g_lin_frame_data_buffer */
139  for (i = 0U; i < size; i++)
140  {
141  g_lin_frame_data_buffer[offset + i] = master_data_ptr->master_data_buffer[i];
142  }
143  }
144 
145  master_data_ptr->frm_offset = 0xFFFFU;
146  }
147 
148  if (master_data_ptr->flag_offset != 0xFFU)
149  {
150  /* Do this to satisfy Requirement: The master node updates its
151  * received signals periodically at the time base start */
152  size = master_data_ptr->flag_size;
153  offset = master_data_ptr->flag_offset;
154 
155  /* Check if size and offset are valid */
156  if ((size <= LIN_FLAG_BUF_SIZE) && ((size + offset) <= LIN_FLAG_BUF_SIZE))
157  {
158  /* Update flag */
159  for (i = 0U; i < size; i++)
160  {
161  g_lin_flag_handle_tbl[offset + i] = 0xFF;
162  }
163 
164  master_data_ptr->flag_offset = 0xFF;
165  }
166  }
167 }
168 
169 /*FUNCTION**********************************************************************
170  *
171  * Function Name : lin_master_update_frame_before_transmit
172  * Description : This function update signal in transmitted frame of master.
173  * This function is implemented for Master.
174  *
175  * Implements : lin_master_update_frame_before_transmit_Activity
176  *END**************************************************************************/
177 static void lin_master_update_frame_before_transmit(l_ifc_handle iii, l_u8 cur_id, l_u8 frame_index)
178 {
179  l_u8 i;
180  l_u8 size;
181  l_u16 offset;
182  l_u8 active_schedule_id;
183  const l_u8 * current_entry;
184  const lin_protocol_state_t * prot_state_ptr;
185  const lin_schedule_data_t * sch_data_ptr;
186  const lin_protocol_user_config_t * prot_user_config_ptr;
187  const lin_schedule_t * active_schedule_struct_ptr;
189 
190  if (0x3CU == cur_id)
191  {
192  active_schedule_id = master_data_ptr->active_schedule_id;
193  active_schedule_struct_ptr = (const lin_schedule_t *)&(g_lin_protocol_user_cfg_array[iii].schedule_tbl[active_schedule_id]);
194  if (LIN_SCH_TBL_DIAG != active_schedule_struct_ptr->sch_tbl_type)
195  {
196  current_entry = (l_u8 *)&master_data_ptr->schedule_start_entry_ptr[active_schedule_id];
197  prot_state_ptr = &g_lin_protocol_state_array[iii];
198  sch_data_ptr = &active_schedule_struct_ptr->ptr_sch_data_ptr[*current_entry];
199  /* Update transmitted data in case diagnostic frame is not added in diagnostic schedule table */
200  for (i = 0U; i < 8U; i++)
201  {
202  prot_state_ptr->response_buffer_ptr[i] = sch_data_ptr->tl_queue_data[i];
203  }
204  }
205  }
206  else
207  {
208  prot_user_config_ptr = &g_lin_protocol_user_cfg_array[iii];
209  /* Update buffer data if master is publisher and not transmit diagnostic request */
210  if (prot_user_config_ptr->frame_tbl_ptr[frame_index].frm_response == LIN_RES_PUB)
211  {
212  size = prot_user_config_ptr->frame_tbl_ptr[frame_index].frm_len;
213  offset = prot_user_config_ptr->frame_tbl_ptr[frame_index].frm_offset;
214  /* Update data */
215  for (i = 0U; i < size; i++)
216  {
217  master_data_ptr->master_data_buffer[i] = g_lin_frame_data_buffer[offset];
218  offset++;
219  }
220  }
221  }
222 }
223 
224 /*FUNCTION**********************************************************************
225  *
226  * Function Name : l_sch_tick
227  * Description : This function follows a schedule. When a frame becomes due, its
228  * transmission is initiated. When the end of the current schedule is reached,
229  * this function starts again at the beginning of the schedule.
230  * This API is for Master interface only.
231  *
232  * Implements : l_sch_tick_Activity
233  *END**************************************************************************/
234 l_u8 l_sch_tick(l_ifc_handle iii)
235 {
236  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
237  const lin_schedule_t * active_schedule_struct_ptr;
238  l_u8 * current_entry;
239  l_u8 frame_index;
240  l_u8 cur_id;
241  l_u8 active_schedule_id;
242  l_u8 retVal = 0U;
243 
244  const lin_tl_descriptor_t * tl_desc_ptr = &g_lin_tl_descriptor_array[iii];
245  const lin_protocol_user_config_t * prot_user_config_ptr = &g_lin_protocol_user_cfg_array[iii];
246  lin_protocol_state_t * prot_state_ptr = &g_lin_protocol_state_array[iii];
247 
248  lin_master_data_t * master_data_ptr;
249 
250  /* Check if the interface is LIN Master */
251  if (prot_user_config_ptr->function == (bool)LIN_MASTER)
252  {
254 
256 
257  /* Get active_schedule_id */
258  active_schedule_id = master_data_ptr->active_schedule_id;
259  cur_id = prot_state_ptr->current_id;
260 
261  /* process diagnostic interleaved mode */
262  if ((tl_desc_ptr->diag_interleave_state == DIAG_NO_RESPONSE) && (prot_state_ptr->diagnostic_mode == DIAG_INTERLEAVE_MODE) &&
263  (cur_id == 0x3DU))
264  {
265  /* go back normal schedule table */
266  active_schedule_id = master_data_ptr->previous_schedule_id;
267  master_data_ptr->active_schedule_id = active_schedule_id;
268  master_data_ptr->schedule_start_entry_ptr[active_schedule_id] = 0U;
269  }
270 
271  active_schedule_struct_ptr = (const lin_schedule_t *)&prot_user_config_ptr->schedule_tbl[active_schedule_id];
272  current_entry = (l_u8 *)&master_data_ptr->schedule_start_entry_ptr[active_schedule_id];
273 
274  if (LIN_SCH_TBL_NULL != active_schedule_struct_ptr->sch_tbl_type)
275  {
276  /* Check if next_transmit is 0 */
277  if (0U == prot_state_ptr->next_transmit_tick)
278  {
279  /* Check protocol */
280  if (prot_user_config_ptr->protocol_version == LIN_PROTOCOL_21)
281  {
282  if (master_data_ptr->event_trigger_collision_flg == true)
283  {
284  /* Call collision resolver */
285  lin_collision_resolve(iii, cur_id);
286  /* Update active schedule table */
287  active_schedule_id = master_data_ptr->active_schedule_id;
288  active_schedule_struct_ptr = (const lin_schedule_t *)&prot_user_config_ptr->schedule_tbl[active_schedule_id];
289  /* Re-calculate current entry due to change table to collision */
290  current_entry = (l_u8 *)&master_data_ptr->schedule_start_entry_ptr[active_schedule_id];
291  master_data_ptr->event_trigger_collision_flg = false;
292  }
293  }
294 
295  /* Set new transmit tick */
296  prot_state_ptr->next_transmit_tick = active_schedule_struct_ptr->ptr_sch_data_ptr[*current_entry].delay_integer;
297  /* Get frame index to send */
298  frame_index = (l_u8)active_schedule_struct_ptr->ptr_sch_data_ptr[*current_entry].frm_id;
299 
300  if ((frame_index - prot_user_config_ptr->frame_start) < prot_user_config_ptr->number_of_configurable_frames)
301  {
302  cur_id = prot_user_config_ptr->list_identifiers_RAM_ptr[(frame_index - prot_user_config_ptr->frame_start) + 1U];
303  }
304 
305  if (LIN_FRM_SPRDC == prot_user_config_ptr->frame_tbl_ptr[frame_index].frm_type)
306  {
307  /* Sporadic frame */
308  cur_id = lin_check_sporadic_update(iii, frame_index);
309  frame_index = lin_get_frame_index(iii, cur_id);
310  }
311 
312  if (0xFFU != cur_id)
313  {
314  /* The latest point master can update value of signal in transmitted frame */
315  lin_master_update_frame_before_transmit(iii, cur_id, frame_index);
316 
317  /* Start transmit header */
318  (void)lin_lld_tx_header(iii, cur_id);
319  }
320  /* increase start entry */
321  *current_entry = (l_u8)(*current_entry + 1U);
322  /* Check if it is the last entry */
323  if (*current_entry >= active_schedule_struct_ptr->num_slots)
324  {
325  /* switch schedule table */
327  }
328  }
329 
330  /* Decrease next_transmit_tick */
331  prot_state_ptr->next_transmit_tick -= 1U;
332 
333  /* if the next call of l_sch_tick will start the transmission of the frame in the next schedule table entry */
334  /* The return value will in this case be the next schedule table entry's number */
335  /* counted from the beginning of the schedule table) in the schedule table */
336  /* The return value will be in range 1 to N if the schedule table has N entries */
337  if (0U == prot_state_ptr->next_transmit_tick)
338  {
339  /* The return value will be in range 1 to N if the schedule table has N entries */
340  if (*current_entry >= active_schedule_struct_ptr->num_slots)
341  {
342  /* If next entry is the first frame in the next schedule table */
343  /* Then return 1*/
344  retVal = 1U;
345  }
346  else
347  {
348  /* The return value will be in range 1 to N if the schedule table has N entries */
349  retVal = (l_u8)(*current_entry + 1U);
350  }
351  }
352  } /* End (LIN_SCH_TBL_NULL != active_schedule_struct_ptr->sch_tbl_type) */
353 
354  /* In the master node the status word is updated in the l_sch_tick function*/
355  switch (prot_user_config_ptr->protocol_version)
356  {
357  case LIN_PROTOCOL_21:
359  break;
360  case LIN_PROTOCOL_J2602:
362  break;
363  default:
364  /*do nothing*/
365  break;
366  }
367 
368  prot_state_ptr->current_id = cur_id;
369  } /* END (prot_user_config_ptr->function == LIN_MASTER) */
370 
371  return retVal;
372 }
373 
374 /*FUNCTION**********************************************************************
375  *
376  * Function Name : l_ifc_goto_sleep
377  * Description : Request slave nodes on the cluster connected to the interface to enter
378  * bus sleep mode by issuing one go to sleep command.
379  *
380  * Implements : l_ifc_goto_sleep_Activity
381  *END**************************************************************************/
382 void l_ifc_goto_sleep(l_ifc_handle iii)
383 {
384  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
385 
386  const lin_protocol_user_config_t * prot_user_config_ptr = &g_lin_protocol_user_cfg_array[iii];
388 
389  if (prot_user_config_ptr->function == (bool)LIN_MASTER)
390  {
391  /* Set active schedule as GOTO_SLEEP_SCHEDULE */
392  /* current schedule reaches its next schedule entry point */
393  master_data_ptr->previous_schedule_id = master_data_ptr->active_schedule_id;
394  /* Insert new schedule at that point of the current schedule */
395  master_data_ptr->active_schedule_id = (l_u8)(prot_user_config_ptr->schedule_start + 1U);
396  /* Assign the start entry of new schedule table by argument entry */
397  master_data_ptr->schedule_start_entry_ptr[prot_user_config_ptr->schedule_start + 1U] = 0;
398  }
399 }
400 
401 #endif /* End (SUPPORT_MASTER_MODE == 1U) */
402 
403 /*FUNCTION**********************************************************************
404  *
405  * Function Name : l_ifc_init
406  * Description : Initialize the interface specified by name, i.e. sets up internal
407  * functions such as the baud rate
408  *
409  * Implements : l_ifc_init_Activity
410  *END**************************************************************************/
411 l_bool l_ifc_init(l_ifc_handle iii)
412 {
413  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
414  lin_protocol_state_t * prot_state_ptr = &g_lin_protocol_state_array[iii];
415 #if (SUPPORT_MASTER_MODE == 1U)
416  const lin_protocol_user_config_t * prot_user_config_ptr = &g_lin_protocol_user_cfg_array[iii];
417  static l_u8 lin_schedule_start_entry[LIN_NUM_OF_SCHD_TBL];
418  lin_master_data_t * master_data_ptr;
419 #endif /* End (SUPPORT_MASTER_MODE == 1U) */
420  l_bool ret_val;
421  prot_state_ptr->diagnostic_mode = DIAG_NONE;
422 
423  /* Call Low level initialization function */
424  ret_val = lin_lld_init(iii);
425  /* Check if low level initialization is successful */
426  if (ret_val == (l_bool)LIN_LLD_OK)
427  {
428  #if (SUPPORT_MASTER_MODE == 1U)
429  if (prot_user_config_ptr->function == (bool)LIN_MASTER)
430  {
431  master_data_ptr = &g_lin_master_data_array[prot_user_config_ptr->master_ifc_handle];
432  /* Init flag offset and frame offset for Master Frame Data Buffer */
433  master_data_ptr->flag_offset = 0xFFU;
434  master_data_ptr->frm_offset = 0xFFFFU;
435  master_data_ptr->flag_size = 0x00U;
436  master_data_ptr->frm_size = 0x00U;
437  master_data_ptr->schedule_start_entry_ptr = &lin_schedule_start_entry[0U];
438  master_data_ptr->send_slave_res_flg = (bool)1;
439  master_data_ptr->send_functional_request_flg = (bool)0;
440  /* For LIN Master, set NULL schedule table after initialization*/
441  /* current schedule reaches its next schedule entry point */
442  master_data_ptr->previous_schedule_id = master_data_ptr->active_schedule_id;
443  /* Insert new schedule at that point of the current schedule */
444  master_data_ptr->active_schedule_id = prot_user_config_ptr->schedule_start;
445  /* Assign the start entry of new schedule table by argument entry */
446  master_data_ptr->schedule_start_entry_ptr[prot_user_config_ptr->schedule_start] = 0;
447  }
448  #endif /* End (SUPPORT_MASTER_MODE == 1U) */
449  }
450 
451  return ret_val;
452 }
453 
454 /*FUNCTION**********************************************************************
455  *
456  * Function Name : l_ifc_wake_up
457  * Description : Transmit the wake up signal.
458  *
459  * Implements : l_ifc_wake_up_Activity
460  *END**************************************************************************/
461 void l_ifc_wake_up(l_ifc_handle iii)
462 {
463  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
464  /* Send wakeup signal */
465  (void)lin_lld_tx_wake_up(iii);
466 }
467 
468 /*FUNCTION**********************************************************************
469  *
470  * Function Name : l_ifc_read_status
471  * Description : This function will return the status of the previous communication.
472  *
473  * Implements : l_ifc_read_status_Activity
474  *END**************************************************************************/
475 l_u16 l_ifc_read_status(l_ifc_handle iii)
476 {
477  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
478 
479  l_u16 tmp_word_status = 0U;
480  lin_protocol_state_t * prot_state_ptr = &g_lin_protocol_state_array[iii];
481  tmp_word_status = (l_u16)(prot_state_ptr->word_status.last_pid << 8);
482  if (prot_state_ptr->word_status.save_config_flg == 1U)
483  {
484  tmp_word_status |= SAVE_CONFIG_SET;
485  }
486 
487  if (prot_state_ptr->word_status.event_trigger_collision_flg == 1U)
488  {
489  tmp_word_status |= EVENT_TRIGGER_COLLISION_SET;
490  }
491 
492  if (prot_state_ptr->word_status.bus_activity == 1U)
493  {
494  tmp_word_status |= BUS_ACTIVITY_SET;
495  }
496 
497  if (prot_state_ptr->word_status.go_to_sleep_flg == 1U)
498  {
499  tmp_word_status |= GO_TO_SLEEP_SET;
500  }
501 
502  if (prot_state_ptr->word_status.overrun == 1U)
503  {
504  tmp_word_status |= OVERRUN;
505  }
506 
507  if (prot_state_ptr->word_status.successful_transfer == 1U)
508  {
509  tmp_word_status |= SUCCESSFULL_TRANSFER;
510  }
511 
512  if (prot_state_ptr->word_status.error_in_res == 1U)
513  {
514  tmp_word_status |= ERROR_IN_RESPONSE;
515  }
516 
517  /* Read-reset call; meaning that after the call has returned,
518  * the status word is set to 0 */
519  /* Clear word status */
520  prot_state_ptr->word_status.last_pid = 0x00U;
521  prot_state_ptr->word_status.reserved = 0U;
522  prot_state_ptr->word_status.save_config_flg = 0U;
523  prot_state_ptr->word_status.event_trigger_collision_flg = 0U;
524  prot_state_ptr->word_status.bus_activity = 0U;
525  prot_state_ptr->word_status.go_to_sleep_flg = 0U;
526  prot_state_ptr->word_status.overrun = 0U;
527  prot_state_ptr->word_status.successful_transfer = 0U;
528  prot_state_ptr->word_status.error_in_res = 0U;
529  /* Clear save configuration flag value */
530  prot_state_ptr->save_config_flg = (bool)0U;
531  /* reset word status flags in g_lin_protocol_state_array for new session*/
532  prot_state_ptr->go_to_sleep_flg = false;
533  prot_state_ptr->overrun_flg = 0U;
534  prot_state_ptr->successful_transfer = 0U;
535 
536  /* Reset number of processed frames to 0 */
537  prot_state_ptr->num_of_processed_frame = 0U;
538 
539  return tmp_word_status;
540 }
541 
542 /*FUNCTION**********************************************************************
543  *
544  * Function Name : l_sys_irq_disable
545  * Description : Disable LIN related IRQ.
546  *
547  * Implements : l_sys_irq_disable_Activity
548  *END**************************************************************************/
549 l_u16 l_sys_irq_disable(l_ifc_handle iii)
550 {
551  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
552 
553  return lin_lld_int_disable(iii);
554 }
555 
556 /*FUNCTION**********************************************************************
557  *
558  * Function Name : l_sys_irq_restore
559  * Description : Enable LIN related IRQ.
560  *
561  * Implements : l_sys_irq_restore_Activity
562  *END**************************************************************************/
563 void l_sys_irq_restore(l_ifc_handle iii)
564 {
565  DEV_ASSERT((l_u8)iii < LIN_NUM_OF_IFCS);
566 
567  (void)lin_lld_int_enable(iii);
568 }
569 
570 #if (SUPPORT_TRANSPORT_LAYER != 1U)
571 /* This function is use when user not use transport layer */
573  lin_tl_event_id_t tl_event_id,
574  l_u8 id)
575 {
576  UNUSED(iii);
577  UNUSED(tl_event_id);
578  UNUSED(id);
579 
580  return TL_ACTION_NONE;
581 }
582 
583 #endif /* if (SUPPORT_TRANSPORT_LAYER != 1U) */
584 
585 /*******************************************************************************
586  * EOF
587  ******************************************************************************/
static void lin_master_update_frame_before_transmit(l_ifc_handle iii, l_u8 cur_id, l_u8 frame_index)
l_u8 overrun_flg
Definition: lin.h:572
l_u16 frm_offset
Definition: lin.h:256
l_u8 * list_identifiers_RAM_ptr
Definition: lin.h:522
lin_sch_tbl_type_t sch_tbl_type
Definition: lin.h:302
lin_tl_event_id_t
Transport layer event IDs Implements : lin_tl_event_id_t_Class.
Definition: lin.h:348
l_ifc_master_handle master_ifc_handle
Definition: lin.h:528
#define EVENT_TRIGGER_COLLISION_SET
unsigned int go_to_sleep_flg
Definition: lin.h:155
#define SAVE_CONFIG_SET
lin_word_status_str_t word_status
Definition: lin.h:573
lin_tl_callback_return_t
Transport layer event IDs Implements : lin_tl_callback_return_t_Class.
Definition: lin.h:364
l_u8 frm_size
Definition: lin.h:549
l_bool save_config_flg
Definition: lin.h:575
l_frame_handle frm_id
Definition: lin.h:290
#define GO_TO_SLEEP_SET
l_u8 l_sch_tick(l_ifc_handle iii)
This function follows a schedule. When a frame becomes due, its transmission is initiated. When the end of the current schedule is reached, this function starts again at the beginning of the schedule.
lin_protocol_state_t g_lin_protocol_state_array[LIN_NUM_OF_IFCS]
Definition: lin.c:50
void l_sch_set(l_ifc_handle iii, l_schedule_handle schedule_iii, l_u8 entry)
Set up the next schedule to be followed by the l_sch_tick function for a certain interface. The new schedule will be activated as soon as the current schedule reaches its next schedule entry point.
LIN schedule structure Implements : lin_schedule_data_t_Class.
Definition: lin.h:288
void lin_collision_resolve(l_ifc_handle iii, l_u8 pid)
Switch to collision resolve table.
#define ERROR_IN_RESPONSE
l_u8 next_transmit_tick
Definition: lin.h:574
lin_master_data_t g_lin_master_data_array[LIN_NUM_OF_MASTER_IFCS]
Definition: lin.c:52
Definition: lin.h:315
void lin_update_word_status_lin21(l_ifc_handle iii, lin_lld_event_id_t event_id)
Update node status flags.
l_u8 lin_lld_tx_header(l_ifc_handle iii, l_u8 id)
This function sends frame header for the input PID.
Definition: lin.c:203
l_diagnostic_mode_t diagnostic_mode
Definition: lin.h:576
l_bool go_to_sleep_flg
Definition: lin.h:568
l_bool send_slave_res_flg
Definition: lin.h:552
l_u8 flag_offset
Definition: lin.h:550
LIN master configuration structure Implements : lin_master_data_t_Class.
Definition: lin.h:541
l_u8 previous_schedule_id
Definition: lin.h:544
Schedule table description Implements : lin_schedule_t_Class.
Definition: lin.h:299
const lin_frame_t * frame_tbl_ptr
Definition: lin.h:519
l_u8 g_lin_frame_data_buffer[LIN_FRAME_BUF_SIZE]
lin_tl_queue_t tl_queue_data
Definition: lin.h:292
#define DEV_ASSERT(x)
Definition: devassert.h:78
lin_tl_descriptor_t g_lin_tl_descriptor_array[LIN_NUM_OF_IFCS]
Definition: lin.c:49
#define SUCCESSFULL_TRANSFER
void lin_switch_sch_table(l_ifc_handle iii)
l_u8 lin_lld_int_disable(l_ifc_handle iii)
Disable the interrupt related to the interface.
Definition: lin.c:287
l_bool lin_lld_init(l_ifc_handle iii)
This function initializes a LIN hardware instance for operation. This function will initialize the ru...
Definition: lin.c:91
unsigned int reserved
Definition: lin.h:159
Configuration structure Implements : lin_protocol_user_config_t_Class.
Definition: lin.h:510
void l_ifc_wake_up(l_ifc_handle iii)
Transmit the wake up signal.
l_bool event_trigger_collision_flg
Definition: lin.h:546
unsigned int error_in_res
Definition: lin.h:152
diag_interleaved_state_t diag_interleave_state
Definition: lin.h:489
l_u8 g_lin_flag_handle_tbl[LIN_FLAG_BUF_SIZE]
void l_sys_irq_restore(l_ifc_handle iii)
Enable LIN related IRQ.
lin_frame_type_t frm_type
Definition: lin.h:253
l_bool l_ifc_init(l_ifc_handle iii)
Initialize the controller specified by name, i.e. sets up internal functions such as the baud rate...
l_u8 * response_buffer_ptr
Definition: lin.h:564
l_bool l_sys_init(void)
This function performs the initialization of the LIN core; is the first call a user must use in the L...
void lin_update_word_status_j2602(l_ifc_handle iii)
Update date word status.
#define LIN_MASTER
Definition: lin.h:168
l_u8 lin_lld_tx_wake_up(l_ifc_handle iii)
This function send a wakeup signal.
Definition: lin.c:236
l_u8 lin_check_sporadic_update(l_ifc_handle iii, l_u8 frm_id)
LIN protocol status structure Implements : lin_protocol_state_t_Class.
Definition: lin.h:560
l_u8 num_of_processed_frame
Definition: lin.h:571
const lin_protocol_user_config_t g_lin_protocol_user_cfg_array[LIN_NUM_OF_IFCS]
static void lin_master_update_signal(l_ifc_handle iii)
unsigned int last_pid
Definition: lin.h:160
l_u8 delay_integer
Definition: lin.h:291
l_u8 lin_get_frame_index(l_ifc_handle iii, l_u8 id)
unsigned char l_u8
Unsigned 8 bit integer Implements : l_u8_Class.
Definition: lin_types.h:30
lin_tl_callback_return_t lin_tl_callback_handler(l_ifc_handle iii, lin_tl_event_id_t tl_event_id, l_u8 id)
const lin_schedule_t * schedule_tbl
Definition: lin.h:526
#define BUS_ACTIVITY_SET
l_u8 num_slots
Definition: lin.h:301
void l_ifc_goto_sleep(l_ifc_handle iii)
Request slave nodes on the cluster connected to the interface to enter bus sleep mode by issuing one ...
const lin_schedule_data_t * ptr_sch_data_ptr
Definition: lin.h:303
l_bool send_functional_request_flg
Definition: lin.h:553
l_u8 lin_lld_int_enable(l_ifc_handle iii)
Enable the interrupt related to the interface.
Definition: lin.c:264
l_u8 active_schedule_id
Definition: lin.h:543
#define OVERRUN
l_u8 frm_len
Definition: lin.h:254
lin_protocol_handle_t protocol_version
Definition: lin.h:512
bool l_bool
0 is false, and non-zero (>0) is true Implements : l_bool_Class
Definition: lin_types.h:48
l_u16 l_ifc_read_status(l_ifc_handle iii)
This function will return the status of the previous communication.
l_u8 successful_transfer
Definition: lin.h:566
l_u8 flag_size
Definition: lin.h:551
unsigned int event_trigger_collision_flg
Definition: lin.h:157
lin_frame_response_t frm_response
Definition: lin.h:255
l_u8 number_of_configurable_frames
Definition: lin.h:517
#define LIN_LLD_OK
Definition: lin.h:92
unsigned int save_config_flg
Definition: lin.h:158
l_u16 frm_offset
Definition: lin.h:548
l_u8 master_data_buffer[8]
Definition: lin.h:547
unsigned int successful_transfer
Definition: lin.h:153
unsigned int overrun
Definition: lin.h:154
l_u8 * schedule_start_entry_ptr
Definition: lin.h:545
unsigned short int l_u16
Unsigned 16 bit integer Implements : l_u16_Class.
Definition: lin_types.h:36
Transport layer description Implements : lin_tl_descriptor_t_Class.
Definition: lin.h:464
l_u16 l_sys_irq_disable(l_ifc_handle iii)
Disable LIN related IRQ.
unsigned int bus_activity
Definition: lin.h:156