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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 X' m) x" G/ |# h+ `  ?
  1. [code]EDMA sample test application  m! C% t+ V+ h: }$ d7 w3 B# x
  2. /*8 ~) C' R" z4 X1 W$ N- _2 ]
  3. * edma_test.c: p" Q1 I) z! x6 T0 P- x, E4 Z2 u; {/ D3 I
  4. *
    $ E: J: \$ l% n7 P9 \( _& U
  5. * brief  EDMA3 Test Application$ l: }$ C, O' }  p. B9 n
  6. *
    5 L; e" I: p5 q4 p* e
  7. *   This file contains EDMA3 Test code.) b/ X% V9 {4 b
  8. *$ I" ^. ~+ i1 M) ?9 [
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE4 z' r/ D8 f& [# \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    0 v& t9 D9 @* W$ ^( Y
  11. *         TO CHANGE.
      W  d# h0 {0 f0 O% G; {
  12. *% R$ b7 c1 p# {9 b  a% a" |  D
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- p- X8 ^/ r! t
  14. *4 W' L$ u# D$ C% ~) d; z
  15. * This program is free software; you can redistribute it and/or' K$ _+ Z& _' {
  16. * modify it under the terms of the GNU General Public License as
    . s5 N: C& [& i8 L) f1 Z& }
  17. * published by the Free Software Foundation version 2.* E4 x2 @+ C; ?* M- x
  18. */ s: z( s; h% X' U' U: r3 C7 g+ i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any( s1 x# J* ~9 \  C( A5 J& A
  20. * kind, whether express or implied; without even the implied warranty( A% Q, Q+ g3 F/ e$ x$ H  f* q2 [
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 n' q) W0 V; |) Y, N
  22. * GNU General Public License for more details.' u) Z0 C' d1 k
  23. */& c4 D* v, ?4 V" d* }

  24. 9 f9 D+ c+ ?6 c0 p8 G6 ?/ E1 k6 @
  25. #include <linux/module.h>0 E$ _9 x  Q. T! Q
  26. #include <linux/init.h>
    9 N) p* B5 {7 f/ g: L
  27. #include <linux/errno.h>4 m& c- ?3 Y6 u( ?
  28. #include <linux/types.h>
    " z$ f" L) Z  @" o0 u
  29. #include <linux/interrupt.h>+ d+ O3 f  I6 e. y% s& P% `& J# c
  30. #include <asm/io.h>
    : E9 ~: K' T" L( R# f
  31. #include <linux/moduleparam.h>
    & q2 u) a( j1 D# S3 X; k( z" E# |
  32. #include <linux/sysctl.h>( o) I, Y9 o7 Y0 T
  33. #include <linux/mm.h>
    7 J0 M2 q" F  W. w
  34. #include <linux/dma-mapping.h>3 \* u' T4 }  w5 A- F' k7 _+ E

  35. 0 u7 U( V! |( o0 n
  36. #include <mach/memory.h>& ~" m' ?+ P0 U& F# K8 P  X
  37. #include <mach/hardware.h>, I" [. d8 T0 \, {
  38. #include <mach/irqs.h>
    0 O+ X& t7 k, v* N
  39. #include <asm/hardware/edma.h>+ z: C7 L0 q+ N7 g; u, P6 T% U
  40. & I; q4 Y  R9 O6 T8 a
  41. #undef EDMA3_DEBUG; d/ y- m  e; |/ K/ f  a! J
  42. /*#define EDMA3_DEBUG*// v, l* _) s/ F* Z4 G* p
  43. - A+ a" g) h" I  Y/ X7 k% a
  44. #ifdef EDMA3_DEBUG* j7 H; c; p9 O* |1 l/ `5 H
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    # f1 m% S& C; T; i- l4 u& W
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ) @% l; K5 ~( j( V; H8 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__): _/ J, U2 e: l9 c# P/ Q/ G
  48. #else
    " x! J1 s8 ?+ f% x3 e' Z4 j; H
  49. #define DMA_PRINTK( x... )# C0 e1 k- Q$ B, P1 g$ t4 ~" K
  50. #define DMA_FN_IN; x+ P) M- R' ^5 f- a! t! T5 j: |% A
  51. #define DMA_FN_OUT' ], A  Q" B0 v6 o
  52. #endif! Z& R' P1 x, v, d7 R) G+ f( a

  53. / T* L7 y- U* |7 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    % p. D+ }, ]1 \! g2 i/ Y
  55. #define STATIC_SHIFT                34 a# Y& t0 A6 s+ e# p5 s# j- h
  56. #define TCINTEN_SHIFT               20
    % ?% q# d* `) o  s+ k6 R
  57. #define ITCINTEN_SHIFT              216 B# \9 B3 M0 @/ R
  58. #define TCCHEN_SHIFT                22! `3 O* y! U+ v9 y6 ~
  59. #define ITCCHEN_SHIFT               23
    0 i( t0 n; `1 A5 D8 e/ i) @8 K
  60. 7 A; W2 `. _% y3 m5 |, q) u. C
  61. static volatile int irqraised1 = 0;% D4 J+ j) x0 l) i! }- B  E
  62. static volatile int irqraised2 = 0;
    & B/ v1 h- F4 O  t
  63. ! p. F% s3 }2 w+ k+ X$ J# |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 t2 T2 {7 J, `% A* N  u
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : R1 o9 Q, |5 x& C. w; {
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 f, D) s  S  |7 D4 y/ M) q& J) i

  67. , R; r, o9 g" L
  68. dma_addr_t dmaphyssrc1 = 0;" G- ~3 y& A9 _2 q* p
  69. dma_addr_t dmaphyssrc2 = 0;
    : A; k' e3 `, r2 I
  70. dma_addr_t dmaphysdest1 = 0;- F: _6 }1 J2 d. [: c
  71. dma_addr_t dmaphysdest2 = 0;  O) ~" g4 s2 o1 D" U9 L/ ~

  72. & g* R/ Q5 N( n! L8 {; S
  73. char *dmabufsrc1 = NULL;- ?/ w  b/ W6 N' |0 I
  74. char *dmabufsrc2 = NULL;# |+ X7 g4 b: g2 I* |& O3 V
  75. char *dmabufdest1 = NULL;2 L- u# ^& L& e' N
  76. char *dmabufdest2 = NULL;7 [/ k" k" N! X# N

  77. 5 q, i7 J, {9 `2 F- D0 M& Z
  78. static int acnt = 512;
    6 b! T3 _1 V% \; f: @
  79. static int bcnt = 8;
    - f5 }* ~' }9 t$ E
  80. static int ccnt = 8;$ Y& U2 y# D! r/ r; y
  81. / C/ B0 E0 b! m. j
  82. module_param(acnt, int, S_IRUGO);! k, `% b! u; `. ?6 z
  83. module_param(bcnt, int, S_IRUGO);
    5 F# n3 W4 K, V* N0 o! p! m
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, |0 A5 {; ^$ j5 ?# A. r; u1 t( C
7 ]+ U  y, A9 t3 b      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 u3 t" E! x$ d5 }" A$ \9 v
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- ?. G$ r* g4 ^: L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. q# |- H! r( y8 [& H
% F0 u0 v) U0 J9 N2 c; T2 W) Z

6 |& P& K6 Q+ A& q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-25 23:03 , Processed in 0.040787 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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