Advanced Operating Systems - Final Project A @ Tokyo Tech ////////////// Author: Chu Van Thiem and Sidik Soleman ////////////// A WAVE file player on the MBED Application Board with an interface to a software on PC via a TCP connection. ////////////// Main functions: 1. Browse files of an attached USB flash 2. The list of the files of the attached USB are displayed on the LCD 3. Use an joystick to select a WAVE file and give an instruction to play that file 4. Adjust the volume using a potentiometer 5. Output audio to the analog audio out jack ////////////// Software (https://github.com/thiemcv/VS/tree/master/Terminal): 1. Connect with the MBED application board via Ethernet connection 2. Read the list of files stored on the USB flash 3. Write files to the USB flash
Dependencies: C12832_lcd EthernetInterface USBHost mbed-rtos mbed wave_player
src/tcp_task.h@1:3b567aa3b09e, 2014-02-02 (annotated)
- Committer:
- aos
- Date:
- Sun Feb 02 10:49:19 2014 +0000
- Revision:
- 1:3b567aa3b09e
- Child:
- 2:5bc47e544b8d
Final Project V1: Integrated WAV player + USB file management via ethernet connection
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aos | 1:3b567aa3b09e | 1 | #ifndef __TCP_TASK_H__ |
aos | 1:3b567aa3b09e | 2 | #define __TCP_TASK_H__ |
aos | 1:3b567aa3b09e | 3 | |
aos | 1:3b567aa3b09e | 4 | #include "mbed.h" |
aos | 1:3b567aa3b09e | 5 | #include "rtos.h" |
aos | 1:3b567aa3b09e | 6 | #include "Queue.h" |
aos | 1:3b567aa3b09e | 7 | #include "EthernetInterface.h" |
aos | 1:3b567aa3b09e | 8 | #include "usb.h" |
aos | 1:3b567aa3b09e | 9 | |
aos | 1:3b567aa3b09e | 10 | // Ethernet config |
aos | 1:3b567aa3b09e | 11 | #define IP_ADDR "192.168.5.123" |
aos | 1:3b567aa3b09e | 12 | #define IP_MASK "255.255.255.0" |
aos | 1:3b567aa3b09e | 13 | #define GW_ADDR "192.168.5.1" |
aos | 1:3b567aa3b09e | 14 | #define TCP_PORT 8001 |
aos | 1:3b567aa3b09e | 15 | |
aos | 1:3b567aa3b09e | 16 | // FSM states |
aos | 1:3b567aa3b09e | 17 | #define STATE_IDLE 0 |
aos | 1:3b567aa3b09e | 18 | #define STATE_1 1 |
aos | 1:3b567aa3b09e | 19 | #define STATE_2 2 |
aos | 1:3b567aa3b09e | 20 | #define STATE_CMD 3 |
aos | 1:3b567aa3b09e | 21 | #define STATE_READ 4 |
aos | 1:3b567aa3b09e | 22 | #define STATE_WFILE 5 |
aos | 1:3b567aa3b09e | 23 | #define STATE_WDATA 6 |
aos | 1:3b567aa3b09e | 24 | |
aos | 1:3b567aa3b09e | 25 | // CMD |
aos | 1:3b567aa3b09e | 26 | #define CMD_1 0xAA |
aos | 1:3b567aa3b09e | 27 | #define CMD_2 0x55 |
aos | 1:3b567aa3b09e | 28 | #define CMD_PC 0x00 |
aos | 1:3b567aa3b09e | 29 | #define CMD_READ 0x00 |
aos | 1:3b567aa3b09e | 30 | #define CMD_WFILE 0x01 |
aos | 1:3b567aa3b09e | 31 | #define CMD_WDATA 0x02 |
aos | 1:3b567aa3b09e | 32 | |
aos | 1:3b567aa3b09e | 33 | // ACK |
aos | 1:3b567aa3b09e | 34 | #define ACK_1 0xAA |
aos | 1:3b567aa3b09e | 35 | #define ACK_2 0x55 |
aos | 1:3b567aa3b09e | 36 | #define ACK_MBED 0x01 |
aos | 1:3b567aa3b09e | 37 | #define ACK_READ 0x00 |
aos | 1:3b567aa3b09e | 38 | #define ACK_WFILE 0x01 |
aos | 1:3b567aa3b09e | 39 | #define ACK_WDATA 0x02 |
aos | 1:3b567aa3b09e | 40 | #define SPR_CHAR 0xFF |
aos | 1:3b567aa3b09e | 41 | |
aos | 1:3b567aa3b09e | 42 | #define QUEUE_MAX_LEN 256 |
aos | 1:3b567aa3b09e | 43 | #define ACK_MAX_LEN 128 |
aos | 1:3b567aa3b09e | 44 | #define NAME_MAX_LEN 32 |
aos | 1:3b567aa3b09e | 45 | #define DATA_MAX_LEN 256 |
aos | 1:3b567aa3b09e | 46 | |
aos | 1:3b567aa3b09e | 47 | void tcp_thread(void const *args); |
aos | 1:3b567aa3b09e | 48 | void cmd_thread(void const *args); |
aos | 1:3b567aa3b09e | 49 | |
aos | 1:3b567aa3b09e | 50 | #endif |