| |
|
|
|
| PA6488 Developer's Guide - Data Structure |
| | |
| Data Type |
8-bit UCHAR and char begin with c, example: UCHAR cHardwareLen;
16-bit USHORT and short begin with s, example: USHORT sIndex;
32-bit UINT and int begin with i, example: UINT iLength;
BOOLEAN begins with b, example: BOOLEAN bAcked;
Add p to pointers, example: UCHAR pcDst[HW_ALEN]; PCHAR pcBuf;
Add pp to 2-dimension pointers.
32-bit memory mapped registers begin with r, example: REG rStall; PREG prCtl;
8-bit memory mapped registers begin with rc, example: REG8 rc;
General struct T_XXXX_XXXX begins with t, example: T_MAC_DESC tMacRecv;
General union U_XXXX_XXXX begins with u, example: u;
PT_XXXX_XXXX and PU_XXXX_XXXX define point to struct and union.
Function pointer F_XXXX_XXXX begins with f, example: _fIpRun;
Const data begins with c_, example: const USHORT c_psLedIndex[MAX_LED];
None const global data begins with g_, example: T_NET_CONFIG g_tNetConfig;
Data only used within the source file begins with _, example: BOOLEAN _bTimer;
|
| | |
| Data Performance |
Make sure index variables are signed integers, example: int i;
When parallel processing is not possible or obvious, use int or UINT where is possible for best performance and size.
Make all struct and union data type 64-bit data alignment for best performance.
Make all items in struct in 32-bit group to avoid compiler bug, see known bugs page.
|
| | |
| Data Alignment |
The total size of struct is 64-bit aligned.
Struct inside struct is 64-bit aligned.
Arrays larger than 8 bytes inside struct is 64-bit aligned as possible.
32-bit int, pointer inside struct is 32-bit aligned.
16-bit data inside struct is 16-bit aligned.
Avoid using 8-bit data inside struct, but use it when necessary.
|
|