AUTOSAR Classic LIN
Das LIN-Cluster umfasst Low-Cost-Subbus-Kommunikation für Karosserie- und Komfortfunktionen inklusive Treiber, LinIf-Schedule-Tabellen-Handling, Transceiver-Steuerung und State-Management.
Inicialização e estado
Lin_GetStatusLin_GetVersionInfoLin_InitLinIf_GetVersionInfoLinIf_InitLinSM_GetVersionInfoLinSM_InitLinTp_GetVersionInfoLinTp_InitLinTrcv_GetVersionInfoLinTrcv_InitServiços · Get…
Serviços · Set…
Serviços · Wakeup…
Serviços · Check…
Serviços · Goto…
Serviços · Schedule…
Serviços · Outros
Lin_GoToSleepLin_GoToSleepInternalLin_SendFrameLinIf_EnableBusMirroringLinIf_HeaderIndicationLinIf_LinErrorIndicationLinIf_TransmitLinSM_RequestComModeLinTp_ChangeParameterLinTp_ShutdownLinTp_TransmitCallbacks
LinIf_RxIndicationLinIf_TxConfirmationCallouts e interfaces esperadas
<User_ResponseErrorSignalChanged><User_RxIndication><User_SaveConfigurationRequest><User_TriggerTransmit><User_TxConfirmation>Cíclico
LinSM_MainFunctionTipos
Lin_ConfigTypeLin_FrameCsModelTypeLin_FrameDlTypeLin_FramePidTypeLin_FrameResponseTypeLin_PduTypeLin_SlaveErrorTypeLin_StatusTypeLinIf_ConfigTypeLinIf_SchHandleTypeLinSM_ConfigTypeLinSM_ModeTypeLinTp_ConfigTypeLinTp_ModeLinTrcv_ConfigTypeLinTrcv_TrcvModeTypeLinTrcv_TrcvWakeupModeTypeLinTrcv_TrcvWakeupReasonTypeFunções
<User_ResponseErrorSignalChanged><User_RxIndication><User_SaveConfigurationRequest><User_TriggerTransmit><User_TxConfirmation>Lin_CheckWakeupLin_GetStatusLin_GetVersionInfoLin_GoToSleepLin_GoToSleepInternalLin_InitLin_SendFrameLin_WakeupLin_WakeupInternalLinIf_CheckWakeupLinIf_EnableBusMirroringLinIf_GetConfiguredNADLinIf_GetPIDTableLinIf_GetTrcvModeLinIf_GetTrcvWakeupReasonLinIf_GetVersionInfoLinIf_GotoSleepLinIf_HeaderIndicationLinIf_InitLinIf_LinErrorIndicationLinIf_RxIndicationLinIf_ScheduleRequestLinIf_SetConfiguredNADLinIf_SetPIDTableLinIf_SetTrcvModeLinIf_SetTrcvWakeupModeLinIf_TransmitLinIf_TxConfirmationLinIf_WakeupLinIf_WakeupConfirmationLinSM_GetCurrentComModeLinSM_GetVersionInfoLinSM_GotoSleepConfirmationLinSM_GotoSleepIndicationLinSM_InitLinSM_MainFunctionLinSM_RequestComModeLinSM_ScheduleRequestLinSM_ScheduleRequestConfirmationLinSM_WakeupConfirmationLinTp_ChangeParameterLinTp_GetVersionInfoLinTp_InitLinTp_ShutdownLinTp_TransmitLinTrcv_CheckWakeupLinTrcv_GetBusWuReasonLinTrcv_GetOpModeLinTrcv_GetVersionInfoLinTrcv_InitLinTrcv_SetOpModeLinTrcv_SetWakeupModeTipos
Lin_ConfigTypeLin_FrameCsModelTypeLin_FrameDlTypeLin_FramePidTypeLin_FrameResponseTypeLin_PduTypeLin_SlaveErrorTypeLin_StatusTypeLinIf_ConfigTypeLinIf_SchHandleTypeLinSM_ConfigTypeLinSM_ModeTypeLinTp_ConfigTypeLinTp_ModeLinTrcv_ConfigTypeLinTrcv_TrcvModeTypeLinTrcv_TrcvWakeupModeTypeLinTrcv_TrcvWakeupReasonTypeMapa de temas
Lin
17LinIf
35LinSM
12Não há dados de elementos para esta versão
Lin
This function checks if a wakeup has occurred on the addressed LIN channel.
Std_ReturnType Lin_CheckWakeup (uint8 Channel);Service Lin_GetStatus.
Lin_StatusType Lin_GetStatus (uint8 Channel, const uint8* * Lin_SduPtr);Returns the version information of this module.
void Lin_GetVersionInfo (Std_VersionInfoType* versioninfo);The service instructs the driver to transmit a go - to - sleep - command on the addressed LIN channel. Only used for LIN master nodes.
Std_ReturnType Lin_GoToSleep (uint8 Channel);Sets the channel state to LIN_ CH_ SLEEP, enables the wake - up detection and optionally sets the LIN hardware unit to reduced power operation mode (if supported by HW).
Std_ReturnType Lin_GoToSleepInternal (uint8 Channel);Initializes the LIN module.
void Lin_Init (const Lin_ConfigType* Config);Sends a LIN header and a LIN response, if necessary. The direction of the frame response (master response, slave response, slave - to - slave communication) is provided by the Pdu Info Ptr. Only used for LIN master nodes.
Std_ReturnType Lin_SendFrame (uint8 Channel, const Lin_PduType* PduInfoPtr);Generates a wake up pulse and sets the channel state to LIN_ CH_ OPERATIONAL.
Std_ReturnType Lin_Wakeup (uint8 Channel);Sets the channel state to LIN_ CH_ OPERATIONAL without generating a wake up pulse.
Std_ReturnType Lin_WakeupInternal (uint8 Channel);This is the type of the external data structure containing the overall initialization data for the LIN driver and the SFR settings affecting the LIN channels. A pointe r to such a structure is provided to the LIN driver initialization routine for configuration of the driver, LIN hardware unit and LIN hardware channels.
This type is used to specify the Checksum model to be used for the LIN Frame.
This type is used to specify the number of SDU data bytes to copy.
Represents all valid protected identifier used by Lin_ Send Frame().
Thi s type is used to specify whether the frame processor is required to transmit the response part of the LIN frame.
This Type is used to provide PID, checksum model, data length and SDU pointer from the LIN Interface to the LIN driver.
This type represents the slave error types that are detected during header reception and response transmission / reception.
LIN operation states for a LIN channel or frame, as returned by the API service Lin_ Get Status().
LinIf
Notifies the change of the response error signal with the new value. Only applicable for LIN slave nodes. AUTOSAR CP R20 - of Document ID : AUTOSAR_ SWS_ LINInterface
void <User_ResponseErrorSignalChanged> (NetworkHandleType Channel, boolean RespErrSigValue);Indication of a received PDU from a lower layer communication interface module.
void <User_RxIndication> (PduIdType RxPduId, const PduInfoType* PduInfoPtr);Notifies the reception of a Save Configuration request. Only applicable for LIN slave nodes.
boolean <User_SaveConfigurationRequest> (NetworkHandleType Channel);Within this API, the upper layer module (called module) shall check whether the available data fits into the b uffer size reported by Pdu Info Ptr - >Sdu Length. If it fits, it shall copy its data into the buffer provided by Pdu Info Ptr - >Sdu Data Ptr and update the length of the actual copied data in Pdu Info Ptr - >Sdu Length. If not, it returns E_ NOT_ OK without ch anging Pdu Info Ptr.
Std_ReturnType <User_TriggerTransmit> (PduIdType TxPduId, PduInfoType* PduInfoPtr);The lower layer communication interface module confirms the transmission of a PDU, or the failure to transmit a PDU.
void <User_TxConfirmation> (PduIdType TxPduId, Std_ReturnType result);Will be called when the Ecu M has been notified about a wakeup on a specific LIN channel.
Std_ReturnType LinIf_CheckWakeup (EcuM_WakeupSourceType WakeupSource);Enables or disables mirroring for a LIN channel.
Std_ReturnType LinIf_EnableBusMirroring (NetworkHandleType Channel, boolean MirroringActive);Reports the current configured NAD. Only applicable for LIN slave nodes.
Std_ReturnType LinIf_GetConfiguredNAD (NetworkHandleType Channel, uint8* Nad);Retrieves all assigned PID values. The order is congruent to the LIN frame index. Only applicable for LIN slave nodes.
Std_ReturnType LinIf_GetPIDTable (NetworkHandleType Channel, Lin_FramePidType* PidBuffer, uint8* PidBufferLength);Returns the actual sta te of a LIN Transceiver Driver.
Std_ReturnType LinIf_GetTrcvMode (NetworkHandleType Channel, LinTrcv_TrcvModeType* TransceiverModePtr);Returns the reason for the wake up that has been detected by the LIN Transceiver Driver.
Std_ReturnType LinIf_GetTrcvWakeupReason (NetworkHandleType Channel, LinTrcv_TrcvWakeupReasonType* TrcvWuReasonPtr);Returns the version information of this module.
void LinIf_GetVersionInfo (Std_VersionInfoType* versioninfo);Initiates a transition into the Sleep Mode on the selected channel.
Std_ReturnType LinIf_GotoSleep (NetworkHandleType Channel);The LIN Driver will call this function to report a received LIN header. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).
Std_ReturnType LinIf_HeaderIndication (NetworkHandleType Channel, Lin_PduType* PduPtr);Initializes the LIN Interface.
void LinIf_Init (const LinIf_ConfigType* ConfigPtr);The LIN Driver will call this function to report a detected error event during header or response processing. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).
void LinIf_LinErrorIndication (NetworkHandleType Channel, Lin_SlaveErrorType ErrorStatus);The LIN Driver will call this function to report a successfully received response and provides the reception data to the LIN Interface. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).
void LinIf_RxIndication (NetworkHandleType Channel, uint8* Lin_SduPtr);Requests a schedule table to be executed. Only used for LIN master nodes.
Std_ReturnType LinIf_ScheduleRequest (NetworkHandleType Channel, LinIf_SchHandleType Schedule);Sets the current configured NAD. Only applicable for LIN slave nodes.
Std_ReturnType LinIf_SetConfiguredNAD (NetworkHandleType Channel, uint8 Nad);Sets all assigned PID values. The order is congruent to the LIN frame index. Only applicable for LIN slave nodes.
Std_ReturnType LinIf_SetPIDTable (NetworkHandleType Channel, Lin_FramePidType* PidBuffer, uint8 PidBufferLength);Set the given LIN transceiver to the given mode.
Std_ReturnType LinIf_SetTrcvMode (NetworkHandleType Channel, LinTrcv_TrcvModeType TransceiverMode);This API enables, disables and cl ears the notification for wakeup events on the addressed network
Std_ReturnType LinIf_SetTrcvWakeupMode (NetworkHandleType Channel, LinTrcv_TrcvWakeupModeType LinTrcvWakeupMode);Re quests transmission of a PDU.
Std_ReturnType LinIf_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);The LIN Driver will call this function to report a successfully transmitted response. This function is only applicable for LIN slave nodes (available only if the ECU has any LIN slave channel).
void LinIf_TxConfirmation (NetworkHandleType Channel);Initiates the wake up process.
Std_ReturnType LinIf_Wakeup (NetworkHandleType Channel);The LIN Driver or LIN Transceiver Driver will call this function to report the wake up source after the successful wakeup detection during Check Wakeup or after power on by bus.
void LinIf_WakeupConfirmation (EcuM_WakeupSourceType WakeupSource);Request to change a specific transport protocol parameter (e.g. block size).
Std_ReturnType LinTp_ChangeParameter (PduIdType id, TPParameterType parameter, uint16 value);Returns the version information of this module.
void LinTp_GetVersionInfo (Std_VersionInfoType* versioninfo);Initializes the LIN Transport Layer.
void LinTp_Init (const LinTp_ConfigType* ConfigPtr);Shutdowns the LIN TP.
void LinTp_Shutdown (void);Requests transmission of a PDU.
Std_ReturnType LinTp_Transmit (PduIdType TxPduId, const PduInfoType* PduInfoPtr);A pointer to an instance of this structure will be used in the initialization of the LIN Interface. The outline of the structure is defined in chapter 10 Configuration Specification.
Index of the schedule table that is selectable and followed by LIN Interface. Value is unique per LIN c hannel/ controller, but not per ECU. The number of schedule tables is limited to 255
This is the base type for the configuration of the LIN Transport Protocol A pointer to an instance of this structure will be used in the initialization of the LIN Transport Protocol. The outline of the structure is defined in chapter 10 Configuration Specification
This type denotes which Schedule table can be requested by LIN TP during diagnostic session
LinSM
Function to query the current communication mode.
Std_ReturnType LinSM_GetCurrentComMode (NetworkHandleType network, ComM_ModeType* mode);-
void LinSM_GetVersionInfo (Std_VersionInfoType* versioninfo);The Lin If will call this callback when the go to sleep command is sent successfully or not sent successfully on the network.
void LinSM_GotoSleepConfirmation (NetworkHandleType network, boolean success);The Lin If will call this callback when the go to sleep command is received on the network or a bus idle timeout occurs. Only applicable for LIN slave nodes.
void LinSM_GotoSleepIndication (NetworkHandleType Channel);This function initializes the Lin SM.
void LinSM_Init (const LinSM_ConfigType* ConfigPtr);Periodic function that runs the timers of different request timeouts
void LinSM_MainFunction (void);Requesting of a communication mode. The mode switch will not be made instant. The Lin SM will notify the caller when mode transition is made.
Std_ReturnType LinSM_RequestComMode (NetworkHandleType network, ComM_ModeType mode);The upper layer requests a schedule table to be changed on one LIN network.
Std_ReturnType LinSM_ScheduleRequest (NetworkHandleType network, LinIf_SchHandleType schedule);The Lin If module will call this callback when the new requested schedule table is active.
void LinSM_ScheduleRequestConfirmation (NetworkHandleType network, LinIf_SchHandleType schedule);The Lin If will call this callback when the wake up signal command is sent not successfully/ successfully on the network.
void LinSM_WakeupConfirmation (NetworkHandleType network, boolean success);Data structure type for the post - build configuration parameters.
Type used to report the current mode to the Bsw M
LinTrcv
Service LinTrcv_CheckWakeup.
Std_ReturnType LinTrcv_CheckWakeup (uint8 LinNetwork);This API provides the reason for the wakeup that the LIN transceiver has detected in the parameter "Reason". The ability to dete ct and differentiate the possible wakeup reasons depends strongly on the LIN transceiver hardware.
Std_ReturnType LinTrcv_GetBusWuReason (uint8 LinNetwork, LinTrcv_TrcvWakeupReasonType* Reason);API detects the actual software state of LIN transceiver driv er.
Std_ReturnType LinTrcv_GetOpMode (uint8 LinNetwork, LinTrcv_TrcvModeType* OpMode);This service provides the version information of this module through the parameter "versioninfo".
void LinTrcv_GetVersionInfo (Std_VersionInfoType* versioninfo);Initializes the Lin Transceiver Driver module.
void LinTrcv_Init (const LinTrcv_ConfigType* ConfigPtr);The internal state of the LIN transceiver driver is switched to mode given in the parameter Op Mode.
Std_ReturnType LinTrcv_SetOpMode (uint8 LinNetwork, LinTrcv_TrcvModeType OpMode);This API enables, disables and clears the notification for wakeup events on the addressed network. A vailable via Lin Trcv.h
Std_ReturnType LinTrcv_SetWakeupMode (uint8 LINNetwork, LinTrcv_TrcvWakeupModeType TrcvWakupMode);Configuration data structure of the Lin Trcv module. AUTOSAR CP R20 - of Document ID : AUTOSAR_SWS_LINTransceiverDriver
Operating modes of the LIN Transceiver Driver
Wake up operating modes of the LIN Transceiver Driver.
This type denotes the wake up reason detected by the LIN transceiver in detail.
Guia do clusterGERADO POR IA
Permite a interconexão em rede com boa relação custo-benefício de sensores e atuadores via Local Interconnect Network no veículo.
Permite a interconexão em rede com boa relação custo-benefício de sensores e atuadores via Local Interconnect Network no veículo.
O cluster de módulos LIN Communication realiza a conexão padronizada de subsistemas de barramento LIN por meio dos módulos LinSM, LinIf, LinTrcv e Lin (SWS COMManager p. 19). Ele controla a transmissão de quadros baseada em schedule nos masters, bem como a avaliação reativa de cabeçalhos e o envio de dados nos slaves ([SWS_LinIf_91004], [SWS_Lin_00168]). Ao mesmo tempo, o cluster coordena a transição ordenada entre comunicação total e modo sleep, assim como o tratamento autônomo de erros através do sinal response_error ([SWS_LinIf_00763]).
O cluster de módulos LIN Communication disponibiliza a implementação AUTOSAR completa do protocolo LIN e compreende o gerenciador de estados LinSM, a interface LinIf (incluindo o protocolo de transporte LinTp), o driver do transceptor LinTrcv e o driver MCAL Lin (SWS COMManager p. 19). Ele conecta sub-redes, sensores e atuadores à matriz de comunicação AUTOSAR e diferencia estritamente entre nós master com execução autônoma de schedules e nós slave de resposta puramente reativa ([SWS_LinIf_00197], [SWS_Lin_00272]).
Diagrama de arquitetura: arquitetura em camadas e relações de interface do cluster LIN entre serviços de comunicação, camada de abstração e MCAL. Fontes: SWS COMManager p. 19, AUTOSAR SWS LINInterface p. 133.
A transmissão de dados ocorre em ECUs master através do acionamento periódico do driver via Lin_SendFrame e subsequente consulta de status via Lin_GetStatus ([SWS_Lin_00168]). No slave, por outro lado, a detecção de um cabeçalho no driver resulta no callback síncrono LinIf_HeaderIndication ([SWS_LinIf_91004]). A interface decide com base no PID se deve receber, responder ou ignorar e confirma a conclusão através de LinIf_RxIndication ou LinIf_TxConfirmation ([SWS_LinIf_91005], [SWS_LinIf_91006]). O LinTp integrado processa mensagens de diagnóstico por meio de alternâncias automatizadas da tabela de schedule ([SWS_LinIf_00641]).
No ciclo de operação, LinSM coordena as transições de estado entre LINSM_NO_COM e LINSM_FULL_COM ([SWS_LinSM_00026], [SWS_LinSM_00032]). O despertar ocorre por pulso no barramento via Lin_Wakeup ([SWS_Lin_00169]). A transição para o modo sleep ocorre no master através do envio ativo de um quadro sleep, e no slave após a recepção do comando sleep ou em caso de inatividade do barramento (idle) via LinIf_GotoSleep, Lin_GoToSleepInternal e controle de sleep do transceptor ([SWS_LinSM_00231], [SWS_LinIf_00757]).
Diagrama de sequência: interação dos módulos BSW na entrada de um slave LIN no estado sleep após o sinal de sleep do barramento. Fontes: [SWS_LinSM_91000], [SWS_LinSM_00231], [SWS_LinIf_00757], AUTOSAR SWS LINStateManager p. 48.
Erros de comunicação são detectados nos slaves via LinIf_LinErrorIndication e reportados autonomamente ao master no sinal response_error ([SWS_LinIf_91007], [SWS_LinIf_00763]). Áreas de sincronização entre canais e separações estritas entre tarefas cíclicas (LinIf_MainFunction) e ISRs do driver asseguram a estabilidade do sistema ([SWS_LinIf_00384]).
Arquitetura do sistema & papel do cluster de módulos
O cluster de módulos LIN Communication disponibiliza, na pilha de Basic Software do AUTOSAR Classic, a comunicação padronizada via Local Interconnect Network (LIN) em conformidade com a ISO 17987. Ele atua primariamente como um subsistema de barramento de baixo custo para a conexão de sensores e atuadores na rede do veículo (AUTOSAR FO Features p. 58). O cluster estende-se por várias camadas da arquitetura AUTOSAR: o LIN State Manager (LinSM) opera no nível dos Communication Services, a LIN Interface (LinIf), incluindo o protocolo de transporte integrado (LinTp), forma a Communication Abstraction, o LIN Transceiver Driver (LinTrcv) é parte da ECU Abstraction e o LIN Driver (Lin) reside como módulo próximo ao hardware no Microcontroller Abstraction Layer (MCAL) (SWS COMManager p. 19).
Arquiteturalmente, o cluster diferencia estritamente entre nós master e slave. Um master LIN controla de forma autônoma o tráfego do barramento por meio de tabelas de schedule e gera todos os cabeçalhos, enquanto os slaves LIN respondem de maneira puramente reativa aos cabeçalhos recebidos ou avaliam sinais ([SWS_LinIf_00197], [SWS_Lin_00272]). Para tarefas de diagnóstico e transporte segundo a ISO 14229, a LIN Interface encapsula a funcionalidade de TP, que processa mensagens de diagnóstico segmentadas (Master Request Frame MRF e Slave Response Frame SRF) através do PduR e do DCM ([SWS_LinIf_00351], [SWS_LinIf_00629]). Externamente, o cluster interage intensamente com o Communication Manager (ComM), o Basic Software Mode Manager (BswM), o PDU Router (PduR) e o ECU State Manager (EcuM) (SWS COMManager p. 19).
Diagrama de arquitetura: arquitetura em camadas e relações de interface do cluster LIN entre serviços de comunicação, camada de abstração e MCAL. Fontes: SWS COMManager p. 19, AUTOSAR SWS LINInterface p. 133.
Interação e caminhos de interação entre os módulos
Os caminhos de interação no cluster diferem fundamentalmente dependendo do papel do nó. No master LIN, a LIN Interface inicia a execução da tabela de schedule ativa por meio de sua tarefa periódica. Para quadros de transmissão pendentes, LinIf busca os dados úteis através de mecanismos de trigger transmit da camada superior e repassa a estrutura Lin_PduType para o driver LIN via Lin_SendFrame ([SWS_Lin_00232], SWS LINInterface p. 37). O driver transmite o cabeçalho e os dados de forma não bloqueante ([SWS_Lin_00027]). Após o término do tempo máximo de execução do quadro, LinIf determina o resultado da transmissão através de Lin_GetStatus ([SWS_Lin_00168], SWS LINInterface p. 35). Em slots de recepção, LinIf busca os dados armazenados pelo driver no buffer e os encaminha para as camadas superiores ([SWS_Lin_00233]).
Em um slave LIN, o caminho de dados ocorre orientado a eventos: se o driver MCAL Lin detectar no hardware um cabeçalho válido de break, synch e PID, ele chama de forma síncrona o callback LinIf_HeaderIndication ([SWS_Lin_00280], [SWS_LinIf_91004]). A interface verifica o identificador protegido (PID) com base na tabela interna de PIDs ([SWS_LinIf_00816], [SWS_LinIf_00823]). Se for um quadro de transmissão, LinIf busca os dados úteis, configura o tipo de resposta para LIN_FRAMERESPONSE_TX e disponibiliza os dados ao driver no buffer ([SWS_Lin_00230]). Se o quadro estiver configurado como recepção, o driver relata o sucesso via LinIf_RxIndication após a recepção completa dos bytes ([SWS_LinIf_91005]), momento em que LinIf encaminha os dados para o PDU Router. Confirmações de respostas enviadas pelo slave ocorrem via LinIf_TxConfirmation ([SWS_LinIf_91006]).
Além disso, o controle do transceptor é encapsulado de forma transparente por meio da interface LIN: solicitações de modo como LinIf_SetTrcvMode são encaminhadas síncronamente pela interface para LinTrcv_SetOpMode ([SWS_LinIf_00544], [SWS_LinTrcv_00002]). Em transações de protocolo de transporte, LinTp controla, por meio de BswM_LinTp_RequestMode, a alternância direcionada da tabela de schedule do master entre modo de aplicação (LINTP_APPLICATIVE_SCHEDULE), solicitação de diagnóstico (LINTP_DIAG_REQUEST) e resposta de diagnóstico (LINTP_DIAG_RESPONSE) ([SWS_LinIf_00641], [SWS_LinIf_00642], [SWS_LinIf_00643]).
Diagrama de sequência: fluxo dinâmico de controle e de dados na indicação de cabeçalho, acionamento de transmissão e confirmação de recepção em um slave LIN. Fontes: [SWS_Lin_00280], [SWS_LinIf_91004], [SWS_LinIf_91005], AUTOSAR SWS LINInterface p. 133.
Sincronização, reentrância e contextos de tarefas
A execução dentro do cluster de módulos é dividida entre contextos de tarefas cíclicas e níveis de interrupção próximos ao hardware. O núcleo do controle de fluxo cíclico na LIN Interface é a função programada LinIf_MainFunction_<LinIfChannel.ShortName>, que é obrigatoriamente instanciada de forma separada para cada canal LIN configurado ([SWS_LinIf_00384], [SWS_LinIf_00725]). Ela assume o avanço dos slots de schedule, as consultas de status ao driver e o tratamento de timeout do protocolo de transporte ([SWS_LinIf_00800], SWS LINInterface p. 119). Paralelamente a isso, LinSM_MainFunction gerencia os temporizadores de contagem regressiva e de confirmação para solicitações assíncronas de canal e de wakeup ([SWS_LinSM_00162], [SWS_LinSM_00159]).
Em contraste com o nível de tarefas, as rotinas de driver do módulo MCAL Lin são executadas no contexto de interrupção (ISR) na presença de um controlador controlado por interrupção ou de uma interface UART (AUTOSAR CP SWS LINDriver p. 53). Os callbacks LinIf_HeaderIndication, LinIf_RxIndication e LinIf_TxConfirmation são disparados sincronamente diretamente a partir desse contexto de ISR ([SWS_Lin_00280], [SWS_LinIf_91005], [SWS_LinIf_91006]). Isso exige uma proteção rigorosa de seções críticas (Exclusive Areas) na LIN Interface: chamadas de controle como LinIf_Transmit, LinIf_GotoSleep, LinIf_ScheduleRequest ou LinIf_Wakeup só podem modificar estruturas internas de canal de forma protegida contra acessos paralelos a partir da LinIf_MainFunction ou de callbacks de ISR (SWS LINInterface p. 119).
Em relação à reentrância, as funções de API dos módulos LinIf e LinSM são predominantemente reentrantes para canais ou redes diferentes, porém concebidas como não reentrantes para o mesmo canal ([SWS_LinSM_00126], [SWS_LinIf_00201], [SWS_LinIf_00204]). O mesmo se aplica aos serviços de driver em Lin (por exemplo, Lin_Wakeup, Lin_GoToSleepInternal), que precisam ser rigorosamente sincronizados por canal físico ([SWS_Lin_00167], [SWS_Lin_00169]). No caso de hardware UART simples sem FIFO de múltiplos bytes, o driver LIN armazena bytes temporariamente em buffer por software ([SWS_Lin_00026]), o que, interpretação: sob alta carga de barramento, deve levar a um aumento no volume de interrupções de CPU em nós slave. Pergunta Q-0d07d89d1ade6a01 (aberta)
Ciclos de vida típicos e modos de operação
Durante a inicialização do sistema, o BswM inicializa os módulos BSW em uma cadeia pré-definida: primeiro são inicializados os drivers básicos Lin_Init e LinTrcv_Init, seguidos por LinIf_Init, LinTp_Init e, por fim, LinSM_Init (ModemanagementGuide p. 54). LinIf_Init define por padrão o schedule de todos os canais master como NULL_SCHEDULE ([SWS_LinIf_00233]) e, nos slaves, carrega as tabelas de NAD e PID pré-configuradas ([SWS_LinIf_00767], [SWS_LinIf_00768]). LinSM inicia no estado LINSM_NO_COM, sem emitir callbacks para ComM ou BswM durante a inicialização ([SWS_LinSM_00026], [SWS_LinSM_00166]).
Se o ComM solicitar a liberação de comunicação via LinSM_RequestComMode(COMM_FULL_COMMUNICATION), LinSM aciona diretamente LinIf_Wakeup e inicia um temporizador de monitoramento ([SWS_LinSM_00047], [SWS_LinSM_00100]). LinIf transmite o pulso físico de wakeup no barramento via Lin_Wakeup ([SWS_LinIf_00205], [SWS_Lin_00043]). Se LinIf relatar o sucesso do processo de despertar via LinSM_WakeupConfirmation(success=TRUE), o estado muda para LINSM_FULL_COM ([SWS_LinSM_00049], [SWS_LinSM_00132]). Isso é sinalizado para ComM via ComM_BusSM_ModeIndication e para BswM via BswM_LinSM_CurrentState ([SWS_LinSM_00033], [SWS_LinSM_00192]). Nos slaves, o barramento só é considerado despertado com sucesso quando o master envia o primeiro cabeçalho LIN e este é recebido ([SWS_LinIf_00761], SWS LINStateManager p. 28).
A descida para o modo sleep (Go-to-Sleep) difere substancialmente: em um master, a solicitação COMM_NO_COMMUNICATION resulta na chamada de LinIf_GotoSleep ([SWS_LinSM_00036], [SWS_LinSM_10208]). LinIf instrui o driver, via Lin_GoToSleep, a enviar um quadro padronizado de Go-to-Sleep no barramento ([SWS_Lin_00166], [SWS_Lin_00089]). Em um slave, por outro lado, a interface recebe o comando de Go-to-Sleep ou detecta um timeout de inatividade do barramento e informa LinSM via LinSM_GotoSleepIndication ([SWS_LinSM_91000]). LinSM chama então de forma síncrona LinIf_GotoSleep ([SWS_LinSM_00231]). A interface comuta o driver localmente para o estado LIN_CH_SLEEP via Lin_GoToSleepInternal ([SWS_LinIf_00757], [SWS_Lin_00095]) e coloca o transceptor em estado de sleep via LinIf_SetTrcvMode(LINTRCV_TRCV_MODE_SLEEP) ([SWS_LinIf_00544], AUTOSAR CP SWS LINInterface p. 137). Após a confirmação LinSM_GotoSleepConfirmation, LinSM muda finalmente para LINSM_NO_COM ([SWS_LinSM_00046], [SWS_LinSM_00233]).
Diagrama de sequência: interação dos módulos BSW na entrada de um slave LIN no estado sleep após o sinal de sleep do barramento. Fontes: [SWS_LinSM_91000], [SWS_LinSM_00231], [SWS_LinIf_00757], AUTOSAR SWS LINStateManager p. 48.
Tratamento de erros, rastreamento pelo DET e degradação
O cluster possui um conceito de diagnóstico e detecção de erros em múltiplos níveis. Erros de desenvolvimento são registrados através do Default Error Tracer (Det): parâmetros inválidos de canal ou rede são reportados por LIN_E_INVALID_CHANNEL ([SWS_Lin_00259]), LINIF_E_NONEXISTENT_CHANNEL ([SWS_LinIf_00539]) ou LINSM_E_NONEXISTENT_NETWORK ([SWS_LinSM_00127]). Chamadas a módulos não inicializados resultam em LIN_E_UNINIT, LINIF_E_UNINIT ou LINSM_E_UNINIT ([SWS_Lin_00258], [SWS_LinSM_00128]). Erros de transceptor, como números de rede inválidos, reportam LINTRCV_E_INVALID_LIN_NETWORK ao DET ([SWS_LinTrcv_00145]).
Falhas de comunicação que ocorrem durante a operação são classificadas como erros de tempo de execução: a interface define LINIF_E_RESPONSE no caso de quadros defeituosos e LINIF_E_NC_NO_RESPONSE na ausência de respostas a solicitações de configuração de nós ([SWS_LinIf_00729]). Erros físicos de barramento e protocolo (erros de enquadramento, erros de checksum, erros de monitoramento de bit) são reportados pelo driver MCAL no slave através de LinIf_LinErrorIndication com o status Lin_SlaveErrorType ([SWS_LinIf_91007], [SWS_Lin_91140]). Em nós master, Lin_GetStatus fornece códigos de erro detalhados como LIN_TX_HEADER_ERROR, LIN_TX_ERROR ou LIN_RX_ERROR para a interface ([SWS_Lin_00168], [SWS_Lin_00233]).
Um mecanismo central de erro para slaves LIN é o sinal padronizado response_error. A interface LIN gerencia esse sinal de 1 bit de forma autônoma: caso ocorra um erro de transmissão, LinIf define o bit, o qual é transmitido ao master no próximo quadro incondicional de transmissão ([SWS_LinIf_00763], SWS LINInterface p. 58). Após a transmissão bem-sucedida do quadro, LinIf limpa o flag automaticamente ([SWS_LinIf_00747]). No canal de diagnóstico, LinTp monitora janelas de tempo de protocolo rigorosas: caso N-PDUs não cheguem, os temporizadores $N_{As}$ e $N_{Cr}$ abortam a transação de forma definida e reportam E_NOT_OK ao PDU Router ([SWS_LinIf_00799], [SWS_LinIf_00804], [SWS_LinIf_00806]). Se faltar capacidade de buffer no PDU Router, a interface interrompe a recepção e comuta a tabela de schedule do master de volta para a operação de aplicação ([SWS_LinIf_00676], [SWS_LinIf_00792]).
Este guia é baseado nas especificações AUTOSAR para o Release R20-11 dos módulos Lin, LinIf, LinSM e LinTrcv. Todas as referências normativas provêm dos documentos e entradas de requisitos referenciados.
Module im Cluster
LIN Driver (Lin)
Controls hardware LIN controllers on the ECU.
LIN Interface (LinIf)
Abstracts LIN hardware and manages schedule tables and frame transmission.
LIN Network Management (LinNm)
AUTOSAR Classic Communication Services-Modul LIN Network Management (LinNm, Spezifikation: AUTOSAR_SWS_LINNetworkManagement.pdf).
LIN State Manager (LinSM)
Manages state transitions of LIN networks.
LIN Transceiver Driver (LinTrcv)
Controls physical bus transceiver states and wakeup on LIN lines.
gemini-3.8-flash-low· 2026-10-13 · Original em alemão