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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 # O- B9 p! h+ e- g
  1. [code]EDMA sample test application$ q( n' g1 A1 w9 D9 `( K
  2. /*
    / }: }5 j, T: b6 ]- H; q9 V
  3. * edma_test.c2 k# ?+ W+ b) q5 e
  4. *
    , ~/ B' V: e& w8 w% e
  5. * brief  EDMA3 Test Application
    $ N3 X$ M/ p9 t
  6. *- Q; ]6 H, ]* q( e# |: [
  7. *   This file contains EDMA3 Test code.
    ' K1 \" \- l5 {. |1 n
  8. *$ U7 n3 F# Q1 [) {+ j- ?( O, I8 w
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE* |& V& w8 E" V& f3 D* b# ^
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ; D6 H& K2 }4 [6 Q% J* K
  11. *         TO CHANGE.
    ; \2 x' x) Q! M9 p$ Z
  12. *
    * Z9 r+ Z  i% C$ e$ ~; p" R; M# ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / R0 u+ H2 K0 p, W
  14. *9 `4 [/ p5 B5 ]; c' M/ g2 ?
  15. * This program is free software; you can redistribute it and/or
    2 `$ o' P1 G  a0 A$ k7 D3 e# k
  16. * modify it under the terms of the GNU General Public License as
    ! X$ X' O3 c/ F6 }
  17. * published by the Free Software Foundation version 2.; l2 u6 M; o! o& Y* V  T
  18. *
    6 n  X2 N) e* G* Y( H, z; C* x9 E* ~) v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 m1 ^' d8 [" D* i) D
  20. * kind, whether express or implied; without even the implied warranty
    . a" N$ z5 q9 x8 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    - z) J3 w/ }7 H
  22. * GNU General Public License for more details.# Q# M% `3 U4 Z
  23. */& I' y. p* Z+ e/ r
  24. & u0 I) o  O8 U6 s# p
  25. #include <linux/module.h>$ U7 Q' B+ J% G3 h4 l
  26. #include <linux/init.h>
    / V* w- J' V+ p: A& Z( S+ i
  27. #include <linux/errno.h>
    1 ]+ V5 |9 }0 v% y* F$ u
  28. #include <linux/types.h>3 z" i( j9 f( H
  29. #include <linux/interrupt.h>
    , @0 z* m' E8 r. u+ q
  30. #include <asm/io.h>
    9 {. b! j5 v* F' N8 g4 {& q# D( ]
  31. #include <linux/moduleparam.h>
    3 M; @; Q& t7 f# n4 Q: x) |
  32. #include <linux/sysctl.h>
    / Q3 J0 ?/ ^3 I/ L0 O
  33. #include <linux/mm.h>
    $ j  |# |9 B( `% L! R, g/ L6 z
  34. #include <linux/dma-mapping.h>2 p/ ]9 B1 Y9 B. g
  35. 2 ~' e7 ?; S3 i% {( e) X1 b
  36. #include <mach/memory.h>5 Z0 U$ i  ^6 `- H5 {5 f' }
  37. #include <mach/hardware.h>4 z7 S4 _7 i) V/ P/ o( T" m9 c
  38. #include <mach/irqs.h>4 W! W, ?5 n4 V6 z) q
  39. #include <asm/hardware/edma.h>
    . Z7 N% x1 C" |& n, u5 I' d' G0 h% r" g
  40. / d9 S( l  t5 R  r) M
  41. #undef EDMA3_DEBUG
    4 m5 X' l1 y3 A4 g, s- z: c
  42. /*#define EDMA3_DEBUG*/
    / J4 r/ F8 u2 C6 {( U3 h* C

  43. / V- F+ u6 t1 O& m9 A, X- d; @
  44. #ifdef EDMA3_DEBUG
    & Z. ]0 p3 G& ]0 s4 }
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)! T7 W# A+ [# [9 z3 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 X; ~7 e+ G: t$ `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 h  d/ I  K% `: O6 D5 v
  48. #else0 y$ c/ d0 S. @; N" R
  49. #define DMA_PRINTK( x... )
    0 k) R7 D/ y7 m5 N3 z0 M' y% r. v
  50. #define DMA_FN_IN* S% |. g7 s4 @3 r$ W0 ?7 Z3 c
  51. #define DMA_FN_OUT2 K8 l, i7 ]) V+ ]1 Y
  52. #endif! l* l8 _$ Y6 o# J, @
  53. % A0 d% J9 f4 x1 n. X4 G9 `
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # Y+ y. K2 \& x% X
  55. #define STATIC_SHIFT                3
    : ]$ z/ ?, S/ v# z& {' O
  56. #define TCINTEN_SHIFT               20
    * W! J2 t4 r8 v+ i- }8 Z6 j
  57. #define ITCINTEN_SHIFT              21
    " y4 X4 }" w( x. a2 ?+ [* a
  58. #define TCCHEN_SHIFT                22
    4 m. U! G4 ?# r9 ~) r
  59. #define ITCCHEN_SHIFT               23
    / l4 p8 `) g8 {, E  \& \4 o
  60. 8 |5 L: k/ V; t' n7 P  M2 A! O
  61. static volatile int irqraised1 = 0;
    , v) G0 l% y) u
  62. static volatile int irqraised2 = 0;8 k/ y$ c$ q4 |

  63. 9 i( |. ?5 N0 B; X; {* }; C, g! U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    7 A3 b& Y$ ^) H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      a+ `* n8 P5 f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % w: U$ ^& x3 Y4 ?: I5 m! \' I
  67. 5 h) v; \/ M: F- F  c+ t9 g" C% d  M
  68. dma_addr_t dmaphyssrc1 = 0;
    % [, H2 m2 s9 @. I7 b* z: n
  69. dma_addr_t dmaphyssrc2 = 0;
    , F( t. J4 g, Y3 o( B* {8 R' P
  70. dma_addr_t dmaphysdest1 = 0;
    8 ~& k( ~& i8 s
  71. dma_addr_t dmaphysdest2 = 0;
    3 `0 v, A" I9 A! H( k0 m

  72. - n1 u0 m) W/ S+ X
  73. char *dmabufsrc1 = NULL;
    & X$ X1 n+ b) Y8 K2 w! b
  74. char *dmabufsrc2 = NULL;$ S/ v7 H% O. ^+ c+ g9 _1 F/ b6 t
  75. char *dmabufdest1 = NULL;
    9 t2 Z, }9 |" J' u% Y
  76. char *dmabufdest2 = NULL;
    2 q' D1 M7 ]" `6 e3 W

  77. 3 h) Q! R/ @' j5 t% F! [+ Y1 ]
  78. static int acnt = 512;, {: p8 f: Z. J1 U; ~/ Y
  79. static int bcnt = 8;
    / W# t, c& |* G( k7 h9 e; F
  80. static int ccnt = 8;
    2 a7 ?4 B  H$ t# d

  81. 2 P( ]% j8 I+ {! N' c  o
  82. module_param(acnt, int, S_IRUGO);, C' p1 U/ Z  \
  83. module_param(bcnt, int, S_IRUGO);8 w: N) V, A- w; k. C' [: P) Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

/ T& v" y- h3 ?% b1 v
- G( d/ e8 R  d9 p      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 I; V' K; O* P6 q  B' o4 {( ^
arm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。! ]  g2 N% E4 z; h
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 s, K4 Y- [' G7 a# H( z2 N

- p- r- ?- k! e( S
; S  Z( P# ]9 q2 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-12 19:44 , Processed in 0.040828 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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