diff options
Diffstat (limited to 'api/user.c')
-rw-r--r-- | api/user.c | 142 |
1 files changed, 142 insertions, 0 deletions
diff --git a/api/user.c b/api/user.c new file mode 100644 index 0000000..e266f45 --- /dev/null +++ b/api/user.c @@ -0,0 +1,142 @@ +#include "user.h" +#include <linux/delay.h> //for Linux mdelay +//#include <unistd.h> + + +/** + * Variable of critical section + */ + +Dword User_memoryCopy ( + IN Demodulator* demodulator, + IN void* dest, + IN void* src, + IN Dword count +) { + /* + * ToDo: Add code here + * + * //Pseudo code + * memcpy(dest, src, (size_t)count); + * return (0); + */ + return (Error_NO_ERROR); +} + +Dword User_delay ( + IN Demodulator* demodulator, + IN Dword dwMs +) { + /* + * ToDo: Add code here + * + * //Pseudo code + * delay(dwMs); + * return (0); + */ + mdelay(dwMs); // for Linux + //sleep(dwMs); + return (Error_NO_ERROR); +} + + +Dword User_enterCriticalSection ( + IN Demodulator* demodulator +) { + /* + * ToDo: Add code here + * + * //Pseudo code + * return (0); + */ + return (Error_NO_ERROR); +} + + +Dword User_leaveCriticalSection ( + IN Demodulator* demodulator +) { + /* + * ToDo: Add code here + * + * //Pseudo code + * return (0); + */ + return (Error_NO_ERROR); +} + + +Dword User_mpegConfig ( + IN Demodulator* demodulator +) { + /* + * ToDo: Add code here + * + */ + return (Error_NO_ERROR); +} + + +Dword User_busTx ( + IN Demodulator* demodulator, + IN Dword bufferLength, + IN Byte* buffer +) { + /* + * ToDo: Add code here + * + * //Pseudo code + * short i; + * + * start(); + * write_i2c(uc2WireAddr); + * ack(); + * for (i = 0; i < bufferLength; i++) { + * write_i2c(*(ucpBuffer + i)); + * ack(); + * } + * stop(); + * + * // If no error happened return 0, else return error code. + * return (0); + */ + return (Error_NO_ERROR); +} + + +Dword User_busRx ( + IN Demodulator* demodulator, + IN Dword bufferLength, + OUT Byte* buffer +) { + /* + * ToDo: Add code here + * + * //Pseudo code + * short i; + * + * start(); + * write_i2c(uc2WireAddr | 0x01); + * ack(); + * for (i = 0; i < bufferLength - 1; i++) { + * read_i2c(*(ucpBuffer + i)); + * ack(); + * } + * read_i2c(*(ucpBuffer + bufferLength - 1)); + * nack(); + * stop(); + * + * // If no error happened return 0, else return error code. + * return (0); + */ + return (Error_NO_ERROR); +} + + +Dword User_busRxData ( + IN Demodulator* demodulator, + IN Dword bufferLength, + OUT Byte* buffer +) { + return (Error_NO_ERROR); +} |