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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , X* I" v' r7 y7 `/ p2 z
  1. [code]EDMA sample test application
    % r- A5 W; S. _$ O
  2. /*
    . k- A. B% q- ?! E2 m
  3. * edma_test.c
    0 i( r! j3 X6 v# F
  4. *
    6 M7 y! k# K, r5 G0 w5 I
  5. * brief  EDMA3 Test Application
    2 w) v8 k7 r6 L) M& }( k
  6. *
    ! G- p% ^; ]3 J, \1 o
  7. *   This file contains EDMA3 Test code.
    4 X  o/ @  ~0 r3 b! p5 p7 o
  8. *9 K1 X0 j( U. \$ {2 \2 k
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  x7 }; ~5 u0 d/ r& Q1 ^) \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 t& _# b. W+ z% w
  11. *         TO CHANGE.
    / E5 ]' p: _7 J- \% A$ y
  12. *2 g8 P2 p& I9 |; I1 e9 S9 r
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    : R+ m, n, N) O
  14. *
    8 e; ~: @" n) [8 [4 Y3 C/ p
  15. * This program is free software; you can redistribute it and/or4 @7 B* J5 i6 L* I- `# s; y0 j% K" `
  16. * modify it under the terms of the GNU General Public License as
    , ~% F5 R/ `3 k( ?. r: m
  17. * published by the Free Software Foundation version 2.- v6 G1 @- M8 y
  18. *# R) i6 h7 U1 @6 `( s! x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  N) C, J: N3 g  T3 U
  20. * kind, whether express or implied; without even the implied warranty( I# C' P5 e# u, b( D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # u4 `2 Z3 ^) Z) Y% N$ C8 L- C4 q
  22. * GNU General Public License for more details.
    : |. c. M; x( \2 x& z
  23. */
    ' n4 g6 f0 N1 J3 I- {
  24. ( H7 `4 K: k# h. x0 O  `( I7 q
  25. #include <linux/module.h>
    7 g9 N( t9 T# S: i
  26. #include <linux/init.h>$ d# ]5 Z* [  }/ [. d3 e' ?+ k: m  w5 x
  27. #include <linux/errno.h>
    5 c+ v  a" y/ U, D( M
  28. #include <linux/types.h>; \% j( e  v& m8 Y9 r
  29. #include <linux/interrupt.h># W) ]+ u6 D  m. ^5 S
  30. #include <asm/io.h>
    " f! O$ m2 p- ]! L! E* f( v/ D( u
  31. #include <linux/moduleparam.h>! P/ {2 c+ N) _8 G# z  S
  32. #include <linux/sysctl.h>
    9 n; U$ q) T  ~1 D1 v2 V
  33. #include <linux/mm.h># ~' h: d$ p: r( ?
  34. #include <linux/dma-mapping.h>
    - E" Z! I$ C! B

  35. , U3 Q8 G! I+ X
  36. #include <mach/memory.h>1 l4 Q# T8 v1 m+ ?4 j* V$ i- q
  37. #include <mach/hardware.h>
    4 C% K. h, _/ S- e2 x% T# F) O
  38. #include <mach/irqs.h>
    2 P; f: J4 f! e% L1 L
  39. #include <asm/hardware/edma.h>2 S7 l* R9 ~5 W; o. [, g9 g
  40. & C0 F+ n7 e7 s
  41. #undef EDMA3_DEBUG$ P6 w. M3 C  g
  42. /*#define EDMA3_DEBUG*/# Y% C. Z8 X7 b  H* c' o+ i

  43. ) ]$ I# i. o5 b0 m
  44. #ifdef EDMA3_DEBUG. R8 k  A* m7 N. }3 c8 X3 D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 K" B0 w) j9 T3 z( p  a6 g4 Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : Y" }; o4 I( }9 d' d
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)7 [$ U( A! _8 E0 T" _( o
  48. #else- W" B4 X4 g' H2 q* M: f; Z
  49. #define DMA_PRINTK( x... )
    ! m5 i$ P3 a0 Q% P' V: T8 _7 r7 N
  50. #define DMA_FN_IN
    ; l$ K0 R; T) T, W( {: d# Z
  51. #define DMA_FN_OUT
    9 ^( i2 Z2 _) ^* l8 k9 f5 b
  52. #endif
    & `0 b: Y8 ?+ P/ x

  53. % `5 n" F" z7 [; ?" `/ D
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ \7 }  U' x7 @/ |7 u% s8 G. F
  55. #define STATIC_SHIFT                3: |: _8 D" H# _  b+ \% @
  56. #define TCINTEN_SHIFT               20
    3 e6 q" s+ u9 f: m' C$ o8 S2 \( _
  57. #define ITCINTEN_SHIFT              21* Y  w; r' o7 T% b  N8 e
  58. #define TCCHEN_SHIFT                22$ F7 y4 E: S/ A% V% }# z9 z6 N
  59. #define ITCCHEN_SHIFT               23
      B/ V  l4 d2 \3 s7 Z

  60. , z5 x6 L+ A# r% B7 ^8 v
  61. static volatile int irqraised1 = 0;) b" Y  G$ u, ~' S+ V$ S
  62. static volatile int irqraised2 = 0;
    0 f% @& R/ |. t' B' [/ l1 b# i

  63. " E( M2 N  e& b( e* H! \! a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ; H0 w4 ~9 x, K3 Z9 |' |
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; i5 a0 I2 U) }' l% a- K
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " U  g1 h+ G& c+ z
  67. : i% n+ m& j3 Y& U% N5 z
  68. dma_addr_t dmaphyssrc1 = 0;
    ( r2 f% L- J; c1 Z6 [
  69. dma_addr_t dmaphyssrc2 = 0;( R/ O& |; o* E2 a# F, c
  70. dma_addr_t dmaphysdest1 = 0;9 G9 ?4 ]% d8 P. h
  71. dma_addr_t dmaphysdest2 = 0;+ c9 j, r3 @# ?; g
  72.   A, t0 V' C/ z
  73. char *dmabufsrc1 = NULL;0 M1 F7 i4 C, O- C* [6 r
  74. char *dmabufsrc2 = NULL;; W8 _; `" `6 W4 ~" `2 Y; V
  75. char *dmabufdest1 = NULL;
    4 b! e8 ]/ C$ e8 R
  76. char *dmabufdest2 = NULL;
    9 j3 O# e$ D  ?5 o/ Z2 Z
  77. " L# S6 Z' y  z. T4 V8 o
  78. static int acnt = 512;
    4 f' q5 B7 O5 H6 B0 B$ E
  79. static int bcnt = 8;( P* X. `  s3 _( _2 }- N
  80. static int ccnt = 8;6 H, q/ ]7 y& H; O
  81. / K2 n1 G* ~0 ?) N) ]: O
  82. module_param(acnt, int, S_IRUGO);0 D# X- U6 Q: z; _/ R
  83. module_param(bcnt, int, S_IRUGO);
    9 J! W' l" P" F
  84. module_param(ccnt, int, S_IRUGO);
复制代码

$ n/ d- N4 z" u1 E# n5 r! U3 c/ [0 P; L% M( E8 {; X
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用) u! V" P4 ~* ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。2 Z3 ?1 u9 k7 X' x7 d
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 a6 f7 ~" a+ s7 \7 w# W9 o

( B  [/ E* l% `& j5 l6 O  x" l" K% l7 d0 J
2 U$ N6 i  l9 B$ }- V9 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 05:26 , Processed in 0.041241 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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