diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-12-19 20:11:52 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-01-06 16:52:39 -0500 |
commit | 833dfbe746f85898dcbcf421c1177c3fd5773ff2 (patch) | |
tree | eff8cbd5edeec1b7de31ac70459fe000a244df08 /drivers/staging/epl/proc_fs.c | |
parent | e0ca0595885e2e324eefe4f32cde6d65e61e6e28 (diff) |
Staging: epl: run Lindent on *.c files
It's a start, still a mess...
Cc: Daniel Krueger <daniel.krueger@systec-electronic.com>
Cc: Ronald Sieber <Ronald.Sieber@systec-electronic.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/epl/proc_fs.c')
-rw-r--r-- | drivers/staging/epl/proc_fs.c | 413 |
1 files changed, 201 insertions, 212 deletions
diff --git a/drivers/staging/epl/proc_fs.c b/drivers/staging/epl/proc_fs.c index 5258e49b14a..f4910332d3c 100644 --- a/drivers/staging/epl/proc_fs.c +++ b/drivers/staging/epl/proc_fs.c | |||
@@ -91,11 +91,10 @@ | |||
91 | #include <linux/spinlock.h> | 91 | #include <linux/spinlock.h> |
92 | 92 | ||
93 | #ifdef CONFIG_COLDFIRE | 93 | #ifdef CONFIG_COLDFIRE |
94 | #include <asm/coldfire.h> | 94 | #include <asm/coldfire.h> |
95 | #include "fec.h" | 95 | #include "fec.h" |
96 | #endif | 96 | #endif |
97 | 97 | ||
98 | |||
99 | /***************************************************************************/ | 98 | /***************************************************************************/ |
100 | /* */ | 99 | /* */ |
101 | /* */ | 100 | /* */ |
@@ -113,45 +112,44 @@ | |||
113 | #endif | 112 | #endif |
114 | 113 | ||
115 | #ifndef DBG_TRACE_POINTS | 114 | #ifndef DBG_TRACE_POINTS |
116 | #define DBG_TRACE_POINTS 23 // # of supported debug trace points | 115 | #define DBG_TRACE_POINTS 23 // # of supported debug trace points |
117 | #endif | 116 | #endif |
118 | 117 | ||
119 | #ifndef DBG_TRACE_VALUES | 118 | #ifndef DBG_TRACE_VALUES |
120 | #define DBG_TRACE_VALUES 24 // # of supported debug trace values (size of circular buffer) | 119 | #define DBG_TRACE_VALUES 24 // # of supported debug trace values (size of circular buffer) |
121 | #endif | 120 | #endif |
122 | 121 | ||
123 | //--------------------------------------------------------------------------- | 122 | //--------------------------------------------------------------------------- |
124 | // modul global types | 123 | // modul global types |
125 | //--------------------------------------------------------------------------- | 124 | //--------------------------------------------------------------------------- |
126 | 125 | ||
127 | |||
128 | //--------------------------------------------------------------------------- | 126 | //--------------------------------------------------------------------------- |
129 | // local vars | 127 | // local vars |
130 | //--------------------------------------------------------------------------- | 128 | //--------------------------------------------------------------------------- |
131 | 129 | ||
132 | #ifdef _DBG_TRACE_POINTS_ | 130 | #ifdef _DBG_TRACE_POINTS_ |
133 | atomic_t aatmDbgTracePoint_l[DBG_TRACE_POINTS]; | 131 | atomic_t aatmDbgTracePoint_l[DBG_TRACE_POINTS]; |
134 | DWORD adwDbgTraceValue_l[DBG_TRACE_VALUES]; | 132 | DWORD adwDbgTraceValue_l[DBG_TRACE_VALUES]; |
135 | DWORD dwDbgTraceValueOld_l; | 133 | DWORD dwDbgTraceValueOld_l; |
136 | unsigned int uiDbgTraceValuePos_l; | 134 | unsigned int uiDbgTraceValuePos_l; |
137 | spinlock_t spinlockDbgTraceValue_l; | 135 | spinlock_t spinlockDbgTraceValue_l; |
138 | unsigned long ulDbTraceValueFlags_l; | 136 | unsigned long ulDbTraceValueFlags_l; |
139 | #endif | 137 | #endif |
140 | 138 | ||
141 | //--------------------------------------------------------------------------- | 139 | //--------------------------------------------------------------------------- |
142 | // local function prototypes | 140 | // local function prototypes |
143 | //--------------------------------------------------------------------------- | 141 | //--------------------------------------------------------------------------- |
144 | 142 | ||
145 | static int EplLinProcRead (char* pcBuffer_p, char** ppcStart_p, off_t Offset_p, int nBufferSize_p, int* pEof_p, void* pData_p); | 143 | static int EplLinProcRead(char *pcBuffer_p, char **ppcStart_p, off_t Offset_p, |
146 | static int EplLinProcWrite(struct file *file, const char __user *buffer, unsigned long count, void *data); | 144 | int nBufferSize_p, int *pEof_p, void *pData_p); |
147 | 145 | static int EplLinProcWrite(struct file *file, const char __user * buffer, | |
148 | void PUBLIC TgtDbgSignalTracePoint (BYTE bTracePointNumber_p); | 146 | unsigned long count, void *data); |
149 | void PUBLIC TgtDbgPostTraceValue (DWORD dwTraceValue_p); | ||
150 | 147 | ||
148 | void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p); | ||
149 | void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p); | ||
151 | 150 | ||
152 | EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void); | 151 | EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void); |
153 | 152 | ||
154 | |||
155 | //=========================================================================// | 153 | //=========================================================================// |
156 | // // | 154 | // // |
157 | // P U B L I C F U N C T I O N S // | 155 | // P U B L I C F U N C T I O N S // |
@@ -160,35 +158,32 @@ EPLDLLEXPORT DWORD PUBLIC EplIdentuGetRunningRequests(void); | |||
160 | 158 | ||
161 | tEplKernel EplLinProcInit(void) | 159 | tEplKernel EplLinProcInit(void) |
162 | { | 160 | { |
163 | struct proc_dir_entry* pProcDirEntry; | 161 | struct proc_dir_entry *pProcDirEntry; |
164 | pProcDirEntry = create_proc_entry (EPL_PROC_DEV_NAME, S_IRUGO, NULL); | 162 | pProcDirEntry = create_proc_entry(EPL_PROC_DEV_NAME, S_IRUGO, NULL); |
165 | if (pProcDirEntry != NULL) | 163 | if (pProcDirEntry != NULL) { |
166 | { | 164 | pProcDirEntry->read_proc = EplLinProcRead; |
167 | pProcDirEntry->read_proc = EplLinProcRead; | 165 | pProcDirEntry->write_proc = EplLinProcWrite; |
168 | pProcDirEntry->write_proc = EplLinProcWrite; | 166 | pProcDirEntry->data = NULL; // device number or something else |
169 | pProcDirEntry->data = NULL; // device number or something else | 167 | |
170 | 168 | } else { | |
171 | } | 169 | return kEplNoResource; |
172 | else | 170 | } |
173 | { | ||
174 | return kEplNoResource; | ||
175 | } | ||
176 | 171 | ||
177 | #ifdef _DBG_TRACE_POINTS_ | 172 | #ifdef _DBG_TRACE_POINTS_ |
178 | // initialize spinlock and circular buffer position | 173 | // initialize spinlock and circular buffer position |
179 | spin_lock_init(&spinlockDbgTraceValue_l); | 174 | spin_lock_init(&spinlockDbgTraceValue_l); |
180 | uiDbgTraceValuePos_l = 0; | 175 | uiDbgTraceValuePos_l = 0; |
181 | dwDbgTraceValueOld_l = 0; | 176 | dwDbgTraceValueOld_l = 0; |
182 | #endif | 177 | #endif |
183 | 178 | ||
184 | return kEplSuccessful; | 179 | return kEplSuccessful; |
185 | } | 180 | } |
186 | 181 | ||
187 | tEplKernel EplLinProcFree(void) | 182 | tEplKernel EplLinProcFree(void) |
188 | { | 183 | { |
189 | remove_proc_entry (EPL_PROC_DEV_NAME, NULL); | 184 | remove_proc_entry(EPL_PROC_DEV_NAME, NULL); |
190 | 185 | ||
191 | return kEplSuccessful; | 186 | return kEplSuccessful; |
192 | } | 187 | } |
193 | 188 | ||
194 | //--------------------------------------------------------------------------- | 189 | //--------------------------------------------------------------------------- |
@@ -196,225 +191,219 @@ tEplKernel EplLinProcFree(void) | |||
196 | //--------------------------------------------------------------------------- | 191 | //--------------------------------------------------------------------------- |
197 | 192 | ||
198 | #ifdef _DBG_TRACE_POINTS_ | 193 | #ifdef _DBG_TRACE_POINTS_ |
199 | void PUBLIC TgtDbgSignalTracePoint ( | 194 | void PUBLIC TgtDbgSignalTracePoint(BYTE bTracePointNumber_p) |
200 | BYTE bTracePointNumber_p) | ||
201 | { | 195 | { |
202 | 196 | ||
203 | if (bTracePointNumber_p >= (sizeof(aatmDbgTracePoint_l) / sizeof(aatmDbgTracePoint_l[0]))) | 197 | if (bTracePointNumber_p >= |
204 | { | 198 | (sizeof(aatmDbgTracePoint_l) / sizeof(aatmDbgTracePoint_l[0]))) { |
205 | goto Exit; | 199 | goto Exit; |
206 | } | 200 | } |
207 | 201 | ||
202 | atomic_inc(&aatmDbgTracePoint_l[bTracePointNumber_p]); | ||
208 | 203 | ||
209 | atomic_inc (&aatmDbgTracePoint_l[bTracePointNumber_p]); | 204 | Exit: |
210 | 205 | ||
211 | Exit: | 206 | return; |
212 | |||
213 | return; | ||
214 | 207 | ||
215 | } | 208 | } |
216 | 209 | ||
217 | void PUBLIC TgtDbgPostTraceValue (DWORD dwTraceValue_p) | 210 | void PUBLIC TgtDbgPostTraceValue(DWORD dwTraceValue_p) |
218 | { | 211 | { |
219 | 212 | ||
220 | spin_lock_irqsave(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l); | 213 | spin_lock_irqsave(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l); |
221 | if (dwDbgTraceValueOld_l != dwTraceValue_p) | 214 | if (dwDbgTraceValueOld_l != dwTraceValue_p) { |
222 | { | 215 | adwDbgTraceValue_l[uiDbgTraceValuePos_l] = dwTraceValue_p; |
223 | adwDbgTraceValue_l[uiDbgTraceValuePos_l] = dwTraceValue_p; | 216 | uiDbgTraceValuePos_l = |
224 | uiDbgTraceValuePos_l = (uiDbgTraceValuePos_l + 1) % DBG_TRACE_VALUES; | 217 | (uiDbgTraceValuePos_l + 1) % DBG_TRACE_VALUES; |
225 | dwDbgTraceValueOld_l = dwTraceValue_p; | 218 | dwDbgTraceValueOld_l = dwTraceValue_p; |
226 | } | 219 | } |
227 | spin_unlock_irqrestore(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l); | 220 | spin_unlock_irqrestore(&spinlockDbgTraceValue_l, ulDbTraceValueFlags_l); |
228 | 221 | ||
229 | return; | 222 | return; |
230 | 223 | ||
231 | } | 224 | } |
232 | #endif | 225 | #endif |
233 | 226 | ||
234 | |||
235 | //--------------------------------------------------------------------------- | 227 | //--------------------------------------------------------------------------- |
236 | // Read function for PROC-FS read access | 228 | // Read function for PROC-FS read access |
237 | //--------------------------------------------------------------------------- | 229 | //--------------------------------------------------------------------------- |
238 | 230 | ||
239 | static int EplLinProcRead ( | 231 | static int EplLinProcRead(char *pcBuffer_p, |
240 | char* pcBuffer_p, | 232 | char **ppcStart_p, |
241 | char** ppcStart_p, | 233 | off_t Offset_p, |
242 | off_t Offset_p, | 234 | int nBufferSize_p, int *pEof_p, void *pData_p) |
243 | int nBufferSize_p, | ||
244 | int* pEof_p, | ||
245 | void* pData_p) | ||
246 | { | 235 | { |
247 | 236 | ||
248 | int nSize; | 237 | int nSize; |
249 | int Eof; | 238 | int Eof; |
250 | tEplDllkCalStatistics* pDllkCalStats; | 239 | tEplDllkCalStatistics *pDllkCalStats; |
251 | 240 | ||
252 | nSize = 0; | 241 | nSize = 0; |
253 | Eof = 0; | 242 | Eof = 0; |
254 | 243 | ||
255 | // count calls of this function | 244 | // count calls of this function |
256 | #ifdef _DBG_TRACE_POINTS_ | 245 | #ifdef _DBG_TRACE_POINTS_ |
257 | TgtDbgSignalTracePoint(0); | 246 | TgtDbgSignalTracePoint(0); |
258 | #endif | 247 | #endif |
259 | 248 | ||
260 | //--------------------------------------------------------------- | 249 | //--------------------------------------------------------------- |
261 | // generate static information | 250 | // generate static information |
262 | //--------------------------------------------------------------- | 251 | //--------------------------------------------------------------- |
263 | |||
264 | // ---- Driver information ---- | ||
265 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
266 | "%s %s (c) 2006 %s\n", | ||
267 | EPL_PRODUCT_NAME, EPL_PRODUCT_VERSION, EPL_PRODUCT_MANUFACTURER); | ||
268 | 252 | ||
253 | // ---- Driver information ---- | ||
254 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
255 | "%s %s (c) 2006 %s\n", | ||
256 | EPL_PRODUCT_NAME, EPL_PRODUCT_VERSION, | ||
257 | EPL_PRODUCT_MANUFACTURER); | ||
269 | 258 | ||
270 | //--------------------------------------------------------------- | 259 | //--------------------------------------------------------------- |
271 | // generate process information | 260 | // generate process information |
272 | //--------------------------------------------------------------- | 261 | //--------------------------------------------------------------- |
273 | 262 | ||
274 | // ---- EPL state ---- | 263 | // ---- EPL state ---- |
275 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | 264 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, |
276 | "NMT state: 0x%04X\n", | 265 | "NMT state: 0x%04X\n", |
277 | (WORD) EplNmtkGetNmtState()); | 266 | (WORD) EplNmtkGetNmtState()); |
278 | 267 | ||
279 | EplDllkCalGetStatistics(&pDllkCalStats); | 268 | EplDllkCalGetStatistics(&pDllkCalStats); |
280 | 269 | ||
281 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | 270 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, |
282 | "CurAsyncTxGen=%lu CurAsyncTxNmt=%lu CurAsyncRx=%lu\nMaxAsyncTxGen=%lu MaxAsyncTxNmt=%lu MaxAsyncRx=%lu\n", pDllkCalStats->m_ulCurTxFrameCountGen, pDllkCalStats->m_ulCurTxFrameCountNmt, pDllkCalStats->m_ulCurRxFrameCount, pDllkCalStats->m_ulMaxTxFrameCountGen, pDllkCalStats->m_ulMaxTxFrameCountNmt, pDllkCalStats->m_ulMaxRxFrameCount); | 271 | "CurAsyncTxGen=%lu CurAsyncTxNmt=%lu CurAsyncRx=%lu\nMaxAsyncTxGen=%lu MaxAsyncTxNmt=%lu MaxAsyncRx=%lu\n", |
272 | pDllkCalStats->m_ulCurTxFrameCountGen, | ||
273 | pDllkCalStats->m_ulCurTxFrameCountNmt, | ||
274 | pDllkCalStats->m_ulCurRxFrameCount, | ||
275 | pDllkCalStats->m_ulMaxTxFrameCountGen, | ||
276 | pDllkCalStats->m_ulMaxTxFrameCountNmt, | ||
277 | pDllkCalStats->m_ulMaxRxFrameCount); | ||
283 | 278 | ||
284 | #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0) | 279 | #if (((EPL_MODULE_INTEGRATION) & (EPL_MODULE_NMT_MN)) != 0) |
285 | // fetch running IdentRequests | 280 | // fetch running IdentRequests |
286 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | 281 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, |
287 | "running IdentRequests: 0x%08lX\n", | 282 | "running IdentRequests: 0x%08lX\n", |
288 | EplIdentuGetRunningRequests()); | 283 | EplIdentuGetRunningRequests()); |
284 | |||
285 | // fetch state of NmtMnu module | ||
286 | { | ||
287 | unsigned int uiMandatorySlaveCount; | ||
288 | unsigned int uiSignalSlaveCount; | ||
289 | WORD wFlags; | ||
290 | |||
291 | EplNmtMnuGetDiagnosticInfo(&uiMandatorySlaveCount, | ||
292 | &uiSignalSlaveCount, &wFlags); | ||
293 | |||
294 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
295 | "MN MandSlaveCount: %u SigSlaveCount: %u Flags: 0x%X\n", | ||
296 | uiMandatorySlaveCount, uiSignalSlaveCount, | ||
297 | wFlags); | ||
298 | |||
299 | } | ||
300 | #endif | ||
289 | 301 | ||
290 | // fetch state of NmtMnu module | 302 | // ---- FEC state ---- |
291 | { | 303 | #ifdef CONFIG_COLDFIRE |
292 | unsigned int uiMandatorySlaveCount; | 304 | { |
293 | unsigned int uiSignalSlaveCount; | 305 | // Receive the base address |
294 | WORD wFlags; | 306 | unsigned long base_addr; |
307 | #if (EDRV_USED_ETH_CTRL == 0) | ||
308 | // Set the base address of FEC0 | ||
309 | base_addr = FEC_BASE_ADDR_FEC0; | ||
310 | #else | ||
311 | // Set the base address of FEC1 | ||
312 | base_addr = FEC_BASE_ADDR_FEC1; | ||
313 | #endif | ||
295 | 314 | ||
296 | EplNmtMnuGetDiagnosticInfo(&uiMandatorySlaveCount, | 315 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, |
297 | &uiSignalSlaveCount, | 316 | "FEC_ECR = 0x%08X FEC_EIR = 0x%08X FEC_EIMR = 0x%08X\nFEC_TCR = 0x%08X FECTFSR = 0x%08X FECRFSR = 0x%08X\n", |
298 | &wFlags); | 317 | FEC_ECR(base_addr), FEC_EIR(base_addr), |
318 | FEC_EIMR(base_addr), FEC_TCR(base_addr), | ||
319 | FEC_FECTFSR(base_addr), | ||
320 | FEC_FECRFSR(base_addr)); | ||
321 | } | ||
322 | #endif | ||
299 | 323 | ||
324 | // ---- DBG: TracePoints ---- | ||
325 | #ifdef _DBG_TRACE_POINTS_ | ||
326 | { | ||
327 | int nNum; | ||
328 | |||
329 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
330 | "DbgTracePoints:\n"); | ||
331 | for (nNum = 0; | ||
332 | nNum < (sizeof(aatmDbgTracePoint_l) / sizeof(atomic_t)); | ||
333 | nNum++) { | ||
334 | nSize += | ||
335 | snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
336 | " TracePoint[%2d]: %d\n", (int)nNum, | ||
337 | atomic_read(&aatmDbgTracePoint_l[nNum])); | ||
338 | } | ||
339 | |||
340 | nSize += snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
341 | "DbgTraceValues:\n"); | ||
342 | for (nNum = 0; nNum < DBG_TRACE_VALUES; nNum++) { | ||
343 | if (nNum == uiDbgTraceValuePos_l) { // next value will be stored at that position | ||
344 | nSize += | ||
345 | snprintf(pcBuffer_p + nSize, | ||
346 | nBufferSize_p - nSize, "*%08lX", | ||
347 | adwDbgTraceValue_l[nNum]); | ||
348 | } else { | ||
349 | nSize += | ||
350 | snprintf(pcBuffer_p + nSize, | ||
351 | nBufferSize_p - nSize, " %08lX", | ||
352 | adwDbgTraceValue_l[nNum]); | ||
353 | } | ||
354 | if ((nNum & 0x00000007) == 0x00000007) { // 8 values printed -> end of line reached | ||
355 | nSize += | ||
356 | snprintf(pcBuffer_p + nSize, | ||
357 | nBufferSize_p - nSize, "\n"); | ||
358 | } | ||
359 | } | ||
360 | if ((nNum & 0x00000007) != 0x00000007) { // number of values printed is not a multiple of 8 -> print new line | ||
361 | nSize += | ||
362 | snprintf(pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
363 | "\n"); | ||
364 | } | ||
365 | } | ||
366 | #endif | ||
300 | 367 | ||
301 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | 368 | Eof = 1; |
302 | "MN MandSlaveCount: %u SigSlaveCount: %u Flags: 0x%X\n", | 369 | goto Exit; |
303 | uiMandatorySlaveCount, uiSignalSlaveCount, wFlags); | ||
304 | 370 | ||
305 | } | 371 | Exit: |
306 | #endif | ||
307 | 372 | ||
308 | // ---- FEC state ---- | 373 | *pEof_p = Eof; |
309 | #ifdef CONFIG_COLDFIRE | ||
310 | { | ||
311 | // Receive the base address | ||
312 | unsigned long base_addr; | ||
313 | #if (EDRV_USED_ETH_CTRL == 0) | ||
314 | // Set the base address of FEC0 | ||
315 | base_addr = FEC_BASE_ADDR_FEC0; | ||
316 | #else | ||
317 | // Set the base address of FEC1 | ||
318 | base_addr = FEC_BASE_ADDR_FEC1; | ||
319 | #endif | ||
320 | |||
321 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
322 | "FEC_ECR = 0x%08X FEC_EIR = 0x%08X FEC_EIMR = 0x%08X\nFEC_TCR = 0x%08X FECTFSR = 0x%08X FECRFSR = 0x%08X\n", | ||
323 | FEC_ECR(base_addr), FEC_EIR(base_addr), FEC_EIMR(base_addr), FEC_TCR(base_addr), FEC_FECTFSR(base_addr), FEC_FECRFSR(base_addr)); | ||
324 | } | ||
325 | #endif | ||
326 | |||
327 | |||
328 | // ---- DBG: TracePoints ---- | ||
329 | #ifdef _DBG_TRACE_POINTS_ | ||
330 | { | ||
331 | int nNum; | ||
332 | |||
333 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
334 | "DbgTracePoints:\n"); | ||
335 | for (nNum=0; nNum<(sizeof(aatmDbgTracePoint_l)/sizeof(atomic_t)); nNum++) | ||
336 | { | ||
337 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
338 | " TracePoint[%2d]: %d\n", (int)nNum, | ||
339 | atomic_read(&aatmDbgTracePoint_l[nNum])); | ||
340 | } | ||
341 | |||
342 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
343 | "DbgTraceValues:\n"); | ||
344 | for (nNum=0; nNum<DBG_TRACE_VALUES; nNum++) | ||
345 | { | ||
346 | if (nNum == uiDbgTraceValuePos_l) | ||
347 | { // next value will be stored at that position | ||
348 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
349 | "*%08lX", adwDbgTraceValue_l[nNum]); | ||
350 | } | ||
351 | else | ||
352 | { | ||
353 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
354 | " %08lX", adwDbgTraceValue_l[nNum]); | ||
355 | } | ||
356 | if ((nNum & 0x00000007) == 0x00000007) | ||
357 | { // 8 values printed -> end of line reached | ||
358 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
359 | "\n"); | ||
360 | } | ||
361 | } | ||
362 | if ((nNum & 0x00000007) != 0x00000007) | ||
363 | { // number of values printed is not a multiple of 8 -> print new line | ||
364 | nSize += snprintf (pcBuffer_p + nSize, nBufferSize_p - nSize, | ||
365 | "\n"); | ||
366 | } | ||
367 | } | ||
368 | #endif | ||
369 | |||
370 | |||
371 | Eof = 1; | ||
372 | goto Exit; | ||
373 | |||
374 | |||
375 | Exit: | ||
376 | |||
377 | *pEof_p = Eof; | ||
378 | |||
379 | return (nSize); | ||
380 | 374 | ||
381 | } | 375 | return (nSize); |
382 | 376 | ||
377 | } | ||
383 | 378 | ||
384 | //--------------------------------------------------------------------------- | 379 | //--------------------------------------------------------------------------- |
385 | // Write function for PROC-FS write access | 380 | // Write function for PROC-FS write access |
386 | //--------------------------------------------------------------------------- | 381 | //--------------------------------------------------------------------------- |
387 | 382 | ||
388 | static int EplLinProcWrite(struct file *file, const char __user *buffer, unsigned long count, void *data) | 383 | static int EplLinProcWrite(struct file *file, const char __user * buffer, |
384 | unsigned long count, void *data) | ||
389 | { | 385 | { |
390 | char abBuffer[count + 1]; | 386 | char abBuffer[count + 1]; |
391 | int iErr; | 387 | int iErr; |
392 | int iVal = 0; | 388 | int iVal = 0; |
393 | tEplNmtEvent NmtEvent; | 389 | tEplNmtEvent NmtEvent; |
394 | 390 | ||
395 | if (count > 0) | 391 | if (count > 0) { |
396 | { | 392 | iErr = copy_from_user(abBuffer, buffer, count); |
397 | iErr = copy_from_user(abBuffer, buffer, count); | 393 | if (iErr != 0) { |
398 | if (iErr != 0) | 394 | return count; |
399 | { | 395 | } |
400 | return count; | 396 | abBuffer[count] = '\0'; |
401 | } | 397 | |
402 | abBuffer[count] = '\0'; | 398 | iErr = sscanf(abBuffer, "%i", &iVal); |
403 | 399 | } | |
404 | iErr = sscanf(abBuffer, "%i", &iVal); | 400 | if ((iVal <= 0) || (iVal > 0x2F)) { |
405 | } | 401 | NmtEvent = kEplNmtEventSwReset; |
406 | if ((iVal <= 0) || (iVal > 0x2F)) | 402 | } else { |
407 | { | 403 | NmtEvent = (tEplNmtEvent) iVal; |
408 | NmtEvent = kEplNmtEventSwReset; | 404 | } |
409 | } | 405 | // execute specified NMT command on write access of /proc/epl |
410 | else | 406 | EplNmtuNmtEvent(NmtEvent); |
411 | { | 407 | |
412 | NmtEvent = (tEplNmtEvent) iVal; | 408 | return count; |
413 | } | ||
414 | // execute specified NMT command on write access of /proc/epl | ||
415 | EplNmtuNmtEvent(NmtEvent); | ||
416 | |||
417 | return count; | ||
418 | } | 409 | } |
419 | |||
420 | |||