4 * Copyright (c) 2012 - 2013 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the License);
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
29 * @defgroup CAPI_SYSTEM_DEVICED_MMC_MODULE MMC
30 * @ingroup CAPI_SYSTEM_DEVICED
31 * @brief This file provides the API for control of mmc(sd-card)
32 * @section CAPI_SYSTEM_DEVICED_MMC_MODULE_HEADER Required Header
33 * \#include <dd-mmc.h>
37 * @addtogroup CAPI_SYSTEM_DEVICED_MMC_MODULE
43 * This API is used to mount mmc.\n
44 * @param[in] mount_point pointer to the character buffer containing the path
45 * @return 0 on success, -1 if failed
49 * if( mmc_secure_mount(mount_point) < 0 )
50 * printf("Mount mmc failed\n");
54 int mmc_secure_mount(const char *mount_point);
58 * This API is used to unmount mmc.\n
59 * @param[in] mount_point pointer to the character buffer containing the path
60 * @return 0 on success, -1 if failed
64 * if( mmc_secure_unmount(mount_point) < 0 )
65 * printf("Unmount mmc failed\n");
69 int mmc_secure_unmount(const char *mount_point);
72 * @brief This structure defines the data for receive result of mmc operations(mount/unmount/format)
75 void (*mmc_cb) (int result, void* data);/**< user callback function for receive result of mmc operations */
76 void* user_data;/**< input data for callback function's second-param(data) */
80 * @fn int deviced_request_mount_mmc(struct mmc_contents *mmc_data)
81 * @brief This API is used to mount mmc.\n
82 * Internally, this API call predefined action API. That is send a notify message. \n
83 * and when mount operation is finished, cb of deviced_mmc_content struct is called with cb's param1(result). \n
84 * means of param1 - 0(mount success) and negative value if failed \n
85 * [mount fail value] \n
86 * -1 : operation not permmitted \n
87 * -2 : no such file or directory \n
88 * -6 : no such device or address \n
89 * -12 : out of memory \n
90 * -13 : A component of a path was not searchable \n
91 * -14 : bad address \n
92 * -15 : block device is requested \n
93 * -16 : device or resource busy \n
94 * -19 : filesystemtype not configured in the kernel \n
95 * -20 : target, or a prefix of source, is not a directory \n
96 * -22 : point does not exist \n
97 * -24 : table of dummy devices is full \n
98 * -36 : requested name is too long \n
99 * -40 : Too many links encountered during pathname resolution. \n
100 * Or, a move was attempted, while target is a descendant of source \n
101 * @param[in] mmc_data for receive result of mount operation
102 * @return non-zero on success message sending, -1 if message sending is failed.
104 int deviced_request_mount_mmc(struct mmc_contents *mmc_data);
107 * @fn int deviced_request_unmount_mmc(struct mmc_contents *mmc_data,int option)
108 * @brief This API is used to unmount mmc.\n
109 * Internally, this API call predefined action API. That is send a notify message. \n
110 * and when unmount opeation is finished, cb of deviced_mmc_content struct is called with cb's param1(result). \n
111 * means of param1 - 0(unmount success) and negative value if failed \n
112 * [unmount fail value] \n
113 * -1 : operation not permmitted \n
114 * -2 : no such file or directory \n
116 * -12 : out of memory \n
117 * -14 : bad address \n
118 * -16 : device or resource busy \n
119 * -22 : point does not exist \n
120 * -36 : requested name is too long \n
121 * @param[in] mmc_data for receive result of unmount operation
122 * @param[in] option type of unmount option \n
123 * 0 : Normal unmount \n
124 * (if other process still access a sdcard, \n
125 * unmount will be failed.) \n
126 * 1 : Force unmount \n
127 * (if other process still access a sdcard, \n
128 * this process will be received SIGTERM or SIGKILL.)
129 * @return non-zero on success message sending, -1 if message sending is failed.
131 int deviced_request_unmount_mmc(struct mmc_contents *mmc_data, int option);
134 * @fn int deviced_request_format_mmc(struct mmc_contents *mmc_data)
135 * @brief This API is used to format mmc.\n
136 * Internally, this API call predefined action API. That is send a notify message. \n
137 * and when format opeation is finished, cb of deviced_mmc_content struct is called with cb's param1(result). \n
138 * means of param1 - 0(format success) , -1(format fail)
139 * @param[in] mmc_data for receive result of format operation
140 * @return non-zero on success message sending, -1 if message sending is failed.
142 int deviced_request_format_mmc(struct mmc_contents *mmc_data);
145 * @fn int deviced_format_mmc(struct mmc_contents *mmc_data, int option)
146 * @brief This API is used to format mmc.\n
147 * Internally, this API call predefined action API. That is send a notify message. \n
148 * and when format opeation is finished, cb of deviced_mmc_content struct is called with cb's param1(result). \n
149 * means of param1 - 0(format success) and negative value if failed \n
150 * [format fail value] \n
151 * -22 : Invalid argument(EINVAL) \n
152 * @param[in] mmc_data for receive result of format operation
153 * @param[in] option FMT_NORMAL is 0, FMT_FORCE is 1
154 * @return non-zero on success message sending, -1 if message sending is failed.
156 int deviced_format_mmc(struct mmc_contents *mmc_data, int option);
159 * @} // end of CAPI_SYSTEM_DEVICED_MMC_MODULE