The "GR-PEACH_Audio_Playback_7InchLCD_Sample" is a sample code that can provides high-resolution audio playback of FLAC format files. It also allows the user to audio-playback control functions such as play, pause, and stop by manipulating key switches.

Dependencies:   GR-PEACH_video R_BSP TLV320_RBSP USBHost_custom

Fork of GR-PEACH_Audio_Playback_Sample by Renesas

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers system.h Source File

system.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 SYSTEM_H
00025 #define SYSTEM_H
00026 
00027 #include "r_typedefs.h"
00028 #include "USBHostMSD.h"
00029 
00030 /*--- Macro definition of folder scan in USB memory ---*/
00031 #define SYS_MAX_FOLDER_NUM      (99u)       /* Supported number of folders */
00032 #define SYS_MAX_TRACK_NUM       (999u)      /* Supported number of tracks  */
00033 #define SYS_MAX_FOLDER_DEPTH    (8u)        /* Supported folder levels */
00034 #define SYS_MAX_NAME_LENGTH     (NAME_MAX)  /* Maximum length of track name and folder name */
00035 #define SYS_MAX_PATH_LENGTH     (511)       /* Maximum length of the full path */
00036 
00037 /* It is the name to mount the file system of the USBHostMSD class. */
00038 #define SYS_USB_MOUNT_NAME      "usb"
00039 
00040 /*--- User defined types of main thread ---*/
00041 /* Key code */
00042 typedef enum {
00043     SYS_KEYCODE_NON = 0,
00044     SYS_KEYCODE_STOP,           /* Stop */
00045     SYS_KEYCODE_PLAYPAUSE,      /* Play / Pause */
00046     SYS_KEYCODE_NEXT,           /* Next track */
00047     SYS_KEYCODE_PREV,           /* Previous track */
00048     SYS_KEYCODE_PLAYINFO,       /* Play info */
00049     SYS_KEYCODE_REPEAT,         /* Repeat */
00050     SYS_KEYCODE_HELP,           /* Help */
00051     SYS_KEYCODE_MODE,           /* Mode */
00052     SYS_KEYCODE_NUM
00053 } SYS_KeyCode;
00054 
00055 /* Playback status */
00056 typedef enum {
00057     SYS_PLAYSTAT_STOP = 0,      /* Stop */
00058     SYS_PLAYSTAT_PLAY,          /* Play */
00059     SYS_PLAYSTAT_PAUSE,         /* Pause */
00060     SYS_PLAYSTAT_NUM
00061 } SYS_PlayStat;
00062 
00063 /** Main Thread
00064  *
00065  *  @param argument Pointer to the thread function as start argument.
00066  */
00067 void system_main(void);
00068 
00069 /** Notifies the main thread of the key input information.
00070  *
00071  *  @param key_code key code
00072  *                    Stop : SYS_KEYCODE_STOP
00073  *                    Play/pause : SYS_KEYCODE_PLAYPAUSE
00074  *                    Play next song : SYS_KEYCODE_NEXT
00075  *                    Play previous song : SYS_KEYCODE_PREV
00076  *                    Show song information : SYS_KEYCODE_PLAYINFO
00077  *                    Switch repeat mode : SYS_KEYCODE_REPEAT
00078  *                    Show help message: SYS_KEYCODE_HELP
00079  *                    Switch display mode: SYS_KEYCODE_MODE
00080  *
00081  *  @returns 
00082  *    Returns true if the API is successful. Returns false if the API fails.
00083  *    This function fails when:
00084  *     Failed to secure memory for mailbox communication.
00085  *     Failed to perform transmit processing for mailbox communication.
00086  */
00087 bool sys_notify_key_input(const SYS_KeyCode key_code);
00088 
00089 /** Notifies the main thread of the play time, total play time, and play state.
00090  *
00091  *  @param play_stat Playback state
00092  *                     Stopped : SYS_PLAYSTAT_STOP
00093  *                     Playing : SYS_PLAYSTAT_PLAY
00094  *                     Paused : SYS_PLAYSTAT_PAUSE
00095  *  @param play_time Playback time (in seconds)
00096  *                     0 to 359999
00097  *                     * 0 hour, 0 minute, 0 second to 99 hours, 59 minutes, 59 seconds
00098  *  @param total_time Total play time (in seconds)
00099  *                      0 to 359999
00100  *                      * 0 hour, 0 minute, 0 second to 99 hours, 59 minutes, 59 seconds
00101  *
00102  *  @returns 
00103  *    Returns true if the API is successful. Returns false if the API fails.
00104  *    This function fails when:
00105  *     Failed to secure memory for mailbox communication.
00106  *     Failed to perform transmit processing for mailbox communication.
00107  */
00108 bool sys_notify_play_time(const SYS_PlayStat play_stat, 
00109     const uint32_t play_time, const uint32_t total_time);
00110 
00111 #endif /* SYSTEM_H */