Пример #1
0
#include <gctypes.h>
u8 gSettingLaunchPyGecko __attribute__((section(".data"))) = 0;
u8 gSettingUseUpdatepath __attribute__((section(".data"))) = 0;
u8 gSettingPadconMode __attribute__((section(".data"))) = 0;
u8 gCursorInitDone __attribute__((section(".data"))) = 0;
u8 gPatchSDKDone __attribute__((section(".data"))) = 0;
u8 gHIDPADEnabled __attribute__((section(".data"))) = 0;
u8 gEnableDLC __attribute__((section(".data"))) = 0;
u32 gLoaderPhysicalBufferAddr __attribute__((section(".data"))) = 0;
u32 gLogUDP __attribute__((section(".data"))) = 0;
char gServerIP[16] __attribute__((section(".data")));
Пример #2
0
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

void mmhisr(void);
void u2fInit(void);

#define APP_VERSIONS "VERSION" \
                      VERSION_STR(MAJOR_VERSION)  "." \
                      VERSION_STR(MINOR_VERSION)  "." \
                      VERSION_STR(PATCH_VERSION)

/* These variables will be used by host application to read the version info */
static const char *const application_version
__attribute__((used, section("version"))) = APP_VERSIONS;

void memory_getDeviceLabel(char *str, size_t len) {
    const char *label = storage_getLabel();

    if (label && is_valid_ascii((const uint8_t*)label, strlen(label))) {
        snprintf(str, len, "KeepKey - %s", label);
    } else {
        strlcpy(str, "KeepKey", len);
    }
}

static bool canDropPrivs(void)
{
    switch (get_bootloaderKind()) {
    case BLK_v1_0_0:
Пример #3
0
// Purpose:      
// Description:  
//              
//####DESCRIPTIONEND####
//
//==========================================================================

#include "flash.h"

#include <pkgconf/hal.h>
#include <cyg/hal/hal_arch.h>


int
flash_program_buf(volatile unsigned char *addr, unsigned char *data, int len)
 __attribute__ ((section (".2ram.flash_program_buf")));
int
flash_program_buf(volatile unsigned char *addr, unsigned char *data, int len)
{
    volatile unsigned char *ROM;
    volatile unsigned char *BA;
    unsigned short stat;
    int timeout = 5000000;
    int i, wc;

    ROM = FLASH_P2V((unsigned long)addr & 0xFF800000);
    BA  = FLASH_P2V((unsigned long)addr & 0xFFFE0000);

    // Clear any error conditions
    ROM[0] = FLASH_Clear_Status;
Пример #4
0
#include "pebble_process_info.h"
#include "src/resource_ids.auto.h"

const PebbleProcessInfo __pbl_app_info __attribute__ ((section (".pbl_header"))) = {
  .header = "PBLAPP",
  .struct_version = { PROCESS_INFO_CURRENT_STRUCT_VERSION_MAJOR, PROCESS_INFO_CURRENT_STRUCT_VERSION_MINOR },
  .sdk_version = { PROCESS_INFO_CURRENT_SDK_VERSION_MAJOR, PROCESS_INFO_CURRENT_SDK_VERSION_MINOR },
  .process_version = { 1, 0 },
  .load_size = 0xb6b6,
  .offset = 0xb6b6b6b6,
  .crc = 0xb6b6b6b6,
  .name = "GrandWatch",
  .company = "Team VI",
  .icon_resource_id = RESOURCE_ID_IMAGE_MENU_ICON,
  .sym_table_addr = 0xA7A7A7A7,
  .flags = 0,
  .num_reloc_entries = 0xdeadcafe,
  .uuid = { 0x13, 0x32, 0x15, 0xF0, 0xCF, 0x20, 0x4C, 0x05, 0x99, 0x7B, 0x3C, 0x9B, 0xE5, 0xA6, 0x4E, 0x5B },
  .virtual_size = 0xb6b6
};
Пример #5
0
#include <sys/systm.h>
#include <sys/tty.h>
#include <sys/vnode.h>
#include <sys/sysctl.h>
#include <machine/cons.h>
#include <pexpert/pexpert.h>
#include <sys/socketvar.h>

extern vm_map_t mb_map;

#if INET || INET6
extern uint32_t   tcp_sendspace;
extern uint32_t   tcp_recvspace;
#endif

void            bsd_bufferinit(void) __attribute__((section("__TEXT, initcode")));
extern void     md_prepare_for_shutdown(int, int, char *);

unsigned int	bsd_mbuf_cluster_reserve(void);
void bsd_srv_setup(int);
void bsd_exec_setup(int);

/*
 * Declare these as initialized data so we can patch them.
 */

#ifdef	NBUF
int             max_nbuf_headers = NBUF;
int             niobuf_headers = NBUF / 2;
int 		nbuf_hashelements = NBUF;
int 		nbuf_headers = NBUF;
Пример #6
0
extern uint32_t _sidata;
extern uint32_t _sdata;
extern uint32_t _edata;
extern uint32_t _sbss;
extern uint32_t _ebss;
extern uint32_t _estack;

extern void main(void);
void reset_handler(void)
{
  uint32_t* idata_begin = &_sidata;
  uint32_t* data_begin = &_sdata;
  uint32_t* data_end = &_edata;
  while (data_begin < data_end) *data_begin++ = *idata_begin++;

  uint32_t* bss_begin = &_sbss;
  uint32_t* bss_end = &_ebss;
  while (bss_begin < bss_end) *bss_begin++ = 0;

  main();
}

__attribute((section(".isr_vector")))
uint32_t *isr_vectors[] = {
  [0x00] = (uint32_t*) &_estack,
  [0x01] = (uint32_t*) reset_handler,
};

__attribute((section(".data")))
uint32_t i = 0;
Пример #7
0
  Thomas Fischl <*****@*****.**>

  License........: GNU GPL v2 (see Readme.txt)
  Target.........: ATMega8 at 12 MHz
  Creation Date..: 2005-02-20
  Last change....: 2007-07-23

  PC2 SCK speed option. GND  -> slow (8khz SCK),
                        open -> fast (375kHz SCK)
*/

/* for bootloadjump */

#define BYRON_START_BOOTLOADER 	14
unsigned long __attribute__ ((section (".BOOTSTART"))) bootStart;


#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include <avr/wdt.h>

#include "usbdrv.h"
#include "isp.h"
#include "clock.h"

#define USBASP_FUNC_CONNECT     1
#define USBASP_FUNC_DISCONNECT  2
#define USBASP_FUNC_TRANSMIT    3
#define USBASP_FUNC_READFLASH   4
Пример #8
0
/*
 * These 'dummy' variables are used in nanoArchInit() to force the inclusion of
 * the spurious interrupt handlers. They *must* be declared in a module other
 * than the one they are used in to get around garbage collection issues and
 * warnings issued some compilers that they aren't used. Therefore care must
 * be taken if they are to be moved. See nano_private.h for more information.
 */
void *_dummy_spurious_interrupt;
void *_dummy_exception_vector_stub;

/*
 * Place the addresses of the spurious interrupt handlers into the intList
 * section. The genIdt tool can then populate any unused vectors with
 * these routines.
 */
void *__attribute__((section(".spurIsr"))) MK_ISR_NAME(_SpuriousIntHandler) =
	&_SpuriousIntHandler;
void *__attribute__((section(".spurNoErrIsr")))
	MK_ISR_NAME(_SpuriousIntNoErrCodeHandler) =
		&_SpuriousIntNoErrCodeHandler;

/**
 *
 * @brief Connect a routine to an interrupt vector
 *
 * @param vector interrupt vector: 0 to 255 on IA-32
 * @param routine a function pointer to the interrupt routine
 * @param dpl priv level for interrupt-gate descriptor
 *
 * This routine "connects" the specified <routine> to the specified interrupt
 * <vector>.  On the IA-32 architecture, an interrupt vector is a value from
Пример #9
0
void TC4_IRQHandler (void) __attribute__((weak));
void TC5_IRQHandler (void) __attribute__((weak));
void ADC_IRQHandler (void) __attribute__((weak));
void DAC_IRQHandler (void) __attribute__((weak));
void PWM_IRQHandler (void) __attribute__((weak));
void CRCCU_IRQHandler (void) __attribute__((weak));
void ACC_IRQHandler (void) __attribute__((weak));
void USBD_IRQHandler (void) __attribute__((weak));

/*=========================================================================*/
/*  DEFINE: All code exported                                              */
/*=========================================================================*/
/*
 * This is our vector table.
 */
__attribute__ ((section(".vectors"), used))
void (* const gVectors[])(void) = 
{
   (void (*)(void))((unsigned long)&_estack),
   ResetHandler,
   NMI_Handler,
   HardFault_Handler,
   MemManage_Handler,
   BusFault_Handler,
   UsageFault_Handler,
   0, 0, 0, 0,
   SVC_Handler,
   DebugMon_Handler,
   0,
   PendSV_Handler,
   SysTick_Handler,
Пример #10
0
Файл: video.c Проект: 8l/FUZIX
	if (c == '_')
		return 0x7F;
	if (c == '`')
		return 0x5E; /* up arrow */
	return c;
}

// Get copy user buffer to video mem
// 
static void video_get( char *usrptr ){
	map_for_video();
	uget( usrptr, (char *)0x2000, 512);
	map_for_kernel();
}

__attribute__((section(".discard")))
void video_init( )
{
	map_for_video();
	memset( (char *)0x2000, ' ', 0x4000 );
	map_for_kernel();
}

int gfx_draw_op(uarg_t arg, char *ptr)
{
	int err=0;
	int l;
	int c = 8;	/* 4 x uint16_t */
	uint16_t *p = (uint16_t *)(char *)0x5e00;

	map_for_video();
  // to be executed before the call of any HAL function.
  HAL_Init();

  // Enable HSE Oscillator and activate PLL with HSE as source
  SystemClock_Config();

  // Call the CSMSIS system clock routine to store the clock frequency
  // in the SystemCoreClock global RAM location.
  SystemCoreClockUpdate();
}

// Disable when using RTOSes, since they have their own handler.
#if 0

// This is a sample SysTick handler, use it if you need HAL timings.
void __attribute__ ((section(".after_vectors")))
SysTick_Handler(void)
{
#if defined(USE_HAL_DRIVER)
	HAL_IncTick();
#endif
}

#endif

// ----------------------------------------------------------------------------

/**
 * @brief  System Clock Configuration
 * @param  None
 * @retval None
Пример #12
0
 ****************************************************************************************
 */

#include "rwip_config.h"
#if (BLE_HID_BOOT_HOST)

#include "hogpbh.h"
#include "hogpbh_task.h"
#include "gap.h"

/*
 * GLOBAL VARIABLES DEFINITIONS
 ****************************************************************************************
 */

struct hogpbh_env_tag **hogpbh_envs __attribute__((section("exchange_mem_case1"))); //@WIKRETENTION MEMORY 

/// HOGPBH task descriptor
static const struct ke_task_desc TASK_DESC_HOGPBH = {hogpbh_state_handler, &hogpbh_default_handler, hogpbh_state, HOGPBH_STATE_MAX, HOGPBH_IDX_MAX};


/*
 * GLOBAL FUNCTIONS DEFINITIONS
 ****************************************************************************************
 */

void hogpbh_init(void)
{
    // Reset all the profile role tasks
    PRF_CLIENT_RESET(hogpbh_envs, HOGPBH);
}
Пример #13
0
	uint32		payloadLen;
	PB_HEADER	header;
	uint32 *	pPayload;
	uint32		txStat;
	uint32		semID;
} POSTED_TX_CONTEXT;

typedef struct
{
	uint16						currTxContext;
	uint16						inBr;
	POSTED_TX_CONTEXT	contexts[MAX_TX_CONTEXTS];
} POSTED_TX_STATE;
*/

POSTED_TX_STATE volatile postedTxState __attribute__((section (".sram.llctx")));

static void initializeContexts(void)
{
	postedTxState.inBr = TRUE;
}




////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/// Interrupt level implementation of the posted context system.
///
////////////////////////////////////////////////////////////////////////////////////////////////////////////////

static void ChkAndSend(void) __attribute__((section (".sram.llccode")));
Пример #14
0
{
  printf ("init array 0\n");
}

static void
init_1 (void)
{
  printf ("init array 1\n");
}

static void
init_2 (void)
{
  printf ("init array 2\n");
}

void (*const init_array []) (void)
     __attribute__ ((section (".init_array"),
		     aligned (sizeof (void *)))) =
{
  &init_0,
  &init_1,
  &init_2
};

int
main (void)
{
  return 0;
}
Пример #15
0
  //removed x86 ASM

  return;
}
#endif

/*
 * Structure: CPUState
 *
 * Description:
 *  This is a structure containing the per-CPU state of each processor in the
 *  system.  We gather this here so that it's easy to find them from the %GS
 *  register.
 */
static struct CPUState realCPUState[numProcessors] __attribute__((aligned(16)))
__attribute__ ((section ("svamem")));
struct CPUState * CPUState = realCPUState;

/* Pre-allocate a large number of SVA Threads */
static struct SVAThread realThreads[4096] __attribute__ ((aligned (16)))
__attribute__ ((section ("svamem")));
struct SVAThread * Threads = realThreads;
#if 0
//add function declaration
void init_threads(void);
void
init_threads(void) {
  for (unsigned index = 0; index < 4096; ++index) {
    Threads[index].used = 0;
  }
  return;
Пример #16
0
 * Copyright 2017 NXP
 * All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include "fsl_flexspi_nor_boot.h"

/* Component ID definition, used by tools. */
#ifndef FSL_COMPONENT_ID
#define FSL_COMPONENT_ID "platform.drivers.xip_device"
#endif

#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1)
#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__)
    __attribute__((section(".boot_hdr.ivt")))
#elif defined(__ICCARM__)
#pragma location=".boot_hdr.ivt"
#endif
/************************************* 
 *  IVT Data 
 *************************************/
const ivt image_vector_table = {
  IVT_HEADER,                         /* IVT Header */
  IMAGE_ENTRY_ADDRESS,                /* Image Entry Function */
  IVT_RSVD,                           /* Reserved = 0 */
  (uint32_t)DCD_ADDRESS,              /* Address where DCD information is stored */
  (uint32_t)BOOT_DATA_ADDRESS,        /* Address where BOOT Data Structure is stored */
  (uint32_t)&image_vector_table,      /* Pointer to IVT Self (absolute address */
  (uint32_t)CSF_ADDRESS,              /* Address where CSF file is stored */
  IVT_RSVD                            /* Reserved = 0 */
Пример #17
0
extern unsigned char mem50;
extern unsigned char mem51;
extern unsigned char mem53;
extern unsigned char mem56;

extern unsigned char speedd;
extern unsigned char pitch;
extern int singmode;

extern int16_t audio_buffer[AUDIO_BUFSZ]; 

extern unsigned char phonemeIndexOutput[60]; //tab47296
extern unsigned char stressOutput[60]; //tab47365
extern unsigned char phonemeLengthOutput[60]; //tab47416

unsigned char pitches[256] __attribute__ ((section (".ccmdata"))); // tab43008

unsigned char frequency1[256] __attribute__ ((section (".ccmdata")));
unsigned char frequency2[256] __attribute__ ((section (".ccmdata")));
unsigned char frequency3[256] __attribute__ ((section (".ccmdata")));

unsigned char amplitude1[256] __attribute__ ((section (".ccmdata")));
unsigned char amplitude2[256] __attribute__ ((section (".ccmdata")));
unsigned char amplitude3[256] __attribute__ ((section (".ccmdata")));

unsigned char sampledConsonantFlag[256] __attribute__ ((section (".ccmdata"))); // tab44800


void AddInflection(unsigned char mem48, unsigned char phase1);
unsigned char trans(unsigned char mem39212, unsigned char mem39213);
Пример #18
0
#define VEC_SWI 2
#define VEC_PABT 3
#define VEC_DABT 4

static char packet_buf[BUFMAX];
static char reply_buf[BUFMAX];

static const char hexchars[] = "0123456789abcdef";
static int gdb_exception_no, gdb_mem_access;
static unsigned char watchdog_enabled;
static unsigned long registers[17];

void gdb_api_breakpoint(void);
static void gdb_api_log(char *msg);

__attribute__((section(".gdbapi"))) struct gdb_api gdb_api =
{
    GDB_API_MAGIC,
    {gdb_api_breakpoint, gdb_api_log}
};

static void watchdog_enable(int on)
{
    (*(volatile unsigned long *)0x80002804) = on;
    watchdog_enabled = on;
}

static void watchdog_service(void)
{
    if (watchdog_enabled)
    {
Пример #19
0
#include "os.h"

extern long _main(long argc, char* argv[]);

void __attribute__((section(".init"))) _start()
{

	//int a = getpid();

	long argc = 0;
	char* argv[1] = {0};
	//char* env[1] = {0};

    int stdin = open("/obj/console", NULL, NULL);

	_main(argc, argv);

    int count = 0;
	for (;;)
	{
	    count ++;
	}

	//__asm("int $3");
}
Пример #20
0
  #include "Events.h"


  /* ISR prototype */
  extern uint32_t __SP_INIT;
  extern
  #ifdef __cplusplus
  "C"
  #endif
  void __thumb_startup( void );
  
  
  /*lint -esym(765,__vect_table) Disable MISRA rule (8.10) checking for symbols (__vect_table). Definition of the interrupt vector table placed by linker on a predefined location. */
  /*lint -save  -e926 -e927 -e928 -e929 Disable MISRA rule (11.4) checking. Need to explicitly cast pointers to the general ISR for Interrupt vector table */
  
  __attribute__ ((section (".vectortable"))) const tVectorTable __vect_table = { /* Interrupt vector table */
  
    /* ISR name                             No. Address      Pri Name                          Description */
    &__SP_INIT,                        /* 0x00  0x00000000   -   ivINT_Initial_Stack_Pointer   used by PE */
    {
    (tIsrFunc)&__thumb_startup,        /* 0x01  0x00000004   -   ivINT_Initial_Program_Counter used by PE */
    (tIsrFunc)&Cpu_INT_NMIInterrupt,   /* 0x02  0x00000008   -2   ivINT_NMI                     used by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x03  0x0000000C   -1   ivINT_Hard_Fault              unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x04  0x00000010   -   ivINT_Reserved4               unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x05  0x00000014   -   ivINT_Reserved5               unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x06  0x00000018   -   ivINT_Reserved6               unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x07  0x0000001C   -   ivINT_Reserved7               unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x08  0x00000020   -   ivINT_Reserved8               unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x09  0x00000024   -   ivINT_Reserved9               unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x0A  0x00000028   -   ivINT_Reserved10              unused by PE */
    (tIsrFunc)&Cpu_Interrupt,          /* 0x0B  0x0000002C   -   ivINT_SVCall                  unused by PE */
Пример #21
0
 * You should have received a copy of the GNU General Public License
 * along with Windnode.  If not, see <http://www.gnu.org/licenses/>.
 */

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

/* NOTE! This stack monitor assumes no memory is allocated using malloc(), and
 * thus all dynamic memory (from heap start to RAMEND) is used for stack.
 */

extern uint8_t __heap_start;
extern uint8_t __stack;

void stackmon_paint(void) __attribute__ ((naked))
    __attribute__ ((section(".init1")));

void stackmon_paint(void)
{
	__asm volatile ("    ldi r30,lo8(__heap_start)\n"
	    "    ldi r31,hi8(__heap_start)\n"
	    "    ldi r24,lo8(0xAC)\n"
	    "    ldi r25,hi8(__stack)\n"
	    "    rjmp .cmp\n"
	    ".loop:\n"
	    "    st Z+,r24\n"
	    ".cmp:\n"
	    "    cpi r30,lo8(__stack)\n"
	    "    cpc r31,r25\n" "    brlo .loop\n" "    breq .loop"::);
}
Пример #22
0
void supervisor_init(void)
{
	static uint32_t supervisor_stack[256];

	static const struct thinkos_thread_inf supervisor_inf = {
		.stack_ptr = supervisor_stack,
		.stack_size = sizeof(supervisor_stack),
		.priority = 8,
		.thread_id = 2,
		.paused = false,
		.tag = "SUPV"
	};

	trace_init();

	thinkos_thread_create_inf((void *)supervisor_task, (void *)NULL,
							  &supervisor_inf);
}

/* -------------------------------------------------------------------------
 * MS/TP 
 * ------------------------------------------------------------------------- */

int mstp_lnk_task(void * arg)
{
	struct mstp_lnk * mstp = (struct mstp_lnk *)arg;

	printf("MS/TP link task started...\n");

	mstp_lnk_loop(mstp);

	return 0;
}

struct net_stats {
	struct {
		unsigned int octet_cnt;
		unsigned int bcast_cnt;
		unsigned int unicast_cnt;
	} rx;
	struct {
		unsigned int octet_cnt;
		unsigned int bcast_cnt;
		unsigned int unicast_cnt;
	} tx;
};

struct {
	struct mstp_lnk * mstp;
	struct net_stats stats;
} net;

int net_recv_task(void * arg)
{
	struct mstp_lnk * mstp = (struct mstp_lnk *)arg;
	struct mstp_frame_inf inf;
	uint8_t pdu[502];
	int len;
	unsigned int seconds = 10;
	uint32_t clk;

	INF("MS/TP receive task started...");

	clk = thinkos_clock() + seconds * 1000;
	for (;;) {
		len = mstp_lnk_recv(mstp, pdu, sizeof(pdu), &inf);
		net.stats.rx.octet_cnt += len;
		if (inf.daddr == MSTP_ADDR_BCAST)
			net.stats.rx.bcast_cnt++;
		else
			net.stats.rx.unicast_cnt++;

//		printf("RCV: %d->%d (%d) \"%s\"\n", inf.saddr, inf.daddr,
//				len, (char*)pdu);
//		DBG("RCV: %d->%d (%d)", inf.saddr, inf.daddr, len);
		/* Log summary each 5 seconds */
		if ((int32_t)(clk - thinkos_clock()) <= 0) {
			unsigned int rate;
			rate = net.stats.rx.octet_cnt / seconds;

			INF("Receive: %d bcast, %d unicast, %d octets, %d.%03d KBps.",
					net.stats.rx.bcast_cnt, net.stats.rx.unicast_cnt, net.stats.rx.octet_cnt,
					rate / 1000, rate % 1000);

			net.stats.rx.bcast_cnt = 0;
			net.stats.rx.unicast_cnt = 0;
			net.stats.rx.octet_cnt = 0;
			seconds = 10;
			clk += seconds * 1000;
		}
	}

	return 0;
}

uint32_t mstp_lnk_stack[512] __attribute__((section (".ccm")));

const struct thinkos_thread_inf mstp_lnk_inf = {
	.stack_ptr = mstp_lnk_stack,
	.stack_size = sizeof(mstp_lnk_stack),
	.priority = 1,
	.thread_id = 1,
	.paused = 0,
	.tag = "MS/TP"
};

uint32_t net_recv_stack[512];

const struct thinkos_thread_inf net_recv_inf = {
	.stack_ptr = net_recv_stack,
	.stack_size = sizeof(net_recv_stack),
	.priority = 32,
	.thread_id = 3,
	.paused = 0,
	.tag = "NET RCV"
};

struct mstp_lnk * mstp_start(int addr)
{
	struct serial_dev * ser;
	struct mstp_lnk * mstp;

	INF("1. serial port init");
	ser = stm32f_uart1_serial_dma_init(500000, SERIAL_8N1);

	INF("2. mstp_lnk_alloc()");
	mstp = mstp_lnk_alloc();

	INF("3. MS/TP link addr: %d", addr);
	mstp_lnk_init(mstp, "MS/TP1", addr, ser);

	INF("4. thinkos_thread_create_inf()");
	thinkos_thread_create_inf(mstp_lnk_task, mstp, &mstp_lnk_inf);

	thinkos_thread_create_inf(net_recv_task, mstp, &net_recv_inf);

	thinkos_sleep(100);

	printf("5. mstp_lnk_resume()");
	mstp_lnk_resume(mstp);

	return mstp;
}

/* -------------------------------------------------------------------------
 * Test
 * ------------------------------------------------------------------------- */
int test_mode = 0;

int mstp_test_task(void * arg)
{
	struct mstp_lnk * mstp = (struct mstp_lnk *)arg;
	struct mstp_frame_inf inf;
	uint8_t pdu[502];
	uint32_t clk;
	uint32_t tmo;
	unsigned int itval = 5;
	int len;
	int i;

	INF("MS/TP test task started...\n");

	clk = thinkos_clock();
	tmo = clk + itval * 1000;

	for (i = 0;; ++i) {
		if (test_mode != 0) {
			inf.daddr = MSTP_ADDR_BCAST;
			inf.type = FRM_DATA_NO_REPLY;
			len = snprintf((char *)pdu, 501, "%6d"
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog."
					" The quick brown fox jumps over the lazy dog.",
					i);
			if (mstp_lnk_send(mstp, pdu, len, &inf) < 0) {
				ERR("mstp_lnk_send() failed!");
			}
			net.stats.tx.octet_cnt += len;
			net.stats.tx.bcast_cnt++;

			/* Log summary each 10 seconds */
			if ((int32_t)(tmo - clk) <= 0) {
				unsigned int rate;

				rate = net.stats.tx.octet_cnt / itval;

				DBG("Send: %d bcasts, %d octets, %d.%03d KBps.",
						net.stats.tx.bcast_cnt, net.stats.tx.octet_cnt,
						rate / 1000, rate % 1000);

				net.stats.tx.octet_cnt = 0;
				net.stats.tx.bcast_cnt = 0;
				itval = 10;
				tmo += itval * 1000;
			}

			if (test_mode > 1) {
				thinkos_alarm(clk + test_mode * 100);
			}
		} else {
			thinkos_alarm(clk + 100);
		}
		clk = thinkos_clock();
	}

	return 0;
}

uint32_t test_stack[512];

const struct thinkos_thread_inf test_inf = {
	.stack_ptr = test_stack,
	.stack_size = sizeof(test_stack),
	.priority = 32,
	.thread_id = 32,
	.paused = 0,
	.tag = "TEST"
};

void  mstp_test_start(struct mstp_lnk * mstp)
{
	thinkos_thread_create_inf(mstp_test_task, mstp, &test_inf);
}

struct board_cfg {
    uint32_t magic;
    uint32_t mstp_addr;
    uint32_t ip_addr;
};

#define CFG_MAGIC 0x01020304
#define CFG_ADDR  0x0800ff00

void show_netmap(struct mstp_lnk * mstp)
{
	uint8_t map[16];
	unsigned int cnt;
	int i;

	cnt = mstp_lnk_getnetmap(mstp, map, sizeof(map));
	printf("\n---- Network Map ----\n");

	for (i = 0; i < cnt; ++i) {
		printf("%2d - Node %2d\n", i, map[i]);
	}

	printf("\n");
}



void show_menu(void)
{
	printf("\n===== MS/TP test =====\n");
	printf("[s] stop sending\n");
	printf("[1..9] set sending mode\n");
	printf("[n] show network map\n");
	printf("\n");
}

void motd(void)
{
	printf("\n--------- Test Application -------\n");
	printf("\n");
}
Пример #23
0
 */


/* Defines */
#define STACK_TOP   0x20000800   // just a tiny stack for demo
#define EVER        (;;)

/* Prototypes */
int reset_handler(void);
static void nmi_handler(void);
static void hardfault_handler(void);

/* Exception vector table */
/* -- See http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0471c/Cihbffg3.html */
unsigned int * exception_vectors[4]
__attribute__ ((section("vectors"))) = {
    (unsigned int *) STACK_TOP,         // Stack pointer
    (unsigned int *) reset_handler,     // Reset exception
    (unsigned int *) nmi_handler,       // NMI exception
    (unsigned int *) hardfault_handler  // HardFault exception
};

/* Reset exception handler */
int reset_handler(void)
{
    int i=0;

    for EVER
    {
        i++;
    }
Пример #24
0
                ));                                  
  /* NVIC_IPR1: PRI_6=0 */
  NVIC_IPR1 &= (uint32_t)~(uint32_t)(NVIC_IP_PRI_6(0xFF));                                   
  /* ### Serial_LDD "IO1" component auto initialization. Auto initialization feature can be disabled by component property "Auto initialization". */
  (void)IO1_Init(NULL);
  /* ### SPIMaster_LDD "SM1" component auto initializatation. Auto initialization feature can be disabled by component's property "Auto initialization". */
  (void)SM1_Init(NULL);
  /* ### TimerInt_LDD "TimerIntLdd1" component auto initialization. Auto initialization feature can be disabled by component property "Auto initialization". */
  (void)TimerIntLdd1_Init(NULL);
  /* ### TimerInt "TI1" init code ... */
  /* ### BitIO_LDD "PCS" component auto initialization. Auto initialization feature can be disabled by component property "Auto initialization". */
  (void)PCS_Init(NULL);
  __EI();
}
  /* Flash configuration field */
  __attribute__ ((section (".cfmconfig"))) const uint8_t _cfm[0x10] = {
   /* NV_BACKKEY3: KEY=0xFF */
    0xFFU,
   /* NV_BACKKEY2: KEY=0xFF */
    0xFFU,
   /* NV_BACKKEY1: KEY=0xFF */
    0xFFU,
   /* NV_BACKKEY0: KEY=0xFF */
    0xFFU,
   /* NV_BACKKEY7: KEY=0xFF */
    0xFFU,
   /* NV_BACKKEY6: KEY=0xFF */
    0xFFU,
   /* NV_BACKKEY5: KEY=0xFF */
    0xFFU,
   /* NV_BACKKEY4: KEY=0xFF */
Пример #25
0
#pragma weak CAN2_IRQHandler        = Spurious_Handler
#pragma weak Ethernet_IRQHandler    = Spurious_Handler
#pragma weak Hibernate_IRQHandler   = Spurious_Handler

/* exception and interrupt vector table ------------------------------------*/
typedef void (*ExceptionHandler)(void);
typedef union {
    ExceptionHandler handler;
    void            *pointer;
} VectorTableEntry;

                               /* top of stack defined in the linker script */
extern unsigned __c_stack_top__;

/*..........................................................................*/
__attribute__ ((section(".isr_vector")))
VectorTableEntry const g_pfnVectors[] = {
    { .pointer = &__c_stack_top__        }, /* initial stack pointer        */
    { .handler = &Reset_Handler          }, /* Reset Handler                */
    { .handler = &NMI_Handler            }, /* NMI Handler                  */
    { .handler = &HardFault_Handler      }, /* Hard Fault Handler           */
    { .handler = &MemManage_Handler      }, /* MPU Fault Handler            */
    { .handler = &BusFault_Handler       }, /* Bus Fault Handler            */
    { .handler = &UsageFault_Handler     }, /* Usage Fault Handler          */
    { .handler = &Spurious_Handler       }, /* Reserved                     */
    { .handler = &Spurious_Handler       }, /* Reserved                     */
    { .handler = &Spurious_Handler       }, /* Reserved                     */
    { .handler = &Spurious_Handler       }, /* Reserved                     */
    { .handler = &SVC_Handler            }, /* SVCall Handler               */
    { .handler = &DebugMon_Handler       }, /* Debug Monitor Handler        */
    { .handler = &Spurious_Handler       }, /* Reserved                     */
Пример #26
0
#if defined(MD_ROOT) && !defined(MD_ROOT_FSTYPE)
#define	MD_ROOT_FSTYPE	"ufs"
#endif

#if defined(MD_ROOT)
/*
 * Preloaded image gets put here.
 */
#if defined(MD_ROOT_SIZE)
/*
 * We put the mfs_root symbol into the oldmfs section of the kernel object file.
 * Applications that patch the object with the image can determine
 * the size looking at the oldmfs section size within the kernel.
 */
u_char mfs_root[MD_ROOT_SIZE*1024] __attribute__ ((section ("oldmfs")));
const int mfs_root_size = sizeof(mfs_root);
#else
extern volatile u_char __weak_symbol mfs_root;
extern volatile u_char __weak_symbol mfs_root_end;
__GLOBL(mfs_root);
__GLOBL(mfs_root_end);
#define mfs_root_size ((uintptr_t)(&mfs_root_end - &mfs_root))
#endif
#endif

static g_init_t g_md_init;
static g_fini_t g_md_fini;
static g_start_t g_md_start;
static g_access_t g_md_access;
static void g_md_dumpconf(struct sbuf *sb, const char *indent,
Пример #27
0
/** \brief System Tick Handler */
static void SysTick_Handler(void);

/** \brief Dummy empty ISR Handler */
static void ISR_NoHandler(void);

/*==================[internal data definition]===============================*/

/*==================[external data definition]===============================*/
#ifndef CPU
#error CPU shall be defined.
#endif

#if (CPU == mk60fx512vlq15)
/** \brief mk60fx512vlq15 Interrupt vector */
__attribute__ ((section(".isr_vector")))
void (* const g_pfnVectors[])(void) = {
   /* System ISRs */
   &__StackTop,                    /* The initial stack pointer  */
   Reset_Handler,                  /* The reset handler          */
   NMI_Handler,                    /* The NMI handler            */
   HardFault_Handler,              /* The hard fault handler     */
   MemManage_Handler,              /* The MPU fault handler      */
   BusFault_Handler,               /* The bus fault handler      */
   UsageFault_Handler,             /* The usage fault handler    */
   0,                              /* Reserved                   */
   0,                              /* Reserved                   */
   0,                              /* Reserved                   */
   0,                              /* Reserved                   */
   SVC_Handler,                    /* SVCall handler             */
   DebugMon_Handler,               /* Debug monitor handler      */
#define BL2_RO_LIMIT (unsigned long)(&__RO_END__)

/*
 * The next 2 constants identify the extents of the coherent memory region.
 * These addresses are used by the MMU setup code and therefore they must be
 * page-aligned.  It is the responsibility of the linker script to ensure that
 * __COHERENT_RAM_START__ and __COHERENT_RAM_END__ linker symbols refer to
 * page-aligned addresses.
 */
#define BL2_COHERENT_RAM_BASE (unsigned long)(&__COHERENT_RAM_START__)
#define BL2_COHERENT_RAM_LIMIT (unsigned long)(&__COHERENT_RAM_END__)

/* Data structure which holds the extents of the trusted RAM for BL2 */
static meminfo_t bl2_tzram_layout
__attribute__ ((aligned(PLATFORM_CACHE_LINE_SIZE),
		section("tzfw_coherent_mem")));

/*******************************************************************************
 * Structure which holds the arguments which need to be passed to BL3-1
 ******************************************************************************/
static bl2_to_bl31_params_mem_t bl31_params_mem;

meminfo_t *bl2_plat_sec_mem_layout(void)
{
	return &bl2_tzram_layout;
}

/*******************************************************************************
 * This function assigns a pointer to the memory that the platform has kept
 * aside to pass platform specific and trusted firmware related information
 * to BL31. This memory is allocated by allocating memory to
#include <linux/module.h>
#include <linux/vermagic.h>
#include <linux/compiler.h>

MODULE_INFO(vermagic, VERMAGIC_STRING);

__visible struct module __this_module
__attribute__((section(".gnu.linkonce.this_module"))) = {
	.name = KBUILD_MODNAME,
	.init = init_module,
#ifdef CONFIG_MODULE_UNLOAD
	.exit = cleanup_module,
#endif
	.arch = MODULE_ARCH_INIT,
};

static const struct modversion_info ____versions[]
__used
__attribute__((section("__versions"))) = {
	{ 0x9412fa01, __VMLINUX_SYMBOL_STR(module_layout) },
	{ 0x27e1a049, __VMLINUX_SYMBOL_STR(printk) },
	{ 0xbdfb6dbb, __VMLINUX_SYMBOL_STR(__fentry__) },
};

static const char __module_depends[]
__used
__attribute__((section(".modinfo"))) =
"depends=";


MODULE_INFO(srcversion, "96F476CBC919048487EFE94");
Пример #30
0
 */

/************************************************************** 
 FILENAME	: CustImageRes.c 
 PURPOSE		: Image Resource file. 
 
 AUTHOR		: Customization Tool 
 DATE		: . 
 **************************************************************/
#include "custdatares.h"
#include "custimgdatahwext.h"
#include "custresdef.h"

//const unsigned short  CSD_CurrMaxImageNumEXT=3;
#ifndef MMI_ON_WIN32
  __attribute__((section (".roresdata"))) 
#endif

const CUSTOM_IMAGE	CSD_nCustImageNamesEXT[]={
{(U8*)&_MAINLCD_ACTIVE_POWERONOFF_POON_GIF_},
{(U8*)&_MAINLCD_IDLESCREEN_WALLPAPER_WALL03_GIF_},
{(U8*)&_MAINLCD_IDLESCREEN_WALLPAPER_WALL02_GIF_},
};



const CUSTPACK_IMAGE_HEADER CSD_image_header={3, (CUSTOM_IMAGE *)CSD_nCustImageNamesEXT};