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@2:5bc47e544b8d, 2014-02-13 (annotated)
- Committer:
- aos
- Date:
- Thu Feb 13 06:51:20 2014 +0000
- Revision:
- 2:5bc47e544b8d
- Parent:
- 1:3b567aa3b09e
Update some comments
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
aos | 2:5bc47e544b8d | 1 | /* FILE: tcp_task.h by Chu Van Thiem |
aos | 2:5bc47e544b8d | 2 | */ |
aos | 1:3b567aa3b09e | 3 | #ifndef __TCP_TASK_H__ |
aos | 1:3b567aa3b09e | 4 | #define __TCP_TASK_H__ |
aos | 1:3b567aa3b09e | 5 | |
aos | 1:3b567aa3b09e | 6 | #include "mbed.h" |
aos | 1:3b567aa3b09e | 7 | #include "rtos.h" |
aos | 1:3b567aa3b09e | 8 | #include "Queue.h" |
aos | 1:3b567aa3b09e | 9 | #include "EthernetInterface.h" |
aos | 1:3b567aa3b09e | 10 | #include "usb.h" |
aos | 1:3b567aa3b09e | 11 | |
aos | 1:3b567aa3b09e | 12 | // Ethernet config |
aos | 1:3b567aa3b09e | 13 | #define IP_ADDR "192.168.5.123" |
aos | 1:3b567aa3b09e | 14 | #define IP_MASK "255.255.255.0" |
aos | 1:3b567aa3b09e | 15 | #define GW_ADDR "192.168.5.1" |
aos | 1:3b567aa3b09e | 16 | #define TCP_PORT 8001 |
aos | 1:3b567aa3b09e | 17 | |
aos | 1:3b567aa3b09e | 18 | // FSM states |
aos | 1:3b567aa3b09e | 19 | #define STATE_IDLE 0 |
aos | 1:3b567aa3b09e | 20 | #define STATE_1 1 |
aos | 1:3b567aa3b09e | 21 | #define STATE_2 2 |
aos | 1:3b567aa3b09e | 22 | #define STATE_CMD 3 |
aos | 1:3b567aa3b09e | 23 | #define STATE_READ 4 |
aos | 1:3b567aa3b09e | 24 | #define STATE_WFILE 5 |
aos | 1:3b567aa3b09e | 25 | #define STATE_WDATA 6 |
aos | 1:3b567aa3b09e | 26 | |
aos | 1:3b567aa3b09e | 27 | // CMD |
aos | 1:3b567aa3b09e | 28 | #define CMD_1 0xAA |
aos | 1:3b567aa3b09e | 29 | #define CMD_2 0x55 |
aos | 1:3b567aa3b09e | 30 | #define CMD_PC 0x00 |
aos | 1:3b567aa3b09e | 31 | #define CMD_READ 0x00 |
aos | 1:3b567aa3b09e | 32 | #define CMD_WFILE 0x01 |
aos | 1:3b567aa3b09e | 33 | #define CMD_WDATA 0x02 |
aos | 1:3b567aa3b09e | 34 | |
aos | 1:3b567aa3b09e | 35 | // ACK |
aos | 1:3b567aa3b09e | 36 | #define ACK_1 0xAA |
aos | 1:3b567aa3b09e | 37 | #define ACK_2 0x55 |
aos | 1:3b567aa3b09e | 38 | #define ACK_MBED 0x01 |
aos | 1:3b567aa3b09e | 39 | #define ACK_READ 0x00 |
aos | 1:3b567aa3b09e | 40 | #define ACK_WFILE 0x01 |
aos | 1:3b567aa3b09e | 41 | #define ACK_WDATA 0x02 |
aos | 1:3b567aa3b09e | 42 | #define SPR_CHAR 0xFF |
aos | 1:3b567aa3b09e | 43 | |
aos | 1:3b567aa3b09e | 44 | #define QUEUE_MAX_LEN 256 |
aos | 1:3b567aa3b09e | 45 | #define ACK_MAX_LEN 128 |
aos | 1:3b567aa3b09e | 46 | #define NAME_MAX_LEN 32 |
aos | 1:3b567aa3b09e | 47 | #define DATA_MAX_LEN 256 |
aos | 1:3b567aa3b09e | 48 | |
aos | 1:3b567aa3b09e | 49 | void tcp_thread(void const *args); |
aos | 1:3b567aa3b09e | 50 | void cmd_thread(void const *args); |
aos | 1:3b567aa3b09e | 51 | |
aos | 1:3b567aa3b09e | 52 | #endif |