MAX32675 Peripheral Driver API
Peripheral Driver API for the MAX32675
msr.h
1
/*******************************************************************************
2
* Copyright (C) 2014 Maxim Integrated Products, Inc., All Rights Reserved.
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a
5
* copy of this software and associated documentation files (the "Software"),
6
* to deal in the Software without restriction, including without limitation
7
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
8
* and/or sell copies of the Software, and to permit persons to whom the
9
* Software is furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice shall be included
12
* in all copies or substantial portions of the Software.
13
*
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
* IN NO EVENT SHALL MAXIM INTEGRATED BE LIABLE FOR ANY CLAIM, DAMAGES
18
* OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
* OTHER DEALINGS IN THE SOFTWARE.
21
*
22
* Except as contained in this notice, the name of Maxim Integrated
23
* Products, Inc. shall not be used except as stated in the Maxim Integrated
24
* Products, Inc. Branding Policy.
25
*
26
* The mere transfer of this software does not imply any licenses
27
* of trade secrets, proprietary technology, copyrights, patents,
28
* trademarks, maskwork rights, or any other form of intellectual
29
* property whatsoever. Maxim Integrated Products, Inc. retains all
30
* ownership rights.
31
*
32
********************************************************************************
33
*/
34
45
#ifndef _MSR_H_
46
#define _MSR_H_
47
48
/***** Definitions *****/
49
51
#ifndef MSR_NUM_TRACKS
52
#define MSR_NUM_TRACKS 3
53
#endif
54
55
#define MSR_MAX_SAMPLES 1536
56
57
// Assuming nominal bit density of 210 bpi and 3.375 inch length
58
#define MSR_MAX_RAW_LEN_BITS (709)
59
#define MSR_MAX_RAW_LEN_BYTES ((MSR_MAX_RAW_LEN_BITS + 7) / 8)
60
#define MSR_MAX_RAW_LEN_HALFWORDS ((MSR_MAX_RAW_LEN_BITS + 15) / 16)
61
63
#define MSR_MAX_DEC_LEN (MSR_MAX_RAW_LEN_BITS / 5)
64
66
#define MSR_FORWARD 0
67
#define MSR_REVERSE 1
69
71
#define MSR_ERR_OK 0x00
72
#define MSR_ERR_BAD_LEN 0x01
73
#define MSR_ERR_START_SEN 0x02
74
#define MSR_ERR_END_SEN 0x04
75
#define MSR_ERR_OUTLIER 0x08
76
#define MSR_ERR_PARAM 0x10
77
#define MSR_ERR_LRC 0x40
78
#define MSR_ERR_PARITY 0x80
79
81
typedef
struct
{
82
uint8_t
error_code
;
83
uint8_t
parity_errs
;
84
uint8_t
lrc
;
87
uint8_t
direction
;
88
uint8_t
len
;
90
uint16_t speed;
91
uint8_t data[MSR_MAX_DEC_LEN];
92
}
msr_decoded_track_t
;
93
95
typedef
union
{
96
struct
{
97
uint16_t time : 9;
98
uint16_t amp : 7;
99
};
100
uint16_t value;
101
}
msr_sample_t
;
102
104
typedef
struct
{
105
uint16_t len;
106
msr_sample_t
data[MSR_MAX_SAMPLES];
107
}
msr_samples_t
;
108
109
/***** Function Prototypes *****/
110
115
int
msr_init (
void
);
116
121
void
msr_init_track (
unsigned
int
track);
122
128
void
msr_enable (
void
);
129
133
void
msr_disable (
void
);
134
142
int
msr_task (
void
);
143
151
unsigned
int
msr_track_decode (
unsigned
int
track,
msr_decoded_track_t
* decoded_track);
152
161
void
msr_set_complete_callback (
void
(*func) (
void
));
162
170
unsigned
int
mcr_get_track_samples (
unsigned
int
track,
msr_samples_t
* samples);
171
172
#endif
/* _MSR_H_ */
173
msr_decoded_track_t::parity_errs
uint8_t parity_errs
Definition:
msr.h:83
msr_decoded_track_t::lrc
uint8_t lrc
Definition:
msr.h:84
msr_decoded_track_t::direction
uint8_t direction
Definition:
msr.h:87
msr_decoded_track_t
Structure to contain result of a track decode.
Definition:
msr.h:81
msr_samples_t
Structure to contain raw MSR samples.
Definition:
msr.h:104
msr_decoded_track_t::len
uint8_t len
Definition:
msr.h:88
msr_decoded_track_t::error_code
uint8_t error_code
Definition:
msr.h:82
msr_sample_t
MSR sample fields.
Definition:
msr.h:95
Include
MAX32675
msr.h
Generated on Mon Feb 8 2021 11:38:50 for MAX32675 Peripheral Driver API by
1.8.17