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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + r2 X& y' b& S1 Y
  1. [code]EDMA sample test application
    ! V, I3 z3 v  J: `, Z6 q) C4 A
  2. /*
    & A1 U( V5 z- |
  3. * edma_test.c
    * d" Q- Z4 \  W6 H8 a
  4. *
    : m+ o! G" B2 H) J, ^. s) g( N
  5. * brief  EDMA3 Test Application" t# s, l% R2 o
  6. *$ t5 m# E  h/ A7 N
  7. *   This file contains EDMA3 Test code.$ m, v! G4 Y! N( T4 |+ d1 y- l3 Q" }
  8. *
    5 K6 p: C- `+ W6 V0 Q, ^7 Y3 a% e
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    4 L7 K0 J4 Y$ z% f7 @% l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 ?, C5 `& q- B! O4 b% M& @9 j# L
  11. *         TO CHANGE.
    0 x' Z; k0 D* Y) {- Y; F. M/ |
  12. *
    0 S4 s5 f" m- ?0 h$ J
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    7 r& c2 o; V3 n( N1 S
  14. *% @$ Z6 `; T, G! _. z% M' Y) E# p  v
  15. * This program is free software; you can redistribute it and/or
    0 u! _5 w7 P7 ]! H0 A% `
  16. * modify it under the terms of the GNU General Public License as
    7 g; {7 f9 o6 ?
  17. * published by the Free Software Foundation version 2.
    / g# v. j  e8 T2 D  h
  18. *( k- N! c/ D' G- P% E/ K
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( y$ W2 a9 ]! u4 ^$ F: Y( D/ e4 b
  20. * kind, whether express or implied; without even the implied warranty
    6 m4 ?  u" f) F6 @
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) [3 U( m' E7 V( b
  22. * GNU General Public License for more details.1 s3 k8 z( c7 r
  23. */
    * K. i% s2 e' ?$ w
  24. - z8 K8 g" [4 w9 z1 ~- q
  25. #include <linux/module.h>
    ) m( v" N; G2 I4 ~/ X% W! x
  26. #include <linux/init.h>
      }" T$ p# p: {( Z( ~) N- r
  27. #include <linux/errno.h>
    * A( d! A' f" U' C7 L7 \* C
  28. #include <linux/types.h>, ]1 C+ q4 `) Z5 A: Q
  29. #include <linux/interrupt.h>
    2 Y; [7 ~: t/ y. z6 p
  30. #include <asm/io.h>; N& C1 f2 A; R- b; w( S# l
  31. #include <linux/moduleparam.h>
    # T# q! ?  D) Q& r2 i: f
  32. #include <linux/sysctl.h>; w6 g0 o* O! g, Q  ]
  33. #include <linux/mm.h>) I7 @% j2 d3 o8 I( i
  34. #include <linux/dma-mapping.h>
    - A7 O8 X+ |  j; I* g, ]
  35. & Y3 `, K  G& V- F
  36. #include <mach/memory.h>
    : a* p, F" _/ T6 I* Y" w
  37. #include <mach/hardware.h>) N- t& f  y* m* o- m
  38. #include <mach/irqs.h>' s4 [+ I  W* U+ |' N
  39. #include <asm/hardware/edma.h>
    3 O9 N' F" ?7 x/ o

  40. , |- ?5 r& H/ A/ i: s
  41. #undef EDMA3_DEBUG
    7 N$ C( L5 |3 a: U
  42. /*#define EDMA3_DEBUG*/
      Z7 ]5 S( n# _- t0 _5 j

  43. ) f6 {6 r% ]: D3 [2 A! T" D
  44. #ifdef EDMA3_DEBUG6 b- b' T$ \% _4 A6 b$ V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    : m: }  y7 n: O6 C% x! ~
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)5 ~0 K2 M* f( u- e  x- S6 F/ b
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)& Z$ h% P. ~) D* j
  48. #else
    8 h# z5 @. h3 r: |# J: X" L
  49. #define DMA_PRINTK( x... )
    3 y$ x( q8 [; O
  50. #define DMA_FN_IN
    4 b" r& Y/ g1 f* Z
  51. #define DMA_FN_OUT: Z3 R( \  t& t6 F9 A8 i
  52. #endif# U  T+ Y, T! r- b" {1 K% b
  53. : l; T# A/ m/ E+ B+ D* a& I( n
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768), N7 q2 {4 x3 T5 v8 @+ E
  55. #define STATIC_SHIFT                3
    ) y6 o; c) y& i+ N
  56. #define TCINTEN_SHIFT               20) ?* v, ~# K7 l* f, ^
  57. #define ITCINTEN_SHIFT              210 X7 Y! b, |. ]1 \7 J: l
  58. #define TCCHEN_SHIFT                22. \( D7 L. w% Q4 b/ y' t
  59. #define ITCCHEN_SHIFT               23
    2 s6 I+ ^$ [4 H  X

  60. - j' y. Q: w, _7 N& h+ h7 P
  61. static volatile int irqraised1 = 0;
    4 h$ f; L9 E3 j
  62. static volatile int irqraised2 = 0;
    0 ^! x: D1 X2 o6 N6 d4 W

  63. - p- t4 N6 O, y. p) Z5 W3 v; B
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ a$ Z: b, R6 O9 \$ R9 @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 A- m+ ]# r& S  q$ R  w
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 p, l' p7 q9 P  u/ u

  67. 9 z" p; S" F2 M! D% d% Q8 q
  68. dma_addr_t dmaphyssrc1 = 0;  F4 G  s4 v% x: R3 [5 X
  69. dma_addr_t dmaphyssrc2 = 0;
    # n2 f: G$ i* y% U- T! }
  70. dma_addr_t dmaphysdest1 = 0;3 D3 z, X- L& ^# T( g+ E
  71. dma_addr_t dmaphysdest2 = 0;1 E( }4 ]$ v4 g2 a$ y

  72. ! |+ ?; h+ G7 f7 L& q
  73. char *dmabufsrc1 = NULL;
    1 ~. w5 W6 }2 p8 o  Q2 ], Y. F  H
  74. char *dmabufsrc2 = NULL;) B$ F2 l% q! @- U5 ^" r8 ]! R
  75. char *dmabufdest1 = NULL;  s( d2 V) [0 M6 t8 m
  76. char *dmabufdest2 = NULL;+ y$ D+ H! Q, `/ h- u) _: _

  77. 3 C# v3 g9 h3 n4 C$ G7 m' c
  78. static int acnt = 512;& u! r( H4 R+ q
  79. static int bcnt = 8;
    8 Z! C) k  Y3 ]6 i1 m8 y
  80. static int ccnt = 8;
    : ]- T4 U. g0 e3 l; u0 \
  81. ; `' e1 y7 s; ]
  82. module_param(acnt, int, S_IRUGO);. i' `5 U+ Z4 U: A8 O
  83. module_param(bcnt, int, S_IRUGO);, B, O+ ?+ W0 ]$ U
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ v; s8 W6 x* |2 O# d

5 C' b, ]8 R! P  \- X0 z6 v      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用$ @# o6 Q/ ]% h' A
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 c  M+ q# ~, f5 r     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
' r; _1 A$ V. P. V' i$ ]- E7 x7 F. Y2 }

' m8 t9 ], ]4 m' u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-4 07:51 , Processed in 0.038763 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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