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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
# C! U9 ^3 m: D1 z3 m
  1. [code]EDMA sample test application$ ]7 ?! V$ O2 n7 c4 v! v$ _+ [# [+ i- m- b
  2. /*0 C4 u- C% H4 x$ @! V
  3. * edma_test.c5 O/ R% _+ J9 s; U+ W; Z
  4. *
    " X  s! Y7 F% X, h# u$ j. ]
  5. * brief  EDMA3 Test Application
      I  {" w$ ?) {7 w% d
  6. *
    " [: L" P4 a0 n1 R
  7. *   This file contains EDMA3 Test code.
    3 w- l; T/ {' `* e" g, |
  8. *5 q7 U3 I% q( ~  n% c3 Z: b: B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: s& }3 g) u+ R8 `9 o# m( e5 S+ }
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) t* k3 c+ K0 h7 j- f1 e
  11. *         TO CHANGE.6 U% I4 z* O) y3 Y) F$ X( {0 m
  12. *
    " t" \- e2 h' t
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/. r6 a% P$ U) J0 _. C
  14. *
    8 c8 N# S5 t$ I2 g# G! M
  15. * This program is free software; you can redistribute it and/or
    + q) W. q# U1 W9 j6 V
  16. * modify it under the terms of the GNU General Public License as& K/ s. D/ @7 m: m4 N2 v
  17. * published by the Free Software Foundation version 2.
    3 Y6 f; B3 G+ R* d4 n( _
  18. *
    # G& A6 r  r0 a3 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any! {. x+ u9 L. V6 ?9 ?8 U. R' I7 v1 ^
  20. * kind, whether express or implied; without even the implied warranty( \2 {- Z! R, K
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ ~0 r& e& y7 u* V7 ?
  22. * GNU General Public License for more details.
    ; G- m, P. U: }# W( N
  23. */" i( h5 g: q6 B. Y
  24. ) N7 `6 X& @5 U" I
  25. #include <linux/module.h>
    % |* \. w; Y- P! i( I$ p; r1 @
  26. #include <linux/init.h>
    ; o" s7 L+ [7 g* U; |1 x5 M
  27. #include <linux/errno.h>
    $ z2 C. s, {; V
  28. #include <linux/types.h>6 B% D% J6 |7 R( |6 A7 d/ J$ I# n
  29. #include <linux/interrupt.h>! L4 [1 V7 e1 v: i
  30. #include <asm/io.h>
    - f5 Z; N8 s8 }! r5 o
  31. #include <linux/moduleparam.h>) w) |2 ]% n0 m: {
  32. #include <linux/sysctl.h>
    ( d, R& _* c' O5 f
  33. #include <linux/mm.h>& j" _1 y$ [, t6 S$ y1 N: u
  34. #include <linux/dma-mapping.h>
    4 v! A; y4 {3 G
  35. $ D8 V) @3 \" k: n; Z, s
  36. #include <mach/memory.h>  a2 T/ p5 U( E5 k7 V2 t
  37. #include <mach/hardware.h>2 Y+ K4 z6 g+ t& ^) g4 Z( [4 z; a
  38. #include <mach/irqs.h>
    7 j& z4 ?, s. O  ^* L7 S* j. b
  39. #include <asm/hardware/edma.h>2 b! M: Q4 g8 ~! P% |4 ~$ S" I. \
  40. . x4 \" T% H4 ~, l) s& Q% O
  41. #undef EDMA3_DEBUG
    ) V: \7 P- ], K2 f' D: l" o
  42. /*#define EDMA3_DEBUG*/
      r* C! b' g) v- ]2 z" Z
  43. . k' A. n+ `, k% d
  44. #ifdef EDMA3_DEBUG$ g, S9 @* L; a6 J" F/ X* `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ; k6 F+ a2 |  ]0 ~7 c) D% V; I( c) S  t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    3 o8 }$ R& T( M0 h8 W1 ?
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 }% l- A: s$ E- c& @8 w% O
  48. #else( ^* T  x/ p0 J" }0 T2 z3 g
  49. #define DMA_PRINTK( x... )
    * \0 D4 Y$ L# p7 }5 p
  50. #define DMA_FN_IN
    ' t4 _$ P6 Q+ C" ?
  51. #define DMA_FN_OUT9 W& }, p) ~, ^: N: i& z
  52. #endif
    ; E2 \7 I  I: I5 Q: t- D% ?7 C

  53. 1 g! o0 A: ?+ S3 f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 @" ?; l0 q3 K/ |% T6 z( D: T
  55. #define STATIC_SHIFT                3; h. |+ s6 E: f. p' B4 Q
  56. #define TCINTEN_SHIFT               20: ^3 G' B1 {8 [/ Q! B
  57. #define ITCINTEN_SHIFT              21  ^1 c% Y5 k$ F: J* ?% U, D
  58. #define TCCHEN_SHIFT                22) L! w0 c, m0 g8 d6 X3 o
  59. #define ITCCHEN_SHIFT               23
    0 j9 `0 z- F& F5 x9 D
  60. ) Y6 Y9 p: Q1 ~" ~
  61. static volatile int irqraised1 = 0;
    * A* O& F' j* i8 |) _  W" f. x/ |
  62. static volatile int irqraised2 = 0;
    ' q6 b; v, h. T" r/ z
  63. ; i# N! A. G- I
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! f) k) I0 U# C7 x; M. g0 N: Q
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % K8 X' Z" m9 `$ n- a0 X0 s
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - w( L  {- L! Q& z0 G" L
  67. ! U& l) Q4 j( j2 V/ I# ?1 z
  68. dma_addr_t dmaphyssrc1 = 0;, c& B1 d2 N: p  ?  {
  69. dma_addr_t dmaphyssrc2 = 0;/ d' y$ U- u7 L8 ~2 @: L/ g# R3 ]
  70. dma_addr_t dmaphysdest1 = 0;
    + n) a! N4 P# A, [, N; c
  71. dma_addr_t dmaphysdest2 = 0;
    ; f( Y/ w! y( ~& r  O  B
  72.   e/ L$ T+ t) ~/ {
  73. char *dmabufsrc1 = NULL;
    + o0 i, q  A2 ~) Z% L/ @
  74. char *dmabufsrc2 = NULL;, h, w. i; |0 d  T2 u. k9 ~  ]
  75. char *dmabufdest1 = NULL;
    : F6 G. i! f, D6 h/ \) j7 |
  76. char *dmabufdest2 = NULL;  L" L3 s( B8 |. t0 p5 T

  77. ; e+ T+ Q3 a1 s, k' V8 X
  78. static int acnt = 512;% o6 p- C% Z* `
  79. static int bcnt = 8;) D  m2 e; O3 w( g9 e+ J) o
  80. static int ccnt = 8;8 x- g+ ?# h/ Z0 z% f) d  \) h0 A
  81. , C. o$ w8 B' @+ Y! ^
  82. module_param(acnt, int, S_IRUGO);
    3 p' D4 Y/ A/ `# |$ U3 N
  83. module_param(bcnt, int, S_IRUGO);0 H" ?3 S0 u3 b: y/ i) y
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% s6 g- a+ H5 n9 K0 a
, G3 H- a7 J1 l5 d) c8 p) r      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用: ?' o/ q! {$ [4 {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。$ i2 \4 M  h5 t' D
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 l- H2 y" k' }- [& _
  [7 k) F6 r* B7 \& b" W$ Z' @3 b1 d/ d- H* }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 20:57 , Processed in 0.038193 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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