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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 }. o) p" ]8 a6 [7 t5 z5 f
  1. [code]EDMA sample test application
    * \# r4 w' S" v3 {. b' @
  2. /** l* Z( ?& m2 z& W4 I
  3. * edma_test.c: J2 p4 h8 b' ~# w2 b, |
  4. *
    / E' U1 }# S4 @2 ^
  5. * brief  EDMA3 Test Application
    " }# M9 S1 L' z) _
  6. *
    + r7 b; C  G9 E! h
  7. *   This file contains EDMA3 Test code.
    - d/ _2 p0 J5 @
  8. *
    + C# j! z( [1 ]/ N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  i& ?, Y( F; D# ]# t0 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT" ^/ D9 w0 t) w# k
  11. *         TO CHANGE.4 K8 h2 o9 X+ w3 D' X8 h4 w8 i
  12. *
    ; D0 C$ @8 X$ ?. {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ( ?! x, l/ c+ t- \5 Q" |
  14. *
    $ p) l  O& x! J8 {8 }9 D
  15. * This program is free software; you can redistribute it and/or
    5 E, X/ q9 I( m( ?9 ^& r
  16. * modify it under the terms of the GNU General Public License as
    $ L$ @3 I. D' e4 l
  17. * published by the Free Software Foundation version 2.
    ; w* ?% q$ U, o( i- @& X
  18. *
    & A  J( q7 m! x. e# `/ n4 O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    5 k1 n- B0 Y; e# u  u* A5 y
  20. * kind, whether express or implied; without even the implied warranty* E- P6 o1 A5 E% I
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . M$ A$ W% [( a/ @" |9 l
  22. * GNU General Public License for more details.. W9 ?" C  j, y1 ~2 @# B
  23. */
    ) o1 J% i8 {$ \( F6 j
  24. " k. _0 u* _+ l8 e5 F9 I/ E; ~! y% N
  25. #include <linux/module.h>
    ) v* E& w4 j* Q- O) n
  26. #include <linux/init.h>
    0 y/ F/ u  Z, m4 v* |" `. @$ Y
  27. #include <linux/errno.h>
    & \+ p/ T& n7 x( J/ u# `
  28. #include <linux/types.h>
    0 `. }- A1 Y9 R$ t( D9 i
  29. #include <linux/interrupt.h>/ t# q, U3 D( p* @
  30. #include <asm/io.h>
    - w  x& v" p8 F+ G5 G5 G
  31. #include <linux/moduleparam.h>! c6 B3 B  T  w5 A
  32. #include <linux/sysctl.h>9 c4 m( M( R2 n) l+ F, k- t
  33. #include <linux/mm.h>
    0 _4 W2 H5 s1 l) x9 Y. m: u
  34. #include <linux/dma-mapping.h>
      F0 g5 E$ ^4 }: q7 h2 n1 C0 o
  35. . M7 u1 ~6 h" ^9 |9 o
  36. #include <mach/memory.h>; l, R9 d7 i; C. l
  37. #include <mach/hardware.h>. g: n; F' B( R: E: ?9 e
  38. #include <mach/irqs.h>
    ' U. E7 g' z3 w, U9 |. w' [
  39. #include <asm/hardware/edma.h>
    / Q5 ^0 U  y; J
  40. 9 z2 \+ X7 q  w: _! a: E
  41. #undef EDMA3_DEBUG
    3 p# H( n) \7 n6 \: {. B. v( q
  42. /*#define EDMA3_DEBUG*/' h# G: f1 M9 t  D9 o2 R
  43. 6 e5 w( U5 C8 A
  44. #ifdef EDMA3_DEBUG
    & D8 A/ z2 s. r( H% |+ g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * j- _# }) o- S6 [' [" i
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 f) _( W7 s8 Y+ O0 \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)9 c3 n9 Y/ w# p& L
  48. #else4 r- m1 Z3 m# {# b
  49. #define DMA_PRINTK( x... )' E) S' w! `0 u! S* M' \
  50. #define DMA_FN_IN  b1 O( ?. V: c: ~
  51. #define DMA_FN_OUT
    ) z$ ^, d1 H) v- a
  52. #endif
    " q! u" m9 m6 f* q/ V8 J5 ?5 a
  53. 5 C. i/ _  B% o% Y$ T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    , W: b( a  R9 {: x9 B
  55. #define STATIC_SHIFT                3
    * {* n' [) ?1 E. }( P1 b; I5 U' d
  56. #define TCINTEN_SHIFT               201 O, A, o# H/ i. D* o9 L
  57. #define ITCINTEN_SHIFT              21. c% i2 J' Q/ ?0 N
  58. #define TCCHEN_SHIFT                22
    8 A3 i4 c. ^" Q
  59. #define ITCCHEN_SHIFT               23. Q9 T; c6 U( J8 n1 }  E

  60. ' T- K2 I) g" h+ @9 Q7 ^
  61. static volatile int irqraised1 = 0;
    ' ^) k, O3 W" _. M6 M
  62. static volatile int irqraised2 = 0;
    1 X: n- h* ]0 h. j
  63. 0 o# `# d6 b) h
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% y4 O, @! m8 s7 Y. `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    " x! v7 |7 }+ f. R& V8 ^
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 }' \8 W, p. V
  67. $ y% |9 y% c* q
  68. dma_addr_t dmaphyssrc1 = 0;+ x* h) t9 g& [) M( s* i0 w  K2 C
  69. dma_addr_t dmaphyssrc2 = 0;
    3 D# o# G% Q. M8 h
  70. dma_addr_t dmaphysdest1 = 0;  S& Z' j. t% c. c! z) Q
  71. dma_addr_t dmaphysdest2 = 0;8 t" e$ [. q$ q+ Z( c& `2 @
  72. ; L* ?3 x: @% Q' n
  73. char *dmabufsrc1 = NULL;
    9 U0 X1 }1 Z$ z4 Y3 P8 P2 U
  74. char *dmabufsrc2 = NULL;1 q* c, A" i" ?3 u& U7 b, j! V, t
  75. char *dmabufdest1 = NULL;7 G9 ^" M; e" B& T' X
  76. char *dmabufdest2 = NULL;
    - f4 I) e, T6 _- X5 V

  77. 8 {" }! D- D9 O5 q. Q% |" w) k( ~
  78. static int acnt = 512;
    : Q: z0 q( P/ _
  79. static int bcnt = 8;
    5 o, Z1 d: S5 Y; [
  80. static int ccnt = 8;, l2 G3 c/ l0 J
  81. + H5 R3 B$ l& o
  82. module_param(acnt, int, S_IRUGO);
    $ ^& X9 L- `7 H9 @' ], {9 {; y5 e) x
  83. module_param(bcnt, int, S_IRUGO);* B9 A( ]  d! z" d: v* M- z. \
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! f6 I: a: l  h: v2 s, }: Q0 M+ U& _
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
+ I! J& {! K9 W- t( `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ B" h- {0 ]' s) {, J$ Z     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
4 d3 j! I& k$ J
/ R/ J' [" T/ Y' N; H2 }( p. t% n$ U0 {0 x6 a+ g
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 22:10 , Processed in 0.040025 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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