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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 8 r  u2 x; l9 ]9 A  [
  1. [code]EDMA sample test application6 J, \" j  G1 ]2 Y
  2. /*, o5 Y3 @/ U. ]2 @' q4 o5 Z
  3. * edma_test.c
    8 w: g" ^$ |3 e; b0 r1 {9 S* ~
  4. *
    0 X/ \9 Q# V  U' c' {1 c: t9 z
  5. * brief  EDMA3 Test Application% d# Y9 M8 g+ @+ j; \
  6. *# B" N) T5 {* u0 m. Q! \+ W( ?
  7. *   This file contains EDMA3 Test code.
    1 x& c, [+ ]- H! K2 D7 M
  8. */ S1 a+ f) A: D5 s) C) a, I0 y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& h5 Q. X0 k+ E1 T; R& X' y' {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    2 h# y: `( p4 x
  11. *         TO CHANGE." r6 ^$ S. M$ E1 W# v
  12. *+ M" Q5 V1 P1 n
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 y, [5 k* E! _' S# M+ ^% B- Z
  14. *8 K- V! u* ~- ^* p/ i' U
  15. * This program is free software; you can redistribute it and/or5 @$ h% B- p3 @) g3 J, ?, |: E) _
  16. * modify it under the terms of the GNU General Public License as
    8 m  ~- m( R# b" w' k) O' ^( ?: Z
  17. * published by the Free Software Foundation version 2.
    ; L  m" L" q( h7 f' G' w! y
  18. *" F3 s- P9 s7 m( n: M/ z8 f
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 ~) k1 [$ N7 ]* \9 L' p
  20. * kind, whether express or implied; without even the implied warranty' ?. |9 N: \; s1 v% n. u+ N
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    2 x) ~( V2 ?& S1 \2 J" o
  22. * GNU General Public License for more details.9 B0 U' L& |" ~& s0 B# U
  23. */, A8 @  k: ]9 H5 C0 X! u- A

  24. " G. ?' u0 i& ~( r/ E% A
  25. #include <linux/module.h>
    " L9 T: ?/ I8 d  @5 a) v) r/ A
  26. #include <linux/init.h>
    ' ?2 Z8 y4 l0 B% A) L8 i+ S
  27. #include <linux/errno.h>
    8 A% Y$ |6 i8 _4 r  w  t5 }7 J
  28. #include <linux/types.h>
    3 i" D8 n' ]$ u& m* p& ~
  29. #include <linux/interrupt.h>( G- D6 G3 {  c% E
  30. #include <asm/io.h>: {% z* j" \( C7 S, ?
  31. #include <linux/moduleparam.h>
    , t, i5 ]1 @( B# s6 W  w
  32. #include <linux/sysctl.h>
    . a% ], E: l7 ]3 h2 H
  33. #include <linux/mm.h>. \2 W. \- u' R: ^, r9 z
  34. #include <linux/dma-mapping.h>
    & R/ N0 {! S' U1 W4 M
  35. 2 ~( x, X  k- N1 s9 I1 H
  36. #include <mach/memory.h>- O0 m. c9 W  |7 {8 l0 l
  37. #include <mach/hardware.h>
    8 h8 Y! r+ p3 N+ y$ u( d/ \# I
  38. #include <mach/irqs.h>3 }. k" ]* v- E" ~
  39. #include <asm/hardware/edma.h>
    9 Z+ H0 c/ x  r5 h& F

  40. $ ?) P9 Y6 Y. T, V# ]" H! c1 y
  41. #undef EDMA3_DEBUG
    # l$ o2 X1 M! F1 _- I
  42. /*#define EDMA3_DEBUG*/2 V; S8 J; Y! Y0 d- t

  43. 3 V6 a' R* z: D4 m+ N
  44. #ifdef EDMA3_DEBUG
    1 X6 J, j& p5 ~' g7 t2 e+ i% ?! W0 ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ ~/ e: L# T6 C; j9 ~: [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " H! ?: G4 I5 @$ b1 v! L
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 n1 P/ D8 y0 K/ L9 g% z
  48. #else
    7 j% S1 d7 ~- }: Z4 f0 V
  49. #define DMA_PRINTK( x... )
    # |( P% B# s3 }& ?- r
  50. #define DMA_FN_IN/ C5 @9 c% ]" l2 S/ h( d6 }7 s
  51. #define DMA_FN_OUT
    3 J. z9 e1 W4 R+ \
  52. #endif
    : J9 e! H0 g: ~

  53. 7 l- ?6 S! Q( _8 G. r
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 [7 x0 j: v  s# o4 Q3 x& c7 ^& k
  55. #define STATIC_SHIFT                3
    0 g3 S3 A) x" I8 ~* B
  56. #define TCINTEN_SHIFT               202 Y$ l$ e* \& ~/ Y6 C: R! O
  57. #define ITCINTEN_SHIFT              214 Q) O7 o& N. J. u4 |! T
  58. #define TCCHEN_SHIFT                22  I& O7 y8 z8 ]+ S- `/ o! ^
  59. #define ITCCHEN_SHIFT               231 F' X0 A2 u3 O; K! u2 H2 T; a

  60. 2 s! ~/ L# [9 R3 P: f% a
  61. static volatile int irqraised1 = 0;- X# d  W( t! L
  62. static volatile int irqraised2 = 0;. Z( L" U0 ?# s; ]
  63. 0 b4 ^0 ]6 E1 i" v! v) q" Y3 f! b
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    3 ~' @) h' h# L1 g
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ }% V+ e" v- e4 b. E/ Z
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ E% R% \+ |$ T  t+ j
  67. 5 b4 k0 M! d. y5 C. T3 w
  68. dma_addr_t dmaphyssrc1 = 0;+ H& W5 c$ v+ Z* V3 Q
  69. dma_addr_t dmaphyssrc2 = 0;9 }) I9 }% n5 n3 f( ?
  70. dma_addr_t dmaphysdest1 = 0;
    * i' E6 u) @8 [+ d5 s# D
  71. dma_addr_t dmaphysdest2 = 0;
    ' u! w# x4 A  S( ^9 Z5 ]7 H! z0 T4 d

  72. 5 y2 m7 A4 i9 n1 j# q. ~: H5 C4 g
  73. char *dmabufsrc1 = NULL;. j+ P, g* K, D3 @7 T; L% N
  74. char *dmabufsrc2 = NULL;! g" w( |' b& f2 |- l: Q5 F
  75. char *dmabufdest1 = NULL;( n) P4 n) }7 [2 ?
  76. char *dmabufdest2 = NULL;' [. I* `* ~, @4 i3 X9 S4 d/ i7 j

  77. * A; A: ?, t; V: ^
  78. static int acnt = 512;
      S% g: q" \* X4 ~7 s
  79. static int bcnt = 8;* t7 Y! k2 V1 p5 c% j
  80. static int ccnt = 8;, `0 P* F" i1 ]- Q
  81. - E1 s: o/ Q6 h( e" Y
  82. module_param(acnt, int, S_IRUGO);5 B) l/ |2 N0 B: Z
  83. module_param(bcnt, int, S_IRUGO);
    4 A& X- L7 W& ?
  84. module_param(ccnt, int, S_IRUGO);
复制代码
$ \3 c9 q& H- B3 E
* q# e" k  z! S: c% L! Y. U
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 Q8 r9 g+ Q+ J9 r' M0 larm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。& Q9 t2 g4 T" L5 ]: D5 x& z( V
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ g; g# u( F  R

5 s5 e" w0 O, R' r1 k* K3 c' ?6 v9 o- d" l* e4 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-5-25 06:58 , Processed in 0.041567 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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