/******************************************************************************* * Project : shakti devt board * Name of the file : util.c * Brief Description of file : src file for util * Name of Author : Sathya Narayanan N * Email ID : sathya281@gmail.com Copyright (C) 2019 IIT Madras. All rights reserved. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . *********************************************************************************/ /** @file util.c @brief source file for util @detail Commonly used utility fuctions are implemented here. These functions are used to achieve higher level objectives. */ #include "log.h" #include "utils.h" #include "string.h" /** @fn void waitfor(unsigned int secs) * @brief stall the process for given time * @param unsigned int secs */ void waitfor(unsigned int secs) { unsigned int time = 0; while (time++ < secs); } /** @fn void delay(unsigned long count) * @brief sleeps for number of "count" * @param unsigned long (number of count) */ void delay(unsigned long count) { unsigned long cntr1 = count *1000; unsigned long tmpCntr; while (cntr1--){ tmpCntr = 1000; while (tmpCntr--); } } /** @fn float pow_10(unsigned int y) * @brief generate different powers of 10 * @param unsigned int y * @return return result in float */ float pow_10(unsigned int y) { unsigned int x=1; for (unsigned int i=0; i