tinyusb  0.4
Click here to lend your support to tinyusb donation and make a donation at pledgie.com
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
norflash.h
1 /*****************************************************************************
2  *
3  * Copyright(C) 2011, Embedded Artists AB
4  * All rights reserved.
5  *
6  ******************************************************************************
7  * Software that is described herein is for illustrative purposes only
8  * which provides customers with programming information regarding the
9  * products. This software is supplied "AS IS" without any warranties.
10  * Embedded Artists AB assumes no responsibility or liability for the
11  * use of the software, conveys no license or title under any patent,
12  * copyright, or mask work right to the product. Embedded Artists AB
13  * reserves the right to make changes in the software without
14  * notification. Embedded Artists AB also make no representation or
15  * warranty that such application will be suitable for the specified
16  * use without further testing or modification.
17  *****************************************************************************/
18 #ifndef __NORFLASH_H
19 #define __NORFLASH_H
20 
21 #define NORFLASH_SIZE 0x400000 /*Bytes or 0x200000 16bit words*/
22 #define NORFLASH_BLOCK_SIZE 0x10000 /*Bytes, or 32K 16bit words*/
23 #define NORFLASH_BASE 0x1C000000
24 
25 //16 bit data
26 #define GET_ADDR(addr) (volatile uint16_t *)(NORFLASH_BASE | ((addr) << 1))
27 
28 typedef struct
29 {
30  uint32_t device_size; /* Device size in bytes */
31  uint32_t num_sectors; /* Number of sectors */
32  uint32_t sector_size; /* Sector size in bytes */
33  uint32_t num_blocks; /* Number of blocks */
34  uint32_t block_size; /* Block size in bytes */
35 } geometry_t;
36 
37 extern uint32_t norflash_init(void);
38 
39 extern void norflash_getGeometry(geometry_t* geometry);
40 
41 extern uint32_t norflash_eraseBlock(uint32_t addr);
42 extern uint32_t norflash_eraseSector(uint32_t addr);
43 extern uint32_t norflash_eraseEntireChip(void);
44 
45 extern uint32_t norflash_writeWord(uint32_t addr, uint16_t data);
46 extern uint32_t norflash_writeBuff(uint32_t addr, uint16_t* data, uint16_t len);
47 
48 extern void norflash_secid_read(uint16_t SST_SecID[8], uint16_t user_SecID[8]);
49 extern uint32_t norflash_secid_getLockStatus(void);
50 extern uint32_t norflash_secid_lockOut(void);
51 extern uint32_t norflash_secid_writeWord(uint16_t target, uint16_t* data, uint16_t len);
52 
53 #endif /* end __NORFLASH_H */
54 /****************************************************************************
55 ** End Of File
56 *****************************************************************************/