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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 @, z! C9 ?5 v, E$ `# p
  1. [code]EDMA sample test application& g! S* \0 H8 ]  G" H% K7 E" f" H: m
  2. /*+ w& o8 |) e4 L; ~% q: c1 n
  3. * edma_test.c2 E- Y! l6 g' e' I( l2 Z/ t
  4. *1 n8 X# y3 g1 t. c7 ?$ K" B
  5. * brief  EDMA3 Test Application/ O: ~3 o& V- r; @
  6. *
    % f$ W- ], D- `' c" N( b
  7. *   This file contains EDMA3 Test code." [  X$ ^$ [1 p2 M8 ?( A+ i
  8. *- M, [) r/ w: w: ^8 I& X1 ^8 l- u
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    6 z1 @8 Q, R$ X% d5 e3 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ b% b( _, q3 z. N
  11. *         TO CHANGE.
    7 c) X# [/ u# S0 n% T4 W
  12. *
    6 y, ^+ M7 d- s" @% m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/1 Q4 G+ Y8 f( E9 B3 i3 }
  14. *( i, l9 ]0 j5 V( Q! E
  15. * This program is free software; you can redistribute it and/or
    % z4 N6 @8 G* c1 B6 q4 s
  16. * modify it under the terms of the GNU General Public License as7 c( p- v, e% n: J
  17. * published by the Free Software Foundation version 2.
    + Z; V3 V9 O' s, ^. {
  18. *5 J3 w6 _) v" w4 ]: C& M3 d5 m- f6 Q
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    7 I- ]+ U7 _* D4 N; K6 a
  20. * kind, whether express or implied; without even the implied warranty: H, `2 @/ h. M0 l% `; y+ o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    7 s2 v" Q: s( k
  22. * GNU General Public License for more details.
    9 g+ W* k, N* c/ N3 ~
  23. */+ n% J# g+ h6 ]/ k( Q8 H8 A% s- {; Z

  24. : ~7 p- Y2 i, F" n8 q
  25. #include <linux/module.h>8 x/ H' }9 [1 }3 k9 ?
  26. #include <linux/init.h>7 j, M3 d; ]9 |+ n; W+ z
  27. #include <linux/errno.h>
    ; T0 D& ?9 ^0 n7 B! i  n, Y2 r* ~
  28. #include <linux/types.h>/ S  x) a5 u$ I) Q2 g% x. Y& `
  29. #include <linux/interrupt.h>
      I- J0 ]( ~8 W8 y0 p4 Y
  30. #include <asm/io.h>4 N' C7 w7 C" [# o3 i9 U7 j
  31. #include <linux/moduleparam.h>
    ) _+ h* k! O. [* i- E% b# G% I
  32. #include <linux/sysctl.h>
    5 B! e: p, W0 x  }' V
  33. #include <linux/mm.h>
    # K# N6 [$ Y3 L4 o2 v% ~
  34. #include <linux/dma-mapping.h>
    . e* v, b* }5 ?+ R. J1 F' F2 |. A" |
  35. 5 m- R& T/ ]0 [
  36. #include <mach/memory.h>. I) g3 u" ?. b6 J  E
  37. #include <mach/hardware.h>/ K+ i, A. i9 p& V0 I
  38. #include <mach/irqs.h>. o' Y% a+ }. a
  39. #include <asm/hardware/edma.h>
    " ?8 a* @( ^3 `" {8 f: l$ z; c/ i  b

  40. 2 z: n0 Q5 M5 W* P
  41. #undef EDMA3_DEBUG
    & M! `% ^; ]$ }
  42. /*#define EDMA3_DEBUG*/
    & x8 V" j9 c* N; v; z( F

  43. + X1 {5 h0 X+ A  R7 A
  44. #ifdef EDMA3_DEBUG
    - m# c! `" g9 K; R/ E/ C8 W6 {+ `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ' P7 e! p; M9 d  j& P/ E" c7 L
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 P$ ^1 w$ l2 ^' X( N, N% r
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " _4 W1 H/ T: v
  48. #else! `/ N, ~+ {0 Y( K8 k# V6 Q& \
  49. #define DMA_PRINTK( x... )
    1 X5 F, _+ f, {. B7 D
  50. #define DMA_FN_IN# G* b0 H0 n# M
  51. #define DMA_FN_OUT
    8 |7 ~3 ~/ z) R
  52. #endif9 o9 |+ y$ L* [' D1 F
  53. $ w# S8 a8 a4 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + Q/ Q$ B3 F! v
  55. #define STATIC_SHIFT                3
    * n4 c* ~* Q8 L: ~) I
  56. #define TCINTEN_SHIFT               20
    . R: P# h* U; D5 K" t, E
  57. #define ITCINTEN_SHIFT              21
    2 x; ]1 y  V' [: Q1 q' A% y
  58. #define TCCHEN_SHIFT                22
      ^3 P& g4 J6 T
  59. #define ITCCHEN_SHIFT               23' F3 g7 }# j  i3 Y
  60. $ M; A6 T1 _4 g# l( \' ?
  61. static volatile int irqraised1 = 0;
    # h- Z8 H. D; r1 o, X5 {
  62. static volatile int irqraised2 = 0;  j+ m  {" U0 S. }8 F6 @
  63. ' J7 j9 ^( [! [! V& g; m
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ \" u- L2 S1 n8 {1 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( q4 [6 u# Y2 ^) P$ @, x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 ~2 S4 R" V2 Q; p( ^9 F5 L1 h. K7 B
  67. & z0 ]9 R2 K7 d. S- g9 x; X$ ]
  68. dma_addr_t dmaphyssrc1 = 0;
    * a/ b" i' p- @6 [1 C- x
  69. dma_addr_t dmaphyssrc2 = 0;- |. n7 L- D2 y' {( d8 `) U- Y
  70. dma_addr_t dmaphysdest1 = 0;
    ; u' Q& m4 F2 {* Q- P
  71. dma_addr_t dmaphysdest2 = 0;2 x. Q' V$ p6 b2 l

  72. . p* z6 Z4 [3 \, R0 u
  73. char *dmabufsrc1 = NULL;
    7 V) H$ M; B3 {' O" _+ g( @
  74. char *dmabufsrc2 = NULL;$ E2 A% M' I( H9 G* ]. c
  75. char *dmabufdest1 = NULL;5 @/ s8 n" b4 t  B4 n
  76. char *dmabufdest2 = NULL;: [, d* z  l) A7 Q8 |2 X1 ^

  77. # {7 Z8 M- Y, X" o1 m, a6 Q" w
  78. static int acnt = 512;
    - I1 F) [+ ], V9 |0 r" x
  79. static int bcnt = 8;
    $ s( j* b/ ]( e3 c5 o' u
  80. static int ccnt = 8;
    ' A3 b  B: r+ h1 T, V  M

  81. 6 x- A6 C' E; n; o' U
  82. module_param(acnt, int, S_IRUGO);* K; Y5 {0 z, c, V5 y
  83. module_param(bcnt, int, S_IRUGO);' j* @6 m) U  k  ]  @
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" b* L0 i1 m* e. v5 }: ?& }5 a

6 a# s/ t( |, D* D) U9 v- n      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用( Q& s  S# K8 A) p  ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 c$ i5 d% [( f- ]. l/ t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; P6 ~) `. h  g+ m" i" b$ i! n3 ^6 M6 h5 W( {' i! E4 t) _

) U0 `! G4 B6 p6 M& K) h+ F* B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-7 07:58 , Processed in 0.040285 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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