Specifications
October 25, 2006 Cypress Semiconductor – Rev. ** 25
LIN Bus 2.0 Reference Design 3. Master Design IP
// Code to update the
Frame5 buffer with the signal
l_sporadic_frame_queue |=
0x04;
}
Only the bits corresponding to the frames in the Sporadic
Frame table are set by the main function.
3.7 Master Design APIs
3.7.1 Basic Functions
These API functions are used to control the LIN core includ-
ing initializing, setting schedules, power management, etc.
l_sys_init
C Prototype: l_u8 l_sys_init (void);
Description: This is a dummy function included in the API
for consistency with the LIN specifications.
Parameters: None.
Returns: Always 0.
l_ifc_init
C Prototype: l_u8 l_ifc_init (void);
Description: This function initializes the LIN master and
loads the Synchro Reception Configuration. It also sets the
Schedule table to L_NULL_SCHEDULE.
Parameters: None.
Returns: Always 0.
l_sch_set
C Prototype: void l_sch_set(const char*
l_schedule_handle, l_u8 entry);
Description: This function sets up the next Schedule table
to be followed by the l_sch_tick function. The entry defines
the starting point in the new Schedule table. The entry value
should be in the range of 0 to N, where N is the number of
frames in the Schedule table. If the entry value is 0 or 1,
then the new Schedule table is started from the beginning.
Parameters:
l_schedule_handle: The name of the schedule to make
active.
entry: The frame number in the schedule that must be sent
during the next frame slot.
Returns: None.
l_sch_tick
C Prototype: l_u8 l_sch_tick(void);
Description: The l_sch_tick function follows a schedule.
When called, it initiates the next due frame in the current
Schedule table. When the end of the current table is
reached, the function starts from the beginning of the sched-
ule.
Parameters: None.
Returns: The return value is the next schedule entry’s num-
ber to be transmitted during the next time slot. Use this
value to interrupt a current running schedule to run some
other schedule and then use this return value with the
l_sch_set API to again start from the left frame.
l_bytes_rd
C Prototype: void l_bytes_rd (const char*
l_signal_handle, l_u8 start, l_u8 count,
char* data);
Description: Reads and returns the current value of the
selected bytes in the signal specified by l_signal_handle.
Parameters:
l_signal_handle: Name of the frame from which bytes are
read.
start: This is the offset in the frame buffer from where the
bytes are read.
count: Number of bytes to read.
data: Buffer to which the data are read.
Example: To read two bytes from Frame1 from the third
byte of the buffer to another buffer called TempBuffer, use
this code:
l_bytes_rd(Frame1, 2, 2, TempBuffer);
Note that the third byte of the frame buffer has an offset of
two. That is why two is used as the offset parameter.
Returns: None.
l_bytes_wr
C Prototype: void l_bytes_wr(const char*
l_signal_handle, l_u8 start, l_u8 count,
char* data);
Description: Writes the specified data to the buffer of the
specified signal.
Parameters:
l_signal_handle: Name of the frame to which bytes are writ-
ten
start: The offset on the frame buffer from where the bytes
are written.
count: Number of bytes to write.
data: Buffer from which the data are copied.