123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- #include "hw.h"
- #include "user_settings.h"
- #include <stdio.h>
- void __assert(const char *__expression, const char *__filename, int __line)
- {
- printf("Assert: %s, File %s (%d)\n", __expression, __filename, __line);
- }
- unsigned long ksdk_time(unsigned long* timer)
- {
- (void)timer;
- return hw_get_time_sec();
- }
- unsigned int LowResTimer(void)
- {
- return hw_get_time_sec();
- }
- double current_time(int reset)
- {
- double time;
- (void)reset;
- time = hw_get_time_sec();
- time += (double)hw_get_time_msec() / 1000;
- return time;
- }
- unsigned int custom_rand_generate(void)
- {
- return hw_rand();
- }
- int custom_rand_generate_block(unsigned char* output, unsigned int sz)
- {
- uint32_t i = 0;
- while (i < sz)
- {
-
- if( (i + sizeof(CUSTOM_RAND_TYPE)) > sz ||
- ((uint32_t)&output[i] % sizeof(CUSTOM_RAND_TYPE)) != 0
- ) {
-
- output[i++] = (unsigned char)custom_rand_generate();
- }
- else {
-
- *((CUSTOM_RAND_TYPE*)&output[i]) = custom_rand_generate();
- i += sizeof(CUSTOM_RAND_TYPE);
- }
- }
- return 0;
- }
- int __putchar(int c, __printf_tag_ptr ctx)
- {
- hw_uart_printchar(c);
- }
- int __write(int __fildes, const unsigned char *__buf, unsigned __len)
- {
- (void)__fildes;
- for (unsigned i = 0; i < __len; i++) {
- hw_uart_printchar((int)__buf[i]);
- }
- }
- extern unsigned char __stack_process_start__[];
- unsigned char * __aeabi_read_tp(void)
- {
-
-
- return (__stack_process_start__);
- }
- void __heap_lock(void)
- {
- }
- void __heap_unlock(void)
- {
- }
- void __printf_lock(void)
- {
- }
- void __printf_unlock(void)
- {
- }
- void __scanf_lock(void)
- {
- }
- void __scanf_unlock(void)
- {
- }
- void __debug_io_lock(void)
- {
- }
- void __debug_io_unlock(void)
- {
- }
|