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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 $ h9 S  ?# ]/ R) h
  1. [code]EDMA sample test application0 }/ g+ p& [! F0 M& S" h# Z. I
  2. /*
    0 V- t' p# a$ d! |2 L1 ?% S( P
  3. * edma_test.c8 K+ g! e1 b8 p
  4. *) r  x; E9 F3 z; V5 R1 s0 ^; z5 I- E& n) j
  5. * brief  EDMA3 Test Application  y9 y: O: D8 s( d$ ~
  6. *9 B3 q+ q# D4 J+ k) K2 z
  7. *   This file contains EDMA3 Test code.
    # E# A/ D  h7 O* ^+ ^( u
  8. *# _$ c. {5 a* X- Q9 S/ Q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE' F- h$ a3 I- e+ B( y7 z% M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    % l; I# G& B# y) f
  11. *         TO CHANGE.
    ; X2 [1 k. _) p* Y' j8 D* ^! P  i8 s
  12. *
    $ q# p" {7 p% x6 t- D$ B/ n, r5 c
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- P& ]5 @( |6 v" m  U8 }. @
  14. *
    " y5 }% n( g# v1 a) E" Y9 k, h
  15. * This program is free software; you can redistribute it and/or4 ~1 [3 X* f- N3 J3 O% L7 {
  16. * modify it under the terms of the GNU General Public License as
    7 j: Q! z9 o$ N% y
  17. * published by the Free Software Foundation version 2.5 l) J( Z. ]' I2 X
  18. *" b0 u. C$ G1 j# f, R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    2 `' I* Y" R  a6 G
  20. * kind, whether express or implied; without even the implied warranty
    & K# |+ I  o+ D4 N7 D6 B% K6 ?5 w
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ! r9 U; A! g5 |; S2 Y, O3 ]# }
  22. * GNU General Public License for more details.
    1 _! H+ ]8 t) C% Y
  23. */- ]4 l9 z) h9 N4 F' e

  24. 8 E8 P1 i# I  L- {; s! ]
  25. #include <linux/module.h>' k7 C, J4 R) W
  26. #include <linux/init.h>
    * k; ^/ u! a" Q0 ~
  27. #include <linux/errno.h>, e6 ]8 g; k, s9 N
  28. #include <linux/types.h>
    : l7 y/ t1 @7 v/ h9 D7 |/ o
  29. #include <linux/interrupt.h>9 `3 [& v3 T9 \0 f) |
  30. #include <asm/io.h>
    . k  F% e0 A- z9 B
  31. #include <linux/moduleparam.h>
    ' |: R8 n1 O1 \  E
  32. #include <linux/sysctl.h>
    7 K7 y' `  E) ?& |0 h0 C
  33. #include <linux/mm.h>* J% V& X" s4 `' ^% |
  34. #include <linux/dma-mapping.h>. ]3 b, D3 s$ n/ N

  35. 6 W) e( F( M! X: k! a9 W
  36. #include <mach/memory.h>( z) Y0 r0 F& w1 {8 ?2 [0 A+ C
  37. #include <mach/hardware.h>, ]( {5 w( t4 A* ]1 U: `( P/ r
  38. #include <mach/irqs.h>
    & f( O8 j. C5 Q" `% E
  39. #include <asm/hardware/edma.h>
    % {# m  o" g7 A# L" w* `
  40. 7 B- o3 z3 ^0 [& x& K
  41. #undef EDMA3_DEBUG
    * S; {- j3 G! i" [' R9 [% ^8 O
  42. /*#define EDMA3_DEBUG*/' M$ Q+ B* j3 r/ w/ V! T( q; Q8 L
  43. 5 m0 E- Z& \+ Q: E% ?  I
  44. #ifdef EDMA3_DEBUG
    * q: j, r* M3 w3 d8 g  T2 {$ k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . H4 G. h. `/ _2 t5 @* d
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! @' t1 @/ c$ W' t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* ]2 j6 X3 G, S4 Q8 N* V
  48. #else: p0 V/ _) H( {4 |, r, ~
  49. #define DMA_PRINTK( x... )
    5 T+ x/ Y! U0 p) Z" ?# o4 [* o
  50. #define DMA_FN_IN  ~# N7 S6 n  @9 ~, G% M& I1 Z: b# X
  51. #define DMA_FN_OUT
    ) V% |0 p: n+ p$ e: R$ h7 \
  52. #endif3 d, w3 A' R" ~6 d" L5 @5 u& Z" {

  53. & x+ {% ?2 L, V3 r! g
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)7 }4 P7 G( |% u2 g7 [! ?
  55. #define STATIC_SHIFT                3
    ) V6 s. S- X% |% Z3 m
  56. #define TCINTEN_SHIFT               207 Y1 n9 ?7 T/ A; \5 r& U5 X  W* J: C
  57. #define ITCINTEN_SHIFT              21
    * r- i; M4 p1 |3 d) n' n& K! ?
  58. #define TCCHEN_SHIFT                22- s7 C  u( H$ h5 O
  59. #define ITCCHEN_SHIFT               23, E/ ?( M' |$ V& L; b

  60. ; N* m) J# T+ y& s/ w
  61. static volatile int irqraised1 = 0;
    ; r, S9 M2 p& U$ i4 U: {. O( K
  62. static volatile int irqraised2 = 0;6 |7 U$ @* C! ^9 b
  63. / H; i. w7 I9 c6 X$ s
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ N" F: Z4 @: z4 B  O' w% D% O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 r$ E8 ?( y! T) j  ?$ ]4 H2 C
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % t+ f. b# v7 G
  67. 1 N9 C& l/ [% m! H, p
  68. dma_addr_t dmaphyssrc1 = 0;
    + i9 c8 f) A2 X! ~
  69. dma_addr_t dmaphyssrc2 = 0;: V- l0 s2 }! s9 m/ v. @
  70. dma_addr_t dmaphysdest1 = 0;% c, y2 Q/ @* V# T7 O
  71. dma_addr_t dmaphysdest2 = 0;
    ; U$ ^7 D9 i) R+ T9 x

  72.   ]  F' G: @9 p: G
  73. char *dmabufsrc1 = NULL;! A5 o' X) L" P- r- e- K
  74. char *dmabufsrc2 = NULL;, u: ]5 a! \9 d- p  R0 q  v6 b' P
  75. char *dmabufdest1 = NULL;' j% }$ L1 u) h- t. k% S* {
  76. char *dmabufdest2 = NULL;
    ) d' t% B0 h: f: |+ P
  77. / i. \, u$ V* U4 n6 l. k
  78. static int acnt = 512;
    2 k  L2 r; k% F' j( P9 C1 A+ K6 l- ]
  79. static int bcnt = 8;1 I5 s% I* H$ ^; |
  80. static int ccnt = 8;
      K/ i' K+ `$ x( j
  81. - d( f+ P* j' G, I- ^  w( P$ z4 S
  82. module_param(acnt, int, S_IRUGO);, v* e: R' U% d2 t' V. }
  83. module_param(bcnt, int, S_IRUGO);
    , Q3 \# d+ i/ ?. a8 J, e
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 q" E0 B, T% }. T& r1 m: f

7 b4 E1 {, P$ c4 P6 q      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
2 O& P: h; j' x! i9 carm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
: |, F. {% j0 ~5 V& d, i     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ s* J* X$ P* d4 w
, G4 w, v' c: v6 j

6 j+ B) E  [+ `- A
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-12 11:57 , Processed in 0.039794 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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