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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 Q( e- \) f3 G, W8 i. Z( q
  1. [code]EDMA sample test application
    ; ]* S+ ]- ]- ?% W1 ^
  2. /*# H& W; M5 S3 j* W& i) d
  3. * edma_test.c( Y! _7 s+ ^/ k( l( z9 B" X4 f$ g
  4. *
    & f0 Z6 `$ ?5 H0 Y! [
  5. * brief  EDMA3 Test Application
    ( D( q: }: c: d5 W) C: j" \
  6. *
    / }. b2 t7 M; [4 B1 t
  7. *   This file contains EDMA3 Test code.
    6 ]5 N/ G6 H$ t, U9 H8 j1 K
  8. *
    ' s$ A" b3 j3 {
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 Q% F% p; Z# ~9 ^# z
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 S- b& a, M. t! m; b; ]
  11. *         TO CHANGE.
    4 N% B% k# p1 c  Y2 P( O
  12. *
    9 G8 F  x  y/ H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 o' `" A; e' b5 [2 }- _$ q
  14. *
    ' \7 |5 @9 G# j$ _% ^# M
  15. * This program is free software; you can redistribute it and/or5 U$ z2 w# K1 \
  16. * modify it under the terms of the GNU General Public License as
    / P9 M2 y$ A* L9 o
  17. * published by the Free Software Foundation version 2.
    # y& I# R% s( X$ s" D4 m
  18. *
    8 ?. `8 v! x8 y! w! a4 |
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( Y) R7 ?$ m6 a8 a, y+ [
  20. * kind, whether express or implied; without even the implied warranty
    6 b  ^  G; B& r, d3 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ e6 f6 _- V! _2 O$ v
  22. * GNU General Public License for more details.
    ! l1 m) f$ X$ P9 X9 S/ m  ~
  23. */# k8 k! B: Q- x8 p2 d
  24. ) A1 @5 h6 \3 A  G% L- p
  25. #include <linux/module.h>
    # Y2 ~7 U9 M7 M+ f% Q( Y
  26. #include <linux/init.h>
    2 k# s2 o: I  i. e4 z* \" d
  27. #include <linux/errno.h>: D. o6 p, ]$ W8 M1 L
  28. #include <linux/types.h>
    + |2 Y# K. _: k' Q
  29. #include <linux/interrupt.h>5 D: f. I& Q7 I6 b% b
  30. #include <asm/io.h>
    : a( r- a# g# Y- K9 a& }
  31. #include <linux/moduleparam.h>5 p7 T: W/ |% W) H( v# J9 n* m
  32. #include <linux/sysctl.h>
      v" ]/ J2 E) x# N  c& m/ q* m9 X
  33. #include <linux/mm.h>
    2 n) e4 m* S. H. K9 }4 y
  34. #include <linux/dma-mapping.h>* J; t  U6 ?* [) L

  35. ; @1 f7 q9 ^, ~& O- j4 J
  36. #include <mach/memory.h>1 F/ k+ F; G5 @* {" u2 t
  37. #include <mach/hardware.h>! I4 h; Q% Y( z2 q+ \
  38. #include <mach/irqs.h># G9 b+ N" f" {0 Y- b/ M$ Z" L
  39. #include <asm/hardware/edma.h>
    ( O7 w/ G. @9 g2 y$ W. F
  40. 0 u9 T4 ?. J, B9 r) r) F( _
  41. #undef EDMA3_DEBUG
    ( ]- o* M# x/ f/ l
  42. /*#define EDMA3_DEBUG*/
    6 J2 x% z: y* F4 U& R" o
  43. 8 Q1 S  E! G5 `# o- |
  44. #ifdef EDMA3_DEBUG! a3 H1 d8 _& v6 s: g# t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + D% V: K1 [2 g, C8 V: P; P, Q6 H
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 v5 k( _: b5 [6 Q2 V1 Z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    : V9 |* p+ X6 q" w/ D
  48. #else2 v* o3 @, ^  X/ _
  49. #define DMA_PRINTK( x... ): X) x0 y. A3 i( H5 {' a
  50. #define DMA_FN_IN/ p0 w% O% u7 }$ r& D2 X5 d! @  ~
  51. #define DMA_FN_OUT
    3 I+ k# v" [: A. J5 Y# J8 O
  52. #endif4 R, _% @$ Z0 D1 h# X2 t+ c

  53. + |# o' B- K( ^- C- U* ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): J% F) m0 m6 }0 \) X
  55. #define STATIC_SHIFT                33 ^( ^& _( u* R
  56. #define TCINTEN_SHIFT               20  {" `$ M  q& G  b
  57. #define ITCINTEN_SHIFT              210 n& g. u" v0 ?  ^
  58. #define TCCHEN_SHIFT                226 Q- U& w* A: [' X7 d: p" s# l
  59. #define ITCCHEN_SHIFT               23
    & a0 T9 E5 k5 |. ^, A' W
  60. 7 ~5 x- u. b0 G. b9 P
  61. static volatile int irqraised1 = 0;, ^+ ]9 ~1 l( X$ B8 o; P
  62. static volatile int irqraised2 = 0;5 @, X/ i2 d7 ]4 A0 D: m* t; h$ C

  63. 4 b2 Y, \8 _+ X& ]: K" M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" f3 q  n! v) P: }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- ]: w1 T+ m$ o2 K1 n* ]1 m8 M: u$ U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ X; G- [0 x# B9 K3 F8 V( R
  67. 0 e' l0 Z+ N" H* c7 S2 q, l
  68. dma_addr_t dmaphyssrc1 = 0;
    0 S% I, N3 R0 i4 U  t, q! t# g
  69. dma_addr_t dmaphyssrc2 = 0;2 p( I/ i8 S* d! ^8 A' V+ s
  70. dma_addr_t dmaphysdest1 = 0;" t) H* Z0 y+ g2 I
  71. dma_addr_t dmaphysdest2 = 0;
    - H, g1 }  J& s) L' M9 k% r/ r

  72. 2 H6 w! u8 h3 ~  D" y+ h+ E
  73. char *dmabufsrc1 = NULL;
    ; _' w4 e5 y, k& B2 \# l
  74. char *dmabufsrc2 = NULL;
    " f/ \7 q/ Z/ H" W  b3 G, w9 P
  75. char *dmabufdest1 = NULL;
    * R; N7 u- H1 [( g  I3 Y
  76. char *dmabufdest2 = NULL;
    ; B  @8 S+ A( X# Y: B0 h+ R

  77. 0 L% c3 x. {% H! e( _4 E
  78. static int acnt = 512;( ?, [9 p9 W4 K( H/ y4 a
  79. static int bcnt = 8;2 ^; D! U: s  ^9 T& v
  80. static int ccnt = 8;9 l% m2 D- J* T) P& l4 J

  81. ! E" {7 K5 ?+ e( {
  82. module_param(acnt, int, S_IRUGO);
    5 O7 X6 A& G+ _/ k- i1 K  b
  83. module_param(bcnt, int, S_IRUGO);
    ) U5 |# w* A& J( B* }) Q' E# ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, n  j' M: k5 b; c! Q. E" w/ O: q7 E5 r# J7 h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( K" x. R% Z' j0 Z' q+ D* Tarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ ^$ |: T  i( C8 p: W% K     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. v: A9 r% }8 {0 r7 Q/ L7 S2 e0 ]
( T3 d# M) A+ s, I5 }. f
0 q" x7 f2 d9 {5 t% j" q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 05:20 , Processed in 0.042113 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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