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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
7 d& X( P  d" K; C5 d. s
  1. [code]EDMA sample test application
    ( V! Y  \0 T  u+ F
  2. /*
    2 Y* g. l9 B. Z. H  F3 Z, w
  3. * edma_test.c+ l( H1 K* J' p3 j; L
  4. *
    ' K/ T. h: U& B5 c7 W
  5. * brief  EDMA3 Test Application
    , w" C" Q" R* o$ f7 [6 H# i8 z
  6. *- W  B- V: g& e0 V
  7. *   This file contains EDMA3 Test code.; [- t9 N* X3 o0 D) v' m5 }1 J
  8. *
    , m8 J  ^6 G  N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ L: s7 z8 ?' K& z; E# C& I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: _: L. e: G% k7 Q4 d& i
  11. *         TO CHANGE.
    + i2 G; O, ~4 u
  12. *
    9 A0 L& z4 D+ U8 A3 Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' h) D6 v8 `+ L% O0 h
  14. *4 x' [# R* B2 D. n, t# \
  15. * This program is free software; you can redistribute it and/or
    + b8 j. @* W; W& J6 J* y/ b
  16. * modify it under the terms of the GNU General Public License as: l% G+ Y; a3 J- j
  17. * published by the Free Software Foundation version 2.
    4 r5 j' f+ U0 ]( k
  18. ** F/ U" D; f' }2 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any3 o, j- H2 h! i/ C$ a
  20. * kind, whether express or implied; without even the implied warranty
    * Q8 x& D; p1 Y7 a2 b& V5 `& l/ B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / r- l0 g" c% }+ f: w+ ^
  22. * GNU General Public License for more details.0 |" ?( n% ^9 V
  23. */9 F/ ], f; Z# K$ o7 J
  24. ; P5 X3 b" s, ?4 a% L
  25. #include <linux/module.h>) d, d- I& Z# j- Z+ W7 w8 @
  26. #include <linux/init.h>* i6 [2 G8 ~+ }
  27. #include <linux/errno.h>
    : J  x3 V6 [$ W1 u6 `" T
  28. #include <linux/types.h>
    3 h6 W. w0 [/ y6 X# f
  29. #include <linux/interrupt.h>: o$ S' t! @  N( d) Y
  30. #include <asm/io.h>. l* D* C7 u; r
  31. #include <linux/moduleparam.h>
    - b$ b2 V( v# A" ?2 M* f; M7 b7 F4 ~  T
  32. #include <linux/sysctl.h>
    9 a4 S6 V0 r/ U
  33. #include <linux/mm.h>
    5 f3 q( ^) `! x; {8 R+ p; w
  34. #include <linux/dma-mapping.h>' n2 p; D6 y) H2 z: Q8 R* R
  35. 7 b; _, G  J: k6 W/ x
  36. #include <mach/memory.h>
    ) f0 D: Y1 G* f1 Z
  37. #include <mach/hardware.h>
    , Z+ [; Y- a$ b. V2 ]5 j' R1 V
  38. #include <mach/irqs.h>+ w2 i7 t+ i& h9 p# F7 C0 j2 f
  39. #include <asm/hardware/edma.h>
    ) [, |3 J  p2 Z- t' }- }4 h

  40. : |1 [& D' a' F
  41. #undef EDMA3_DEBUG/ w. p; o; m2 j
  42. /*#define EDMA3_DEBUG*/
    # s% Y8 H" l4 `7 ?# D( y, X) J

  43. 2 w4 x8 F% v: E7 y& A! L+ K2 B- ]) N4 p
  44. #ifdef EDMA3_DEBUG0 k- ?) @3 c+ r$ q
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    4 [; r" u. b* C: I3 Q: w6 R$ m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 Z# s& D1 a3 c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 r/ s8 w( o8 h9 P$ C( d% u2 X
  48. #else
    * w: {( h! ~, k$ P
  49. #define DMA_PRINTK( x... )" F. }) i" S  f  i1 O
  50. #define DMA_FN_IN4 ?& o% L& b7 O. n% X* J
  51. #define DMA_FN_OUT5 A& \0 D# R% Y1 d
  52. #endif4 s( e( P8 j- `

  53. - X, @2 q6 }+ b$ K5 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); j6 b1 ~) R- ]4 N% S0 c2 N
  55. #define STATIC_SHIFT                3
    0 [8 E3 [" p3 \* E
  56. #define TCINTEN_SHIFT               20
    * f- w% I1 A7 y) O! Y
  57. #define ITCINTEN_SHIFT              21: L/ K0 `0 o" w# ^) ?+ G
  58. #define TCCHEN_SHIFT                22
      g* ]; ^2 a$ U7 t5 y
  59. #define ITCCHEN_SHIFT               23
    " I' ]1 A( b$ n$ Q

  60. 2 ?1 G7 F( d( @$ t5 J0 H( G) w
  61. static volatile int irqraised1 = 0;! G: P2 s/ j- g; k
  62. static volatile int irqraised2 = 0;& R" r6 p5 ]. Z' \2 Z/ C& @
  63. 9 L- [+ s0 u6 Z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 M" ~0 E: u7 V  g) m& W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' g" Z' F, G; L1 P# C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 F5 {/ `: g. e
  67. ; K% j# _: k" F7 _$ S  E$ o
  68. dma_addr_t dmaphyssrc1 = 0;
      N- |+ u) C! f4 H7 L, }) X& z3 v
  69. dma_addr_t dmaphyssrc2 = 0;
    : h( F' D8 Q8 ]9 A. ?6 @+ n
  70. dma_addr_t dmaphysdest1 = 0;4 n8 O( K7 L; Q2 u# G, ]$ _
  71. dma_addr_t dmaphysdest2 = 0;- E& h: [" I  {: y! R7 b/ H( E

  72. 6 g8 [- S1 i! A4 e0 D2 s
  73. char *dmabufsrc1 = NULL;2 f4 F/ i# f2 g. ^( s
  74. char *dmabufsrc2 = NULL;
    2 t0 k& G3 |4 M
  75. char *dmabufdest1 = NULL;
    2 G% h; ^) t" t& M  j. V) e+ k
  76. char *dmabufdest2 = NULL;
    , }- _4 J# O  v0 l
  77. 4 y6 C5 I/ `5 j  x
  78. static int acnt = 512;
    6 c0 Y/ H' s1 ~/ k- ?& f2 c
  79. static int bcnt = 8;
    6 g" n4 e# S* E7 o7 D! f
  80. static int ccnt = 8;% e2 a; R, W% D& ~5 G1 E9 \* n
  81. / a) V" s# Q* ^$ G5 M
  82. module_param(acnt, int, S_IRUGO);
    : k) O" L& G6 L4 }% h# j5 |
  83. module_param(bcnt, int, S_IRUGO);* e. y3 M( a1 q3 z8 w" t, \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; B2 p$ h( B, o+ F3 f) L6 V  P: G1 ?7 ?1 D6 _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, E( W; W: _0 g/ z0 ]( t
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 G9 C5 e) L. Z- V# |  C3 s7 f% A/ V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。- X8 U/ D; e" O! M$ ]- [

& T( W9 f: D# {: n" W# D* z
% J: @  v* K( X- ]6 `4 z1 f0 m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-18 23:31 , Processed in 0.038000 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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