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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* N7 v- k( u4 j# a' [5 N( }+ D% X7 M
  1. [code]EDMA sample test application2 e4 |9 G8 A* L$ D. N+ @
  2. /*( Q3 \3 G4 z) _7 Z6 [" f
  3. * edma_test.c
    % w) ^7 }/ h5 y4 @) p( ]! V
  4. *8 u# C6 i, N9 J4 k9 @) |: s- [( s
  5. * brief  EDMA3 Test Application
      \- k9 L+ W+ N$ ]: S
  6. *
    1 r2 l8 y# E; D7 E3 B# E( h6 y; i
  7. *   This file contains EDMA3 Test code." j' O! y( s0 ]" W3 e5 o
  8. *
    1 D( P  w4 }* h/ }: o# R% B& q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% [0 _1 [% D; v' e1 g" K5 J  r
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT# v1 [$ F- h- l  k
  11. *         TO CHANGE.
    . }6 q$ `+ c6 {7 m: @
  12. *
    . V& ~$ s% G" H2 K
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/3 g' O; z: N# ^1 f
  14. *
    1 D7 s6 J. n& W% F+ b7 V
  15. * This program is free software; you can redistribute it and/or
    + A, U6 j0 R1 s' E" L
  16. * modify it under the terms of the GNU General Public License as
    $ B0 p/ u# A( v) e
  17. * published by the Free Software Foundation version 2.
    1 h/ ~. C6 G0 f1 m# V) D
  18. *
      z1 H7 z4 V1 t3 i9 K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    , W0 q4 }6 b$ J: Q2 w& l
  20. * kind, whether express or implied; without even the implied warranty
    ) `8 z9 q) c- H4 A3 W9 |) r; x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      O3 q- |4 r% O& r' e  r+ S
  22. * GNU General Public License for more details.8 j  R/ h- E2 p6 N; |/ v6 @
  23. */
    ' P, h9 p: |( h3 C0 Z- C
  24. ) `: Z$ f7 R- R. u3 n+ A' g# w
  25. #include <linux/module.h>9 F  T$ E/ z( |! N2 p
  26. #include <linux/init.h>. f% R$ ~. X# h. \2 u1 [+ q& N
  27. #include <linux/errno.h>/ v$ T* r% g1 V6 B& c
  28. #include <linux/types.h>
    5 H; s1 `. W) e& [# V
  29. #include <linux/interrupt.h>5 T7 E/ q" c3 ^+ @$ A! W
  30. #include <asm/io.h>: B7 @5 T: T3 F; P. @
  31. #include <linux/moduleparam.h>
    6 ]. h) T) R. `' D) V5 p$ T9 A) T+ z
  32. #include <linux/sysctl.h>3 b1 c. a, T5 {  o# z
  33. #include <linux/mm.h>* K: c4 t- C( h, q0 K
  34. #include <linux/dma-mapping.h>6 f1 r. p  c) l  {1 T9 T  g* R- a
  35. 0 y) f. j8 i9 G, T, a
  36. #include <mach/memory.h>& Y! c2 w( {3 g
  37. #include <mach/hardware.h>
    $ m  d5 S/ \' n/ |5 Z
  38. #include <mach/irqs.h>4 S. W% h0 R- A- |$ j( c2 p2 L
  39. #include <asm/hardware/edma.h># w! V& r$ X4 P2 c1 n. j

  40. # T8 m0 g8 D9 h4 K
  41. #undef EDMA3_DEBUG' j, q# X4 W" L4 ]1 i3 Z
  42. /*#define EDMA3_DEBUG*/' V& {; ]* ?) Q% Z9 c, D4 i

  43. 9 t) K% M2 l7 d
  44. #ifdef EDMA3_DEBUG) |* c( s' k$ ~4 G
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 c) O" t! e- U( o- Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ _* U6 ?# c0 N- l; p6 E) }
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 Y+ a  n% j9 q( n. U6 v+ L  u6 H
  48. #else* A% N8 b3 ]: {, A- o5 c; v! B
  49. #define DMA_PRINTK( x... )
      `3 u0 X' q8 G6 ]6 l; H+ K+ {# u
  50. #define DMA_FN_IN" e7 \$ n9 L9 s8 f
  51. #define DMA_FN_OUT
    # u0 y8 q" l# s& |4 w
  52. #endif
    $ k$ d, P; ~6 q" U, y
  53. % h, _! e$ }$ `3 f$ W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    " y0 W7 B" e" O2 K- A5 ^  A7 \. d
  55. #define STATIC_SHIFT                36 W+ j) w3 Z5 F$ c; t/ b: B
  56. #define TCINTEN_SHIFT               20# O8 U# ~$ |, S$ r! m, c
  57. #define ITCINTEN_SHIFT              21
    + E" i5 j3 V/ K  f2 p  q0 U
  58. #define TCCHEN_SHIFT                22
    . O6 n2 T% g# S* e- O0 d) U
  59. #define ITCCHEN_SHIFT               23
    6 E2 G( Z7 R: E4 r# t+ G

  60. 8 s. @0 V0 g( x" i( {
  61. static volatile int irqraised1 = 0;
    ; u$ `# m! m# X
  62. static volatile int irqraised2 = 0;) h3 L/ _5 b+ r- J1 {7 \

  63. # Y0 b1 Y& H. O* U1 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % B' F7 V8 c  v# y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , X) \! R! M8 w, W6 d
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . u1 ^) W& p9 ?3 i
  67. 4 D* `: `% T9 {: i, _
  68. dma_addr_t dmaphyssrc1 = 0;% ^0 j5 ~) l+ h( R
  69. dma_addr_t dmaphyssrc2 = 0;
    # ?! d& ]* u: _
  70. dma_addr_t dmaphysdest1 = 0;" K- o; g; O1 P$ b0 i; c5 K
  71. dma_addr_t dmaphysdest2 = 0;$ Z0 k+ V7 G% P9 [, {( q$ [  b9 J

  72. 8 G. x- `- }* k& ~: x
  73. char *dmabufsrc1 = NULL;5 f4 P2 C& p) M
  74. char *dmabufsrc2 = NULL;" n2 h" m2 B/ S
  75. char *dmabufdest1 = NULL;
    - q( p. i( _9 Y/ p. b* U/ T6 N5 g6 {
  76. char *dmabufdest2 = NULL;4 Z* v# K4 P) O0 `1 }
  77. ; W/ n$ L4 }9 O& h% z& u' p$ q, m
  78. static int acnt = 512;- V, l/ i+ V9 D& b# F( Y  V
  79. static int bcnt = 8;
    , k- h9 H0 e. L7 M% i# A# o# h- k4 b
  80. static int ccnt = 8;
    , \( ]( e( `9 A
  81. ! @! q; U; i6 b# q+ G! q0 _& S- c$ X
  82. module_param(acnt, int, S_IRUGO);
    7 P3 @5 ~, e6 Q6 ^
  83. module_param(bcnt, int, S_IRUGO);* f% `+ _5 s5 j, x: `! i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

4 ]& N+ ^$ u  J4 [0 X* D/ {5 B. a) m- J) j2 y; }& J2 ~- @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ L0 Z( [! t9 V8 R! j' j7 p5 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 d1 R4 y( b% V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 c; n2 Q; L" n" d
, z" R) i/ M' }9 ^9 N& Z' I

' p0 z8 t# G  Z# c
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-19 12:58 , Processed in 0.046364 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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