Reputation: 107
What are all .c and .h files a MCAL module (eg. Lin diver, CAN driver) should contain? and what each of those files contain? How to derive configurations for them?
Upvotes: 0
Views: 3600
Reputation: 1496
see also standard/AUTOSAR_BSWGeneral.pdf
Can.c - Implementation of the CAN Driver .. could be split in other C files
Can.h - define the CAN Driver public interface as defined by AUTOSAR
Can_Irq.c - ISRs of the CAN
Can_Cfg.c - PreCompile Config e.g. CONST(CanConfigType, CAN_CONFIG_DATA) CanConfig = {...} -- AUTOSAR allows to skip this file and put this config in LCfg or PBcfg files
Can_Cfg.h - PreCompile Config and Compiler Switches
Can_PBcfg.c - POSTBUILD_CONFIG replaces the PRECOMPILE Config e.g. CONST(CanConfigType, CONFIG_DATA) CanConfigSets = { N, { CfgSet0 }, {CfgSet1 } ..}
Can_PBcfg.h - POSTBUILD_CONFIG types, structures/defines
Can_Lcfg.c - LINKTIME_CONFIG configuration
Can_Lcfg.h - LINKTIME_CONFIG types/structures/defines
in case CAN Driver would provide callbacks for other modules to include: Can_Cbk.h
Upvotes: 0
Reputation: 2590
That is not entirely specified by Autosar. The standard goes into great detail when it comes to behaviour of the implementation, but not into so much detail when it comes to files. There are many companies supplying MCALs, and each of those suppliers will make some decisions about code organization.
File names are actually specified though. The CAN driver has Can.c
, Can.h
, Can_Cfg.h
and Can_PBcfg.c
. By Autosar convention, the post-build part of the configuration goes to Can_PBcfg.c
, the compile-time config is in Can_Cfg.h
. Their content is mostly left to the supplier. Can.c
is the implementation, Can.h
is the header file for which no additional rules are given except that it shall include ComStack_Types.h
and Can_GeneralTypes.h
.
The configuration that gets generated is not entirely specified either. The input to the driver configuration is the ECU configuration (described in a chapter called "Configuration specification" for each driver or module), the output is mostly up to the supplier. The supplier may add additional layers of abstraction, may have their Can.c
call functions that are in other, supplier-specific C files, and so on. You can be sure that Can.c
is going to have the Can_Write
function, but the implementation will be different for different suppliers.
MCAL suppliers will usually provide additional documentation for configuring the modules, and will either have their own Autosar configuration tool or recommend a tool that their MCAL is known to work with.
Upvotes: 1