From 140783ef66eef379feedcfef5403c5729d38936a Mon Sep 17 00:00:00 2001 From: Amaury Pouly Date: Sat, 13 Jul 2013 17:35:53 +0200 Subject: hwstub: split target specific code from the common part Completely rewrite the Mafile, properly put the usb driver in its own file and the target specific files in a subdirectory. Change-Id: Iaeee0128e021d5dad76b4d6035a63e33e2d946c1 --- utils/hwstub/stmp/logf.c | 68 ------------------------------------------------ 1 file changed, 68 deletions(-) delete mode 100644 utils/hwstub/stmp/logf.c (limited to 'utils/hwstub/stmp/logf.c') diff --git a/utils/hwstub/stmp/logf.c b/utils/hwstub/stmp/logf.c deleted file mode 100644 index 3ccc5c5e9f..0000000000 --- a/utils/hwstub/stmp/logf.c +++ /dev/null @@ -1,68 +0,0 @@ -/*************************************************************************** - * __________ __ ___. - * Open \______ \ ____ ____ | | _\_ |__ _______ ___ - * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / - * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < - * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ - * \/ \/ \/ \/ \/ - * $Id$ - * - * Copyright (C) 2012 by Amaury Pouly - * - * 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 2 - * of the License, or (at your option) any later version. - * - * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY - * KIND, either express or implied. - * - ****************************************************************************/ -#include "config.h" -#include "logf.h" -#include "format.h" -#include "string.h" - -static unsigned char logfbuffer[MAX_LOGF_SIZE]; -static int logfread = 0; -static int logfwrite = 0; -static int logfen = true; - -void enable_logf(bool en) -{ - logfen = en; -} - -static int logf_push(void *userp, unsigned char c) -{ - (void)userp; - - logfbuffer[logfwrite++] = c; - if(logfwrite == MAX_LOGF_SIZE) - logfwrite = 0; - return true; -} - -void logf(const char *fmt, ...) -{ - if(!logfen) return; - va_list ap; - va_start(ap, fmt); - vuprintf(logf_push, NULL, fmt, ap); - va_end(ap); -} - -size_t logf_readback(char *buf, size_t max_size) -{ - if(logfread == logfwrite) - return 0; - if(logfread < logfwrite) - max_size = MIN(max_size, (size_t)(logfwrite - logfread)); - else - max_size = MIN(max_size, (size_t)(MAX_LOGF_SIZE - logfread)); - memcpy(buf, &logfbuffer[logfread], max_size); - logfread += max_size; - if(logfread == MAX_LOGF_SIZE) - logfread = 0; - return max_size; -} -- cgit v1.2.3