PM5358
Appendix A: Coding Conventions
Functions
API Functions
•Naming of the API functions must follow the hungarian notation
•The device’s full name in all lowercase shall be used as a prefix
•Example: suni4x622Add() is a valid name for an API function
Porting Functions
Porting functions correspond to all function that are HW and/or RTOS dependent
•Naming of the porting functions must follow the hungarian notation
•The ‘sys’ prefix shall be used to indicate a porting function
•The device’s name starting with an uppercase must follow the prefix
•Example: sysSuni4x622Read() is a hardware / RTOS specific
Other Functions
•Other functions are all the remaining functions that are part of the driver and have no special naming convention. However, they must follow the hungarian notation
•Example: utilSuni4x622ValidateChan() is a valid name for such a function
Variables
•Naming of variables must follow the hungarian notation
•A pointer to a variable shall use ‘p’ as a prefix followed by the variable name unchanged. If the variable name already starts with a ‘p’, the first letter of the variable name may be capitalized, but this is not a requirement. Double pointers might be prefixed with ‘pp’, but this is not required
•Global variables must be identified with the device’s name in all lowercase as a prefix
•Examples: maxDevs is a valid name for a variable, pmaxDevs is a valid name for a pointer to maxDevs, and suni4x622Mdb is a valid name for a global variable. Note that both pprevBuf and pPrevBuf are accepted names for a pointer to the prevBuf variable, and that both pmatrix and ppmatrix are accepted names for a double pointer to the variable
matrix
File Organization
The next table presents a summary of the file naming conventions. All file names must start with the device abbreviation, followed by an underscore and the actual file name. File names convey their purpose with a minimum number of characters.
Proprietary and Confidential to | 123 |
Document ID: |
|