aboutsummaryrefslogtreecommitdiff
path: root/cc3200/util
diff options
context:
space:
mode:
authorDamien George2017-09-06 13:40:51 +1000
committerDamien George2017-09-06 13:40:51 +1000
commit01dd7804b87d60b2deab16712eccb3b97351a9b7 (patch)
tree1aa21f38a872b8e62a3d4e4f74f68033c6f827e4 /cc3200/util
parenta9862b30068fc9df1022f08019fb35aaa5085f64 (diff)
ports: Make new ports/ sub-directory and move all ports there.
This is to keep the top-level directory clean, to make it clear what is core and what is a port, and to allow the repository to grow with new ports in a sustainable way.
Diffstat (limited to 'cc3200/util')
-rw-r--r--cc3200/util/cryptohash.c76
-rw-r--r--cc3200/util/cryptohash.h37
-rw-r--r--cc3200/util/fifo.c126
-rw-r--r--cc3200/util/fifo.h49
-rw-r--r--cc3200/util/gccollect.c60
-rw-r--r--cc3200/util/gccollect.h45
-rw-r--r--cc3200/util/gchelper.h33
-rw-r--r--cc3200/util/gchelper.s41
-rw-r--r--cc3200/util/random.c109
-rw-r--r--cc3200/util/random.h34
-rw-r--r--cc3200/util/sleeprestore.h32
-rw-r--r--cc3200/util/sleeprestore.s61
-rw-r--r--cc3200/util/socketfifo.c106
-rw-r--r--cc3200/util/socketfifo.h62
14 files changed, 0 insertions, 871 deletions
diff --git a/cc3200/util/cryptohash.c b/cc3200/util/cryptohash.c
deleted file mode 100644
index 909dadc8c..000000000
--- a/cc3200/util/cryptohash.c
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include "inc/hw_types.h"
-#include "inc/hw_ints.h"
-#include "inc/hw_nvic.h"
-#include "inc/hw_shamd5.h"
-#include "inc/hw_dthe.h"
-#include "hw_memmap.h"
-#include "rom_map.h"
-#include "prcm.h"
-#include "shamd5.h"
-#include "cryptohash.h"
-
-
-/******************************************************************************
- DEFINE PUBLIC FUNCTIONS
- ******************************************************************************/
-void CRYPTOHASH_Init (void) {
- // Enable the Data Hashing and Transform Engine
- MAP_PRCMPeripheralClkEnable(PRCM_DTHE, PRCM_RUN_MODE_CLK | PRCM_SLP_MODE_CLK);
- MAP_PRCMPeripheralReset(PRCM_DTHE);
-}
-
-void CRYPTOHASH_SHAMD5Start (uint32_t algo, uint32_t blocklen) {
- // wait until the context is ready
- while ((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_CONTEXT_READY) == 0);
-
- // Configure the SHA/MD5 module algorithm
- MAP_SHAMD5ConfigSet(SHAMD5_BASE, algo);
-
- // if not a multiple of 64 bytes, close the hash
- if (blocklen % 64) {
- HWREG(SHAMD5_BASE + SHAMD5_O_MODE) |= SHAMD5_MODE_CLOSE_HASH;
- }
-
- // set the lenght
- HWREG(SHAMD5_BASE + SHAMD5_O_LENGTH) = blocklen;
-}
-
-void CRYPTOHASH_SHAMD5Update (uint8_t *data, uint32_t datalen) {
- // write the data
- SHAMD5DataWriteMultiple(data, datalen);
-}
-
-void CRYPTOHASH_SHAMD5Read (uint8_t *hash) {
- // wait for the output to be ready
- while((HWREG(SHAMD5_BASE + SHAMD5_O_IRQSTATUS) & SHAMD5_INT_OUTPUT_READY) == 0);
- // read the result
- MAP_SHAMD5ResultRead(SHAMD5_BASE, hash);
-}
diff --git a/cc3200/util/cryptohash.h b/cc3200/util/cryptohash.h
deleted file mode 100644
index 15d46b705..000000000
--- a/cc3200/util/cryptohash.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
-#define MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
-
-/******************************************************************************
- DECLARE PUBLIC FUNCTIONS
- ******************************************************************************/
-extern void CRYPTOHASH_Init (void);
-extern void CRYPTOHASH_SHAMD5Start (uint32_t algo, uint32_t blocklen);
-extern void CRYPTOHASH_SHAMD5Update (uint8_t *data, uint32_t datalen);
-extern void CRYPTOHASH_SHAMD5Read (uint8_t *hash);
-
-#endif // MICROPY_INCLUDED_CC3200_UTIL_CRYPTOHASH_H
diff --git a/cc3200/util/fifo.c b/cc3200/util/fifo.c
deleted file mode 100644
index 421f83710..000000000
--- a/cc3200/util/fifo.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "fifo.h"
-
-
-/******************************************************************************
- DEFINE PUBLIC FUNCTIONS
- ******************************************************************************/
-void FIFO_Init (FIFO_t *fifo, unsigned int uiElementsMax,
- void (*pfElmentPush)(void * const pvFifo, const void * const pvElement),
- void (*pfElementPop)(void * const pvFifo, void * const pvElement)) {
- if (fifo) {
- fifo->uiFirst = 0;
- fifo->uiLast = uiElementsMax - 1;
- fifo->uiElementCount = 0;
- fifo->uiElementsMax = uiElementsMax;
- fifo->pfElementPush = pfElmentPush;
- fifo->pfElementPop = pfElementPop;
- }
-}
-
-bool FIFO_bPushElement (FIFO_t *fifo, const void * const pvElement) {
- if (!fifo) {
- return false;
- }
- // Check if the queue is full
- if (true == FIFO_IsFull (fifo)) {
- return false;
- }
-
- // Increment the element count
- if (fifo->uiElementsMax > fifo->uiElementCount) {
- fifo->uiElementCount++;
- }
- fifo->uiLast++;
- if (fifo->uiLast == fifo->uiElementsMax) {
- fifo->uiLast = 0;
- }
- // Insert the element into the queue
- fifo->pfElementPush(fifo, pvElement);
- return true;
-}
-
-bool FIFO_bPopElement (FIFO_t *fifo, void * const pvElement) {
- if (!fifo) {
- return false;
- }
- // Check if the queue is empty
- if (true == FIFO_IsEmpty (fifo)) {
- return false;
- }
-
- // Get the element from the queue
- fifo->pfElementPop(fifo, pvElement);
- // Decrement the element count
- if (fifo->uiElementCount > 0) {
- fifo->uiElementCount--;
- }
- fifo->uiFirst++;
- if (fifo->uiFirst == fifo->uiElementsMax) {
- fifo->uiFirst = 0;
- }
- return true;
-}
-
-bool FIFO_bPeekElement (FIFO_t *fifo, void * const pvElement) {
- if (!fifo) {
- return false;
- }
- // Check if the queue is empty
- if (true == FIFO_IsEmpty (fifo)) {
- return false;
- }
- // Get the element from the queue
- fifo->pfElementPop(fifo, pvElement);
- return true;
-}
-
-bool FIFO_IsEmpty (FIFO_t *fifo) {
- if (fifo) {
- return ((fifo->uiElementCount == 0) ? true : false);
- }
- return false;
-}
-
-bool FIFO_IsFull (FIFO_t *fifo) {
- if (fifo) {
- return ((fifo->uiElementCount < fifo->uiElementsMax) ? false : true);
- }
- return false;
-}
-
-void FIFO_Flush (FIFO_t *fifo) {
- if (fifo) {
- fifo->uiElementCount = 0;
- fifo->uiFirst = 0;
- fifo->uiLast = fifo->uiElementsMax - 1;
- }
-}
diff --git a/cc3200/util/fifo.h b/cc3200/util/fifo.h
deleted file mode 100644
index 6ede57e1e..000000000
--- a/cc3200/util/fifo.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
-#define MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
-
-typedef struct {
- void *pvElements;
- unsigned int uiElementCount;
- unsigned int uiElementsMax;
- unsigned int uiFirst;
- unsigned int uiLast;
- void (*pfElementPush)(void * const pvFifo, const void * const pvElement);
- void (*pfElementPop)(void * const pvFifo, void * const pvElement);
-}FIFO_t;
-
-extern void FIFO_Init (FIFO_t *fifo, unsigned int uiElementsMax,
-void (*pfElmentPush)(void * const pvFifo, const void * const pvElement),
-void (*pfElementPop)(void * const pvFifo, void * const pvElement));
-extern bool FIFO_bPushElement (FIFO_t *fifo, const void * const pvElement);
-extern bool FIFO_bPopElement (FIFO_t *fifo, void * const pvElement);
-extern bool FIFO_bPeekElement (FIFO_t *fifo, void * const pvElement);
-extern bool FIFO_IsEmpty (FIFO_t *fifo);
-extern bool FIFO_IsFull (FIFO_t *fifo);
-extern void FIFO_Flush (FIFO_t *fifo);
-
-#endif // MICROPY_INCLUDED_CC3200_UTIL_FIFO_H
diff --git a/cc3200/util/gccollect.c b/cc3200/util/gccollect.c
deleted file mode 100644
index baee2eeef..000000000
--- a/cc3200/util/gccollect.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdio.h>
-#include <stdint.h>
-
-#include "py/mpconfig.h"
-#include "py/mpstate.h"
-#include "py/gc.h"
-#include "py/mpthread.h"
-#include "gccollect.h"
-#include "gchelper.h"
-
-/******************************************************************************
-DECLARE PUBLIC FUNCTIONS
- ******************************************************************************/
-
-void gc_collect(void) {
- // start the GC
- gc_collect_start();
-
- // get the registers and the sp
- mp_uint_t regs[10];
- mp_uint_t sp = gc_helper_get_regs_and_sp(regs);
-
- // trace the stack, including the registers (since they live on the stack in this function)
- gc_collect_root((void**)sp, ((mp_uint_t)MP_STATE_THREAD(stack_top) - sp) / sizeof(uint32_t));
-
- // trace root pointers from any threads
- #if MICROPY_PY_THREAD
- mp_thread_gc_others();
- #endif
-
- // end the GC
- gc_collect_end();
-}
diff --git a/cc3200/util/gccollect.h b/cc3200/util/gccollect.h
deleted file mode 100644
index 08d43d283..000000000
--- a/cc3200/util/gccollect.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
-#define MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
-
-// variables defining memory layout
-extern uint32_t _etext;
-extern uint32_t _data;
-extern uint32_t _edata;
-extern uint32_t _boot;
-extern uint32_t _eboot;
-extern uint32_t _bss;
-extern uint32_t _ebss;
-extern uint32_t _heap;
-extern uint32_t _eheap;
-extern uint32_t _stack;
-extern uint32_t _estack;
-
-void gc_collect(void);
-
-#endif // MICROPY_INCLUDED_CC3200_UTIL_GCCOLLECT_H
diff --git a/cc3200/util/gchelper.h b/cc3200/util/gchelper.h
deleted file mode 100644
index 48e81bc61..000000000
--- a/cc3200/util/gchelper.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2013, 2014 Damien P. George
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
-#define MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
-
-extern mp_uint_t gc_helper_get_sp(void);
-extern mp_uint_t gc_helper_get_regs_and_sp(mp_uint_t *regs);
-
-#endif // MICROPY_INCLUDED_CC3200_UTIL_GCHELPER_H
diff --git a/cc3200/util/gchelper.s b/cc3200/util/gchelper.s
deleted file mode 100644
index aa8fb499e..000000000
--- a/cc3200/util/gchelper.s
+++ /dev/null
@@ -1,41 +0,0 @@
- .syntax unified
- .cpu cortex-m4
- .thumb
- .text
- .align 2
-
-
-
-@ uint gc_helper_get_sp(void)
- .global gc_helper_get_sp
- .thumb
- .thumb_func
- .type gc_helper_get_sp, %function
-gc_helper_get_sp:
- @ return the sp
- mov r0, sp
- bx lr
-
-
-
-@ uint gc_helper_get_regs_and_sp(r0=uint regs[10])
- .global gc_helper_get_regs_and_sp
- .thumb
- .thumb_func
- .type gc_helper_get_regs_and_sp, %function
-gc_helper_get_regs_and_sp:
- @ store registers into given array
- str r4, [r0], #4
- str r5, [r0], #4
- str r6, [r0], #4
- str r7, [r0], #4
- str r8, [r0], #4
- str r9, [r0], #4
- str r10, [r0], #4
- str r11, [r0], #4
- str r12, [r0], #4
- str r13, [r0], #4
-
- @ return the sp
- mov r0, sp
- bx lr
diff --git a/cc3200/util/random.c b/cc3200/util/random.c
deleted file mode 100644
index f8e9cdf0c..000000000
--- a/cc3200/util/random.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-
-#include "py/obj.h"
-#include "inc/hw_types.h"
-#include "inc/hw_ints.h"
-#include "inc/hw_memmap.h"
-#include "rom_map.h"
-#include "pybrtc.h"
-#include "simplelink.h"
-#include "modnetwork.h"
-#include "modwlan.h"
-#include "random.h"
-#include "debug.h"
-
-/******************************************************************************
-* LOCAL TYPES
-******************************************************************************/
-typedef union _rng_id_t {
- uint32_t id32;
- uint16_t id16[3];
- uint8_t id8[6];
-} rng_id_t;
-
-/******************************************************************************
-* LOCAL VARIABLES
-******************************************************************************/
-static uint32_t s_seed;
-
-/******************************************************************************
-* LOCAL FUNCTION DECLARATIONS
-******************************************************************************/
-STATIC uint32_t lfsr (uint32_t input);
-
-/******************************************************************************
-* PRIVATE FUNCTIONS
-******************************************************************************/
-STATIC uint32_t lfsr (uint32_t input) {
- assert( input != 0 );
- return (input >> 1) ^ (-(input & 0x01) & 0x00E10000);
-}
-
-/******************************************************************************/
-// MicroPython bindings;
-
-STATIC mp_obj_t machine_rng_get(void) {
- return mp_obj_new_int(rng_get());
-}
-MP_DEFINE_CONST_FUN_OBJ_0(machine_rng_get_obj, machine_rng_get);
-
-/******************************************************************************
-* PUBLIC FUNCTIONS
-******************************************************************************/
-void rng_init0 (void) {
- rng_id_t juggler;
- uint32_t seconds;
- uint16_t mseconds;
-
- // get the seconds and the milliseconds from the RTC
- pyb_rtc_get_time(&seconds, &mseconds);
-
- wlan_get_mac (juggler.id8);
-
- // flatten the 48-bit board identification to 24 bits
- juggler.id16[0] ^= juggler.id16[2];
-
- juggler.id8[0] ^= juggler.id8[3];
- juggler.id8[1] ^= juggler.id8[4];
- juggler.id8[2] ^= juggler.id8[5];
-
- s_seed = juggler.id32 & 0x00FFFFFF;
- s_seed += (seconds & 0x000FFFFF) + mseconds;
-
- // the seed must not be zero
- if (s_seed == 0) {
- s_seed = 1;
- }
-}
-
-uint32_t rng_get (void) {
- s_seed = lfsr( s_seed );
- return s_seed;
-}
diff --git a/cc3200/util/random.h b/cc3200/util/random.h
deleted file mode 100644
index 02cde6b52..000000000
--- a/cc3200/util/random.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
-#define MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
-
-void rng_init0 (void);
-uint32_t rng_get (void);
-
-MP_DECLARE_CONST_FUN_OBJ_0(machine_rng_get_obj);
-
-#endif // MICROPY_INCLUDED_CC3200_UTIL_RANDOM_H
diff --git a/cc3200/util/sleeprestore.h b/cc3200/util/sleeprestore.h
deleted file mode 100644
index e178f4c2d..000000000
--- a/cc3200/util/sleeprestore.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
-#define MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
-
-extern void sleep_store(void);
-extern void sleep_restore(void);
-
-#endif // MICROPY_INCLUDED_CC3200_UTIL_SLEEPRESTORE_H
diff --git a/cc3200/util/sleeprestore.s b/cc3200/util/sleeprestore.s
deleted file mode 100644
index c7b0c7da2..000000000
--- a/cc3200/util/sleeprestore.s
+++ /dev/null
@@ -1,61 +0,0 @@
- .syntax unified
- .cpu cortex-m4
- .thumb
- .text
- .align 2
-
-@ global variable with the backup registers
- .extern vault_arm_registers
-@ global function that performs the wake up actions
- .extern pyb_sleep_suspend_exit
-
-@ uint sleep_store(void)
- .global sleep_store
- .thumb
- .thumb_func
- .type sleep_store, %function
-sleep_store:
- dsb
- isb
- push {r0-r12, lr}
- ldr r1, =vault_arm_registers
- mrs r0, msp
- str r0, [r1]
- mrs r0, psp
- str r0, [r1, #4]
- mrs r0, primask
- str r0, [r1, #12]
- mrs r0, faultmask
- str r0, [r1, #16]
- mrs r0, basepri
- str r0, [r1, #20]
- mrs r0, control
- str r0, [r1, #24]
- dsb
- isb
- bx lr
-
-@ uint sleep_restore(void)
- .global sleep_restore
- .thumb
- .thumb_func
- .type sleep_restore, %function
-sleep_restore:
- dsb
- isb
- mrs r0, msp
- msr psp, r0
- ldr r1, =vault_arm_registers
- ldr r0, [r1, #24]
- msr control, r0
- ldr r0, [r1]
- msr msp, r0
- ldr r0, [r1, #12]
- msr primask, r0
- ldr r0, [r1, #16]
- msr faultmask, r0
- ldr r0, [r1, #20]
- msr basepri, r0
- dsb
- isb
- bl pyb_sleep_suspend_exit
diff --git a/cc3200/util/socketfifo.c b/cc3200/util/socketfifo.c
deleted file mode 100644
index d0a715048..000000000
--- a/cc3200/util/socketfifo.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include <stdint.h>
-#include <stdbool.h>
-#include <string.h>
-
-#include "osi.h"
-#include "fifo.h"
-#include "socketfifo.h"
-
-
-/*----------------------------------------------------------------------------
- ** Declare private functions
- */
-static void socketfifo_Push (void * const pvFifo, const void * const pvElement);
-static void socketfifo_Pop (void * const pvFifo, void * const pvElement);
-
-/*----------------------------------------------------------------------------
- ** Declare private data
- */
-static FIFO_t *socketfifo;
-
-/*----------------------------------------------------------------------------
- ** Define public functions
- */
-void SOCKETFIFO_Init (FIFO_t *fifo, void *elements, uint32_t maxcount) {
- // Initialize global data
- socketfifo = fifo;
- socketfifo->pvElements = elements;
- FIFO_Init (socketfifo, maxcount, socketfifo_Push, socketfifo_Pop);
-}
-
-bool SOCKETFIFO_Push (const void * const element) {
- return FIFO_bPushElement (socketfifo, element);
-}
-
-bool SOCKETFIFO_Pop (void * const element) {
- return FIFO_bPopElement (socketfifo, element);
-}
-
-bool SOCKETFIFO_Peek (void * const element) {
- return FIFO_bPeekElement (socketfifo, element);
-}
-
-bool SOCKETFIFO_IsEmpty (void) {
- return FIFO_IsEmpty (socketfifo);
-}
-
-bool SOCKETFIFO_IsFull (void) {
- return FIFO_IsFull (socketfifo);
-}
-
-void SOCKETFIFO_Flush (void) {
- SocketFifoElement_t element;
- while (SOCKETFIFO_Pop(&element)) {
- if (element.freedata) {
- mem_Free(element.data);
- }
- }
-}
-
-unsigned int SOCKETFIFO_Count (void) {
- return socketfifo->uiElementCount;
-}
-
-/*----------------------------------------------------------------------------
- ** Define private functions
- */
-static void socketfifo_Push (void * const pvFifo, const void * const pvElement) {
- if ((pvFifo != NULL) && (NULL != pvElement)) {
- unsigned int uiLast = ((FIFO_t *)pvFifo)->uiLast;
- memcpy (&((SocketFifoElement_t *)((FIFO_t *)pvFifo)->pvElements)[uiLast], pvElement, sizeof(SocketFifoElement_t));
- }
-}
-
-static void socketfifo_Pop (void * const pvFifo, void * const pvElement) {
- if ((pvFifo != NULL) && (NULL != pvElement)) {
- unsigned int uiFirst = ((FIFO_t *)pvFifo)->uiFirst;
- memcpy (pvElement, &((SocketFifoElement_t *)((FIFO_t *)pvFifo)->pvElements)[uiFirst], sizeof(SocketFifoElement_t));
- }
-}
-
diff --git a/cc3200/util/socketfifo.h b/cc3200/util/socketfifo.h
deleted file mode 100644
index e6cf851b1..000000000
--- a/cc3200/util/socketfifo.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * This file is part of the MicroPython project, http://micropython.org/
- *
- * The MIT License (MIT)
- *
- * Copyright (c) 2015 Daniel Campora
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-#ifndef MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
-#define MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H
-
-/*----------------------------------------------------------------------------
- ** Imports
- */
-
-/*----------------------------------------------------------------------------
- ** Define constants
- */
-
-/*----------------------------------------------------------------------------
- ** Define types
- */
-
-typedef struct {
- void *data;
- signed short *sd;
- unsigned short datasize;
- unsigned char closesockets;
- bool freedata;
-
-}SocketFifoElement_t;
-
-/*----------------------------------------------------------------------------
- ** Declare public functions
- */
-extern void SOCKETFIFO_Init (FIFO_t *fifo, void *elements, uint32_t maxcount);
-extern bool SOCKETFIFO_Push (const void * const element);
-extern bool SOCKETFIFO_Pop (void * const element);
-extern bool SOCKETFIFO_Peek (void * const element);
-extern bool SOCKETFIFO_IsEmpty (void);
-extern bool SOCKETFIFO_IsFull (void);
-extern void SOCKETFIFO_Flush (void);
-extern unsigned int SOCKETFIFO_Count (void);
-
-#endif // MICROPY_INCLUDED_CC3200_UTIL_SOCKETFIFO_H