summaryrefslogtreecommitdiff
path: root/firmware/src/picc/ssc_picc.c
diff options
context:
space:
mode:
authorlaforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-20 11:44:10 +0000
committerlaforge <laforge@6dc7ffe9-61d6-0310-9af1-9938baff3ed1>2006-09-20 11:44:10 +0000
commit514b0f72f50b50b75ef855f008c888f29989d68e (patch)
tree4a48031e2d2e95512ae3dc868301b5314c317081 /firmware/src/picc/ssc_picc.c
parent20b657d7d20508b2a5fedf2e7a59a30e3d9a2fa4 (diff)
- Add OpenPICC register definition (and USB command handling)
- Add automatic generation of include/compile.h with svn revision and compiletime - Add openpcd_compile_version structure to obtain version via USB - Move LED commands into new CMD_CLS_GENERIC family - Update TODO - Add support for large (2048 byte) request contexts in addition to 64byte - Shrink req_ctx size by collapsing rx and tx buffer into one - move definition of DFU_API_LOCATION to header file - Implement large req_ctx aware USB transmit / refill routines - Implement TX refilling for IRQ Endpoint - Print version information at startup time - move some generic req_ctx processing into usb_handler.c - Some further work on DFU (still not finished) - Only use '-Os' for DFU, use '-O2' for application code git-svn-id: https://svn.openpcd.org:2342/trunk@208 6dc7ffe9-61d6-0310-9af1-9938baff3ed1
Diffstat (limited to 'firmware/src/picc/ssc_picc.c')
-rw-r--r--firmware/src/picc/ssc_picc.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/firmware/src/picc/ssc_picc.c b/firmware/src/picc/ssc_picc.c
index ea48de5..d4db71a 100644
--- a/firmware/src/picc/ssc_picc.c
+++ b/firmware/src/picc/ssc_picc.c
@@ -166,8 +166,8 @@ static struct openpcd_hdr opcd_ssc_hdr = {
static inline void init_opcdhdr(struct req_ctx *rctx)
{
- memcpy(&rctx->tx.data[0], &opcd_ssc_hdr, sizeof(opcd_ssc_hdr));
- rctx->tx.tot_len = MAX_HDRSIZE + MAX_REQSIZE -1;
+ memcpy(rctx->data, &opcd_ssc_hdr, sizeof(opcd_ssc_hdr));
+ rctx->tot_len = MAX_HDRSIZE + MAX_REQSIZE -1;
}
#ifdef DEBUG_SSC_REFILL
@@ -191,7 +191,7 @@ static int8_t ssc_rx_refill(void)
#if 1
struct req_ctx *rctx;
- rctx = req_ctx_find_get(RCTX_STATE_FREE, RCTX_STATE_SSC_RX_BUSY);
+ rctx = req_ctx_find_get(1, RCTX_STATE_FREE, RCTX_STATE_SSC_RX_BUSY);
if (!rctx) {
DEBUGPCRF("no rctx for refill!");
return -1;
@@ -200,12 +200,12 @@ static int8_t ssc_rx_refill(void)
if (AT91F_PDC_IsRxEmpty(rx_pdc)) {
DEBUGR("filling primary SSC RX dma ctx");
- AT91F_PDC_SetRx(rx_pdc, &rctx->rx.data[MAX_HDRSIZE],
- (sizeof(rctx->rx.data)-MAX_HDRSIZE)>>2);
+ AT91F_PDC_SetRx(rx_pdc, &rctx->data[MAX_HDRSIZE],
+ (rctx->size-MAX_HDRSIZE)>>2);
ssc_state.rx_ctx[0] = rctx;
/* If primary is empty, secondary must be empty, too */
- rctx = req_ctx_find_get(RCTX_STATE_FREE,
+ rctx = req_ctx_find_get(1, RCTX_STATE_FREE,
RCTX_STATE_SSC_RX_BUSY);
if (!rctx) {
DEBUGPCRF("no rctx for secondary refill!");
@@ -216,8 +216,8 @@ static int8_t ssc_rx_refill(void)
if (AT91F_PDC_IsNextRxEmpty(rx_pdc)) {
DEBUGR("filling secondary SSC RX dma ctx");
- AT91F_PDC_SetNextRx(rx_pdc, &rctx->rx.data[MAX_HDRSIZE],
- (sizeof(rctx->rx.data)-MAX_HDRSIZE)>2);
+ AT91F_PDC_SetNextRx(rx_pdc, &rctx->data[MAX_HDRSIZE],
+ (rctx->size-MAX_HDRSIZE)>2);
ssc_state.rx_ctx[1] = rctx;
return 2;
} else {
@@ -331,8 +331,7 @@ void ssc_tx_init(void)
static int ssc_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 *poh = (struct openpcd_hdr *) rctx->data;
switch (poh->cmd) {
case OPENPCD_CMD_SSC_READ:
@@ -366,7 +365,7 @@ void ssc_rx_init(void)
/* Reset */
//ssc->SSC_CR = AT91C_SSC_SWRST;
- /* don't divide clock */
+ /* don't divide clock inside SSC, we do that in tc_cdiv */
ssc->SSC_CMR = 0;
ssc->SSC_RCMR = AT91C_SSC_CKS_RK | AT91C_SSC_CKO_NONE |
personal git repositories of Harald Welte. Your mileage may vary