mirror of
git://projects.qi-hardware.com/f32xbase.git
synced 2024-11-27 18:10:38 +02:00
e614d15fef
- f32x/c2-ben.c: removed #include <stdio.h> left over from debugging - f32x/f32x.c (main): command-line parsing now uses getopt() and is done before trying to talk to the target - f32x/c2-drv.h (c2_ops), f32x/c2.h (c2_init), f32x/c2.c (c2_init), f32x/c2-om.c (om_init): pass "power" argument along the init call chain - f32x/c2-ben.c (ben_init): added target power switching - f32x/f32x.c (usage, main): new option -n to disable target power
46 lines
934 B
C
46 lines
934 B
C
/*
|
|
* f32x/c2-ben.c - Basic C2 messages, driver for Openmoko GTA01/GTA02+DebugV3
|
|
*
|
|
* Written 2010 by Werner Almesberger
|
|
* Copyright 2010 Werner Almesberger
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
* (at your option) any later version.
|
|
*/
|
|
|
|
|
|
#include "gpio-xburst.h"
|
|
#include "c2-drv.h"
|
|
|
|
|
|
#define POWER_OFF 3, 2 /* PD02, drive low to enable power */
|
|
#define C2CK 3, 8 /* PD08 */
|
|
#define C2D 3, 12 /* PD12 */
|
|
|
|
|
|
#include "c2-bitbang.c"
|
|
|
|
|
|
static void ben_init(int power)
|
|
{
|
|
gpio_init();
|
|
if (power)
|
|
gpio_low(POWER_OFF);
|
|
else
|
|
gpio_high(POWER_OFF);
|
|
c2_init();
|
|
|
|
}
|
|
|
|
|
|
struct c2_ops c2_ben = {
|
|
.init = ben_init,
|
|
.reset = c2_reset,
|
|
.addr_write = c2_addr_write,
|
|
.addr_read = c2_addr_read,
|
|
.data_write = c2_data_write,
|
|
.data_read = c2_data_read,
|
|
};
|