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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   Y( c: s- C! w* t* Y# x! t/ _* ?
  1. [code]EDMA sample test application4 O0 c! ]; R& H# I2 K! {8 W
  2. /*0 E5 b6 O. p; I' D, q& p5 B% Y  m
  3. * edma_test.c
    * d* F9 s' K+ S" A* D
  4. */ M& J) L3 |2 g5 u
  5. * brief  EDMA3 Test Application
    - L1 n. _  Z' i# J' p  @
  6. *
    ; N! E# ?5 ]7 l: o+ `8 O# g
  7. *   This file contains EDMA3 Test code.: r1 O$ V0 I: @% u+ U- `, t
  8. *
    & a# w2 j) i4 Q- }" x8 j& N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE; m5 X" ]9 P: i) m; Z/ O
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 f6 s1 Q- @1 C: O1 H2 `# u* n6 p
  11. *         TO CHANGE.
    . q1 |8 O7 U* S" [" }3 K, o- s. i' ]6 x
  12. *6 J( \( R' |% f
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com// h$ W$ B% O$ ?' h6 n4 |
  14. *
    ; A' f4 x0 ?6 e! W
  15. * This program is free software; you can redistribute it and/or, z& o+ j5 b; n1 v# g" S# {" I( x  i
  16. * modify it under the terms of the GNU General Public License as: {, a) [+ U2 Y$ w; }& v
  17. * published by the Free Software Foundation version 2.
    5 |0 o& r  D* W8 `* k; c
  18. *6 y5 z( c' `' ~- u+ A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 r2 I0 H8 B% I( P7 x
  20. * kind, whether express or implied; without even the implied warranty
    9 \4 q% q% d8 T: ~, m0 w4 _& f" F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  B$ ~6 ~0 h, ?! J7 }: I. a- }1 F
  22. * GNU General Public License for more details.6 `# a9 G5 b5 d' K0 Z
  23. */& Q4 @4 {; C0 L$ m1 A& J+ n

  24. : s9 g+ N  \9 E
  25. #include <linux/module.h>
    , O+ x4 _& F5 g8 v
  26. #include <linux/init.h>: O1 l6 b, d6 q! l4 Z; G7 s+ s1 F
  27. #include <linux/errno.h>
    ( Z. ?; e* @% |; [9 p4 j6 Z1 p
  28. #include <linux/types.h>
    : M1 f& P7 P5 H% e' e7 n* d3 u5 M( p
  29. #include <linux/interrupt.h>; ^( v+ o7 w& t2 f7 s
  30. #include <asm/io.h>
    ) x' }( a7 I, H3 l- @5 H* H
  31. #include <linux/moduleparam.h>- G6 H+ e  r: c. M6 Q
  32. #include <linux/sysctl.h>" c+ M  y9 I' M
  33. #include <linux/mm.h>
    ' I; c4 L7 v9 K
  34. #include <linux/dma-mapping.h>" h6 ^: p0 F, L4 w. Y2 F

  35. ; C' Q9 v1 S% S* c" `: b6 l1 g
  36. #include <mach/memory.h>
    * ^( }2 i7 R* H3 G0 T* N; K
  37. #include <mach/hardware.h>
    ) t1 G! }1 q2 o% y
  38. #include <mach/irqs.h>8 |9 U& T  z' s6 r3 k
  39. #include <asm/hardware/edma.h>
    ; n- h( S2 P/ ]) _

  40. . s0 T, U% e- K
  41. #undef EDMA3_DEBUG" S; d( ?- O6 D0 L  f& c# G  U' {0 d
  42. /*#define EDMA3_DEBUG*/( F2 A$ a6 u" z0 M3 l

  43. & ~) Y# C1 |$ [+ d; V8 l
  44. #ifdef EDMA3_DEBUG* a, U  R/ t8 T
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * R# W' _% ^* ^; _- p2 }
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 a; A$ V2 i" n9 ]
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    5 I, h* c: g; ], \
  48. #else7 j9 ]" L  F: C4 O
  49. #define DMA_PRINTK( x... )
    , K6 z5 B5 k9 q  `8 Y8 K5 _
  50. #define DMA_FN_IN
    7 ]0 S, K% F/ B( w
  51. #define DMA_FN_OUT
    0 g7 O2 L( _2 P7 R1 s4 ^
  52. #endif
    # E. ]9 |+ K8 D9 [" F* ^

  53. 3 b& O, x  O. M5 |; b( k+ P
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 ^( V! O' x' H' S: p. P* E
  55. #define STATIC_SHIFT                38 s: S+ F# ^5 A* s, d" W3 i
  56. #define TCINTEN_SHIFT               20
    . q) D' q7 z! o5 s, }0 O: F
  57. #define ITCINTEN_SHIFT              21; v+ F1 d! S5 z; Y
  58. #define TCCHEN_SHIFT                22( I+ E2 o& v  ]7 ]
  59. #define ITCCHEN_SHIFT               23
    ) Y) t5 {9 F  p" g0 I, {3 c3 c, F6 q

  60. # e' z# E% D+ i# x/ ]
  61. static volatile int irqraised1 = 0;! ~. `3 d; S# ]' i
  62. static volatile int irqraised2 = 0;8 ~, E9 S3 f* H! ~: B, S7 g
  63. 6 ^0 d. [% M7 f% Q. c
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ G& M% Q% R  ~. ~
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
      O$ d- Z2 G5 P6 B) ~8 Z; c0 J% o
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ m, k# c8 P+ a% F. ^  F
  67. ) w% \6 r9 A" T5 C1 D. r6 Y
  68. dma_addr_t dmaphyssrc1 = 0;
    # n8 Z3 ^8 l% l( g- S( F% c  t
  69. dma_addr_t dmaphyssrc2 = 0;
    , G+ Q% g* d3 n# N. D$ p0 T% {
  70. dma_addr_t dmaphysdest1 = 0;
    + g! \, {- t7 K' V' m; l6 ]
  71. dma_addr_t dmaphysdest2 = 0;
    - X2 L& L' b3 H- D
  72. 8 J4 B3 R" G6 a
  73. char *dmabufsrc1 = NULL;
    7 L* A6 e& m2 i& D* t2 E
  74. char *dmabufsrc2 = NULL;* t1 U+ O4 T/ Q4 H' p) g; L
  75. char *dmabufdest1 = NULL;
    ) f, S$ s, S9 |. G" \5 U
  76. char *dmabufdest2 = NULL;
    * m! h5 ]. @* y, R
  77. # R% G0 }* `/ H# l7 d8 u; c3 Z4 c
  78. static int acnt = 512;4 v( F6 H2 X$ ^1 S; u+ @6 z/ D+ F' k
  79. static int bcnt = 8;! t! Y' e! b1 S
  80. static int ccnt = 8;
    - s# b1 s5 l4 u1 v$ a: c9 O
  81. * y7 N6 ^. i: ~8 Z# n1 A
  82. module_param(acnt, int, S_IRUGO);
    1 X# g3 o$ q/ Y" M5 |4 T" w
  83. module_param(bcnt, int, S_IRUGO);- z& E0 V  [! E8 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: }" g0 j9 t% G$ e4 v( p, B6 D2 d
6 O; g  H" j/ V      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
' X. s; l' q7 ^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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。) V% m* }( K" w8 q+ Q) _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 `* j( z1 r% i, {! F. D: _
3 m) ~, d$ G) D9 Z

4 }3 P$ U% k7 V7 e' p! I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-8 06:06 , Processed in 0.039525 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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