/*******************************************************************************
* Project:      Amped'RF Bluetooth
* File name:    GKI_os.h
* Description:  Header for OS abstraction layer
*
* Copyright (c) 2012 Amped'RF Inc., AR Technology  All rights reserved.
*******************************************************************************/
#ifndef _GKI_OS_H_
#define _GKI_OS_H_

#if defined(NATIVE_OS)
#include "../GKI/GKI_NativeOS.h"

#elif defined(FREE_RTOS)
#include "../GKI_FreeRTOS/GKI_FreeRTOS.h"

#else
#warning "No OS Defined"
#endif


//-----------------------------------------------------------------------------
//  Uninitialized Boot RAM
//-----------------------------------------------------------------------------
#ifdef CUSTOM_LITE
#define BOOT_RAMSTART_BASE      0x20004F90
#else
#define BOOT_RAMSTART_BASE      0x2000BF90
#endif
#define BOOT_RAMSTART_SIZE      0x70
#define SU_RamStart             (void *)(BOOT_RAMSTART_BASE)        // Start of boot ram
#define SU_ResetMagicNumber     *(uint32 *)(BOOT_RAMSTART_BASE)     // A selected byte pattern
#define SU_HciBaudrate          *(uint32 *)(BOOT_RAMSTART_BASE+4)   // Last known HCI baudrate
#define SU_PowerDownReason      *(uint32 *)(BOOT_RAMSTART_BASE+8)   // Reason as computed by software
#define SU_ResetReason          *(uint32 *)(BOOT_RAMSTART_BASE+12)  // State of system before reset
#define SU_BD_ADDR              (uint8 *)(BOOT_RAMSTART_BASE+16)    // BD Address
#define SU_LINK_DESKEY          (tDESKEY *)(BOOT_RAMSTART_BASE+24)  // Link Triple DES Key
#define SU_UART_DESKEY          (tDESKEY *)(BOOT_RAMSTART_BASE+40)  // UART Triple DES Key
#ifdef SMALL_FLASH_LOADER
#define ROM_BD_ADDR             0x080017F8                          // Location for perm BD_ADDR
#else
#define ROM_BD_ADDR             0x08001FF8                          // Location for perm BD_ADDR
#endif
#define SU_LINK_DESKEY_CHECK    *(uint32 *)(SU_LINK_DESKEY)         // non-zero == key exists
#define SU_UART_DESKEY_CHECK    *(uint32 *)(SU_UART_DESKEY)         // non-zero == key exists
#define SU_BD_ADDR_EXISTS()     (*(uint32 *)SU_BD_ADDR != 0)

typedef struct {
    uint32  ResetMagicNumber;
    uint32  HciBaudrate;
    uint32  PowerDownReason;
    uint32  ResetReason;
    uint8   Bd_Addr[8];
    uint8   Fill[16];
    char    ResetReasonLog[];
} tRamStart;

extern tRamStart *pRamStart;



#endif // _GKI_OS_H_
//--------------------------------------------------------------
//