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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 % |' d$ y' y1 `: W
  1. [code]EDMA sample test application
    0 m+ k4 y) c% M. A# S
  2. /*
    . d' K6 \5 e0 [2 j; D% T7 L
  3. * edma_test.c* G1 u" _9 g6 \# p/ `
  4. *
    & _7 k5 T7 E& x
  5. * brief  EDMA3 Test Application
    4 k! [4 V3 w, |' W3 K7 o( o" [7 a
  6. *
    + a1 W, r9 U% @
  7. *   This file contains EDMA3 Test code.+ J8 S! w) @/ g* [' Z+ ~) R/ t+ `* O  Z
  8. *
    6 ^0 Y( @- S+ Z. A$ s, r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 x/ ]4 V  R6 O! ]( L) k4 L, Q! V
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT: G; G8 O7 c$ H1 a4 N
  11. *         TO CHANGE.. ?/ Q0 e7 [# H2 z' q
  12. *
    " Y2 }1 h' C1 x& ]8 h9 D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    - z" v+ k3 ~$ a! T$ O
  14. *
    , X# k7 p+ c" H5 H0 H$ a3 [3 a
  15. * This program is free software; you can redistribute it and/or) m# ^$ j# o5 q' E) H( M$ M( ]
  16. * modify it under the terms of the GNU General Public License as# d! ]& L5 y: N
  17. * published by the Free Software Foundation version 2.* S% B% R, R2 [& I+ N7 v
  18. *; }- [" e6 h/ D9 e! J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  [& z% v6 x; E
  20. * kind, whether express or implied; without even the implied warranty. A5 o3 z- i- @2 S' _8 n: a
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the& @0 R9 L, d) h6 i8 h- j
  22. * GNU General Public License for more details.
    4 h  j$ t( v) f; ~% y# n
  23. */( D2 {% ]9 d0 d$ C+ y- S

  24. / F7 h" B% i2 r9 m1 t, t, U% `
  25. #include <linux/module.h>/ \2 [0 {* V8 A- q, `* J
  26. #include <linux/init.h>
    2 k5 t! Z5 k! f* E6 E, A4 Q- i
  27. #include <linux/errno.h>
    2 n0 z) z' w/ a- I8 a
  28. #include <linux/types.h>1 S; I& m# C: D
  29. #include <linux/interrupt.h>3 D/ `7 Q  c6 W4 U, |4 n
  30. #include <asm/io.h>
    3 N/ I* y! O( o1 |! a1 U! b
  31. #include <linux/moduleparam.h>& g7 F1 o& N1 J& V4 N- o5 \5 a2 g' [2 K
  32. #include <linux/sysctl.h>
    3 q  F- x* o8 y6 z( t+ E) v$ l
  33. #include <linux/mm.h>: g6 v, ~; r4 r! F) B
  34. #include <linux/dma-mapping.h>
    : H0 k( B: ]& w- I) ?1 L$ y- z

  35. 0 p& C& j2 ^' ?! @3 G7 ?
  36. #include <mach/memory.h>* B! {0 t: }4 g; u* D8 Z
  37. #include <mach/hardware.h>6 F# d1 K% O9 f2 h: i
  38. #include <mach/irqs.h>2 D9 S2 G9 R; F7 K# o9 d  }$ J+ X
  39. #include <asm/hardware/edma.h>3 U, B5 k8 H; g

  40. 1 |7 I- M' c% f6 j# s" v
  41. #undef EDMA3_DEBUG1 N, O( w* K' ]' }7 ^
  42. /*#define EDMA3_DEBUG*/
    " [2 A. o6 {9 N8 ^- `; }- x4 F4 r2 z0 Q
  43. " j; |( ~" h$ V4 [' |
  44. #ifdef EDMA3_DEBUG- n3 N  ^8 C7 E* B% ]5 `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 S$ T5 [- v9 N: k3 Q( w$ U
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)) l9 y) I' h0 n& L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    - Z4 N' R% r% b1 b' K
  48. #else
    & Q5 X  H; ^, n- @/ d. P( W. g( c
  49. #define DMA_PRINTK( x... )
    2 M" f; f. G* r, I. @- a1 h/ Q
  50. #define DMA_FN_IN
    * O( X) ^1 f; ~5 m2 v  X5 V
  51. #define DMA_FN_OUT
    9 Q; U0 s! q! u& t1 ?6 N% F* X
  52. #endif: W6 H- j9 C. f0 B! \
  53. & P; B. M) b/ l8 }* t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)1 U# y  `' K. M
  55. #define STATIC_SHIFT                3
    ) W" L5 U+ k4 ?* D) `
  56. #define TCINTEN_SHIFT               20! x" S1 P- a9 J- {2 `+ _
  57. #define ITCINTEN_SHIFT              21
    5 o2 t6 |, P" j7 h3 n- u
  58. #define TCCHEN_SHIFT                22
    ! ?+ B* b( r# D" W
  59. #define ITCCHEN_SHIFT               23
    6 A8 h6 O  @! A# i  Z* b. \, D
  60. 7 X# B- i5 b  e0 O% O' ~
  61. static volatile int irqraised1 = 0;' S, L2 v9 r! n# [" W% \+ h
  62. static volatile int irqraised2 = 0;& x! W& i/ v, Y% d6 L! k
  63. ' [' A1 L! t5 p4 A9 g9 u) ~/ j) K* l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 O! b. U; Y3 a  i" J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * z% d7 j2 [7 H; o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 h% k/ ^" y( n, W

  67. + B2 K$ S, j0 V9 M# R7 W
  68. dma_addr_t dmaphyssrc1 = 0;) C$ V9 a% I1 n/ \
  69. dma_addr_t dmaphyssrc2 = 0;
    ' I8 v+ j2 g1 W( M. S, v- q
  70. dma_addr_t dmaphysdest1 = 0;
    " H# c; ?' n" J! Y8 T8 M9 l
  71. dma_addr_t dmaphysdest2 = 0;
    0 Y- W# e+ W0 W/ ^$ j
  72. ! [- f* h: v  k/ n2 x6 O/ ~( I* N
  73. char *dmabufsrc1 = NULL;" }/ c2 k) I: f
  74. char *dmabufsrc2 = NULL;
    ! R) k# q) W& k1 [& J4 Y
  75. char *dmabufdest1 = NULL;9 W; H* |& U# e! d- I
  76. char *dmabufdest2 = NULL;
    , h4 P( f8 C" {
  77. ) y# d; C) Q: k
  78. static int acnt = 512;* [1 P- W4 M4 {3 b
  79. static int bcnt = 8;
      V0 t! K/ v2 j  w- f
  80. static int ccnt = 8;8 n- T- P) t' ~( w, o

  81. - A& O" |& m' W- d; P) d8 O6 ~0 q
  82. module_param(acnt, int, S_IRUGO);
    ; c- p8 V) m. n+ l) `: ^5 c1 q" u
  83. module_param(bcnt, int, S_IRUGO);5 v( R1 N8 L( }+ X8 H
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 S* P$ N4 q* a1 Y( R/ J; @
& ]& N* I. _1 Z. J. Q* e4 C/ y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( V6 P4 T- D$ a. marm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。4 ]3 b7 |# r$ D1 e8 `4 x5 |
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
6 p! e& w  H1 O, H) V, r; X$ L" w+ d
3 \  e) z+ d$ n: ?2 k; `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-27 04:11 , Processed in 0.040378 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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