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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , W' a# g( F$ |: t9 |# n3 s$ U9 W
  1. [code]EDMA sample test application' ~0 g, q. n' H- y, G
  2. /*
    6 t) @" X# N) R  }- d! s
  3. * edma_test.c
    " x( }' ~' s* J4 r# p( o( n
  4. *+ {4 R# U$ |. l; f
  5. * brief  EDMA3 Test Application- G) z: H$ f/ I1 q/ m1 |
  6. *: V/ W2 Y7 B0 @) r5 y2 y& ~* L
  7. *   This file contains EDMA3 Test code.. g) L: |- h/ f9 H- D, E# S; h
  8. *7 Y) X+ i: U$ N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  t3 e5 b  r8 \1 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    , |. i( C( j, B6 N9 B' Z
  11. *         TO CHANGE.
    , [9 Y: O! V6 b
  12. *
    2 G. a! }! G9 V- }6 `- H8 H
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 b  {) x$ E! G# o$ [; l
  14. *
    9 M  |* _( p; B1 h; B
  15. * This program is free software; you can redistribute it and/or
    / I5 [7 e* }7 s. v  o3 q( q
  16. * modify it under the terms of the GNU General Public License as/ N9 O1 F; j1 K- o. ]8 U7 K( w
  17. * published by the Free Software Foundation version 2.! \. D# e# ]3 [2 d# N
  18. *
    8 W" M$ m- ?* F" @7 J
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    9 w+ m4 c* C8 b. J2 b
  20. * kind, whether express or implied; without even the implied warranty; G6 c/ r, l/ o" H' m
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% ^+ [& i  |, f1 l; U
  22. * GNU General Public License for more details.) ]5 z6 `) X+ z. j
  23. */. @% T( v6 ~# M; [8 x
  24. , z$ ~# J' h$ C
  25. #include <linux/module.h>
    . o: a8 |+ Z( m& ~9 w, ^  V6 }
  26. #include <linux/init.h>
    % u1 ~3 [2 B7 Z8 _* B
  27. #include <linux/errno.h>
    , C. K+ b/ z+ l
  28. #include <linux/types.h>
    + z! R9 B4 F* ]4 a4 ]$ Z
  29. #include <linux/interrupt.h>
    . K2 V1 U3 z! P4 x( X2 D
  30. #include <asm/io.h>, c' h  U  U: i  q+ m7 d
  31. #include <linux/moduleparam.h>
    6 }* X" q4 e) z
  32. #include <linux/sysctl.h>
    8 Z5 g, g( U3 T3 n( v
  33. #include <linux/mm.h>! b5 {" r5 i( y$ n4 ]9 q. R& Z0 g
  34. #include <linux/dma-mapping.h>
    : O' `1 L  C& _) }' a

  35. 0 h2 ]4 m. `8 d( e" z9 V! \
  36. #include <mach/memory.h>. e& ^8 w5 U$ {5 G. W
  37. #include <mach/hardware.h>
    4 Q* c- m6 j# D8 u" U
  38. #include <mach/irqs.h>3 R, t5 C6 X: R3 U+ N* w
  39. #include <asm/hardware/edma.h>
    3 y8 Y' }3 [& i, k1 \

  40. * F% w0 c' D0 ]- q; N
  41. #undef EDMA3_DEBUG7 I) l1 `/ B  T7 f2 A
  42. /*#define EDMA3_DEBUG*/  J% O" k& u& s, y4 }3 x+ n
  43. ' E" i; C7 v3 \" t/ @/ u- ^2 a% C
  44. #ifdef EDMA3_DEBUG
    / [: O# I( Q2 K7 R! @" o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 u; w" G" a- f/ c& {! P% t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 e0 {7 r4 U/ b! z7 X
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ) k9 f3 T9 ]1 b9 c' ^
  48. #else' ]' Z: b1 u5 A2 W% e0 q: @" p, }
  49. #define DMA_PRINTK( x... )
    : O& C8 u6 n- b2 S3 R, ?& D; e: m
  50. #define DMA_FN_IN+ u' P/ s; o/ }
  51. #define DMA_FN_OUT
    8 ~8 s( M1 s/ I. E. b6 @
  52. #endif) F) [) u+ h3 _0 P8 y9 i
  53. ' ?! z! q: u4 y$ l3 E3 ]" r* y4 c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): ~6 {( y. c8 C) N5 S" d
  55. #define STATIC_SHIFT                38 h& @2 e. K; J" }
  56. #define TCINTEN_SHIFT               20' @2 \+ W3 q4 s$ [, v
  57. #define ITCINTEN_SHIFT              211 S! j3 |, l( x5 l
  58. #define TCCHEN_SHIFT                22; g! o' V0 N% F+ O' I$ ?
  59. #define ITCCHEN_SHIFT               23# P2 t2 N/ _/ y) G
  60. - J+ l& _' C' t& X; S4 V9 Y( J
  61. static volatile int irqraised1 = 0;
    0 V! u3 `4 C+ q3 `5 }
  62. static volatile int irqraised2 = 0;9 p6 O/ M$ H) V5 }( V( Y% Q% r
  63. 7 q( V' j, c% E0 {$ c8 z2 B0 b0 `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! P2 I, y% d' r2 @' R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ V. o/ k8 p: \
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( y0 u( k2 ~0 ~( E
  67. 5 _( E0 P2 U/ a9 m2 [8 [
  68. dma_addr_t dmaphyssrc1 = 0;1 q' C. f: W5 I) d
  69. dma_addr_t dmaphyssrc2 = 0;" }8 O4 g( o3 j* Z( ~* k# B) p
  70. dma_addr_t dmaphysdest1 = 0;" r' @) q1 V8 F1 N/ i& x" P6 s
  71. dma_addr_t dmaphysdest2 = 0;. W  L3 e( M, `7 P* L
  72. 9 ^$ F8 \4 b! [6 `' ^6 h
  73. char *dmabufsrc1 = NULL;
    # Q5 j' M3 V5 C% A3 |
  74. char *dmabufsrc2 = NULL;; J3 x! e: g0 M: u" a$ h
  75. char *dmabufdest1 = NULL;* D5 J) l/ r( a( b- }3 ]
  76. char *dmabufdest2 = NULL;
    ' g4 |* y9 c  J+ R& p% G1 w: o

  77. 0 k7 v+ s, |+ m) ^# J
  78. static int acnt = 512;
    & s* h$ S+ x4 t) B& j# O" {
  79. static int bcnt = 8;
    ' q' [+ k2 l' w# I+ Y' ~+ ]
  80. static int ccnt = 8;4 |# c; X7 C5 |

  81. + i  K! d! V1 u1 E5 H
  82. module_param(acnt, int, S_IRUGO);
    4 |; |3 W7 x, o: y
  83. module_param(bcnt, int, S_IRUGO);- m, v" S/ X8 \1 O" a: Y4 @. x
  84. module_param(ccnt, int, S_IRUGO);
复制代码
' {/ J+ v$ b5 o( Z; C1 `& n; l. A
+ V6 M) P  M* c; V% s5 F
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 Q5 p/ U$ ?4 G5 K, b& e
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
0 L; z6 {1 O6 }( I! G/ L4 Y$ g% Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。' u9 y& A9 d# O( a3 \' B

) n( t0 k+ u8 k6 y( Y) }; [9 s- C
9 s' ~( @2 K4 j7 v/ ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-14 14:25 , Processed in 0.040365 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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