OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
4 b& e8 J* ]; R
  1. [code]EDMA sample test application
    ' v0 l1 s5 T& e1 k
  2. /*/ T: E( i; Y, R
  3. * edma_test.c
    ) H0 ~3 m2 d1 C0 M
  4. *" E" ^5 n+ ~. i% O9 {5 w
  5. * brief  EDMA3 Test Application
    0 Y: _# N1 @5 ?9 @! u& G' N/ K
  6. *, q' C( O- T; \
  7. *   This file contains EDMA3 Test code.
    - ~( Q; {# f* T) ]8 _' p+ |
  8. *
    : {8 {$ ?5 ?: X: X0 g& ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE, t3 }0 S$ T& R$ W$ S% ]  |5 x& k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    3 b- T* j+ a6 ^" D
  11. *         TO CHANGE.
    0 z! r" G+ E' a0 y8 E* P, s* ~
  12. ** _0 h5 L: u: v$ Q. j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    # B0 a0 P) ^/ z3 L% C9 M: e
  14. *
    1 N; t1 x- k) ?2 L1 j+ }
  15. * This program is free software; you can redistribute it and/or
    ' C) i1 X& m2 Y; e4 w
  16. * modify it under the terms of the GNU General Public License as5 w6 v& a6 C! a) q' z
  17. * published by the Free Software Foundation version 2.
    % I* t" j! ]. y8 h+ J" j5 }& R, E
  18. *. z9 H: U+ G% f8 |$ f. `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, E, L" b) c- d) ]- v/ d, r8 q
  20. * kind, whether express or implied; without even the implied warranty, R; `0 u8 j1 M% e
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    , }6 ]. t) o, a6 x- L$ g! y8 Q
  22. * GNU General Public License for more details.
    ! c( U  w( Y: T! E
  23. */5 g' u. z* O2 m' H

  24. # e. t* l, e: }' A
  25. #include <linux/module.h># e$ f+ L9 J0 I
  26. #include <linux/init.h>
    9 z" ?; {8 m7 C: d3 y5 K# ?" a4 W  D3 E
  27. #include <linux/errno.h>" d6 v, d: z, y* B) }" P$ ]" {
  28. #include <linux/types.h>- F! b- q: l/ J: B. E+ x4 a" [
  29. #include <linux/interrupt.h>
    " J6 T  u- |5 {/ u0 P
  30. #include <asm/io.h>7 [3 @/ i, i* `. f6 i0 A
  31. #include <linux/moduleparam.h>
    / a' u$ l4 f4 t- C3 {
  32. #include <linux/sysctl.h>
    / h# ~' a  [. P$ M: {" c
  33. #include <linux/mm.h>
    : ?& Z* Z8 O) e8 a* y3 q
  34. #include <linux/dma-mapping.h>
    5 [4 ]; o/ ?4 L" K; d  `
  35. 0 o- \5 ?3 n. G) e
  36. #include <mach/memory.h># T- Q# F3 p% W  m) r9 A% K9 b
  37. #include <mach/hardware.h>/ L1 m8 T2 P2 m
  38. #include <mach/irqs.h>  e/ n. I) j- ?) u  R& Z
  39. #include <asm/hardware/edma.h>
    1 y; _8 e7 h4 K  \* o/ b
  40. , H, G4 X: z) @1 @% A; Q, R9 o
  41. #undef EDMA3_DEBUG
    ' c5 R2 W. Z+ @. V; _3 ^  ]7 Y4 ]+ K3 a
  42. /*#define EDMA3_DEBUG*/' m# ^8 q$ Q+ x
  43. & u: K8 Z# t. S- }4 R
  44. #ifdef EDMA3_DEBUG% Q0 ]0 a) P9 K) E4 _
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)1 k3 H" N* T2 }; z  r$ G, J2 }/ Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 {( C) c+ ?! C  L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& a5 s. R. \8 |/ S. I" ]8 w7 Y( W
  48. #else
      o: ?% L" S0 A8 a0 p
  49. #define DMA_PRINTK( x... )) H" P5 S7 \( H, O# Q/ I, f3 u
  50. #define DMA_FN_IN8 k9 y/ {2 P. L6 }2 Y. Z% `
  51. #define DMA_FN_OUT
    " g$ x1 `: S; F, [$ [0 y& o- R8 A
  52. #endif  y0 W* K/ {' U1 T1 W! J) s
  53. / f- X) l/ n  x- g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)6 s4 C1 M3 f! }7 G
  55. #define STATIC_SHIFT                36 f# t/ M. T5 u3 a0 f: H' C. g0 Y$ ^
  56. #define TCINTEN_SHIFT               207 f; l5 A9 [4 ^' }" K- X" Y0 a1 M
  57. #define ITCINTEN_SHIFT              21- Z+ Z5 b: D" B7 u; Q, i
  58. #define TCCHEN_SHIFT                221 q' Q+ i3 n, J( @$ j& ~  V
  59. #define ITCCHEN_SHIFT               23
    . g4 o, I; x# W0 ?" z5 X2 C" M

  60. ( ?, Y  w: e% f% U$ P' w( k
  61. static volatile int irqraised1 = 0;
    3 {3 {8 f) N3 O0 g( s* B6 u* i' {
  62. static volatile int irqraised2 = 0;
    " e, _0 z8 E" F5 T) K- E' T
  63. ( C+ [' V3 ^3 f- ?1 ?
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      T- J* A% p: V) ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) A" D& R' P' k2 z! F
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ R- K3 L( h7 s
  67. 1 e; d% ]* {' P
  68. dma_addr_t dmaphyssrc1 = 0;+ h" c' t" V, j% Y+ _: q+ s
  69. dma_addr_t dmaphyssrc2 = 0;" d" p; C$ H$ W$ X6 z6 w: R
  70. dma_addr_t dmaphysdest1 = 0;0 q8 c: u* M6 h0 H' u1 i
  71. dma_addr_t dmaphysdest2 = 0;- g5 `% i5 j6 ^3 N/ Q' K

  72. 9 A+ d4 P3 v( ^9 b% G+ [9 I
  73. char *dmabufsrc1 = NULL;6 w' \4 F8 y+ z4 ]% u# ]% C2 @2 r# f
  74. char *dmabufsrc2 = NULL;
    " G$ U2 M$ ^& @
  75. char *dmabufdest1 = NULL;
    : i% T& w0 F2 \8 I8 m3 `
  76. char *dmabufdest2 = NULL;
    * a8 I9 z" n; @0 p5 m
  77. 9 L: |" w+ d$ I! @/ @3 U" Q
  78. static int acnt = 512;
    3 G6 B, s8 }; k! G# p
  79. static int bcnt = 8;
    ( H8 H& s2 {2 X, e( [( v6 \' _
  80. static int ccnt = 8;
    , Q& f1 [- D7 i5 c! D
  81. 3 \7 ]* ?2 P3 A# l
  82. module_param(acnt, int, S_IRUGO);
      X: s% L, M' p
  83. module_param(bcnt, int, S_IRUGO);% {- M+ `# N, o6 D( d6 G
  84. module_param(ccnt, int, S_IRUGO);
复制代码

2 ]/ _0 F* L4 @: Z
" s" @0 Z, K$ J9 Y$ x: Z      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
7 i# `- \. {: i$ X8 x; \+ U1 G0 |& Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。* w" D7 M# }) C+ o2 f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
- B% s3 n) h# L+ Z4 v
9 z, T- M8 j! N  ]6 }5 |. P0 k7 r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-15 14:48 , Processed in 0.037851 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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