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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 O) A; A! X# E$ @- a) M
  1. [code]EDMA sample test application6 A+ @2 c3 u6 n# W: R6 Q
  2. /*
    , {6 A6 V: {* K. f9 _8 D" u" h
  3. * edma_test.c" X- \2 P. n( f2 j3 a8 E( l7 ]
  4. ** U; {9 i; M$ a- V% P. _2 I: p- p
  5. * brief  EDMA3 Test Application+ b: k" _) k+ x9 [" h3 A
  6. *( {! T% a0 }3 \: ^) M3 M9 J: {
  7. *   This file contains EDMA3 Test code.1 W* m6 o2 _- X
  8. *
    + c5 [/ r; J& {  ^: E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE+ x- f. h; }1 T% F# R& J% u8 t5 K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 d/ l) g( i3 T* ?
  11. *         TO CHANGE.4 A; S$ L) s- q3 x
  12. *
    7 A; }5 U) z+ B+ Y5 H3 c- D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    6 X+ b% u4 g: C
  14. *( j: W6 X! R, y
  15. * This program is free software; you can redistribute it and/or) g4 n5 q- g$ s
  16. * modify it under the terms of the GNU General Public License as
    . y: k8 P* J0 o' n
  17. * published by the Free Software Foundation version 2.
    : W) x/ c* M5 F
  18. *$ r* m6 L6 i  o* W/ I. W
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' E/ @& s* {. a9 @" M
  20. * kind, whether express or implied; without even the implied warranty6 b4 c  I9 ?3 q* J
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' L2 O$ y: M& i# j& a
  22. * GNU General Public License for more details.
    ( a/ Y, \5 S7 H2 p5 r
  23. */
    # S; h6 m8 {" u1 |5 a7 r

  24. 1 D: `% T) h7 q4 P+ f2 K
  25. #include <linux/module.h>
    8 [6 {! h8 j2 {- s/ ^
  26. #include <linux/init.h>3 ?$ g/ e1 ~4 D
  27. #include <linux/errno.h>6 \9 _: d8 B8 w2 f# R8 |* v( f
  28. #include <linux/types.h>/ H  M* W# B9 v; p5 X' k; o. K
  29. #include <linux/interrupt.h>
    ' ]0 v& R: l$ X( i5 a* ?
  30. #include <asm/io.h>
    ( ^% r0 j( |4 d; ?( y
  31. #include <linux/moduleparam.h>; g9 Z- i) F) `- ~1 L/ x
  32. #include <linux/sysctl.h>
    , p0 M' X: P7 H' f
  33. #include <linux/mm.h>
    ! g1 h+ _6 O- [, ^8 ?
  34. #include <linux/dma-mapping.h>
    " {  \' i4 _+ u2 Q- B

  35. 9 b% D8 g! [+ Y% E! w5 n4 |% y3 y
  36. #include <mach/memory.h>
    / R/ A9 R8 s4 ?! n8 v2 t
  37. #include <mach/hardware.h>; }& w. C; W. _- q1 x: |
  38. #include <mach/irqs.h>
    5 M" C  |* |5 b& k  ]
  39. #include <asm/hardware/edma.h>. K6 J4 h" V" B; P, r7 \

  40. ) `% o% c" m3 f9 x& z% ^" u; ?7 |
  41. #undef EDMA3_DEBUG
    9 O% G9 T  G6 I( A. r2 u  J. d6 `
  42. /*#define EDMA3_DEBUG*/7 ]% S1 z: J' e
  43. - P9 p- n, h6 t8 l
  44. #ifdef EDMA3_DEBUG
    ; t- }$ A' X$ V0 r4 g5 o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 ?' o* J7 G( q! I) o" {+ X6 B0 a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): _4 a( }& X- S4 L* @
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__). E& d9 h8 V% u! ]1 U7 d: h5 N
  48. #else/ z! I  M- E  h  J2 p. I. N: z- V
  49. #define DMA_PRINTK( x... )
    : g# H/ r) ^7 L8 A
  50. #define DMA_FN_IN8 j; m" P" a, j% n; [: q
  51. #define DMA_FN_OUT' S* Q, A, T+ ?: q0 L
  52. #endif
    8 e# C' }) j" q2 l, n' a  e! B

  53. . s: |8 C! P- |5 T7 D' g- r0 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ) j' I8 a: r* B8 S; V
  55. #define STATIC_SHIFT                34 j9 _. l8 l) B1 _
  56. #define TCINTEN_SHIFT               20
    $ E+ x/ r1 ^( c: P9 |
  57. #define ITCINTEN_SHIFT              217 S8 W; j  G) H6 @
  58. #define TCCHEN_SHIFT                22% Y- h0 ?/ H7 b& \9 H: H
  59. #define ITCCHEN_SHIFT               23
    $ {7 s$ z# u2 u  J
  60. 1 y8 n2 e! o) I6 W
  61. static volatile int irqraised1 = 0;4 h) D8 ^' G% A* v" O/ d$ v
  62. static volatile int irqraised2 = 0;
    , q+ P/ ^( d8 Z6 {# n
  63. 2 y; n" n, d  o
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    9 S( `6 u+ E" P8 R4 F. D
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 c# Z6 U; g$ f( V
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) d6 R; ?2 g* F; {: A- G3 a

  67. - [% a9 X& J+ i" `4 z7 q
  68. dma_addr_t dmaphyssrc1 = 0;
    # Z5 E( k; H, \" |0 s
  69. dma_addr_t dmaphyssrc2 = 0;3 H6 T- c. g2 d0 A) t. D$ z! ?" k
  70. dma_addr_t dmaphysdest1 = 0;6 @: z1 j% w" U$ I  n
  71. dma_addr_t dmaphysdest2 = 0;
      I8 @1 ~; g( N6 f' ?" N0 S

  72. - a, k- \# {3 X5 o6 K
  73. char *dmabufsrc1 = NULL;2 O' e; |) R# }4 |7 ^' Q5 i
  74. char *dmabufsrc2 = NULL;/ E) Y/ x8 D9 y7 v" @
  75. char *dmabufdest1 = NULL;
    ; m: ~3 D( ]7 @/ p3 G0 D: m0 s2 [
  76. char *dmabufdest2 = NULL;& S/ H7 B2 D8 h
  77. * U! s8 U+ t/ D( H: w
  78. static int acnt = 512;5 K, \5 `. x1 O9 @1 A# `( [
  79. static int bcnt = 8;5 z2 C- h" s$ }0 f8 ?
  80. static int ccnt = 8;
      j& ?% k4 A, A

  81. / c( g; Y2 v2 D
  82. module_param(acnt, int, S_IRUGO);
    1 @- j7 H9 T1 P8 z  t0 e' o1 W
  83. module_param(bcnt, int, S_IRUGO);2 A# y: k* H. g( [  y# P
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* |8 d) {9 d- Q% R; L; n% Q2 N5 S+ H
2 {5 [( w7 Y9 O      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
# O$ {! V. W, k" O% darm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。" T# `& l* P, y, U# M$ f3 q/ Y
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 J; ^1 m2 J! {2 d0 M0 }

/ A3 B1 ~* g8 l" f. R0 j
% B$ g# X5 C! h( S, I: E5 ?& T4 m+ j* C
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 15:55 , Processed in 0.041831 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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