Renesas / Mbed OS GR-PEACH_Audio_Playback_Sample

Dependencies:   R_BSP TLV320_RBSP USBHost_custom

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers display.h Source File

display.h

00001 /*******************************************************************************
00002 * DISCLAIMER
00003 * This software is supplied by Renesas Electronics Corporation and is only
00004 * intended for use with Renesas products. No other uses are authorized. This
00005 * software is owned by Renesas Electronics Corporation and is protected under
00006 * all applicable laws, including copyright laws.
00007 * THIS SOFTWARE IS PROVIDED "AS IS" AND RENESAS MAKES NO WARRANTIES REGARDING
00008 * THIS SOFTWARE, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT
00009 * LIMITED TO WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
00010 * AND NON-INFRINGEMENT. ALL SUCH WARRANTIES ARE EXPRESSLY DISCLAIMED.
00011 * TO THE MAXIMUM EXTENT PERMITTED NOT PROHIBITED BY LAW, NEITHER RENESAS
00012 * ELECTRONICS CORPORATION NOR ANY OF ITS AFFILIATED COMPANIES SHALL BE LIABLE
00013 * FOR ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES FOR
00014 * ANY REASON RELATED TO THIS SOFTWARE, EVEN IF RENESAS OR ITS AFFILIATES HAVE
00015 * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
00016 * Renesas reserves the right, without notice, to make changes to this software
00017 * and to discontinue the availability of this software. By using this software,
00018 * you agree to the additional terms and conditions found by accessing the
00019 * following link:
00020 * http://www.renesas.com/disclaimer*
00021 * Copyright (C) 2015 Renesas Electronics Corporation. All rights reserved.
00022 *******************************************************************************/
00023 
00024 #ifndef DISPLAY_H
00025 #define DISPLAY_H
00026 
00027 #include "r_typedefs.h"
00028 #include "system.h"
00029 
00030 /*--- Macro definition ---*/
00031 #define DSP_STACK_SIZE      (2048u)     /* Stack size of display thread */
00032 
00033 /* The maximum length of display character string. */
00034 #define DSP_DISP_STR_MAX_LEN        (64)
00035 /* The maximum length of input character string by the command-line. */
00036 #define DSP_CMD_INPT_STR_MAX_LEN    (63)
00037 
00038 /* The baud rate of the serial port for PC communication. */
00039 #define DSP_PC_COM_BAUDRATE         (9600)
00040 
00041 /*--- User defined types ---*/
00042 typedef enum {
00043     DSP_MAILID_DUMMY = 0,
00044     DSP_MAILID_CYCLE_IND,   /* Cyclic notice */
00045     DSP_MAILID_CMD_STR,     /* Notifies display thread of input string. */
00046     DSP_MAILID_PRINT_STR,   /* Notifies display thread of output string. */
00047     DSP_MAILID_PLAY_TIME,   /* Notifies display thread of playback time. */
00048     DSP_MAILID_PLAY_INFO,   /* Notifies display thread of playback information. */
00049     DSP_MAILID_PLAY_MODE,   /* Notifies display thread of repeat mode. */
00050     DSP_MAILID_FILE_NAME,   /* Notifies display thread of file name. */
00051     DSP_MAILID_HELP,        /* Requests display thread to display help message. */
00052     DSP_MAILID_NUM
00053 } DSP_MAIL_ID;
00054 
00055 /* These data are used in all display modules. */
00056 typedef struct {
00057     uint32_t        disp_mode;      /* Display mode */
00058     SYS_PlayStat    play_stat;      /* Playback status */
00059     uint32_t        track_id;       /* Track number */
00060     uint32_t        play_time;      /* Playback time (sec) */
00061     uint32_t        total_time;     /* Total playback time (sec) */
00062     uint32_t        samp_freq;      /* Sampling frequency (Hz) */
00063     uint32_t        channel;        /* Channel number */
00064     bool            repeat_mode;    /* Repeat mode */
00065     char_t          file_name[DSP_DISP_STR_MAX_LEN];/* Character string of file name */
00066     char_t          dspl_str[DSP_DISP_STR_MAX_LEN]; /* Display character string */
00067 } dsp_com_ctrl_t;
00068 
00069 /* These data are used only in the terminal-output module. */
00070 typedef struct {
00071     bool        edge_fin_inpt;      /* Completion status of the input by the command-line.*/
00072                                     /* [true = input completion, false = input now] */
00073     char_t      inpt_str[DSP_CMD_INPT_STR_MAX_LEN];/* Input character string by the command-line. */
00074 } dsp_trm_ctrl_t;
00075 
00076 /* These data are used only in the TFT module. */
00077 typedef struct {
00078     int32_t         disp_phase_no;  /* The making phase of the display image */
00079 } dsp_tft_ctrl_t;
00080 
00081 
00082 /** Display Thread
00083  *
00084  *  @param argument Pointer to the thread function as start argument.
00085  */
00086 void dsp_thread(void const *argument);
00087 
00088 /** Notifies the display thread of the song information (file number, play time, total play time, play state).
00089  *
00090  *  @param play_stat Playback state
00091  *                     Stopped : SYS_PLAYSTAT_STOP
00092  *                     Playing : SYS_PLAYSTAT_PLAY
00093  *                     Paused : SYS_PLAYSTAT_PAUSE
00094  *  @param file_no File number
00095  *                   1 to 999
00096  *  @param play_time Playback time (in seconds)
00097  *                     0 to 359999
00098  *                     * 0 hour, 0 minute, 0 second to 99 hours, 59 minutes, 59 seconds
00099  *  @param total_time Total play time (in seconds)
00100  *                      0 to 359999
00101  *                      * 0 hour, 0 minute, 0 second to 99 hours, 59 minutes, 59 seconds
00102  *
00103  *  @returns 
00104  *    Returns true if the API is successful. Returns false if the API fails.
00105  *    This function fails when:
00106  *     Failed to secure memory for mailbox communication.
00107  *     Failed to perform transmit processing for mailbox communication.
00108  */
00109 bool dsp_notify_play_time(const SYS_PlayStat play_stat, const uint32_t file_no, 
00110                             const uint32_t play_time, const uint32_t total_time);
00111 
00112 /** Notifies the display thread of the song information (file number, sampling frequency, and number of channels).
00113  *
00114  *  @param file_no File number
00115  *                   1 to 999
00116  *  @param sample_freq Sampling frequency (Hz)
00117  *                       22050, 24000, 32000, 44100, 48000, 64000, 88200, 96000
00118  *  @param channel_num Number of channels
00119  *                       1, 2
00120  *
00121  *  @returns 
00122  *    Returns true if the API is successful. Returns false if the API fails.
00123  *    This function fails when:
00124  *     Failed to secure memory for mailbox communication.
00125  *     Failed to perform transmit processing for mailbox communication.
00126  */
00127 bool dsp_notify_play_info(const uint32_t file_no, 
00128                     const uint32_t sample_freq, const uint32_t channel_num);
00129 
00130 /** Notifies the display thread of the playback mode (repeat mode).
00131  *
00132  *  @param rep_mode Repeat mode
00133  *                    Repeat mode OFF : false
00134  *                    Repeat mode ON : true
00135  *
00136  *  @returns 
00137  *    Returns true if the API is successful. Returns false if the API fails.
00138  *    This function fails when:
00139  *     Failed to secure memory for mailbox communication.
00140  *     Failed to perform transmit processing for mailbox communication.
00141  */
00142 bool dsp_notify_play_mode(const bool rep_mode);
00143 
00144 /** Notifies the display thread of the file name.
00145  *
00146  *  @param p_str File name string
00147  *                 * The string must be terminated by '\0'.
00148  *                   The character code must be the local character code. Since the end of
00149  *                   a string is identified by the presence of '\0', a file name of 
00150  *                   multi-byte code may not be displayed correctly. 
00151  *                   The maximum length of the string that the display thread can notify
00152  *                   is 64 bytes including '\0'.
00153  *
00154  *  @returns 
00155  *    Returns true if the API is successful. Returns false if the API fails.
00156  *    This function fails when:
00157  *     The argument p_str is set to NULL.
00158  *     Failed to secure memory for mailbox communication.
00159  *     Failed to perform transmit processing for mailbox communication.
00160  */
00161 bool dsp_notify_file_name(const char_t * const p_str);
00162 
00163 /** Notifies the display thread of the string to be output on the terminal.
00164  *
00165  *  @param p_str String to be output on the terminal
00166  *                 * The string must be terminated by '\0'.
00167  *                   The character code must be the local character code. Since the end of
00168  *                   a string is identified by the presence of '\0', a file name of
00169  *                   multi-byte code may not be displayed correctly. 
00170  *                   The maximum length of the string that the display thread can notify
00171  *                   is 64 bytes including '\0'.
00172  *
00173  *  @returns 
00174  *    Returns true if the API is successful. Returns false if the API fails.
00175  *    This function fails when:
00176  *     The argument p_str is set to NULL.
00177  *     Failed to secure memory for mailbox communication.
00178  *     Failed to perform transmit processing for mailbox communication.
00179  */
00180 bool dsp_notify_print_string(const char_t * const p_str);
00181 
00182 /** Notifies the display thread of the command line input string.
00183  *  * Used to echo back the string entered from the command line. 
00184  *
00185  *  @param p_str Command line input string
00186  *                 * The string must contain no control characters and terminate with '\0'.
00187  *                   The character code must be the local character code. Since the end of
00188  *                   a string is identified by the presence of '\0', a file name of
00189  *                   multi-byte code may not be displayed correctly.
00190  *                   The maximum length of the string that the display thread can notify
00191  *                   is 63 bytes including '\0'.
00192  *
00193  *  @param flag_fin Input completion flag
00194  *                   Middle of input : false
00195  *                   Input complete : true
00196  *
00197  *  @returns 
00198  *    Returns true if the API is successful. Returns false if the API fails.
00199  *    This function fails when:
00200  *     The argument p_str is set to NULL.
00201  *     Failed to secure memory for mailbox communication.
00202  *     Failed to perform transmit processing for mailbox communication.
00203  */
00204 bool dsp_notify_input_string(const char_t * const p_str, const bool flag_fin);
00205 
00206 /** Requests the display thread to display help message.
00207  *
00208  *  @returns 
00209  *    Returns true if the API is successful. Returns false if the API fails.
00210  *    This function fails when:
00211  *     Failed to secure memory for mailbox communication.
00212  *     Failed to perform transmit processing for mailbox communication.
00213  */
00214 bool dsp_req_help(void);
00215 
00216 #endif /* DISPLAY_H */