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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 ; i6 u2 f% ]: a
  1. [code]EDMA sample test application/ @8 s' A1 ^. R7 R( P
  2. /*
    % ^4 \3 A  K- m* m( V4 m
  3. * edma_test.c
    4 Y, n# }) _2 a
  4. *
    # Q, N: ^6 ?& v8 ~3 r
  5. * brief  EDMA3 Test Application3 z, S% f1 h; ~  x& {  }
  6. *
    $ l6 Z6 h' P. h' L, _$ l/ v
  7. *   This file contains EDMA3 Test code.
    5 G, Z- f8 H: `- F( F2 f' B" x
  8. *
    ' ^+ c3 t7 s+ U+ M. P9 Z# T2 o
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: x7 V, O" S; `5 h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ! w# k3 V+ t+ H) Y/ K# c& a) o
  11. *         TO CHANGE.
    ' l, {7 x9 F9 N* W
  12. *
      V  X1 O( C( B" l! h1 m+ l  M
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/5 |+ {- Z7 D/ {0 F) X
  14. *
    9 `& [0 M; P4 d4 r, _* Z2 Q" X8 x
  15. * This program is free software; you can redistribute it and/or
    ; ?3 u5 @6 A5 M/ k! M) L7 Y
  16. * modify it under the terms of the GNU General Public License as
    & @* }8 ^$ @; V1 w
  17. * published by the Free Software Foundation version 2.
    ) h1 r) m: p' A1 s* Q* R  S+ ^
  18. ** _/ Y2 M) g, Y/ ~9 v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ! o7 y2 d$ v1 o3 ?
  20. * kind, whether express or implied; without even the implied warranty
    , ~6 c% D5 ?1 M2 b: b
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 U' m  D+ o( h3 P  z8 v8 x+ ]: C- @
  22. * GNU General Public License for more details.
    , E& b# y; g+ p' Y1 O8 S4 G, ]) r
  23. */1 Y5 f# j. Q' H- e2 M8 Z. p

  24. # B$ _  n, @9 \. z5 B- H: A/ J  y
  25. #include <linux/module.h>/ C! @: ]$ E* O5 W( y2 M/ r5 o. Z6 G
  26. #include <linux/init.h>5 \/ l1 K7 u. o7 b2 T& n* N/ e3 k0 A' S
  27. #include <linux/errno.h>5 o3 L9 ]3 C6 ?. X- _: a( h
  28. #include <linux/types.h>
    % u& G- O( b8 p: l$ V* {
  29. #include <linux/interrupt.h>
    9 v0 f) h4 Y" G+ p$ R( E" ~
  30. #include <asm/io.h>+ \8 R& p$ u$ B
  31. #include <linux/moduleparam.h>! _2 H2 o" _6 U
  32. #include <linux/sysctl.h>* _" k, F' H' m$ g. N
  33. #include <linux/mm.h>- D: O* r( x- A$ |9 i* `
  34. #include <linux/dma-mapping.h>
    8 Q, ]; F1 E- g
  35. . k4 s& g! u" b& e: A4 k
  36. #include <mach/memory.h>
    / g: K8 |- b8 |0 e2 S/ O& s% w8 E
  37. #include <mach/hardware.h>
    - a. s; f( R2 i1 r, \3 K0 X
  38. #include <mach/irqs.h>
    * Y3 T8 L, W# E/ f% }
  39. #include <asm/hardware/edma.h>
    1 Q; r9 k. w0 w5 z
  40. ! ?9 h; h; W  x6 ~9 i" z9 P% W
  41. #undef EDMA3_DEBUG# i6 m" R. s- F; U! m5 C7 A2 s0 ]
  42. /*#define EDMA3_DEBUG*/0 Y6 ^6 [+ }1 ?, S4 r' A" r* w
  43. $ C% ^; a4 l# H
  44. #ifdef EDMA3_DEBUG
    ! l+ F% l  e1 Y2 I$ W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # q& t7 X+ N4 v- o4 Z* Z( }. ?6 F! ^
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)" {0 h9 Y( y+ Q' v5 d1 A  \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 y. w" R( y6 E
  48. #else* e1 C1 `$ o2 z* P! H" n: Q/ G! b( t& p4 ]
  49. #define DMA_PRINTK( x... )
    ; u5 ^" l) ?/ u* ?1 _* r- y; H
  50. #define DMA_FN_IN+ k! G2 q  \6 s9 g6 q
  51. #define DMA_FN_OUT* B. `. @! I3 I1 v
  52. #endif
    ' p; E# b( S3 H, D  j

  53. 8 q; v$ l  e- F/ V6 u
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; e9 O3 c% ^; A
  55. #define STATIC_SHIFT                32 E. l5 j! d2 \  L4 X" I
  56. #define TCINTEN_SHIFT               20  F! V: w: h( m  D& s
  57. #define ITCINTEN_SHIFT              21
    0 I  G5 ?) G4 Q
  58. #define TCCHEN_SHIFT                225 k- _, g4 k* P
  59. #define ITCCHEN_SHIFT               23
    " _% K0 m  c+ u+ c) k7 q
  60. # T9 Y9 }' m7 m5 x  s3 `
  61. static volatile int irqraised1 = 0;, t! ]1 ^* q7 z; k
  62. static volatile int irqraised2 = 0;
    ) b3 t+ Q, k0 ~4 s! ~# L8 ]
  63. * W3 R  X; B: K& ?! D, {" l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: t+ T( i& H( Z+ J7 x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 b/ Q, E8 h3 u/ Y, x+ E  Q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 b( g6 I- f/ p* h9 T0 [4 `  _& f" s

  67. / Y: _1 S; W! c7 R. z3 Y2 j
  68. dma_addr_t dmaphyssrc1 = 0;
    + G7 }. @& b! Z
  69. dma_addr_t dmaphyssrc2 = 0;
    : E2 O  Q& g: ]6 p3 a4 C7 v( P
  70. dma_addr_t dmaphysdest1 = 0;- Y6 x/ Y8 {9 O
  71. dma_addr_t dmaphysdest2 = 0;
      P1 ?! V8 L% }8 h& G: E1 T; \
  72. & N( ?4 I/ m7 w9 ^8 e6 W
  73. char *dmabufsrc1 = NULL;3 A2 X( V! S: B1 f
  74. char *dmabufsrc2 = NULL;
      m* ?$ p& J& E0 g0 _" D3 w: @
  75. char *dmabufdest1 = NULL;3 I( _. G6 C0 ~9 y- n
  76. char *dmabufdest2 = NULL;
    . g1 d/ U- h: L/ t0 [7 Y; O! L0 B( _

  77. 2 y+ p4 {% ^( d4 ?0 N9 a
  78. static int acnt = 512;, n: M( a- N3 x. O+ r5 c
  79. static int bcnt = 8;
    " G1 h1 o+ T7 r; p+ i9 ~8 G6 y
  80. static int ccnt = 8;
    4 i  C! |4 y% B" S( ?# ^
  81. ; c' Z4 w( s7 p- H, N0 B
  82. module_param(acnt, int, S_IRUGO);
    " r4 C8 ]% }, |# ]
  83. module_param(bcnt, int, S_IRUGO);8 y; z# h$ W5 G) U& o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, S% O1 b' E7 }; h
* N: x. I" n+ [- c/ G2 J      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 Z5 o5 C5 O8 v2 [! \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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
* D/ S$ I! ?2 m7 Q, L& @' ^     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* |( {/ K# f8 M% W, P9 }: e

: M5 F/ R$ p2 Q
/ X4 H5 J6 J7 I7 C/ S- ^& i/ F9 F* r
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-28 18:35 , Processed in 0.046295 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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