mirror of
https://github.com/siemens-mobile-hacks/sdk.git
synced 2026-11-25 22:27:39 +00:00
|
|
||
|---|---|---|
| .. | ||
| include | ||
| patterns | ||
| tools | ||
| config.toml | ||
| Doxyfile | ||
| DoxygenLayout.xml | ||
| main.c | ||
| patterns.toml | ||
| README.md | ||
SWILIB - functions from the firmware
Documentation by platforms:
- SG - SL65, SK65, C65, CX70, ...
- X75 - CX75, M75, CF75, ...
- NSG - C81, S75, SL75, S68, ...
- ELKA - E71, EL71, ...
Note: Functions across platforms are mostly the same, but some structures have different memory layout.
How add new function?
- Fork this repository.
- Choose right category in
include/swilib/*.h - Add function definition to this file, commit changes, send PR.
Format of the function definition:
/**
* Write data to a file.
* @param fd file descriptor
* @param buffer pointer to a buffer with data to be written
* @param length maximum size for write
* @param[out] err error code
* @return count of written bytes or error (< 0)
* */ // <--- Short documentation in Doxygen format
__swi_begin(0x00C) // <-- swi number for IAR
int sys_write(int fd, const void *buffer, int length, uint32_t *err) // <-- function definition
__swi_end(0x00C, sys_write, (fd, buffer, length, err)); // <-- swi number for GCC and others
Format of the variadic function definition:
/**
* Send message to the GBS event processor.
* You can pass up to 3 additional parameters (submsg, data0, data1 - see #GBS_MSG).
* @param cepid destination CEPID.
* @param msg ID of the message
*/ // <--- Short documentation in Doxygen format
__swi_variadic_begin(0x100) // <-- swi number for IAR
void GBS_SendMessage(int cepid, int msg, ...) // <-- function definition
__swi_variadic_end(0x100, GBS_SendMessage, cepid, msg); // <-- swi number and fixed arguments for GCC
Macroses:
__swi_begin(swi_num)- macros for IAR support- swi_num - SWI number
__swi_end(swi_num, function_name, function_arguments)- macros for GCC support- swi_num - SWI number
- function_name - name of the function
- function_arguments - list of the function arguments in braces
()
__swi_variadic_begin(swi_num)- variadic function declaration start- swi_num - SWI number
__swi_variadic_end(swi_num, function_name, fixed_arguments...)- variadic function declaration end- swi_num - SWI number
- function_name - name of the function
- fixed_arguments - named arguments before
...