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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
" `; v8 @) A' c
  1. [code]EDMA sample test application2 c+ P4 d0 d. R* j, l* J- Y$ p
  2. /*$ R" u# d6 f. C# a, u5 h. s, [
  3. * edma_test.c
    , N- J: R  h% h! ]* |* b: m8 n
  4. *
    8 g! _9 s3 B  d+ S
  5. * brief  EDMA3 Test Application
    0 [. y9 o% L% L
  6. *" R- K6 G4 L5 `2 E5 o
  7. *   This file contains EDMA3 Test code.# o! p/ U7 {  t2 C4 x
  8. *7 U1 `( w. {6 P8 v% ~2 R4 d
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE0 c5 n, {- {- J5 B
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 s7 K: D) J  _1 o# S+ m! v3 T$ ~
  11. *         TO CHANGE.
    + q* }6 m, L+ b+ |) O" m
  12. *9 W3 @$ l6 o( H, l& W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 \' C! G) U5 b/ D1 {6 f
  14. *
    ( w5 U& ^  z" I* f+ l7 L
  15. * This program is free software; you can redistribute it and/or
    $ z8 n7 i( r* J( N( o
  16. * modify it under the terms of the GNU General Public License as* X5 f) U6 _! J* T$ E$ W8 [% m8 }
  17. * published by the Free Software Foundation version 2.
    ! r* g) i" P: ?9 x  u; M
  18. *, J! E+ P& _; I$ V5 k5 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any# ]* Y  o. j2 |8 F) U9 c1 u+ i: j+ ~0 E& T
  20. * kind, whether express or implied; without even the implied warranty" v  P1 Z% ~' W( d9 s' [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ y: p* d/ B% _( D6 g
  22. * GNU General Public License for more details.2 I3 G4 F: \7 B0 K* m' c# U
  23. */+ j- r) m! V3 w+ w- M- Z

  24. 7 G" {: ^$ G, J
  25. #include <linux/module.h>
    & W& \! L1 _4 E/ q& G$ m1 f! M+ A
  26. #include <linux/init.h>
    " @, ?" `* a2 j9 u
  27. #include <linux/errno.h>
    & d$ x$ j  l6 D! _/ G0 `
  28. #include <linux/types.h>
    7 I/ Z% r% d' V& Z. k
  29. #include <linux/interrupt.h>  x/ s) G9 T0 @/ x
  30. #include <asm/io.h>
    6 U+ y8 e1 o  n, y8 Y: g. h
  31. #include <linux/moduleparam.h>
    ( u( K( c/ q/ b+ P  J; ]4 x! U
  32. #include <linux/sysctl.h>
    8 ^6 z- x0 _, s& Z( s
  33. #include <linux/mm.h>; D, n5 S. q7 d0 b0 u. X
  34. #include <linux/dma-mapping.h>5 q, {. m: K$ ]  r. X! a  H

  35. 8 \+ ], k" F# ~' e* R
  36. #include <mach/memory.h>. |9 L# b6 N) {- S4 @$ [1 j
  37. #include <mach/hardware.h>
    " f( T% P/ _, f# X2 ~  }
  38. #include <mach/irqs.h>4 P& a# ?1 |0 W/ Y6 p8 q
  39. #include <asm/hardware/edma.h>
    + O/ }4 M# o6 F: T
  40. ! C( m# N. Z  m2 v
  41. #undef EDMA3_DEBUG
    " n/ j5 M4 c: e( E
  42. /*#define EDMA3_DEBUG*/7 b- f: U2 L) [, Z! ~
  43. 9 y8 j' {7 Z+ m' i1 Z+ M
  44. #ifdef EDMA3_DEBUG
    1 ^9 m5 G2 `8 k2 J' X6 b& }$ {  X
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): j! U8 D7 j2 k/ w2 E$ _9 D+ B& C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    8 t$ E/ U6 H0 i" q6 ?( `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    % W( A: D) I$ F; H% o
  48. #else
    ( C2 J/ c" t2 O/ {* L, f
  49. #define DMA_PRINTK( x... )! \8 X; y8 f" O* _3 h
  50. #define DMA_FN_IN. j; a6 T" B6 ]$ e
  51. #define DMA_FN_OUT/ x1 f' I9 x4 Y- P
  52. #endif
    # A0 e, I' _, N6 s

  53. ( z* r* O0 `7 z5 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)' k! \# O) [8 ], |- D6 }  F
  55. #define STATIC_SHIFT                30 X7 t: f  V+ @& A
  56. #define TCINTEN_SHIFT               20
    8 M) q) }9 h2 Q6 M& i9 w+ x4 I+ y
  57. #define ITCINTEN_SHIFT              21
    / P7 ]/ B% |7 J) k) k
  58. #define TCCHEN_SHIFT                222 P, e. q6 J2 [+ c+ E& V. F# U
  59. #define ITCCHEN_SHIFT               237 Y) z# O/ b1 c

  60. 0 R* V" L8 f" x6 z3 k
  61. static volatile int irqraised1 = 0;
    + u2 d) z+ R* k2 N
  62. static volatile int irqraised2 = 0;2 w5 ?  F1 v! \* i

  63. - @* X6 C" z* D$ _) z
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ B& T8 k- F1 c: p% ~, @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - u8 e: [( P$ f8 o# o; G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ) I3 `( c2 H3 Z; G: b' `+ i

  67. + Q; I7 f+ ^4 v$ I$ C( h0 f
  68. dma_addr_t dmaphyssrc1 = 0;) D! A/ a( S! F. L8 M# o
  69. dma_addr_t dmaphyssrc2 = 0;7 @' O* |8 p: ]# W0 E0 X
  70. dma_addr_t dmaphysdest1 = 0;8 M' k* E+ k* j2 z) W/ {, D
  71. dma_addr_t dmaphysdest2 = 0;" M6 x& N$ b9 g

  72. - L5 r. v. r1 x  ^8 N* L2 D+ |  i; j
  73. char *dmabufsrc1 = NULL;
    3 L7 q* T% s( f, Y9 C9 Q: }
  74. char *dmabufsrc2 = NULL;
    6 T% h3 K: u  t
  75. char *dmabufdest1 = NULL;
      w) w$ V$ g. \# x; T; o  q1 I% x: `
  76. char *dmabufdest2 = NULL;) b7 Y( a) d; c9 s# |. Q

  77. 8 P% a8 v  [- @6 B" L0 v5 H; z6 }. b
  78. static int acnt = 512;+ ~) y- V. ^( s* D+ W5 B. z# n- O
  79. static int bcnt = 8;
    , m  v: X0 j: ^( H" z
  80. static int ccnt = 8;; `8 |( y6 W# \& m8 \

  81. / s4 K- b, u. U1 R8 ^$ P
  82. module_param(acnt, int, S_IRUGO);
    7 S# x2 Z% a& I8 j3 a' J3 L+ K8 y
  83. module_param(bcnt, int, S_IRUGO);
    7 j* e. p3 A: k
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) x7 Q4 `) e& t/ \

4 t. A5 c! g  K: o- A$ Z5 f      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! y4 T# j' V# d* Y( Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。6 z& k5 M5 K( T2 u/ l8 b
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: B+ y$ v+ I+ q# R- R
) R- ^; G% Z+ u! O/ i$ Y8 H; E/ j) u% l0 W  z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-28 08:32 , Processed in 0.038874 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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