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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
0 o" l% P9 |& d& j& q
  1. [code]EDMA sample test application- k9 M+ `& k7 r: [) ^% s
  2. /*7 P( Z# Q  R/ e
  3. * edma_test.c
    / X) s" H8 h/ C$ R% S  Y
  4. *
    , |) y8 i! T, V) `
  5. * brief  EDMA3 Test Application% z/ P3 m8 t& H8 Q9 i
  6. *
    $ s( t; z- Q" k8 E* H. u% @
  7. *   This file contains EDMA3 Test code.
    ) z9 F4 a. }2 ~& W" {
  8. *
    3 x$ u+ O+ ^  v, X  g* H% g* X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) S3 Q- E7 z# {! K5 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    5 j/ s+ W. }- _" R9 e4 A
  11. *         TO CHANGE.
    1 D. m/ p( K, E; C
  12. *- O$ v6 S" d: l* L0 A8 |( Y# V
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/$ Y; f" h( Z# K4 s
  14. *
    * m+ @& i) z3 j. g* ~3 s, M
  15. * This program is free software; you can redistribute it and/or
    # Q8 A. `' g* Q
  16. * modify it under the terms of the GNU General Public License as
    9 C  D! ]% f/ `2 F
  17. * published by the Free Software Foundation version 2.
    4 A: f+ p0 R6 S
  18. *
    * V5 e* o+ o1 o, H& h3 }' R
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    % B3 i# p1 I, R9 o
  20. * kind, whether express or implied; without even the implied warranty
    6 X6 R0 j* y  ^0 w; Z% H) i! }
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the1 ^- u3 _- G7 M: z4 P: o2 {4 K
  22. * GNU General Public License for more details.$ R) Y/ k  {: I& K) [
  23. */
    8 a- X) T& Q3 s8 }$ V
  24. % I8 c7 z& R* [/ k7 D
  25. #include <linux/module.h>
    / M% h" h5 W; A
  26. #include <linux/init.h>
      e$ Q" A! u" V3 q9 N6 h! n8 y
  27. #include <linux/errno.h>5 R/ e8 D/ F! i# _
  28. #include <linux/types.h>
    - R; |( }% M6 N' ^% c
  29. #include <linux/interrupt.h>9 q5 H4 B. G7 Q: A" q( N+ l
  30. #include <asm/io.h>4 ^& l4 d+ x( n& I
  31. #include <linux/moduleparam.h>+ d9 R* R# e# ]% o1 h- h' R
  32. #include <linux/sysctl.h># m: c" l6 p8 a! l3 V
  33. #include <linux/mm.h>
      y; y2 X% g( Y6 Q
  34. #include <linux/dma-mapping.h>" _$ i" j; r9 S% c
  35. 9 B) o+ d$ U/ E' K  G4 M
  36. #include <mach/memory.h>
    7 e4 A1 e9 v$ S4 E: \" z* s
  37. #include <mach/hardware.h>9 z0 q' s: o/ m. G3 m8 y9 ~
  38. #include <mach/irqs.h>( V: `0 h) p% ]
  39. #include <asm/hardware/edma.h>
    , y/ _: a3 m. t2 x0 j2 y

  40. 1 y, h6 _/ A; \
  41. #undef EDMA3_DEBUG2 S9 \$ d. i" k
  42. /*#define EDMA3_DEBUG*/
    & K( R: H0 c/ f

  43. ; ?0 y" m; Z" x! {  p5 Z
  44. #ifdef EDMA3_DEBUG
    1 U4 n! B. w! m- _7 F. h" \
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)& f+ h7 c0 \* ~, Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    0 g) ]- t$ L2 {1 M( W% {) [+ h
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    * W1 @5 o. d% G$ r
  48. #else
    9 z0 x3 j' s5 e; d
  49. #define DMA_PRINTK( x... )
    " n7 D  q) A# D' s& P
  50. #define DMA_FN_IN, L: E8 p& Y; t1 U+ c! M& q4 Y8 J
  51. #define DMA_FN_OUT
    ) q1 `) V- N1 S0 g
  52. #endif$ Z& A/ Y1 F' a+ X" {

  53. * @3 M5 ]2 a1 @1 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ m7 V& [( J9 U, _
  55. #define STATIC_SHIFT                3$ Y+ b) C" r: f: N) R
  56. #define TCINTEN_SHIFT               200 _# C5 q' t4 p/ h
  57. #define ITCINTEN_SHIFT              21
    - _7 e, d4 P- A  u; _4 S, N
  58. #define TCCHEN_SHIFT                22! `1 J: F' g$ M+ Y* Q/ R
  59. #define ITCCHEN_SHIFT               23
    + L2 |$ b. S% b
  60. $ p, n! a+ D/ M& p
  61. static volatile int irqraised1 = 0;
    % I! V& R/ x! _- t" y7 N
  62. static volatile int irqraised2 = 0;
    8 a; R; ~! U+ I, H+ m) N

  63. , G0 h: P9 X4 ~! ~8 L  [/ ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ L# I$ }+ m) b0 Z" ], a3 {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' K2 E" u, a+ H! }4 `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( {# K& C, S! ~  F0 N

  67. & Q* V& o& l$ p5 e; W
  68. dma_addr_t dmaphyssrc1 = 0;# }4 X# t4 n0 q; @# F
  69. dma_addr_t dmaphyssrc2 = 0;: ?4 E; R. z4 _( j, U* Y: v( C
  70. dma_addr_t dmaphysdest1 = 0;
    4 u+ p( o* j, U: ^2 i, n! E( H
  71. dma_addr_t dmaphysdest2 = 0;) ?' y7 T. F: L% |" g/ F
  72. ) |% w6 k, b4 O5 ~1 p$ c8 `
  73. char *dmabufsrc1 = NULL;
      i2 j+ P! t1 P  i
  74. char *dmabufsrc2 = NULL;% Q2 U% D- z4 G% f1 I( Q9 c
  75. char *dmabufdest1 = NULL;4 D% g$ [% o% t, q/ s
  76. char *dmabufdest2 = NULL;
    & b$ {' F& f9 Q. t: G% s% f5 M+ C
  77. + i: ]' V( u. q
  78. static int acnt = 512;
    : }8 T; ]( p" O, V4 A
  79. static int bcnt = 8;
    4 V4 v2 C3 Q( {. o) |  N
  80. static int ccnt = 8;+ P8 ?' P$ w0 t6 m8 O) a* A

  81. : h2 G& r9 o* a
  82. module_param(acnt, int, S_IRUGO);/ k( M/ [' n) }* y/ F! o
  83. module_param(bcnt, int, S_IRUGO);
    1 p6 t( m1 v0 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码
, ?6 V9 q, ?1 C% E8 n) t
4 j: Q8 w: ~& f9 ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用9 Y) |  L: j+ f/ b0 O1 ~9 ?
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- K5 z/ I: G; W1 n2 y+ k2 i/ b" n3 Q
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 ~1 x% N# ], D( e- ]- E( k
5 R: Q- k, \+ Q. Q# A

/ m4 y/ M& ^8 |$ m
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-1 23:06 , Processed in 0.040537 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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