Sonoma (MAXREFDES14#) Code Documentation V01.00 Isolated EMP (Energy Measurement Processor)

- Main Page
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Macros Pages
MAXREFDES14.h
Go to the documentation of this file.
1
28 /*
29 * Copyright (C) 2012 Maxim Integrated Products, All Rights Reserved.
30 *
31 * Permission is hereby granted, free of charge, to any person obtaining a
32 * copy of this software and associated documentation files (the "Software"),
33 * to deal in the Software without restriction, including without limitation
34 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
35 * and/or sell copies of the Software, and to permit persons to whom the
36 * Software is furnished to do so, subject to the following conditions:
37 *
38 * The above copyright notice and this permission notice shall be included
39 * in all copies or substantial portions of the Software.
40 *
41 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
42 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
43 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
44 * IN NO EVENT SHALL MAXIM INTEGRATED PRODUCTS BE LIABLE FOR ANY CLAIM, DAMAGES
45 * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
46 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
48 *
49 * Except as contained in this notice, the name of Maxim Integrated Products
50 * shall not be used except as stated in the Maxim Integrated Products
51 * Branding Policy.
52 *
53 * The mere transfer of this software does not imply any licenses
54 * of trade secrets, proprietary technology, copyrights, patents,
55 * trademarks, maskwork rights, or any other form of intellectual
56 * property whatsoever. Maxim Integrated Products retains all ownership rights.
57 *
58 ***************************************************************************/
59
60 #ifndef MAXIMPMOD_H_
61 #define MAXIMPMOD_H_
62
63 #include "xgpio.h"
64 #include "xgpio_l.h"
65 #include "xparameters.h"
66 #include "xuartlite.h"
67 #include "xspi_l.h"
68 #include "xspi.h"
69 #include "xiic_l.h"
70 #include "utilities.h"
71 #include <string.h>
72 #include <stdio.h>
73 #include "platform.h"
74
75 #define DEFAULT_HYPERTERMINAL_UART_ID XPAR_USB_UART_DEVICE_ID
76 #define DEFAULT_HYPERTERMINAL_UART_ADDRESS XPAR_USB_UART_BASEADDR
77
78 #define ABOUT_ONE_SECOND 3508380
79 // Update this if microblaze core frequency is changed, or if the external memory timing changes.
80 // Although emprirically tested to 1.0000003 seconds, it is not meant to be used for precise timing purposes
81
82 #define PMOD_TYPE_UART 0
83 #define PMOD_TYPE_SPI 1
84 #define PMOD_TYPE_GPIO 2
85 #define PMOD_TYPE_I2C 3
86
87 #define PMOD_PORT_TYPE_UART 0x00
88 #define PMOD_PORT_TYPE_SPI 0x01
89 #define PMOD_PORT_TYPE_GPIO 0x02
90 #define PMOD_PORT_TYPE_I2C 0x03
91
92 #define BIT_BANG_SPI_CLK 0x08
93 #define BIT_BANG_SPI_CLRB 0x04
94 #define BIT_BANG_SPI_MISO 0x04
95 #define BIT_BANG_SPI_MOSI 0x02
96 #define BIT_BANG_SPI_SSB 0x01
97
98 #define RE_B 0x00000001
99 #define DI 0x00000002
100 #define RO 0x00000004
101 #define DE 0x00000008
102
103
104
105 struct maximProduct
106 {
107 char sPartNumber[10];
108 char sPartName[80];
109 u8 uchPmodType; // pmod: i2c, spi, gpio, etc
110 u8 uchKeypress;
111 };
112
113 struct maximDateTime
114 {
115 u8 uchHour;
116 u8 uchMinute;
117 u8 uchSecond;
118 u8 uchMonth;
119 u8 uchDate;
120 u8 uchYear;
121 u8 uchDow;
122 };
123
124 #define INPUT_STRING_MAX_SIZE 16
125 extern XGpio g_xGpioPmodPortA;
126 extern XGpio g_xGpioPmodPortB;
127 extern char g_sInputString[ INPUT_STRING_MAX_SIZE ]; //This string will hold user input from terminal.
128
129 #endif /* MAXIMPMOD_H_ */