OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站
点击跳转“创龙科技服务通”

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

查看: 10367|回复: 0
打印 上一主题 下一主题

[未解决] OMAPL138如何在Linux下使用EDMA3驱动

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . A% ?/ {+ L! z# G
  1. [code]EDMA sample test application
    4 E8 X4 a' I1 }. y& c# N0 `( s
  2. /*) T7 [: Y/ w) u1 f; y
  3. * edma_test.c, X: c$ ?" ?4 ?1 u) O
  4. *7 S; M0 J5 P* O5 b/ ]
  5. * brief  EDMA3 Test Application
    5 R- s# s/ z  `; o* M
  6. *
    $ D1 {% |, ^6 \8 W
  7. *   This file contains EDMA3 Test code.$ \1 a: J* H  ^( z' V, U( K8 n
  8. *
    $ a9 U* ^. N  [5 l9 I4 F. ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* L1 {2 u  y- A5 j
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 R: x/ n- x8 j9 o1 y9 \
  11. *         TO CHANGE.4 U  M3 r  [  D! |6 q
  12. *
    9 R: J" E& b0 O- ]" T4 ~+ F- M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* I% x9 {1 K! D! t1 @# X0 S
  14. *. ^$ B4 i7 K! f' s1 k* T
  15. * This program is free software; you can redistribute it and/or  Y5 I" o3 A/ ?2 G& {# m' d
  16. * modify it under the terms of the GNU General Public License as
    # o( Y& h) i9 V2 X+ A, @
  17. * published by the Free Software Foundation version 2.& ?5 b4 ]0 A) H% z# g
  18. */ m+ o, e5 Q9 l% J5 m8 \/ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any/ d; g  H3 c% O; I8 E
  20. * kind, whether express or implied; without even the implied warranty
    5 J& s( f9 d& \1 \5 a0 A# O7 b9 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    & i$ @9 l" I, u2 m7 U% P. i
  22. * GNU General Public License for more details.
    1 P5 F, D& D; o. `& o
  23. */) M$ t1 I$ s; s+ I& m& N3 K
  24. # }' n) t/ n  ]
  25. #include <linux/module.h>( X  d2 \2 `- m5 |+ K
  26. #include <linux/init.h>
    4 {8 I$ v- ~! O4 x  }
  27. #include <linux/errno.h>
    ; X" U1 i7 W' m4 R) o8 s! Y' Y2 I
  28. #include <linux/types.h>
    , `3 U4 Z! F6 ?
  29. #include <linux/interrupt.h>
    9 C5 M6 f$ q; ?' t( \
  30. #include <asm/io.h>) m0 W1 B9 h+ C- X4 `3 p! A
  31. #include <linux/moduleparam.h>
    $ _* U' ]8 x! L
  32. #include <linux/sysctl.h>
    4 a4 L: n, i5 D+ A. T0 }) P) v, P
  33. #include <linux/mm.h>
    8 n' X  X& m; }  e2 W5 h; o
  34. #include <linux/dma-mapping.h>
    # n+ ?6 }. j2 d; V8 N) j# w- i
  35. 7 ?8 l9 i( D+ r  N" q( R
  36. #include <mach/memory.h>( T# V7 \; V  Y- O1 \! X/ \
  37. #include <mach/hardware.h>! \$ b% G. C/ [, t+ A; y- z
  38. #include <mach/irqs.h>
      M  C$ h0 M! J9 [% |( r  T4 B" o; O+ }
  39. #include <asm/hardware/edma.h>) G3 o; u/ g$ t+ l6 i

  40. * R( n- f9 @- Q+ ~* X
  41. #undef EDMA3_DEBUG6 K, B" ^/ h* r
  42. /*#define EDMA3_DEBUG*/
    8 N2 [) H! m& g) J& P1 R% U$ Q

  43. ! x- |" @0 P* P/ K
  44. #ifdef EDMA3_DEBUG, Q" o2 T2 E0 |/ `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 E9 n3 I/ ^: i, j5 ^: t0 v0 c7 k
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__). p& P9 I( R, L# f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) I3 z1 \. D6 D; W) {2 f5 Z
  48. #else0 g, `- C7 G/ X; N7 @# g
  49. #define DMA_PRINTK( x... )
    ; @! P# |) I' f7 t9 l( ]# H0 r, ?
  50. #define DMA_FN_IN
    2 ~! o$ t) N7 p, f! z) e$ M
  51. #define DMA_FN_OUT6 q, m# _; `3 I& d  s* \$ V; Y
  52. #endif
    4 N& r$ l; o3 s' m- j

  53. - C0 w0 ~4 A0 M9 \9 B  H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)% E$ N  o* F: J3 H5 L! B. c9 W* x
  55. #define STATIC_SHIFT                3
    # b( a  U5 `7 `( M- r
  56. #define TCINTEN_SHIFT               20
    9 p$ g) @) }/ b- O
  57. #define ITCINTEN_SHIFT              21
    " C0 ]" w2 r- L) U8 [5 |8 t( [
  58. #define TCCHEN_SHIFT                22
    : N$ e2 `: }1 s( P/ z
  59. #define ITCCHEN_SHIFT               23
    - M& g- V, J0 R8 E9 F: W# n

  60. 3 M. G& `, b% B
  61. static volatile int irqraised1 = 0;
    ' K. z' t) ~. L# S
  62. static volatile int irqraised2 = 0;
    , R7 p( o9 h/ h8 Y4 Q% p+ u

  63. ) k0 q: F( p4 @
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : w+ V3 U- `' G( d. v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) e  _0 [& h# g' {/ k+ j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 |$ Z3 M  A  i

  67. ' K, ]: p9 H5 Z/ d- G5 Q
  68. dma_addr_t dmaphyssrc1 = 0;
    1 m' N) ]+ E0 N3 t
  69. dma_addr_t dmaphyssrc2 = 0;9 B# }6 B/ K  B* \( d( S6 \+ C
  70. dma_addr_t dmaphysdest1 = 0;
    ) d8 e% D! @. @- I; n$ |5 X
  71. dma_addr_t dmaphysdest2 = 0;
    2 g+ }: n9 r$ n" n$ \
  72. + ]1 c- o  j; U  f- H
  73. char *dmabufsrc1 = NULL;
    ' _* }" D+ ?% ?9 M3 F( C7 ^! ^
  74. char *dmabufsrc2 = NULL;! n2 L. Z, V1 J  P( S
  75. char *dmabufdest1 = NULL;; T* q0 Q: Q! f, ]' \9 F) i
  76. char *dmabufdest2 = NULL;
    % y- U4 [8 {' d' k$ K2 t* q" L
  77. 7 M, G5 i  O" I# N  \( i. X, _
  78. static int acnt = 512;
    1 Z5 J3 E: A7 l2 P4 D
  79. static int bcnt = 8;
    2 @* N6 F; W1 t8 x8 ?
  80. static int ccnt = 8;
    0 a" H6 A$ D, q7 i

  81. , L/ f" U- q1 _! A# H
  82. module_param(acnt, int, S_IRUGO);6 E, _; F5 l$ I7 ^1 ~1 n
  83. module_param(bcnt, int, S_IRUGO);
    $ f2 f( }5 q6 d: F9 L" _
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- H# P, o! V- X" A9 d3 W" B2 ^3 V2 s
) N; E( ^, T, u) ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
4 b2 F8 `. N, u3 c& U6 B; s5 y6 r: Carm-none-linux-gnueabi-gcc  -I /home/tl/omapl138/linux-3.3/arch/arm/include -I /home/tl/omapl138/linux-3.3/include  EDMA3test.cpp -o EDMA3这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 q3 W! D9 ?- c; @: e% F4 i% |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; |& S* t: D; b4 u8 r6 [7 L9 |5 q
" G/ f' n. P5 L% |5 {, O5 P0 n' h, \$ U' T1 [+ |
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

点击跳转“创龙科技服务通”

QQ|手机版|小黑屋|嵌入式开发者社区 ( 粤ICP备15055271号

GMT+8, 2026-1-22 10:25 , Processed in 0.039237 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

快速回复 返回顶部 返回列表