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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
- B( \) d! h4 U1 e$ V$ g  c3 {# m+ r. O
  1. [code]EDMA sample test application$ n3 w" a4 O0 U8 I( R- L
  2. /*
    3 y/ x4 c+ `( T$ P& m* B0 v
  3. * edma_test.c
    0 G8 O7 b5 J0 ]; a4 W- E# s5 E# U$ R
  4. *" Q; o# M6 Q. r7 c- X3 |$ ?8 W3 ]0 [
  5. * brief  EDMA3 Test Application
    - S9 ?9 K# V! L
  6. *
    $ t9 }/ h5 G/ D
  7. *   This file contains EDMA3 Test code.4 z3 X/ q( U' N* @
  8. *- E0 r1 W+ v: F; q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ @+ o* \5 X. G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) m( n) B# \( |' q) w) E
  11. *         TO CHANGE.
    + W. c  f2 T# {# U8 ]- Z1 w
  12. *" ^$ M! Z6 q# x# ^5 ^1 H9 y5 N  x$ q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. B/ z7 l  z* O+ X
  14. *
    . Z+ q* T6 J8 _3 s0 z4 V
  15. * This program is free software; you can redistribute it and/or
    0 X  t: J) ^! y, g
  16. * modify it under the terms of the GNU General Public License as
    3 W+ V7 l7 G0 n  a# V3 r! d
  17. * published by the Free Software Foundation version 2.5 R) f/ t6 B+ v6 O& A9 f, y
  18. *  D8 w+ d# r% [1 Q; }
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; M# Y+ S' e3 x, `& G9 S" E
  20. * kind, whether express or implied; without even the implied warranty
    , V3 E, |6 [7 L* {/ R
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the' i& F  Y/ [# J, ^7 T
  22. * GNU General Public License for more details.
    : _; k8 Q$ _# P4 M. A, i3 e
  23. */
    ' E$ ~7 S, f* n( e' t5 p8 ~

  24. & K2 D/ u, y5 L; {- V% k- L
  25. #include <linux/module.h>
    5 }8 d) {. K5 A8 J! p
  26. #include <linux/init.h>
    ' R/ Q3 x- c! \' Q$ x4 O
  27. #include <linux/errno.h>
    9 i! w  k( w4 ?* {9 H
  28. #include <linux/types.h>
    : S" r& B3 H4 J
  29. #include <linux/interrupt.h>
    : P& w  O/ M) P- u3 r* a* n3 @
  30. #include <asm/io.h>4 [% V8 I) X8 U0 C0 |3 @0 M* j2 m
  31. #include <linux/moduleparam.h># `# J6 Y. d; h
  32. #include <linux/sysctl.h>
      T6 U/ C4 Q4 Q" }: B9 _
  33. #include <linux/mm.h>
    . ^3 K* L$ R5 b/ D2 R" l
  34. #include <linux/dma-mapping.h>2 l8 |% D, s* H$ M. w
  35. . v+ i7 U) x. W3 S$ F
  36. #include <mach/memory.h>
    $ ~$ Q, X9 @& i& d: w9 Z+ L1 [
  37. #include <mach/hardware.h>% w- b# k7 o! `1 a  _$ _# i" f' k
  38. #include <mach/irqs.h>3 _/ y/ N3 [/ T% d6 R+ R; p
  39. #include <asm/hardware/edma.h>
    1 |6 d0 k6 n  f: ]' s% A

  40. + c) R. {/ N" x. B  {5 @2 o
  41. #undef EDMA3_DEBUG
    ' w/ j/ }* {8 [+ S2 U! i9 {! ~( w. v
  42. /*#define EDMA3_DEBUG*/
    8 E+ |1 k8 m( h5 a2 X2 [) f

  43. 7 U1 i& \, b6 `! c- j1 C5 N
  44. #ifdef EDMA3_DEBUG' v0 ]/ }. v" K2 M
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 M! B$ B8 R& E& f& u$ b5 S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    % E0 N! y& e1 d) b  a! a
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " R0 u( X& |# @- d, l) P( H; q9 ~  x
  48. #else/ a3 J2 g3 b# K& F3 h9 r
  49. #define DMA_PRINTK( x... )* A, K- e: l& k" R4 d
  50. #define DMA_FN_IN
    ' Z. H+ W6 F: W, i& E+ f
  51. #define DMA_FN_OUT- G- l( I( H: y: N6 C" R
  52. #endif
    1 w6 M( v0 B) G4 V& I; D
  53. * s4 W( @( X  Q, i' M5 S/ c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) E* p$ |' a- Z# ?; @7 @
  55. #define STATIC_SHIFT                3# G! h6 W4 ?& P( t6 J2 y% R
  56. #define TCINTEN_SHIFT               20
    + X6 F. ?, \* n
  57. #define ITCINTEN_SHIFT              21
    " q& @& z! H- ]7 G3 q9 \" k* z
  58. #define TCCHEN_SHIFT                22
    8 l( K# `- q, `9 Y) m
  59. #define ITCCHEN_SHIFT               236 }+ g# Q, f5 }* r, H
  60. % p- D# g( _: \* L' t
  61. static volatile int irqraised1 = 0;. |# W3 v9 g- Y" |
  62. static volatile int irqraised2 = 0;; J# A9 L% V* e/ x/ ~% C, X) V# M
  63. - ?# t; `0 G3 n1 |! L1 v/ a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; H. N8 ], l* j/ S% O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 b$ h2 q; s0 p
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 X$ B1 ], g7 w) ?! T6 V, F4 T

  67. 4 [6 `2 `/ g- d- M0 L/ H6 j
  68. dma_addr_t dmaphyssrc1 = 0;
    6 \( ^. R: R  X9 g1 r9 A7 H
  69. dma_addr_t dmaphyssrc2 = 0;
    8 [& J6 B' U& u/ x
  70. dma_addr_t dmaphysdest1 = 0;
    4 g9 {; \7 Z3 L9 O
  71. dma_addr_t dmaphysdest2 = 0;
    # b, M/ p  ]6 }4 ]  A: o
  72. 8 [5 b/ L) L* j  G7 k+ T' ~
  73. char *dmabufsrc1 = NULL;& D7 T$ U: V& p; |/ L
  74. char *dmabufsrc2 = NULL;
    * R5 f  b- j: z3 S$ G1 O
  75. char *dmabufdest1 = NULL;* N! |: E* d3 p) x  I
  76. char *dmabufdest2 = NULL;
    0 L* n# V% d2 ^! L' }: g  O; @
  77. * g+ V8 v% I) k& A) }& q4 [+ f
  78. static int acnt = 512;
    , Y2 J4 Y6 T! h0 n* F. `- J. Q; Q
  79. static int bcnt = 8;8 L2 |8 R- t4 e+ T2 j* d
  80. static int ccnt = 8;0 m$ O  B4 K: ~& ?% [
  81. * u- z( O+ E! n' A& ?$ N
  82. module_param(acnt, int, S_IRUGO);
    1 d% T5 U# F6 O, ?: c" I
  83. module_param(bcnt, int, S_IRUGO);" F- n1 T) N" r) G6 d& X% {  ~) a
  84. module_param(ccnt, int, S_IRUGO);
复制代码

; W' x1 t9 L' k7 J# P9 G- D& a& b% \7 W" v7 Y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, }- ]/ V' }2 F
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ Q6 ~0 q+ X6 e0 |4 y) ~, ?     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; J  U) _/ {0 J6 C! B' L  f  Y  a- d$ m
% }" c' B, ]: `7 G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 01:13 , Processed in 0.039923 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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