Skip to content

Commit 4022000

Browse files
committed
Formatting and macro rename
turns out that EEPROM_SIZE is already in use on megaAVR devices. The macro is now renamed to EE_SIZE. My text editor have also gone through the files and removed all blank spaces at the end over every line
1 parent c96a2c2 commit 4022000

File tree

10 files changed

+17224
-17214
lines changed

10 files changed

+17224
-17214
lines changed

DSP_parameter_generator.sh

+35-35
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/bin/bash
2-
set -e
2+
set -e
33

44
#####################################################################
55
# SIGMADSP PARAMETER FILE GENERATOR SCRIPT #
@@ -60,7 +60,7 @@ then
6060
FILE_ERROR=false
6161
fi
6262
63-
# DSP parameter file (*_IC_1_PARAM.h)
63+
# DSP parameter file (*_IC_1_PARAM.h)
6464
DSP_PARAM_FILE=$(find $(dirname "$0") -name "*${SIGMA_STUDIO_PROJECT_NAME%%.*}_IC_1_PARAM.h")
6565
if [ "$DSP_PARAM_FILE" = "" ]
6666
then
@@ -97,10 +97,10 @@ BEGIN {
9797
# Add guards
9898
printf("#ifndef SIGMADSP_PARAMETERS_H\n")
9999
printf("#define SIGMADSP_PARAMETERS_H\n\n")
100-
100+
101101
# Include SigmaDSP library
102102
printf("#include <SigmaDSP.h>\n\n")
103-
103+
104104
# Print header
105105
printf("/****************************************************************************\n")
106106
printf("| Filename: SigmaDSP_parameters.h |\n")
@@ -144,16 +144,16 @@ BEGIN {
144144
printf("| EEPROM, you can simply run loadProgram() (located at the bottom of this |\n")
145145
printf("| file) where you pass the SigmaDSP object as the only parameter. |\n")
146146
printf("****************************************************************************/\n\n\n")
147-
147+
148148
printf("/* 7-bit i2c addresses */\n")
149149
}
150150

151151
{
152152
# Track down the DSP and EEPROM i2c addresses and convert them into 7-bit
153153
if ($1 ~ "#define" && $2 ~ "DEVICE_ADDR_IC_1")
154154
printf("%s DSP_I2C_ADDRESS (%.4s >> 1) & 0xFE\n", $1, $3)
155-
156-
if ($1 ~ "#define" && $2 ~ "DEVICE_ADDR_IC_2")
155+
156+
if ($1 ~ "#define" && $2 ~ "DEVICE_ADDR_IC_2")
157157
printf("%s EEPROM_I2C_ADDRESS (%.4s >> 1) & 0xFE\n", $1, $3)
158158
} ' "$DSP_PROGRAM_FILE" "$EEPROM_PROGRAM_FILE" > "$(dirname "$0")/SigmaDSP_parameters.h"
159159
@@ -166,48 +166,48 @@ echo -e "\x1B[31m"
166166
awk '
167167
{
168168
sub("\r","") # Get rid of all CR characters from the input file
169-
169+
170170
# Print out each module comment
171-
if ($0 ~ "/* Module.")
171+
if ($0 ~ "/* Module.")
172172
printf("\n%s\n", $0)
173173

174174
# Print every line where column two ends with _COUNT
175175
if ($2 ~ "._COUNT$")
176176
printf("%s %s %s\n\n", $1, $2, $3)
177177

178178
# Print every line where column two ends with _ADDR
179-
if ($2 ~ "._ADDR$")
179+
if ($2 ~ "._ADDR$")
180180
printf("%s\n", $0)
181181

182182
# Print column 1, 2 and only the number between the parenthesis on the line where column two ends with _VALUES
183183
if ($2 ~ "._VALUES$")
184184
printf("%s %s %s\n", $1, $2, substr($3, match($3, /\(/) + 1, match($3, /\)/) - (match($3, /\(/)) - 1))
185185

186186
# Print every line where column two ends with _FIXPT
187-
if ($2 ~ "._FIXPT$")
187+
if ($2 ~ "._FIXPT$")
188188
printf("%s\n\n", $0)
189189
} ' "$DSP_PARAM_FILE" >> "$(dirname "$0")/SigmaDSP_parameters.h"
190190
191191
192192
193193
# Skip EEPROM array if file is not present
194194
if [ "$EEPROM_HEXFILE" != "" ]
195-
then
195+
then
196196
# Generate C style array out from passed hex file
197197
echo -e "\x1B[0mExtract and format EEPROM array from"
198198
echo -e "\x1B[1m$EEPROM_HEXFILE"
199199
echo -e "\x1B[31m"
200200
awk '
201201
BEGIN {
202202
FS=" * , *"
203-
RS="^$"
203+
RS="^$"
204204
printf("\n\n/* This array contains the entire DSP program,\nand should be loaded into the external i2c EEPROM */\n\n")
205205
}
206-
206+
207207
{
208-
printf("#define EEPROM_SIZE " NF-1 "\n\n")
209-
printf("const uint8_t PROGMEM DSP_eeprom_firmware[EEPROM_SIZE] =\n{\n")
210-
for(i = 1; i < NF; i++)
208+
printf("#define EE_SIZE " NF-1 "\n\n")
209+
printf("const uint8_t PROGMEM DSP_eeprom_firmware[EE_SIZE] =\n{\n")
210+
for(i = 1; i < NF; i++)
211211
{
212212
sub("\r","") # Get rid of all CR characters from the input file
213213
printf("%s", $i ", ")
@@ -233,75 +233,75 @@ BEGIN {
233233

234234
{
235235
sub("\r","\n") # Get rid of all CR characters from the input file
236-
236+
237237
if (NR >= 28) # Start from line 28
238238
{
239239
# Print out relevant comments
240240
if ($0 ~ "/* DSP." || $0 ~"/* Register.")
241-
printf("\n%s\n", $0)
242-
241+
printf("\n%s\n", $0)
242+
243243
if ($2 == "PROGRAM_SIZE_IC_1")
244244
printf("#define PROGRAM_SIZE %s\n", $3)
245-
245+
246246
if ($2 == "PROGRAM_ADDR_IC_1")
247247
{
248248
printf("#define PROGRAM_ADDR %s\n", $3)
249249
printf("#define PROGRAM_REGSIZE 5\n\n")
250250
}
251-
251+
252252
if ($1 == "ADI_REG_TYPE" && $2 ~ "Program_Data.")
253-
printf("const uint8_t PROGMEM DSP_program_data[PROGRAM_SIZE] = \n{\n")
254-
253+
printf("const uint8_t PROGMEM DSP_program_data[PROGRAM_SIZE] = \n{\n")
254+
255255
if ($2 == "PARAM_SIZE_IC_1")
256256
printf("#define PARAMETER_SIZE %s\n", $3)
257-
257+
258258
if ($2 == "PARAM_ADDR_IC_1")
259259
{
260260
printf("#define PARAMETER_ADDR %s\n", $3)
261261
printf("#define PARAMETER_REGSIZE 4\n\n")
262262
}
263-
263+
264264
if ($1 == "ADI_REG_TYPE" && $2 ~ "Param_Data.")
265265
printf("const uint8_t PROGMEM DSP_parameter_data[PARAMETER_SIZE] = \n{\n")
266-
266+
267267
if ($1 == "ADI_REG_TYPE" && $2 ~ "R0_COREREGISTER.")
268268
{
269269
printf("#define CORE_REGISTER_R0_SIZE 2\n")
270270
printf("#define CORE_REGISTER_R0_ADDR 0x081C\n")
271271
printf("#define CORE_REGISTER_R0_REGSIZE 2\n\n")
272272
printf("const uint8_t PROGMEM DSP_core_register_R0_data[CORE_REGISTER_R0_SIZE] = \n{\n")
273273
}
274-
274+
275275
if ($2 == "R3_HWCONFIGURATION_IC_1_SIZE")
276276
{
277277
printf("#define HARDWARE_CONF_SIZE %s\n", $3)
278278
printf("#define HARDWARE_CONF_ADDR 0x081C\n")
279279
printf("#define HARDWARE_CONF_REGSIZE 1\n\n")
280280
}
281-
281+
282282
if ($1 == "ADI_REG_TYPE" && $2 ~ "R3_HWCONFIGURATION.")
283283
printf("const uint8_t PROGMEM DSP_hardware_conf_data[HARDWARE_CONF_SIZE] = \n{\n")
284-
284+
285285
if ($1 == "ADI_REG_TYPE" && $2 ~ "R4_COREREGISTER.")
286286
{
287287
printf("#define CORE_REGISTER_R4_SIZE 2\n")
288288
printf("#define CORE_REGISTER_R4_ADDR 0x081C\n")
289289
printf("#define CORE_REGISTER_R4_REGSIZE 2\n\n")
290290
printf("const uint8_t PROGMEM DSP_core_register_R4_data[CORE_REGISTER_R4_SIZE] = \n{\n")
291291
}
292-
292+
293293
# Print out all lines that thats with 0x
294294
if ($1 ~ "0x.")
295295
printf($0)
296-
296+
297297
# Print out all end brackets
298298
if ($1 ~ "}.")
299299
printf("%s\n\n", $0)
300-
301-
# Escape
300+
301+
# Escape
302302
if ($1 == "*")
303303
{exit}
304-
}
304+
}
305305
}
306306

307307
END {

0 commit comments

Comments
 (0)