Robotics platform
Sign in or create your account | Project List | Help
Robotics platform Git Source Tree
Root/
| 1 | /* ADC Peripheral.c |
| 2 | |
| 3 | Copyright (C) 2010 Carlos Camargo cicamargoba@unal.edu.co |
| 4 | Andres Calderon andres.calderon@emqbit.com |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; if not, write to the Free Software |
| 18 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
| 19 | |
| 20 | #include <stdio.h> |
| 21 | #include <unistd.h> |
| 22 | |
| 23 | #include "jz_adc_peripheral.h" |
| 24 | |
| 25 | JZ_REG * |
| 26 | jz_adc_init() |
| 27 | { |
| 28 | JZ_PIO *pio; |
| 29 | JZ_REG *virt_addr; |
| 30 | |
| 31 | pio = jz_gpio_map (CS2_PORT); |
| 32 | jz_gpio_as_func (pio, CS2_PIN, 0); |
| 33 | |
| 34 | virt_addr = (JZ_REG *) (jz_mmap(0x13010000) + 0x18); |
| 35 | |
| 36 | if (*virt_addr != 0x0FFF7700) |
| 37 | { |
| 38 | *virt_addr = 0x0FFF7700; |
| 39 | printf ("ADC: Configuring CS2 8 bits and 0 WS: %08X\n", *virt_addr); |
| 40 | } |
| 41 | else |
| 42 | printf ("ADC: CS2, already configured: %08X\n", *virt_addr); |
| 43 | |
| 44 | virt_addr = (JZ_REG *) jz_mmap (0x14000000); |
| 45 | |
| 46 | return virt_addr; |
| 47 | } |
| 48 |
Branches:
master
