summaryrefslogtreecommitdiff
path: root/firmware/src/os/req_ctx.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/os/req_ctx.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/os/req_ctx.c')
-rw-r--r--firmware/src/os/req_ctx.c37
1 files changed, 35 insertions, 2 deletions
diff --git a/firmware/src/os/req_ctx.c b/firmware/src/os/req_ctx.c
index d118aca..fef7258 100644
--- a/firmware/src/os/req_ctx.c
+++ b/firmware/src/os/req_ctx.c
@@ -28,14 +28,32 @@
/* FIXME: locking, FIFO order processing */
+#define RCTX_SIZE_LARGE 2048
+#define RCTX_SIZE_SMALL 64
+
+#define NUM_RCTX_SMALL 8
+#define NUM_RCTX_LARGE 3
+
+#define NUM_REQ_CTX (NUM_RCTX_SMALL+NUM_RCTX_LARGE)
+
+static u_int8_t rctx_data[NUM_RCTX_SMALL][RCTX_SIZE_SMALL];
+static u_int8_t rctx_data_large[NUM_RCTX_LARGE][RCTX_SIZE_LARGE];
+
static struct req_ctx req_ctx[NUM_REQ_CTX];
-struct req_ctx *req_ctx_find_get(unsigned long old_state, unsigned long new_state)
+struct req_ctx *req_ctx_find_get(int large,
+ unsigned long old_state,
+ unsigned long new_state)
{
unsigned long flags;
u_int8_t i;
+
+ if (large)
+ i = NUM_RCTX_SMALL;
+ else
+ i = 0;
- for (i = 0; i < NUM_REQ_CTX; i++) {
+ for (1; i < NUM_REQ_CTX; i++) {
local_irq_save(flags);
if (req_ctx[i].state == old_state) {
req_ctx[i].state = new_state;
@@ -67,3 +85,18 @@ void req_ctx_put(struct req_ctx *ctx)
{
req_ctx_set_state(ctx, RCTX_STATE_FREE);
}
+
+void req_ctx_init(void)
+{
+ int i;
+
+ for (i = 0; i < NUM_RCTX_SMALL; i++) {
+ req_ctx[i].size = RCTX_SIZE_SMALL;
+ req_ctx[i].data = rctx_data[i];
+ }
+
+ for (i = 0; i < NUM_RCTX_LARGE; i++) {
+ req_ctx[i].size = RCTX_SIZE_LARGE;
+ req_ctx[NUM_RCTX_SMALL+i].data = rctx_data_large[i];
+ }
+}
personal git repositories of Harald Welte. Your mileage may vary