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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 U" E" c1 L& E% }5 _
  1. [code]EDMA sample test application
    ) G; B6 @0 c% U8 |8 ?, T. q
  2. /*
    ; L6 f! y$ @; ?- ~  O& J& \$ v
  3. * edma_test.c
    " n9 ]! h: C4 B
  4. *
    ! O7 Q# s* x4 N. A- M
  5. * brief  EDMA3 Test Application7 [8 l) H3 J2 ], O+ Z
  6. *0 ]$ M; e: C6 v; B9 c/ Z
  7. *   This file contains EDMA3 Test code.
    ! x8 |6 |/ \, Z  ~
  8. *
    ; P6 g# O2 o. u# A$ Z$ m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    , z( T( d. r8 x+ I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT- x1 n- x. s1 [5 P: O+ |
  11. *         TO CHANGE.
    9 v+ T. u+ v) Z7 P. C
  12. *
    2 L! j9 J' S5 V% o- V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    $ v7 v& w% r" p" R) Y4 K* A
  14. *
    ( ]& l9 b: K4 X8 r# _
  15. * This program is free software; you can redistribute it and/or! h& j" i: P8 g- a) Z7 @
  16. * modify it under the terms of the GNU General Public License as
    7 Y* b8 R1 X0 ]% _4 H( N5 e
  17. * published by the Free Software Foundation version 2.8 I* x* E: ]1 h8 a
  18. *
    ' }: D5 ^  ]. W+ T" S: g2 Z6 M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    . ?) B) \4 X. @2 t0 f9 V
  20. * kind, whether express or implied; without even the implied warranty
    ; e1 }% `( Z: d, }2 G* }- V% H9 @* R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 m" O9 N9 d# z- ^# V- p
  22. * GNU General Public License for more details.
    & _$ X7 c! A: Q8 e/ R% C
  23. */
    7 u* A& o8 R# E

  24. ' P2 e# x4 @; u! q
  25. #include <linux/module.h>
    $ Z6 p3 ]! s: ~4 l
  26. #include <linux/init.h>
    " w9 L) M3 N, C( m* Y; `( U  e* ?
  27. #include <linux/errno.h>
    ) b4 ?9 J% `6 Y2 }
  28. #include <linux/types.h>
    : J. ^! D& V5 [2 U& V$ o
  29. #include <linux/interrupt.h>
    ' v2 h/ {; ?! b  e. C, \; `
  30. #include <asm/io.h>: W2 H, j" @) t) B" F! P) R1 J
  31. #include <linux/moduleparam.h>, p0 P+ e( U4 x/ i1 n" B
  32. #include <linux/sysctl.h>
    $ r& r! H7 H4 A3 m5 `5 Q
  33. #include <linux/mm.h>
    ( X4 }- L2 J3 P* V! j
  34. #include <linux/dma-mapping.h>4 R5 y' v) R: b# A3 `  e( F9 q$ s5 B

  35. 0 b) {( |0 A4 a; g
  36. #include <mach/memory.h>
    $ J6 |* X0 p) ^' Z( b% G; n' O$ v) p4 o
  37. #include <mach/hardware.h>. a/ k, Z- p2 n: K. @! Q# v. q; J1 r
  38. #include <mach/irqs.h>& a9 _7 f  \" O8 A7 L' S7 X2 j, N
  39. #include <asm/hardware/edma.h>  J: X! T6 }$ ~! {% |: J
  40. / Q3 O7 g7 u& y/ K% {" u
  41. #undef EDMA3_DEBUG
    ' _& R" ]( K8 l& X2 [6 o; n  L
  42. /*#define EDMA3_DEBUG*/( x  k  T) J1 r) |3 A5 a
  43. ! T' T7 p3 ]3 s2 K4 |9 n
  44. #ifdef EDMA3_DEBUG* i& a7 _1 n/ Z5 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  L2 F6 I, T- W& n& u
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    # y. V8 [3 _) r$ _9 u( _; y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! Z0 A/ _+ @  `* ~
  48. #else* t3 }7 y% q6 B8 o: Q; A% M9 z' ?
  49. #define DMA_PRINTK( x... )
    $ y. ?1 o5 `) k5 p- ^, _3 f
  50. #define DMA_FN_IN
    % v- f# F# h( x% ]# {: ?+ {  i
  51. #define DMA_FN_OUT
    8 k( n2 N3 o( v- A% O3 ?1 }) ]
  52. #endif
    ( _' P; y- Y" B  `- z9 @

  53. 6 v6 R: w4 A& d" F$ W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    9 N4 S  C5 {2 C7 \8 G& E
  55. #define STATIC_SHIFT                37 v6 b( P2 z4 f5 e+ k5 G( b
  56. #define TCINTEN_SHIFT               209 R2 Z2 U- O9 m
  57. #define ITCINTEN_SHIFT              21
    ; k7 o# ~; y; z# p
  58. #define TCCHEN_SHIFT                228 I: W- F$ \- p5 I9 f1 y
  59. #define ITCCHEN_SHIFT               23$ H0 ?0 `% i5 R5 z; s. t$ r8 a

  60. ' V# L$ R0 k  Y! y$ q5 i  [/ M) w6 f  }
  61. static volatile int irqraised1 = 0;1 |" W+ ?' o9 t, n& |1 n
  62. static volatile int irqraised2 = 0;: N1 t) O- y: R; ~. k& \2 O/ r

  63. 8 U+ I- I4 Q, E  t* O# H. r
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. N; o# H0 W+ S$ x! i7 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 U+ ]8 J' Q" z- p9 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 J4 D/ z6 x! c. h2 @/ o2 w

  67. $ t/ N, M% u; w
  68. dma_addr_t dmaphyssrc1 = 0;
    % t9 x4 W0 b9 u# v! u
  69. dma_addr_t dmaphyssrc2 = 0;
    , u0 X" W; z1 v
  70. dma_addr_t dmaphysdest1 = 0;
    ' L2 I+ i* {7 Q0 }/ Y
  71. dma_addr_t dmaphysdest2 = 0;( ]  a+ t+ R  ]- q% k$ |

  72. ) _* X. o" p$ b. E5 a
  73. char *dmabufsrc1 = NULL;
    8 M. T7 s+ T  M
  74. char *dmabufsrc2 = NULL;
    2 u0 D- w" s% U- N" V* ^( s
  75. char *dmabufdest1 = NULL;
    7 w$ J8 c( ?7 `7 v
  76. char *dmabufdest2 = NULL;2 P" C4 Q+ _9 ]/ g7 i
  77. & }1 M" ^& g& `" R
  78. static int acnt = 512;- k6 Q" o5 H3 H$ r' Y
  79. static int bcnt = 8;
    3 Z7 c/ c8 Q, g" E$ K; l# U4 Y; Y
  80. static int ccnt = 8;! a* b2 g. j4 F. b% I3 }9 P3 _
  81. . @* ?# ]* U# N" d% [& U# D
  82. module_param(acnt, int, S_IRUGO);
    . {' s) i( O8 j5 c1 r
  83. module_param(bcnt, int, S_IRUGO);8 D( v- {' U; y* n  A3 U- j. C
  84. module_param(ccnt, int, S_IRUGO);
复制代码
5 S$ @9 c1 N' P* v

" [3 q4 C' b9 ^      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' @7 k' H& x. K$ |
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
# K$ O% |2 g4 B! V- A: }     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
9 r9 g- }* m" F+ o9 m4 J4 r6 Z$ z( W5 M  X

0 S. F& j: p! u+ R- f7 ~3 x) e5 t
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 01:52 , Processed in 0.052586 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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