summaryrefslogtreecommitdiffstats
path: root/libsensors_iio/software/core/mllite/linux/mlos_linux.c
diff options
context:
space:
mode:
authorRamanan Rajeswaran <ramanan@google.com>2012-09-26 14:24:48 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-09-26 14:24:48 -0700
commit64ca18f95225d0a86f7ccfd1d21c23971b9f77ae (patch)
treed00916dda47dd39f3d625c834e2f2e04782559f1 /libsensors_iio/software/core/mllite/linux/mlos_linux.c
parent6a4d9a48ffde124c498496f6dae1e77c2cae6864 (diff)
downloadandroid_hardware_invensense-64ca18f95225d0a86f7ccfd1d21c23971b9f77ae.tar.gz
android_hardware_invensense-64ca18f95225d0a86f7ccfd1d21c23971b9f77ae.tar.bz2
android_hardware_invensense-64ca18f95225d0a86f7ccfd1d21c23971b9f77ae.zip
Revert "Official MA 5.1.2 - RC11 Release"
This reverts commit 6a4d9a48ffde124c498496f6dae1e77c2cae6864 Change-Id: I85c4b326a2adf930fcd4a64e4c4f36e99f4fa4cb
Diffstat (limited to 'libsensors_iio/software/core/mllite/linux/mlos_linux.c')
-rw-r--r--libsensors_iio/software/core/mllite/linux/mlos_linux.c54
1 files changed, 29 insertions, 25 deletions
diff --git a/libsensors_iio/software/core/mllite/linux/mlos_linux.c b/libsensors_iio/software/core/mllite/linux/mlos_linux.c
index 5424508..75f062e 100644
--- a/libsensors_iio/software/core/mllite/linux/mlos_linux.c
+++ b/libsensors_iio/software/core/mllite/linux/mlos_linux.c
@@ -1,14 +1,13 @@
/*
$License:
- Copyright (C) 2012 InvenSense Corporation, All Rights Reserved.
+ Copyright (C) 2011 InvenSense Corporation, All Rights Reserved.
$
*/
-
/*******************************************************************************
*
* $Id: mlos_linux.c 5629 2011-06-11 03:13:08Z mcaramello $
*
- ******************************************************************************/
+ *******************************************************************************/
/**
* @defgroup MLOS
@@ -17,7 +16,7 @@
* @{
* @file mlos.c
* @brief OS Interface.
- */
+**/
/* ------------- */
/* - Includes. - */
@@ -27,10 +26,11 @@
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
-#include <errno.h>
#include "stdint_invensense.h"
+
#include "mlos.h"
+#include <errno.h>
/* -------------- */
@@ -39,14 +39,14 @@
/**
* @brief Allocate space
- * @param num_bytes number of bytes
+ * @param numBytes number of bytes
* @return pointer to allocated space
- */
-void *inv_malloc(unsigned int num_bytes)
+**/
+void *inv_malloc(unsigned int numBytes)
{
// Allocate space.
- void *alloc_ptr = malloc(num_bytes);
- return alloc_ptr;
+ void *allocPtr = malloc(numBytes);
+ return allocPtr;
}
@@ -54,11 +54,12 @@ void *inv_malloc(unsigned int num_bytes)
* @brief Free allocated space
* @param ptr pointer to space to deallocate
* @return error code.
- */
+**/
inv_error_t inv_free(void *ptr)
{
- if (ptr)
- free(ptr);
+ // Deallocate space.
+ free(ptr);
+
return INV_SUCCESS;
}
@@ -95,10 +96,10 @@ inv_error_t inv_create_mutex(HANDLE *mutex)
inv_error_t inv_lock_mutex(HANDLE mutex)
{
int res;
- pthread_mutex_t *pm = (pthread_mutex_t *)mutex;
+ pthread_mutex_t *pm = (pthread_mutex_t*)mutex;
res = pthread_mutex_lock(pm);
- if(res == -1)
+ if(res == -1)
return INV_ERROR_OS_LOCK_FAILED;
return INV_SUCCESS;
@@ -109,11 +110,11 @@ inv_error_t inv_lock_mutex(HANDLE mutex)
* @brief Mutex unlock function
* @param mutex mutex handle
* @return error code.
- */
+**/
inv_error_t inv_unlock_mutex(HANDLE mutex)
{
int res;
- pthread_mutex_t *pm = (pthread_mutex_t *)mutex;
+ pthread_mutex_t *pm = (pthread_mutex_t*)mutex;
res = pthread_mutex_unlock(pm);
if(res == -1)
@@ -130,7 +131,7 @@ inv_error_t inv_unlock_mutex(HANDLE mutex)
*/
FILE *inv_fopen(char *filename)
{
- FILE *fp = fopen(filename, "r");
+ FILE *fp = fopen(filename,"r");
return fp;
}
@@ -153,21 +154,22 @@ void inv_fclose(FILE *fp)
inv_error_t inv_destroy_mutex(HANDLE handle)
{
int error;
- pthread_mutex_t *pm = (pthread_mutex_t *)handle;
+ pthread_mutex_t *pm = (pthread_mutex_t*)handle;
error = pthread_mutex_destroy(pm);
- if (error)
+ if (error) {
return errno;
+ }
free((void*) handle);
-
+
return INV_SUCCESS;}
/**
* @brief Sleep function.
*/
-void inv_sleep(int m_secs)
+void inv_sleep(int mSecs)
{
- usleep(m_secs * 1000);
+ usleep(mSecs*1000);
}
@@ -180,11 +182,13 @@ unsigned long inv_get_tick_count()
{
struct timeval tv;
- if (gettimeofday(&tv, NULL) != 0)
+ if (gettimeofday(&tv, NULL) !=0)
return 0;
return (long)((tv.tv_sec * 1000000LL + tv.tv_usec) / 1000LL);
}
-/** @} */
+ /**********************/
+ /** @} */ /* defgroup */
+/**********************/