Philips Bluetooth QuickStart Kit GPS Receiver User Manual


 
Bluetooth QuickStart Kit Version 1.0 - User’s Guide Page 31
Copyright 2004-2005 © Embedded Artists AB
B Application Program Interface (API)
This appendix describes the QuickStart library API in detail. The description is divided into
functional sections. Please refer to appendix C for sample applications that illustrate how the
API can be used in practical applications.
B.1 Preemptive Real-Time Operating System API
B.1.1 Error Codes
OS_OK (0x00) - Operation completed successfully
OS_ERROR_NULL (0x01) - A NULL pointer was supplied as an argument that is
not allowed to be NULL.
OS_ERROR_ISR (0x02) - The operation is not allowed inside an interrupt service
routine.
OS_ERROR_SEM_OVERRUN (0x03) - The semaphore cannot be given since the
semaphore limit is already reached.
OS_ERROR_PID (0x04) - An illegal pid was supplied to the function.
OS_ERROR_ALLOCATE (0x05) - Out of process control blocks
OS_ERROR_STATE (0x06) - Trying to resume a process that is not suspended.
OS_ERROR_QUEUE_FULL (0x07) - The queue is full.
OS_ERROR_TIMEOUT (0x08) - The operation returned due to a timeout.
OS_ERROR_PRIO (0x09) - The priority level is out of range.
B.1.2 osSemInit
void osSemInit( tCntSem* pSem, tU8 initial )
This function initializes a counting semaphore and must be called before any other
function is used on the semaphore.
Parameters:
[in] pSem – A pointer to an allocated counting semaphore structure.
[in] initial – The initial counter value.
B.1.3 osSemTake
tBool osSemTake( tCntSem* pSem, tU32 timeout )
This function takes a counting semaphore, i.e. decreasing the semaphore counting. If the
semaphore counter is zero the function will block until another process or an ISR gives
the semaphore or a timeout occurs.
Parameters:
[in] pSem - A pointer to an initialized semaphore structure.
[in] timeout - After timeout ticks the operation will timeout. A timeout of zero
means no timeout at all.