Mouse code for the MacroRat

Dependencies:   ITG3200 QEI

Committer:
sahilmgandhi
Date:
Sun May 14 23:18:57 2017 +0000
Revision:
18:6a4db94011d3
Publishing again

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sahilmgandhi 18:6a4db94011d3 1 /* mbed Microcontroller Library
sahilmgandhi 18:6a4db94011d3 2 * Copyright (c) 2017 ARM Limited
sahilmgandhi 18:6a4db94011d3 3 *
sahilmgandhi 18:6a4db94011d3 4 * Licensed under the Apache License, Version 2.0 (the "License");
sahilmgandhi 18:6a4db94011d3 5 * you may not use this file except in compliance with the License.
sahilmgandhi 18:6a4db94011d3 6 * You may obtain a copy of the License at
sahilmgandhi 18:6a4db94011d3 7 *
sahilmgandhi 18:6a4db94011d3 8 * http://www.apache.org/licenses/LICENSE-2.0
sahilmgandhi 18:6a4db94011d3 9 *
sahilmgandhi 18:6a4db94011d3 10 * Unless required by applicable law or agreed to in writing, software
sahilmgandhi 18:6a4db94011d3 11 * distributed under the License is distributed on an "AS IS" BASIS,
sahilmgandhi 18:6a4db94011d3 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
sahilmgandhi 18:6a4db94011d3 13 * See the License for the specific language governing permissions and
sahilmgandhi 18:6a4db94011d3 14 * limitations under the License.
sahilmgandhi 18:6a4db94011d3 15 */
sahilmgandhi 18:6a4db94011d3 16 #ifndef MBED_FLASH_DATA_H
sahilmgandhi 18:6a4db94011d3 17 #define MBED_FLASH_DATA_H
sahilmgandhi 18:6a4db94011d3 18
sahilmgandhi 18:6a4db94011d3 19 #include <stdint.h>
sahilmgandhi 18:6a4db94011d3 20
sahilmgandhi 18:6a4db94011d3 21 // Target flash algorithm structure
sahilmgandhi 18:6a4db94011d3 22 typedef struct {
sahilmgandhi 18:6a4db94011d3 23 const uint32_t init;
sahilmgandhi 18:6a4db94011d3 24 const uint32_t uninit;
sahilmgandhi 18:6a4db94011d3 25 const uint32_t erase_sector;
sahilmgandhi 18:6a4db94011d3 26 const uint32_t program_page;
sahilmgandhi 18:6a4db94011d3 27 const uint32_t static_base;
sahilmgandhi 18:6a4db94011d3 28 uint32_t *algo_blob;
sahilmgandhi 18:6a4db94011d3 29 } flash_algo_t;
sahilmgandhi 18:6a4db94011d3 30
sahilmgandhi 18:6a4db94011d3 31 typedef struct {
sahilmgandhi 18:6a4db94011d3 32 const uint32_t start;
sahilmgandhi 18:6a4db94011d3 33 const uint32_t size;
sahilmgandhi 18:6a4db94011d3 34 } sector_info_t;
sahilmgandhi 18:6a4db94011d3 35
sahilmgandhi 18:6a4db94011d3 36 typedef struct {
sahilmgandhi 18:6a4db94011d3 37 const uint32_t page_size;
sahilmgandhi 18:6a4db94011d3 38 const uint32_t flash_start;
sahilmgandhi 18:6a4db94011d3 39 const uint32_t flash_size;
sahilmgandhi 18:6a4db94011d3 40 const sector_info_t *sectors;
sahilmgandhi 18:6a4db94011d3 41 const uint32_t sector_info_count;
sahilmgandhi 18:6a4db94011d3 42 } flash_target_config_t;
sahilmgandhi 18:6a4db94011d3 43
sahilmgandhi 18:6a4db94011d3 44 // Target flash configuration
sahilmgandhi 18:6a4db94011d3 45 struct flash_s {
sahilmgandhi 18:6a4db94011d3 46 const flash_target_config_t *target_config;
sahilmgandhi 18:6a4db94011d3 47 const flash_algo_t *flash_algo;
sahilmgandhi 18:6a4db94011d3 48 };
sahilmgandhi 18:6a4db94011d3 49
sahilmgandhi 18:6a4db94011d3 50 typedef struct {
sahilmgandhi 18:6a4db94011d3 51 uint32_t r0;
sahilmgandhi 18:6a4db94011d3 52 uint32_t r1;
sahilmgandhi 18:6a4db94011d3 53 uint32_t r2;
sahilmgandhi 18:6a4db94011d3 54 uint32_t r3;
sahilmgandhi 18:6a4db94011d3 55 uint32_t r9;
sahilmgandhi 18:6a4db94011d3 56 uint32_t pc;
sahilmgandhi 18:6a4db94011d3 57 } args_t;
sahilmgandhi 18:6a4db94011d3 58
sahilmgandhi 18:6a4db94011d3 59 typedef int32_t (*flash_algo_jump_t)(args_t*);
sahilmgandhi 18:6a4db94011d3 60
sahilmgandhi 18:6a4db94011d3 61 // prototypes for flash algo CMSIS API
sahilmgandhi 18:6a4db94011d3 62
sahilmgandhi 18:6a4db94011d3 63 typedef int (*CMSIS_Algo_Function_Init)(unsigned long adr, unsigned long clk, unsigned long fnc);
sahilmgandhi 18:6a4db94011d3 64 typedef int (*CMSIS_Algo_Function_UnInit)(unsigned long fnc);
sahilmgandhi 18:6a4db94011d3 65 typedef int (*CMSIS_Algo_Function_EraseSector)(unsigned long adr);
sahilmgandhi 18:6a4db94011d3 66 typedef int (*CMSIS_Algo_Function_EraseChip)(void);
sahilmgandhi 18:6a4db94011d3 67 typedef int (*CMSIS_Algo_Function_ProgramPage)(unsigned long adr, unsigned long sz, unsigned char *buf);
sahilmgandhi 18:6a4db94011d3 68 typedef unsigned long (*CMSIS_Algo_Function_Verify)(unsigned long adr, unsigned long sz, unsigned char *buf);
sahilmgandhi 18:6a4db94011d3 69
sahilmgandhi 18:6a4db94011d3 70 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 71 extern "C" {
sahilmgandhi 18:6a4db94011d3 72 #endif
sahilmgandhi 18:6a4db94011d3 73
sahilmgandhi 18:6a4db94011d3 74 /* Set target configuration
sahilmgandhi 18:6a4db94011d3 75 */
sahilmgandhi 18:6a4db94011d3 76 void flash_set_target_config(flash_t *obj);
sahilmgandhi 18:6a4db94011d3 77
sahilmgandhi 18:6a4db94011d3 78 #ifdef __cplusplus
sahilmgandhi 18:6a4db94011d3 79 };
sahilmgandhi 18:6a4db94011d3 80 #endif
sahilmgandhi 18:6a4db94011d3 81
sahilmgandhi 18:6a4db94011d3 82
sahilmgandhi 18:6a4db94011d3 83 #endif