Microchip® Advanced Software Framework

chipid_example.c File Reference

Chip Identifier (CHIPID) example for SAM.

Copyright (c) 2011-2018 Microchip Technology Inc. and its subsidiaries.

#include <string.h>
#include "asf.h"
#include "stdio_serial.h"
#include "conf_board.h"

Data Structures

struct  chipidtype
 Chip ID catalog information: Type ID and its description stream. More...
 

Macros

#define CHIPID_ARCH_SIZE   47
 Number of architectures Supported. More...
 
#define CHIPID_EPROC_SIZE   7
 Number of Embedded Processors Supported. More...
 
#define CHIPID_NVPSIZE2_SIZE   16
 Number of 2nd Non-Volatile Program Memories Supported. More...
 
#define CHIPID_NVPSIZE_SIZE   16
 Number of 1st Non-Volatile Program Memories Supported. More...
 
#define CHIPID_NVPTYPE_SIZE   5
 Number of ROMs Supported. More...
 
#define CHIPID_SRAMSIZE_SIZE   16
 Number of SRAMs Supported. More...
 
#define STRING_EOL   "\r"
 
#define STRING_HEADER
 

Typedefs

typedef struct chipidtype chipidtype_t
 Chip ID catalog information: Type ID and its description stream. More...
 

Functions

static bool chipid_find (const chipidtype_t *p_cid_types, uint32_t ul_size, uint32_t ul_id, chipidtype_t *p_cid_type)
 The function finds chipid from specific list according to ul_id. More...
 
static void chipid_print (chipid_data_t *p_chipid_data)
 The function prints specific chipid data structure. More...
 
static void configure_console (void)
 Configure UART console. More...
 
int main (void)
 Application entry point. More...
 

Variables

const chipidtype_t chipid_archsize [CHIPID_ARCH_SIZE]
 Architectures support list. More...
 
const chipidtype_t chipid_eproc [CHIPID_EPROC_SIZE]
 Embedded Processors support list. More...
 
const chipidtype_t chipid_nvpsize [CHIPID_NVPSIZE_SIZE]
 1st Non-Volatile Program Memories support list More...
 
const chipidtype_t chipid_nvpsize2 [CHIPID_NVPSIZE2_SIZE]
 2nd Non-Volatile Program Memories support list More...
 
const chipidtype_t chipid_nvptype [CHIPID_NVPTYPE_SIZE]
 ROMs support list. More...
 
const chipidtype_t chipid_sramsize [CHIPID_SRAMSIZE_SIZE]
 SRAMs support list. More...
 
chipid_data_t g_chipid_data
 ChipID data read. More...
 

#define CHIPID_ARCH_SIZE   47

Number of architectures Supported.

Referenced by chipid_print().

#define CHIPID_EPROC_SIZE   7

Number of Embedded Processors Supported.

Referenced by chipid_print().

#define CHIPID_NVPSIZE2_SIZE   16

Number of 2nd Non-Volatile Program Memories Supported.

Referenced by chipid_print().

#define CHIPID_NVPSIZE_SIZE   16

Number of 1st Non-Volatile Program Memories Supported.

Referenced by chipid_print().

#define CHIPID_NVPTYPE_SIZE   5

Number of ROMs Supported.

Referenced by chipid_print().

#define CHIPID_SRAMSIZE_SIZE   16

Number of SRAMs Supported.

Referenced by chipid_print().

#define STRING_EOL   "\r"
#define STRING_HEADER
Value:
"-- CHIPID Example --\r\n" \
"-- "BOARD_NAME" --\r\n" \
"-- Compiled: "__DATE__" "__TIME__" --"STRING_EOL
#define BOARD_NAME
Name of the board.
Definition: same70_xplained.h:75
#define STRING_EOL
Definition: chipid_example.c:98

Referenced by main().

typedef struct chipidtype chipidtype_t

Chip ID catalog information: Type ID and its description stream.

static bool chipid_find ( const chipidtype_t p_cid_types,
uint32_t  ul_size,
uint32_t  ul_id,
chipidtype_t p_cid_type 
)
static

The function finds chipid from specific list according to ul_id.

Parameters
p_cid_typesPointer to the chipid list.
ul_sizechipid list size
ul_idchipid number
p_cid_typepointer to chipid type
Returns
true if ID is found in list

Referenced by chipid_print().

static void configure_console ( void  )
static
int main ( void  )

Application entry point.

Returns
Unused (ANSI-C compatibility).

References board_init(), chipid_print(), chipid_read(), configure_console(), STRING_HEADER, and sysclk_init().

const chipidtype_t chipid_archsize[CHIPID_ARCH_SIZE]

Architectures support list.

const chipidtype_t chipid_eproc[CHIPID_EPROC_SIZE]
Initial value:
= {
{0x1, "ARM946ES"},
{0x2, "ARM7TDMI"},
{0x3, "Cortex-M3"},
{0x4, "ARM920T"},
{0x5, "ARM926EJS"},
{0x6, "Cortex-A5"},
{0x7, "Cortex-M4"}
}

Embedded Processors support list.

const chipidtype_t chipid_nvpsize[CHIPID_NVPSIZE_SIZE]
Initial value:
= {
{0x0, "None"},
{0x1, "8K bytes"},
{0x2, "16K bytes"},
{0x3, "32K bytes"},
{0x4, "Reserved"},
{0x5, "64K bytes"},
{0x6, "Reserved"},
{0x7, "128K bytes"},
{0x8, "Reserved"},
{0x9, "256K bytes"},
{0xA, "512K bytes"},
{0xB, "Reserved"},
{0xC, "1024K bytes"},
{0xD, "Reserved"},
{0xE, "2048K bytes"},
{0xF, "Reserved"}
}

1st Non-Volatile Program Memories support list

const chipidtype_t chipid_nvpsize2[CHIPID_NVPSIZE2_SIZE]
Initial value:
= {
{0x0, "None"},
{0x1, "8K bytes"},
{0x2, "16K bytes"},
{0x3, "32K bytes"},
{0x4, "Reserved"},
{0x5, "64K bytes"},
{0x6, "Reserved"},
{0x7, "128K bytes"},
{0x8, "Reserved"},
{0x9, "256K bytes"},
{0xA, "512K bytes"},
{0xB, "Reserved"},
{0xC, "1024K bytes"},
{0xD, "Reserved"},
{0xE, "2048K bytes"},
{0xF, "Reserved"}
}

2nd Non-Volatile Program Memories support list

const chipidtype_t chipid_nvptype[CHIPID_NVPTYPE_SIZE]
Initial value:
= {
{0x0, "ROM"},
{0x1, "ROMless or on-chip Flash"},
{0x4, "SRAM emulating ROM"},
{0x2, "Embedded Flash Memory"},
{0x3, "ROM and Embedded Flash Memory, NVPSIZ is ROM size, NVPSIZ2 is Flash size"}
}

ROMs support list.

const chipidtype_t chipid_sramsize[CHIPID_SRAMSIZE_SIZE]
Initial value:
= {
{0x0, "48K bytes"},
{0x1, "192K bytes"},
{0x2, "384K bytes"},
{0x3, "6K bytes"},
{0x4, "112K bytes"},
{0x5, "4K bytes"},
{0x6, "80K bytes"},
{0x7, "160K bytes"},
{0x8, "8K bytes"},
{0x9, "16K bytes"},
{0xA, "32K bytes"},
{0xB, "64K bytes"},
{0xC, "128K bytes"},
{0xD, "256K bytes"},
{0xE, "96K bytes"},
{0xF, "512K bytes"}
}

SRAMs support list.

chipid_data_t g_chipid_data

ChipID data read.