FreeCalypso > hg > fc-magnetite
comparison src/cs/drivers/drv_core/armio/armio.c @ 681:140a0d24a64c
Tango pinmux implemented
except for GPIO1 special outputs, which will be implemented later.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Thu, 25 Jun 2020 05:36:24 +0000 |
parents | ee3ac8c617cb |
children |
comparison
equal
deleted
inserted
replaced
680:ee3ac8c617cb | 681:140a0d24a64c |
---|---|
32 #include "memif/mem.h" | 32 #include "memif/mem.h" |
33 | 33 |
34 #include "inth/iq.h" | 34 #include "inth/iq.h" |
35 #include "armio/armio.h" | 35 #include "armio/armio.h" |
36 #include "abb/abb.h" // for AI_Power function : to be removed, use ABB_Power_Off in abb.c file instead !!! | 36 #include "abb/abb.h" // for AI_Power function : to be removed, use ABB_Power_Off in abb.c file instead !!! |
37 | |
38 #ifdef CONFIG_TANGO_MODEM | |
39 #include "ffs/ffs_api.h" | |
40 | |
41 SYS_UWORD8 AI_Tango_pinmux[4]; | |
42 #endif | |
37 | 43 |
38 #if (CHIPSET != 12) | 44 #if (CHIPSET != 12) |
39 /* | 45 /* |
40 * AI_EnableBit | 46 * AI_EnableBit |
41 * | 47 * |
278 // set IOs 1,2,5,7,9,14 and 15 as ouputs. | 284 // set IOs 1,2,5,7,9,14 and 15 as ouputs. |
279 // all others are FreeCalypso additions | 285 // all others are FreeCalypso additions |
280 #if defined(CONFIG_GPIO046_OUTPUTS) || defined(CONFIG_TARGET_GTM900) | 286 #if defined(CONFIG_GPIO046_OUTPUTS) || defined(CONFIG_TARGET_GTM900) |
281 AI_ConfigBitAsOutput(0); | 287 AI_ConfigBitAsOutput(0); |
282 #endif | 288 #endif |
283 AI_ConfigBitAsOutput(1); | 289 #ifndef CONFIG_TANGO_MODEM /* we do dynamic config on Tango instead */ |
284 #ifndef CONFIG_TARGET_LEONARDO /* GPIO 2 is an input on Leonardo! */ | 290 AI_ConfigBitAsOutput(1); |
285 AI_ConfigBitAsOutput(2); | 291 #ifndef CONFIG_TARGET_LEONARDO /* GPIO 2 is an input on Leonardo! */ |
286 #endif | 292 AI_ConfigBitAsOutput(2); |
287 #ifdef CONFIG_GPIO3_OUTPUT | 293 #endif |
288 AI_ConfigBitAsOutput(3); | 294 #ifdef CONFIG_GPIO3_OUTPUT |
295 AI_ConfigBitAsOutput(3); | |
296 #endif | |
289 #endif | 297 #endif |
290 #ifdef CONFIG_GPIO046_OUTPUTS | 298 #ifdef CONFIG_GPIO046_OUTPUTS |
291 AI_ConfigBitAsOutput(4); | 299 AI_ConfigBitAsOutput(4); |
292 #endif | 300 #endif |
293 AI_ConfigBitAsOutput(5); | 301 AI_ConfigBitAsOutput(5); |
309 #endif | 317 #endif |
310 AI_ConfigBitAsOutput(14); | 318 AI_ConfigBitAsOutput(14); |
311 AI_ConfigBitAsOutput(15); | 319 AI_ConfigBitAsOutput(15); |
312 #endif | 320 #endif |
313 } | 321 } |
322 | |
323 #ifdef CONFIG_TANGO_MODEM | |
324 void AI_Init_Tango_pinmux(void) | |
325 { | |
326 ffs_file_read("/etc/tango-pinmux", AI_Tango_pinmux, 4); | |
327 /* apply this config */ | |
328 if (AI_Tango_pinmux[0] & 0x80) { | |
329 if (AI_Tango_pinmux[0] & 1) | |
330 AI_SetBit(1); | |
331 else | |
332 AI_ResetBit(1); | |
333 AI_ConfigBitAsOutput(1); | |
334 } | |
335 /* GPIO2 config */ | |
336 if (AI_Tango_pinmux[1] & 0x02) { | |
337 if (AI_Tango_pinmux[1] & 0x01) | |
338 AI_SetBit(2); | |
339 else | |
340 AI_ResetBit(2); | |
341 AI_ConfigBitAsOutput(2); | |
342 } | |
343 /* GPIO3 config */ | |
344 if (AI_Tango_pinmux[1] & 0x20) { | |
345 if (AI_Tango_pinmux[1] & 0x10) | |
346 AI_SetBit(3); | |
347 else | |
348 AI_ResetBit(3); | |
349 AI_ConfigBitAsOutput(3); | |
350 } | |
351 /* RESET_OUT/IO7 config */ | |
352 if (AI_Tango_pinmux[2] & 0x08) { | |
353 AI_EnableBit(3); | |
354 if (AI_Tango_pinmux[2] & 0x02) { | |
355 if (AI_Tango_pinmux[2] & 0x01) | |
356 AI_SetBit(7); | |
357 else | |
358 AI_ResetBit(7); | |
359 } else | |
360 AI_ConfigBitAsInput(7); | |
361 } | |
362 /* MCSI/GPIO config */ | |
363 if (AI_Tango_pinmux[2] & 0x80) { | |
364 if (AI_Tango_pinmux[3] & 0x10) { | |
365 if (AI_Tango_pinmux[3] & 0x01) | |
366 AI_SetBit(9); | |
367 else | |
368 AI_ResetBit(9); | |
369 } else | |
370 AI_ConfigBitAsInput(9); | |
371 AI_EnableBit(5); | |
372 AI_EnableBit(6); | |
373 AI_EnableBit(7); | |
374 AI_EnableBit(8); | |
375 if (AI_Tango_pinmux[3] & 0x20) { | |
376 if (AI_Tango_pinmux[3] & 0x02) | |
377 AI_SetBit(10); | |
378 else | |
379 AI_ResetBit(10); | |
380 AI_ConfigBitAsOutput(10); | |
381 } | |
382 if (AI_Tango_pinmux[3] & 0x40) { | |
383 if (AI_Tango_pinmux[3] & 0x04) | |
384 AI_SetBit(11); | |
385 else | |
386 AI_ResetBit(11); | |
387 AI_ConfigBitAsOutput(11); | |
388 } | |
389 if (AI_Tango_pinmux[3] & 0x80) { | |
390 if (AI_Tango_pinmux[3] & 0x08) | |
391 AI_SetBit(12); | |
392 else | |
393 AI_ResetBit(12); | |
394 AI_ConfigBitAsOutput(12); | |
395 } | |
396 } | |
397 } | |
398 #endif | |
314 | 399 |
315 /* | 400 /* |
316 * AI_SelectIOForIT | 401 * AI_SelectIOForIT |
317 * | 402 * |
318 * Select which IO will be used to generate an interrupt. | 403 * Select which IO will be used to generate an interrupt. |