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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 0 |1 m4 t' ^! @2 m) [( s1 v
  1. [code]EDMA sample test application1 U/ c3 p8 [; l8 [6 O
  2. /*
    # \& c2 d& m2 m  P$ d' I
  3. * edma_test.c/ H- a6 q. T  I' Y3 L& t
  4. *
    " a  N6 @9 {& z, ~
  5. * brief  EDMA3 Test Application$ s; i) l% g' K5 X+ }8 ~
  6. *) r# \) ]) K; _* a$ }- f
  7. *   This file contains EDMA3 Test code.0 |5 e, f; F3 ]( G* \  }
  8. *7 \9 N1 ~5 W' n
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE% y0 o/ x! ^: \. i" |
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 @0 F/ Q0 X% y. Z" }: U# t
  11. *         TO CHANGE.
    $ L4 _+ e  E; q7 D: T2 r& B
  12. *2 I/ \: N! {2 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, e5 q. X6 i$ Z, o) N7 Y, {
  14. *9 t. `) X1 T5 [1 h* W
  15. * This program is free software; you can redistribute it and/or7 T( y: O3 e  {/ l: b6 ]
  16. * modify it under the terms of the GNU General Public License as
    ) g, C  |, m7 S
  17. * published by the Free Software Foundation version 2.
    & O2 z, z: s9 C/ @" I# U6 X4 F* Q
  18. *  h# F& S+ P! e$ u/ u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ v# x! J9 m$ \3 N
  20. * kind, whether express or implied; without even the implied warranty
    6 P! |. o& S3 O6 |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, A6 P4 P1 |- w' k" w2 U1 p
  22. * GNU General Public License for more details.: |0 C' |0 K/ N+ Y  W
  23. */6 _, C% v; H3 H5 h' Q5 N) t

  24. ! U' y, [3 j, ^& g3 }
  25. #include <linux/module.h>5 }/ G1 u: V' L6 X, b( x
  26. #include <linux/init.h>
    9 z* ?" P# \: s' T( {- Y, @
  27. #include <linux/errno.h>
    7 R, P6 I8 {6 ?* |' \% x2 a, E& h
  28. #include <linux/types.h>& X% s1 N. G: R3 J0 D6 A: ^* n
  29. #include <linux/interrupt.h>* C( s, j  x2 j! D
  30. #include <asm/io.h>
    6 }- Y% I. {5 n( G# e% W7 h9 E7 `
  31. #include <linux/moduleparam.h>
    ! m/ O5 }0 J# H7 q
  32. #include <linux/sysctl.h>
    # I) |: q- ~0 k( k
  33. #include <linux/mm.h>0 F! Z8 }/ D9 f+ O
  34. #include <linux/dma-mapping.h>- {1 o1 @( V. o0 c2 Z) c5 r( y

  35. - u2 d7 z/ t7 L$ ?$ {  _. U, P
  36. #include <mach/memory.h>
    1 Y! W7 F6 A0 X& [+ M
  37. #include <mach/hardware.h>
    3 L0 r$ A$ l! @$ ]3 P4 b7 H
  38. #include <mach/irqs.h>5 ?$ E( R/ ^7 a; ^
  39. #include <asm/hardware/edma.h>0 S$ s5 I0 N$ r  C) @/ h/ {
  40. 9 k/ ~. F' h% B/ f4 x" q( \4 e; q
  41. #undef EDMA3_DEBUG
    $ q" G# k, N1 D! T5 T, B' U# L
  42. /*#define EDMA3_DEBUG*/* v, }/ o0 B) @2 N# F' H
  43. 2 x# M$ {6 J! D6 _) }: m
  44. #ifdef EDMA3_DEBUG
    . C5 R& e  @  I# P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)% I2 {( j  o8 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)+ s8 h$ F; |% f% I; `
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + x) B  O9 A  L$ ]: w2 ]# J
  48. #else
    , C1 b8 U, j+ U7 U, e
  49. #define DMA_PRINTK( x... )7 T8 ?' C' a0 X. C) X  m
  50. #define DMA_FN_IN: ?1 a2 g% M3 q* e; U0 _7 d
  51. #define DMA_FN_OUT
      \8 H7 `6 _0 _: z: U
  52. #endif
    ) W: d- b. c% s( [; F6 g- ^

  53. 2 _  j" S9 E1 ?/ P0 j3 i
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 J3 s5 R6 R7 v& e' o: p
  55. #define STATIC_SHIFT                32 N; V6 u) \% m3 {2 n; N) j$ N$ W
  56. #define TCINTEN_SHIFT               20
    & T7 H- \+ r, A& s9 w/ t$ ^
  57. #define ITCINTEN_SHIFT              21
    ( V; K. L& g# K: z5 S. k
  58. #define TCCHEN_SHIFT                22
    6 }8 K2 |6 D1 w! O9 [$ V- s0 z
  59. #define ITCCHEN_SHIFT               23; K; g" o& l% N; t
  60. # ?7 \/ d, o3 q! w' @
  61. static volatile int irqraised1 = 0;, {) a4 K) {! c5 [; Z
  62. static volatile int irqraised2 = 0;; T' x2 p2 \8 x$ f+ w, y
  63. 7 V5 r: T0 G7 S* c: Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) @6 X/ @/ E% {! }
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& D0 `) e$ t& g* [  L# q
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* H* L# m, e' ?8 |8 ^. g

  67. # j1 Q  l6 H9 V+ [+ p
  68. dma_addr_t dmaphyssrc1 = 0;" S0 d- h; |  `9 Y; y+ }
  69. dma_addr_t dmaphyssrc2 = 0;6 `7 r7 e+ f& b  J5 ~: N1 p
  70. dma_addr_t dmaphysdest1 = 0;! X. q% W. W" V% z: t. W* g! K) \1 ?
  71. dma_addr_t dmaphysdest2 = 0;
    + w  k2 B  ?4 H- u  I

  72. 5 B. a8 _; Z) X, M- \& u
  73. char *dmabufsrc1 = NULL;! v2 T2 E( g4 q1 O& c, K% Z- R
  74. char *dmabufsrc2 = NULL;
    . Q/ J4 J+ s# d3 n/ _; R0 A0 V. {
  75. char *dmabufdest1 = NULL;
    / {' W9 c5 k  f7 P
  76. char *dmabufdest2 = NULL;' A) _' P/ c4 `& b. u9 s+ f

  77. * o, x4 v9 t0 h5 S+ @) y
  78. static int acnt = 512;% @3 O9 W& ?# Q/ B5 D
  79. static int bcnt = 8;
    ! w  U! e  e7 @6 g
  80. static int ccnt = 8;) Y& I1 y8 E% Z
  81. 7 [% U, \; o  L& z- n
  82. module_param(acnt, int, S_IRUGO);, f  L; F3 N, d/ v. i  u% \
  83. module_param(bcnt, int, S_IRUGO);
    & S+ J+ @7 d9 g% O& I; d
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 Q9 s; Q1 j9 e% K" T5 L
: Y" f" Q/ P+ d0 F5 ]5 f0 J) e      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  T: m. j; a- X& [+ v! oarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 o0 b5 ^' h' G/ x) p     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
/ T) N% \" Y1 B: l. t4 H6 q1 {# T) u) D
- D! `+ Q2 f& C: W, H" Q: m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-1 18:09 , Processed in 0.041549 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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