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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. A5 i. U7 A' j- l9 Y) n$ B
  1. [code]EDMA sample test application9 v* E% g- ^: E7 x  D4 C' j
  2. /*
    ( n& `; Z! g" c6 \6 `5 q5 o7 I
  3. * edma_test.c
    6 u" y; W$ U7 Q& R) O* ]
  4. *
    ! L/ _) S1 M) g$ z- ~% L+ {4 M1 g* d
  5. * brief  EDMA3 Test Application2 w' }% I" X3 W5 [! v4 n7 J& l! Z
  6. *
    . B. {/ V, o) h6 A1 Q$ @
  7. *   This file contains EDMA3 Test code.
    ' t6 k% ]3 h: S; Y
  8. *
    8 b; x* L* u* y5 _9 ~1 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) M! R* ^0 R# V9 H* h
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT3 j$ l3 \: p8 d) S  s0 N: s
  11. *         TO CHANGE., f" w" R/ `) t* s+ i( B
  12. *
    . D4 ^: @$ b9 U/ E
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    2 g: \( _- M" g
  14. *
    , k0 B1 c; k& F) {& H/ ?2 d( q
  15. * This program is free software; you can redistribute it and/or
    4 F! U& v. \2 t* b
  16. * modify it under the terms of the GNU General Public License as1 ]+ ?; \" p( t2 s9 s. @' J0 D0 I) ~
  17. * published by the Free Software Foundation version 2.
    , Z0 S/ Y/ V5 e$ u
  18. *
    2 ^5 }$ W/ r2 H3 o! o" S: B
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 f; ^4 ], l8 [, z2 G
  20. * kind, whether express or implied; without even the implied warranty
    * ^2 s6 W1 \* Z3 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) j! G% z; b9 ^% L9 p3 H* b) ]
  22. * GNU General Public License for more details.) C5 k- q$ H' ~/ S7 s6 j
  23. */
    : ?4 I2 g7 i8 k2 ?' O1 J4 j

  24.   w( i. M' d  Z) A# A
  25. #include <linux/module.h>
    & l9 ]6 H( j5 o  g2 w
  26. #include <linux/init.h>: j. b# E7 c/ G4 Y9 X
  27. #include <linux/errno.h>
    1 K% G: X8 \/ N: `. s* K& e
  28. #include <linux/types.h>
    5 l6 P: d/ d( z4 K6 N  \) |; A
  29. #include <linux/interrupt.h>7 W! P! w5 e! V" J$ o) A3 w
  30. #include <asm/io.h>
    5 A- L& y8 q6 S* O2 N% V
  31. #include <linux/moduleparam.h>
    ! q6 m; f" h, x" k8 H% p9 `5 h
  32. #include <linux/sysctl.h>0 X* E  I  V* w  X& R
  33. #include <linux/mm.h>
    ) B/ X$ r4 T3 Y/ z4 L) }3 l
  34. #include <linux/dma-mapping.h>/ p9 q$ Q% X( b

  35. 1 J1 h, g  C. `) s4 O5 |! q
  36. #include <mach/memory.h>+ i3 w* e& o! o) J$ B5 l0 |
  37. #include <mach/hardware.h>
    % p% C) ]( L  @9 P5 M& p$ z
  38. #include <mach/irqs.h>
    6 R3 Y5 ^7 D- O$ N/ g
  39. #include <asm/hardware/edma.h>
    " c- f) E& [4 G
  40. 4 n" M# ?: R2 @: v
  41. #undef EDMA3_DEBUG' s9 [. n) U7 k" X$ V; f! R- ~& X. L
  42. /*#define EDMA3_DEBUG*/
    ' g6 j( K( h5 f5 Y

  43. ( f3 m, K$ d$ m' w' h
  44. #ifdef EDMA3_DEBUG1 f+ H& u6 _) @, V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) Q; W4 k. `6 Q: y8 A
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; \0 o  B1 {# Y! _0 f! m1 y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # x, Y- }2 b% {6 H6 ?
  48. #else
    ) @, \( u" C$ j& N
  49. #define DMA_PRINTK( x... )
    3 j; |; Z6 y3 _" [. T
  50. #define DMA_FN_IN
    5 w( \$ f) y4 E6 a3 Y
  51. #define DMA_FN_OUT
    8 g2 O& F6 o9 B1 F
  52. #endif% `1 ^5 }' R3 A! d8 c: l7 H
  53.   C1 W% e* Q: X! ^1 s6 B: |2 b5 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ V- {' Y4 [7 y9 Z+ r$ ^
  55. #define STATIC_SHIFT                3- |0 h' t# Q& N8 M& D! b/ A, T
  56. #define TCINTEN_SHIFT               20
    - V% k7 m7 t! M& @# b
  57. #define ITCINTEN_SHIFT              21
    # t5 s. ]* I# W, N
  58. #define TCCHEN_SHIFT                22& i' T, t  G7 X/ e! ]; M& ?0 Q
  59. #define ITCCHEN_SHIFT               23
    # g% ~! p1 E% p  B5 @
  60. ! ]5 T- d5 X- G& |* i4 g8 Y& y! ?
  61. static volatile int irqraised1 = 0;
    9 u1 r) d# m7 C( _0 v3 N" M
  62. static volatile int irqraised2 = 0;
    ; m1 O% o2 Q& d+ \# K. [

  63. 9 K5 }( H6 E) |7 ?# C& e" g) M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - c" J7 @# v" S$ N' \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # l5 k* w9 Q" e( x7 N1 O
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 Q  L0 ^9 `6 I
  67. 0 F: _& I5 Q4 g# A/ l
  68. dma_addr_t dmaphyssrc1 = 0;4 Y, d6 t7 p( k, r
  69. dma_addr_t dmaphyssrc2 = 0;
    1 G1 _' u8 B* Z& x# U; }0 |
  70. dma_addr_t dmaphysdest1 = 0;7 t- Z6 N/ |) \: H  Q" L6 U
  71. dma_addr_t dmaphysdest2 = 0;
    & s( D/ i1 i1 I  [! Y: ^3 H, u

  72.   G& J" D; [+ I0 a# g
  73. char *dmabufsrc1 = NULL;3 r6 v2 j3 _3 f6 V
  74. char *dmabufsrc2 = NULL;; s, P) j6 q* z; A9 l, r
  75. char *dmabufdest1 = NULL;
    & X9 K6 i. H0 m) \- i
  76. char *dmabufdest2 = NULL;
    8 k- }% w3 b$ o; K( C1 V
  77. 4 c6 T' [) @* }* U/ h/ k
  78. static int acnt = 512;
    ' b6 S( L: K: \& ?3 V* e$ }
  79. static int bcnt = 8;0 n' z6 ^" D" S+ @3 p7 z. f
  80. static int ccnt = 8;& @5 C) u9 b4 h" |( l* k

  81. 8 Y5 d9 L5 p1 F/ [  T: N! U
  82. module_param(acnt, int, S_IRUGO);
    , Y1 O# m4 R9 y  {6 `4 _
  83. module_param(bcnt, int, S_IRUGO);
      }# t2 e' S7 e1 {
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- a! o3 D5 v) w/ V8 |4 x
* f1 t" d+ a; Z! w5 f; O" e! [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
  p( V: K, K- Farm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 \7 f2 M1 E0 f
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。& C9 y. t3 n9 D$ E
4 S3 B9 U$ V6 S. v! x4 [
6 M! G4 l0 b9 B) j" M) \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-8 12:50 , Processed in 0.039461 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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