OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " @4 b$ @8 m/ v
  1. [code]EDMA sample test application
    : q2 y9 a3 i' G1 |
  2. /*
    ! M/ Q# D! D- s4 a, ]
  3. * edma_test.c% |8 a3 h3 q% d0 t
  4. *
    2 Q9 D- j* k; s
  5. * brief  EDMA3 Test Application
    6 j! A: Q) n# S
  6. *; d+ d( u# {4 ~2 A
  7. *   This file contains EDMA3 Test code.
    ( T: x7 Z! U1 l
  8. *
    ) j2 r% O3 `3 z  J
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) R3 U' u2 {( W1 P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    : {$ J  [) D$ c) o9 @. o
  11. *         TO CHANGE.4 n' W( \: T1 {' u$ u) ~4 k
  12. *. r! r& V6 K7 f4 _( O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % i& }1 T3 i# l+ u
  14. *- a& z. S7 J; N7 x9 n
  15. * This program is free software; you can redistribute it and/or! M, H4 A: p! O+ h* R. \9 C) v
  16. * modify it under the terms of the GNU General Public License as( Y& q$ f8 H. ?2 \, h1 R# ]/ T
  17. * published by the Free Software Foundation version 2.6 A* X/ U" j2 p7 a6 O
  18. *! e$ Z/ o  J; |' |9 \9 k1 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any% ~% c) G' s) H1 l! @! `8 U6 w
  20. * kind, whether express or implied; without even the implied warranty: u- Z+ H. F3 h+ U! V- N! ^- @; v
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 ~% i. c$ e& R* m& Z+ l& k
  22. * GNU General Public License for more details.
    $ a9 ^+ {7 b+ d/ a. r  j
  23. */$ p/ l0 W/ V* e1 R# P- [$ B; ~
  24. ' @, @, }' g7 |% J$ X8 S
  25. #include <linux/module.h>8 H! q- V  b$ \
  26. #include <linux/init.h>8 W' G9 g. X& E6 F% w1 P4 t
  27. #include <linux/errno.h>
    0 \/ K) @- w! F5 ]) }" b) P
  28. #include <linux/types.h># Z9 D/ H3 f8 Y8 P" c, J2 e
  29. #include <linux/interrupt.h>, z8 r# @& m. q& B
  30. #include <asm/io.h>
    # D9 l+ M- S0 h& e  w% s0 f1 v$ n
  31. #include <linux/moduleparam.h>
    3 Y& W% W" W" o& {, I: Y5 M
  32. #include <linux/sysctl.h>& @' K1 k7 `. u. V0 ~( Y
  33. #include <linux/mm.h>
    + ?  y- a9 |& M
  34. #include <linux/dma-mapping.h>
    ( i2 s( x: C$ z
  35. $ T, s8 |2 F2 j1 p
  36. #include <mach/memory.h>
    - a8 f. ^4 y. e- g- w4 ]6 P6 F6 X
  37. #include <mach/hardware.h>
    & P4 A6 |! e: H) k
  38. #include <mach/irqs.h>
    1 c1 x% A( p1 L
  39. #include <asm/hardware/edma.h>
    3 H$ S* t# p( e3 J) l1 [, u

  40. % f3 ^; Q# A1 y( y, m8 m
  41. #undef EDMA3_DEBUG$ L) k4 d' s5 I7 ~- a( n4 r" p
  42. /*#define EDMA3_DEBUG*/& @. f* G7 g7 }' A  H8 y
  43. . d3 R3 h$ ]/ F3 D- |
  44. #ifdef EDMA3_DEBUG9 n# W) q, q) k, ]$ E$ o. a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) y0 h/ g5 n2 S+ R: V* I6 L* z$ y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): K' m$ Y. B* w7 h* U$ ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): X  a: u" W! N' P3 L. d4 y& U, g, Q1 c1 z
  48. #else
    4 y7 |+ Y1 F4 [+ L4 [* D
  49. #define DMA_PRINTK( x... ): a9 p7 ]" i( \: z6 j
  50. #define DMA_FN_IN
    & P( z0 Q& @* o' \. |
  51. #define DMA_FN_OUT
    $ F4 b9 J6 s! E) [$ \- K
  52. #endif2 q# w4 u2 G4 [

  53. % g4 n. O: e! t$ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : E( i  i& }" a: B- _" e0 Y! C
  55. #define STATIC_SHIFT                3+ m! s8 u7 N# s+ n) F
  56. #define TCINTEN_SHIFT               20
    ( F1 c' i1 u5 \# F7 M! [2 h( T
  57. #define ITCINTEN_SHIFT              21
    % m' S+ f+ y3 o1 J
  58. #define TCCHEN_SHIFT                22
    6 k- j0 d: g8 X# w' l" F
  59. #define ITCCHEN_SHIFT               23
    * @6 d8 ^# c& |9 _! Y
  60. & T* [9 i! X6 E7 o% G* E+ o5 Q
  61. static volatile int irqraised1 = 0;1 G/ r9 f* N$ T& h  Q( e/ R$ l
  62. static volatile int irqraised2 = 0;- p, e& F- W) K3 K- S. q

  63. * M6 M  [! s6 N; z, J4 b. R9 H
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - e% |, R1 [( v
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % u" m- g0 r4 A& L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) k  S& A4 }: a& a6 t) J  m. r
  67. # y' Q5 X3 o3 i1 ]4 B' u# p2 h: b
  68. dma_addr_t dmaphyssrc1 = 0;8 _8 M/ y! _: C8 Q) k  e) _
  69. dma_addr_t dmaphyssrc2 = 0;
    8 H5 e4 ~- s+ z- k3 u
  70. dma_addr_t dmaphysdest1 = 0;
    9 u8 Y6 Q* E) g
  71. dma_addr_t dmaphysdest2 = 0;( Z4 z' |& [& u9 H
  72. . I5 V8 |" ~8 c# D, N( T8 a
  73. char *dmabufsrc1 = NULL;% ]9 j; R) s/ L$ C9 Z
  74. char *dmabufsrc2 = NULL;
    0 l, `& ~, c4 Z6 r) x! D$ X
  75. char *dmabufdest1 = NULL;0 f3 S1 u+ \- O. l6 S  ?
  76. char *dmabufdest2 = NULL;# m7 J6 m+ B/ L2 x+ C, P
  77. ) z3 r! e# |+ w
  78. static int acnt = 512;' p* V& E6 C( X  F/ _
  79. static int bcnt = 8;! G) n4 {" o& |  d( L1 X
  80. static int ccnt = 8;
    " e3 G% y8 ^; x: o
  81. ; U2 W; K; m. ^$ u
  82. module_param(acnt, int, S_IRUGO);  P8 X2 w2 B6 `  G0 i/ ?
  83. module_param(bcnt, int, S_IRUGO);+ k* @. e9 D7 t3 u
  84. module_param(ccnt, int, S_IRUGO);
复制代码

  q2 a/ P5 |3 d# i2 C2 n4 g; a! e) j; {7 E; I8 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 j3 E) q$ A. W; v( ~) F7 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- r$ C' r- Q/ u' q/ |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! Y' l; ]9 {% q9 F( ?9 B8 b5 @
$ A0 M$ Q' v. L$ @. G3 {) g) k6 F& V; {) G& [% S; E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 20:30 , Processed in 0.035867 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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