- cosmetic cleanup

git-svn-id: https://svn.openpcd.org:2342/trunk@146 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
This commit is contained in:
(no author) 2006-09-09 04:42:17 +00:00
parent 3a98ae1285
commit 83c18361d8
16 changed files with 26 additions and 24 deletions

View File

@ -31,7 +31,6 @@ int _main_dbgu(char key)
void _init_func(void)
{
udp_init();
usbtest_init();
}

View File

@ -99,7 +99,4 @@
#define OPENPCD_IRQ_PRIO_UDP (AT91C_AIC_PRIOR_LOWEST+1)
#define OPENPCD_IRQ_PRIO_RC632 AT91C_AIC_PRIOR_LOWEST
extern void _init_func(void);
extern void _main_func(void);
#endif /* _OPENPCD_H */

View File

@ -26,6 +26,7 @@ void AT91F_DBGU_Init(void);
void AT91F_DBGU_Printk( char *buffer);
void AT91F_DBGU_Frame( char *buffer);
int AT91F_DBGU_Get( char *val);
void dbgu_rb_flush(void);
#ifndef __WinARM__
void AT91F_DBGU_scanf(char * type,unsigned int * val);
#endif

View File

@ -24,8 +24,8 @@
#define DEBUGE DEBUGP
#define DEBUGI DEBUGP
#else
#define DEBUGE(x, args ...)
#define DEBUGI(x, args ...)
#define DEBUGE(x, args ...) do { } while (0)
#define DEBUGI(x, args ...) do { } while (0)
#endif
/* this is only called once before DFU mode, no __dfufunc required */
@ -160,7 +160,7 @@ static __dfufunc int handle_upload(u_int16_t val, u_int16_t len)
if (ptr + len > AT91C_IFLASH_SIZE)
len = AT91C_IFLASH_SIZE - (u_int32_t) ptr;
udp_ep0_send_data(ptr, len);
udp_ep0_send_data((char *)ptr, len);
ptr+= len;
return len;
@ -176,7 +176,7 @@ static __dfufunc void handle_getstatus(void)
dstat.bStatus = status;
dstat.bState = dfu_state;
dstat.iString = 0;
udp_ep0_send_data(&dstat, sizeof(dstat));
udp_ep0_send_data((char *)&dstat, sizeof(dstat));
}
static void __dfufunc handle_getstate(void)
@ -368,7 +368,7 @@ send_zlp:
static u_int8_t cur_config;
/* USB DFU Device descriptor in DFU mode */
__dfustruct struct usb_device_descriptor dfu_dev_descriptor = {
__dfustruct const struct usb_device_descriptor dfu_dev_descriptor = {
.bLength = USB_DT_DEVICE_SIZE,
.bDescriptorType = USB_DT_DEVICE,
.bcdUSB = 0x0100,
@ -386,7 +386,7 @@ __dfustruct struct usb_device_descriptor dfu_dev_descriptor = {
};
/* USB DFU Config descriptor in DFU mode */
__dfustruct struct _dfu_desc dfu_cfg_descriptor = {
__dfustruct const struct _dfu_desc dfu_cfg_descriptor = {
.ucfg = {
.bLength = USB_DT_CONFIG_SIZE,
.bDescriptorType = USB_DT_CONFIG,
@ -665,7 +665,7 @@ void __dfufunc dfu_main(void)
while (1) ;
}
struct dfuapi __dfufunctab dfu_api = {
const struct dfuapi __dfufunctab dfu_api = {
.ep0_send_data = &udp_ep0_send_data,
.ep0_send_zlp = &udp_ep0_send_zlp,
.ep0_send_stall = &udp_ep0_send_stall,

View File

@ -72,8 +72,8 @@ struct dfuapi {
u_int16_t val, u_int16_t len);
void (*dfu_switch)(void);
u_int8_t *dfu_state;
struct usb_device_descriptor *dfu_dev_descriptor;
struct _dfu_desc *dfu_cfg_descriptor;
const struct usb_device_descriptor *dfu_dev_descriptor;
const struct _dfu_desc *dfu_cfg_descriptor;
};

View File

@ -3,6 +3,9 @@
#include <include/lib_AT91SAM7.h>
#include <os/dbgu.h>
#include <os/led.h>
#include <os/dfu.h>
#include <os/main.h>
#include <os/pcd_enumerate.h>
#include "../openpcd.h"
int main(void)
@ -14,6 +17,10 @@ int main(void)
/* call application specific init function */
_init_func();
/* initialize USB */
udp_init();
udp_open();
// Enable User Reset and set its minimal assertion to 960 us
AT91C_BASE_RSTC->RSTC_RMR =
AT91C_RSTC_URSTEN | (0x4 << 8) | (unsigned int)(0xA5 << 24);

View File

@ -31,7 +31,7 @@ struct req_ctx *req_ctx_find_get(unsigned long old_state, unsigned long new_stat
u_int8_t req_ctx_num(struct req_ctx *ctx)
{
return ((void *)ctx - (void *)&req_ctx[0])/sizeof(*ctx);
return ((char *)ctx - (char *)&req_ctx[0])/sizeof(*ctx);
}
void req_ctx_set_state(struct req_ctx *ctx, unsigned long new_state)

View File

@ -21,6 +21,7 @@ static usb_cmd_fn *cmd_hdlrs[16];
int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class)
{
cmd_hdlrs[class] = hdlr;
return 0;
}
void usb_hdlr_unregister(u_int8_t class)

View File

@ -2,12 +2,14 @@
#define _USB_HANDLER_H
#include "openpcd.h"
#include <os/req_ctx.h>
#define MAX_PAYLOAD_LEN (64 - sizeof(struct openpcd_hdr))
typedef int usb_cmd_fn(struct req_ctx *rctx);
extern int usb_hdlr_register(usb_cmd_fn *hdlr, u_int8_t class);
extern void usb_hdlr_unregister(u_int8_t class);
extern void usb_in_process(void);
extern void usb_out_process(void);

View File

@ -19,7 +19,6 @@
void _init_func(void)
{
//udp_init();
trigger_init();
rc632_init();
DEBUGPCRF("turning on RF");

View File

@ -12,8 +12,6 @@
void _init_func(void)
{
rc632_init();
udp_init();
udp_open();
rc632_test(RAH);
}

View File

@ -95,8 +95,6 @@ void _init_func(void)
pwm_duty_set_percent(0, 22); /* 22% of 9.43uS = 2.07uS */
rc632_modulate_mfin();
udp_init();
DEBUGPCRF("Initializing SSC RX");
ssc_rx_init();
}

View File

@ -26,7 +26,6 @@
void _init_func(void)
{
//udp_init();
trigger_init();
DEBUGPCRF("enabling RC632");
rc632_init();

View File

@ -107,7 +107,7 @@ void pwm_duty_set_percent(int channel, u_int16_t duty)
static int pwm_usb_in(struct req_ctx *rctx)
{
struct openpcd_hdr *poh = (struct openpcd_hdr *) &rctx->rx.data[0];
struct openpcd_hdr *pih = (struct openpcd_hdr *) &rctx->tx.data[0];
/* struct openpcd_hdr *pih = (struct openpcd_hdr *) &rctx->tx.data[0]; */
u_int32_t *freq;
switch (poh->cmd) {
@ -126,7 +126,7 @@ static int pwm_usb_in(struct req_ctx *rctx)
case OPENPCD_CMD_PWM_FREQ_SET:
if (rctx->rx.tot_len < sizeof(*poh)+4)
break;
freq = (void *) poh + sizeof(*poh);
freq = (unsigned char *) poh + sizeof(*poh);
pwm_freq_set(0, *freq);
break;
case OPENPCD_CMD_PWM_FREQ_GET:

View File

@ -397,7 +397,7 @@ static int rc632_usb_in(struct req_ctx *rctx)
break;
case OPENPCD_CMD_READ_FIFO:
{
u_int16_t req_len = poh->val, remain_len, pih_len;
u_int16_t req_len = poh->val, remain_len = req_len, pih_len;
if (req_len > MAX_PAYLOAD_LEN) {
pih_len = MAX_PAYLOAD_LEN;
remain_len -= pih_len;

View File

@ -19,11 +19,12 @@
//#define DEBUG_LL
#ifdef DEBUG_LL
/* Debugging macros for switching on/off LED1 (green) */
#define PIOA_PER 0xFFFFF400
#define PIOA_OER 0xFFFFF410
#define PIOA_SODR 0xFFFFF430
#define PIOA_CODR 0xFFFFF434
#define LED1 25
#define LED1 25 /* this only works on OpenPICC, not Olimex */
.macro led1on
ldr r2, =PIOA_CODR
mov r1, #(1 << LED1)