Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#pragma once

#include "cpu_id.h"
#include <stdint.h>

void cpu0_set_core_id(void);
void cpu1_set_core_id(void);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#ifndef _AUDIO_MEM_H_
#define _AUDIO_MEM_H_

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "includes.h"
#include "utils/os.h"
#include <components/system.h>
#include <sys/types.h>
#ifdef IEEE8021X_EAPOL
#include "xfile.h"
#endif
Expand Down
98 changes: 49 additions & 49 deletions tuyaos/tuyaos_adapter/src/misc/bk_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -111,54 +111,54 @@ void _fini(void) {
#define NANOSECONDS_PER_SECOND ( 1000000000LL ) /**< Nanoseconds per second. */
#define NANOSECONDS_PER_TICK ( NANOSECONDS_PER_SECOND / configTICK_RATE_HZ ) /**< Nanoseconds per FreeRTOS tick. */

static void UTILS_NanosecondsToTimespec( int64_t llSource,
struct timespec * const pxDestination )
{
long lCarrySec = 0;

/* Convert to timespec. */
pxDestination->tv_sec = ( time_t ) ( llSource / NANOSECONDS_PER_SECOND );
pxDestination->tv_nsec = ( long ) ( llSource % NANOSECONDS_PER_SECOND );

/* Subtract from tv_sec if tv_nsec < 0. */
if( pxDestination->tv_nsec < 0L )
{
/* Compute the number of seconds to carry. */
lCarrySec = ( pxDestination->tv_nsec / ( long ) NANOSECONDS_PER_SECOND ) + 1L;

pxDestination->tv_sec -= ( time_t ) ( lCarrySec );
pxDestination->tv_nsec += lCarrySec * ( long ) NANOSECONDS_PER_SECOND;
}
}

int clock_gettime( clockid_t clock_id,
struct timespec * tp )
{
TimeOut_t xCurrentTime = { 0 };

/* Intermediate variable used to convert TimeOut_t to struct timespec.
* Also used to detect overflow issues. It must be unsigned because the
* behavior of signed integer overflow is undefined. */
uint64_t ullTickCount = 0ULL;

/* Silence warnings about unused parameters. */
( void ) clock_id;

/* Get the current tick count and overflow count. vTaskSetTimeOutState()
* is used to get these values because they are both static in tasks.c. */
vTaskSetTimeOutState( &xCurrentTime );

/* Adjust the tick count for the number of times a TickType_t has overflowed.
* portMAX_DELAY should be the maximum value of a TickType_t. */
ullTickCount = ( uint64_t ) ( xCurrentTime.xOverflowCount ) << ( sizeof( TickType_t ) * 8 );

/* Add the current tick count. */
ullTickCount += xCurrentTime.xTimeOnEntering;

/* Convert ullTickCount to timespec. */
UTILS_NanosecondsToTimespec( ( int64_t ) ullTickCount * NANOSECONDS_PER_TICK, tp );

return 0;
}
// static void UTILS_NanosecondsToTimespec( int64_t llSource,
// struct timespec * const pxDestination )
// {
// long lCarrySec = 0;

// /* Convert to timespec. */
// pxDestination->tv_sec = ( time_t ) ( llSource / NANOSECONDS_PER_SECOND );
// pxDestination->tv_nsec = ( long ) ( llSource % NANOSECONDS_PER_SECOND );

// /* Subtract from tv_sec if tv_nsec < 0. */
// if( pxDestination->tv_nsec < 0L )
// {
// /* Compute the number of seconds to carry. */
// lCarrySec = ( pxDestination->tv_nsec / ( long ) NANOSECONDS_PER_SECOND ) + 1L;

// pxDestination->tv_sec -= ( time_t ) ( lCarrySec );
// pxDestination->tv_nsec += lCarrySec * ( long ) NANOSECONDS_PER_SECOND;
// }
// }

// int clock_gettime( clockid_t clock_id,
// struct timespec * tp )
// {
// TimeOut_t xCurrentTime = { 0 };

// /* Intermediate variable used to convert TimeOut_t to struct timespec.
// * Also used to detect overflow issues. It must be unsigned because the
// * behavior of signed integer overflow is undefined. */
// uint64_t ullTickCount = 0ULL;

// /* Silence warnings about unused parameters. */
// ( void ) clock_id;

// /* Get the current tick count and overflow count. vTaskSetTimeOutState()
// * is used to get these values because they are both static in tasks.c. */
// vTaskSetTimeOutState( &xCurrentTime );

// /* Adjust the tick count for the number of times a TickType_t has overflowed.
// * portMAX_DELAY should be the maximum value of a TickType_t. */
// ullTickCount = ( uint64_t ) ( xCurrentTime.xOverflowCount ) << ( sizeof( TickType_t ) * 8 );

// /* Add the current tick count. */
// ullTickCount += xCurrentTime.xTimeOnEntering;

// /* Convert ullTickCount to timespec. */
// UTILS_NanosecondsToTimespec( ( int64_t ) ullTickCount * NANOSECONDS_PER_TICK, tp );

// return 0;
// }


1 change: 1 addition & 0 deletions tuyaos/tuyaos_adapter/src/misc/encrypt.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>

#ifndef TRUE
#define TRUE 1
Expand Down