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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
/ J* v! N/ j. d8 I! d
  1. [code]EDMA sample test application
    7 E: L8 R+ L: @0 i8 `2 m
  2. /*6 Y7 C2 t& l) S* J) }, [  i( |8 u
  3. * edma_test.c
    ; e- V* G- _9 [$ ~3 M3 d
  4. *
    8 b" ]+ ~5 ^7 `3 i- h& e' I
  5. * brief  EDMA3 Test Application
    , ^1 t4 F! c! {" g/ ^
  6. *# |3 {" F# a( P% `: I) @/ V2 W
  7. *   This file contains EDMA3 Test code.
    ! K6 M; F/ }# W" n4 {! G
  8. *
    ; K  v* _" {: R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE( l! Z% H" G% Q) C" H( [, u
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # Y# a  `5 ?) Q
  11. *         TO CHANGE.
    8 r" N* h* C, j$ O- y4 u- @
  12. *
      a3 p0 e: E+ V5 L
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 g% N- w( G$ ^  L4 ^' G7 Z
  14. *) b( A7 X$ C, ]0 d# d7 y6 t
  15. * This program is free software; you can redistribute it and/or
      p5 t% t; u7 t5 U/ j! R( K
  16. * modify it under the terms of the GNU General Public License as
    # w- j4 Y2 `  N* Q0 r
  17. * published by the Free Software Foundation version 2.' a2 F& Z6 i- M+ q+ g! ~
  18. *; `  }8 a9 |; Y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, d% I; n8 x, L& q1 K( F. k- I
  20. * kind, whether express or implied; without even the implied warranty
    8 J/ F4 O# D' ]0 `; l3 x
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    : j& n: C" W2 L7 ^: L: L. A# @
  22. * GNU General Public License for more details.0 E1 l+ m. @9 H! _: h9 b9 Y! ]# K$ |
  23. */
    4 B) D! S. G' }- N) o9 ^
  24. - {4 ?. E" E5 t  J
  25. #include <linux/module.h>
    ) b+ a4 d2 a: m  Y
  26. #include <linux/init.h>0 x; C8 A' ^" Z, k1 z0 Q5 m
  27. #include <linux/errno.h>
    ! o. j7 |( r) n* `9 y/ v
  28. #include <linux/types.h>
    - y2 M5 \4 q7 u
  29. #include <linux/interrupt.h>( X2 t: Y$ s4 m3 w- T( a
  30. #include <asm/io.h>
    # j+ Y% Q: z- F8 {/ n
  31. #include <linux/moduleparam.h>4 x- a0 Y* m: E- K9 C
  32. #include <linux/sysctl.h>
    7 s# g( d% O: H. `; a
  33. #include <linux/mm.h>" X" H' J. _( N# v! l( X2 L* Q
  34. #include <linux/dma-mapping.h>
    ) q# d2 \- U1 {7 D% w3 `# _( i

  35. ( i/ B& ~4 V3 c. d  O6 \
  36. #include <mach/memory.h>. C+ C1 e6 a; @! a6 u
  37. #include <mach/hardware.h>  H4 n+ `0 N% t0 Z, p
  38. #include <mach/irqs.h>
    + n; K. Q( y) G3 g0 H
  39. #include <asm/hardware/edma.h>
    / M$ |* _3 S# G  j
  40. 6 M7 V' f# I) c; k3 |+ Q$ }5 b
  41. #undef EDMA3_DEBUG$ b; y" a3 V' v$ P
  42. /*#define EDMA3_DEBUG*/
    0 W  I" Y9 z: n8 j
  43. & v" A6 X/ z6 |3 G# X& K; z3 z
  44. #ifdef EDMA3_DEBUG) J0 X5 c! t  T6 `* I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    9 ]6 p8 Y: R# j- M0 z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)9 U1 {! C1 ]7 r6 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 i+ |& c7 F# R7 B; U7 e
  48. #else
    " d4 e1 C$ ?" }9 b  M; a/ P
  49. #define DMA_PRINTK( x... )" \4 z5 a( C# k: S
  50. #define DMA_FN_IN
    $ `2 a; x/ ^9 v, d0 v
  51. #define DMA_FN_OUT
    # Z6 O1 |9 L" V) K* T8 D9 m
  52. #endif
    # P5 n0 a, ]7 B3 {# O

  53. ) x: m$ Q% A, b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    5 A; E& ^4 W2 K* }" ~
  55. #define STATIC_SHIFT                3
    9 a% x6 [0 i1 J; s" E. M1 g$ o
  56. #define TCINTEN_SHIFT               20
    8 S$ X* Y- a. Z1 w/ C2 u
  57. #define ITCINTEN_SHIFT              214 |* L) m* J" H8 V6 [1 y
  58. #define TCCHEN_SHIFT                22% D" s0 a* C8 d
  59. #define ITCCHEN_SHIFT               23
    : q  d0 G  |5 T3 a& |& Y! Z/ A: }
  60. 0 z0 d* v( L* G% o* X) W5 ~' t4 h
  61. static volatile int irqraised1 = 0;. X+ y* E8 ^' B# b2 o3 o
  62. static volatile int irqraised2 = 0;
    , g* y: U, F2 X/ w  ?, _
  63. 6 |6 a; c, ?- R  ?% O; ~& b: @& A
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);- w$ w- b3 E: U  Y: p6 R- L% x
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ( ?' F) s: e; w2 H
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 T3 S  ]7 E/ F
  67. + V# f6 z' V* ]9 L; z) Z  ~
  68. dma_addr_t dmaphyssrc1 = 0;
    - I' c+ Z+ L. g3 b1 s5 z! r
  69. dma_addr_t dmaphyssrc2 = 0;% Y; f2 X) K  k- X
  70. dma_addr_t dmaphysdest1 = 0;
    # j$ X& o$ w& o! z$ g3 [
  71. dma_addr_t dmaphysdest2 = 0;
    2 X, Q8 x& J& b" o3 k. q

  72. 2 a" o; v5 ~4 {8 P
  73. char *dmabufsrc1 = NULL;
    7 X9 c% y1 o! ]$ |  A- @
  74. char *dmabufsrc2 = NULL;
    8 r7 N4 e2 d/ ~4 j; Z! O
  75. char *dmabufdest1 = NULL;
    * O* [( x6 B% C' N! S
  76. char *dmabufdest2 = NULL;, j% E/ D& r8 w% ~
  77. 0 w! \3 A% L4 A, h9 U, |
  78. static int acnt = 512;# Q3 n* W2 K; e' M2 U4 S  s2 n" k
  79. static int bcnt = 8;
    ( A2 [7 ]9 Z; d  |  L' k
  80. static int ccnt = 8;, |7 e3 r2 C) c1 }4 U

  81. : t; D- n8 h/ s( w0 E  F
  82. module_param(acnt, int, S_IRUGO);; _, R+ y$ I3 @0 C
  83. module_param(bcnt, int, S_IRUGO);+ ^( I+ l0 U: c5 }: n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
" Y2 Z9 ^' ^* x* d( Y6 r, ^* a
+ q3 L( D8 [' Z( `( ]: L' K& ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  G* Z6 o2 g. S. N; m9 qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: N4 a# \: @# E3 E4 B
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: h$ n0 t6 F) O+ I) G6 R2 o+ v+ X! [" ]" E$ C

$ D, b, X& Y  y9 c" q) O; l
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-22 15:01 , Processed in 0.041906 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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