2010-08-19 15:04:51 +03:00
|
|
|
/*
|
2010-08-20 21:11:41 +03:00
|
|
|
* atspi/atspi.c - ATSPI initialization and main loop
|
2010-08-19 15:04:51 +03:00
|
|
|
*
|
|
|
|
* Written 2008-2010 by Werner Almesberger
|
|
|
|
* Copyright 2008-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 "regs.h"
|
|
|
|
#include "io.h"
|
|
|
|
#include "usb.h"
|
|
|
|
#include "atspi/ep0.h"
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
2010-08-20 07:50:51 +03:00
|
|
|
static void init_io(void)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Signal Mode Value
|
|
|
|
*
|
|
|
|
* MOSI push-pull 0
|
|
|
|
* MISO open drain 1 (input)
|
|
|
|
* SCLK push-pull 1
|
|
|
|
* nSS push-pull 1
|
|
|
|
* nRST_RF push-pull 1
|
|
|
|
* IRQ_RF open drain 1 (input)
|
|
|
|
* SLP_TR push-pull 0
|
|
|
|
*
|
|
|
|
* LED push-pull 0 (set up by boot loader)
|
|
|
|
*
|
|
|
|
* all unused open drain 0
|
|
|
|
*/
|
|
|
|
|
|
|
|
MOSI = 0;
|
|
|
|
MOSI_MODE = 1;
|
|
|
|
|
|
|
|
SCLK = 0;
|
|
|
|
SCLK_MODE = 1;
|
|
|
|
|
|
|
|
nSS_MODE = 1;
|
|
|
|
|
|
|
|
nRST_RF_MODE = 1;
|
|
|
|
|
|
|
|
SLP_TR = 0;
|
|
|
|
SLP_TR_MODE = 1;
|
|
|
|
|
|
|
|
P0 &=
|
|
|
|
~((1 << 0) | (1 << 3) | (1 << 4) | (1 << 5) | (1 << 6) | (1 << 7));
|
|
|
|
P3 = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-08-19 15:04:51 +03:00
|
|
|
void main(void)
|
|
|
|
{
|
2010-08-20 07:50:51 +03:00
|
|
|
init_io();
|
|
|
|
|
2010-08-19 15:04:51 +03:00
|
|
|
usb_init();
|
|
|
|
ep0_init();
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
usb_poll();
|
|
|
|
}
|
|
|
|
}
|