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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
6 i7 R6 r/ d  g. o& W
  1. [code]EDMA sample test application. |: I5 B& b$ G$ {6 m2 U
  2. /*
    ' ~# I6 X3 g8 Z4 u# C
  3. * edma_test.c
    $ P; b& I. S( P( _' X# ^: R
  4. *
    " p: R3 [! c+ z' F& ^) P, S
  5. * brief  EDMA3 Test Application
    # {# x9 C% V6 c0 d$ c+ b
  6. *' K% {8 k! S, ^7 A- @4 v2 S
  7. *   This file contains EDMA3 Test code.
    : x+ {/ @) P: R( c0 N0 t
  8. *
    - x& D' o& `9 R4 Z0 j7 Y% t4 S; G
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 y1 {; M9 ?8 v, `2 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 R1 @( a! J' O# r
  11. *         TO CHANGE.
    / Y( H$ ]2 o' K
  12. *
    / `& x( W) `5 I1 K/ v5 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 P) ~9 l; }! B" b+ D; z. p; M
  14. */ S6 ~- e) n. F3 C# V  D
  15. * This program is free software; you can redistribute it and/or
      @7 M" F+ n( W! p: A8 d& A
  16. * modify it under the terms of the GNU General Public License as( e; v3 z' f- V  K  m# O
  17. * published by the Free Software Foundation version 2.7 o9 r5 u5 H4 }8 L; x4 T
  18. *; N( s9 e( W. _2 P1 _( E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any, S* A. p  H" X+ C4 t4 A
  20. * kind, whether express or implied; without even the implied warranty6 M2 O0 W2 m3 E% F
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) m5 R- Y( m" r/ `2 Y4 [" U
  22. * GNU General Public License for more details.2 k  r4 p9 r4 w- e# u
  23. */
    % B/ T' [; t# n+ j

  24. ! o9 V  ?& P$ y4 u
  25. #include <linux/module.h>
    * a3 g3 ?+ Q9 t0 p0 E* W
  26. #include <linux/init.h>
    / D" F, b) _; M) `, G
  27. #include <linux/errno.h>3 s% v7 P( c  M1 ]2 |9 {. Q+ W
  28. #include <linux/types.h>( w6 L( c4 v! I( ^
  29. #include <linux/interrupt.h>
    ! N3 |3 w/ f6 q3 |( D% \# q
  30. #include <asm/io.h>/ }0 D$ T* i# l" d2 A6 s3 W
  31. #include <linux/moduleparam.h>
    3 e7 E) v; B5 P8 W
  32. #include <linux/sysctl.h>
    3 K4 ?0 X% b% L! W! ~
  33. #include <linux/mm.h>
    0 C, j1 R6 J: t: i7 T
  34. #include <linux/dma-mapping.h>& ?5 L" ^: ]& p9 ~" V4 h3 T

  35. 5 R4 W3 l" N5 H4 j% D
  36. #include <mach/memory.h>4 g# S8 K) [# A# K
  37. #include <mach/hardware.h>( Q( m; n8 A( N; D3 g5 K! i6 {
  38. #include <mach/irqs.h>- ]5 h) h9 o  i* a4 k7 O1 i
  39. #include <asm/hardware/edma.h>0 B( u$ A( e, F/ e

  40. 2 a: }9 x  n6 V, t+ e8 w
  41. #undef EDMA3_DEBUG& F9 p" I* J6 z2 n# Z) M7 Z5 h2 u
  42. /*#define EDMA3_DEBUG*/
    $ @) o! R3 E9 ?' |. H5 R# I# p
  43. * n' c+ k2 c& \; P5 {( V7 {# Q
  44. #ifdef EDMA3_DEBUG6 T( f7 a3 d7 L0 ]5 ]+ q( K
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ) W; K+ Z1 U, p4 l( g, i! b5 O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    " w/ C8 O7 @0 k9 {: Z- B# }' Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- u, k# [; X- m8 j  _
  48. #else
    + D5 K7 p5 e! \. j$ S& y
  49. #define DMA_PRINTK( x... )
    5 p; b+ I7 e6 B1 I  K7 Y6 D
  50. #define DMA_FN_IN  S8 }" U( J, J
  51. #define DMA_FN_OUT
    0 R9 W: B6 i. H/ E7 W
  52. #endif$ Q+ q0 b) g) M" r& N
  53. ' G' Y$ }' P+ i4 O: H
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + [; ?+ y6 ]& {4 ^
  55. #define STATIC_SHIFT                3
    : }) a! H& U0 N" l
  56. #define TCINTEN_SHIFT               20% Q! C7 k1 ^' B0 _9 M2 Q4 z
  57. #define ITCINTEN_SHIFT              215 y" Y3 R' \, O& b. V& f, z
  58. #define TCCHEN_SHIFT                229 E0 [3 I, f: m; a
  59. #define ITCCHEN_SHIFT               234 E, @2 m7 S  D6 v/ D
  60. ) l8 P3 ?0 h+ t0 Q) m1 T' [" O
  61. static volatile int irqraised1 = 0;
    5 `/ D  J# ]5 ^/ n; r( B5 l
  62. static volatile int irqraised2 = 0;% B* B2 w2 z7 r% N. v9 @
  63. ( U, x; b( R$ q/ B0 Y' g+ e
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 s! N! l8 T6 G0 A, H
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    2 ^! [$ A& g+ i2 u1 S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% @3 v1 a" E( X4 n- ]  `5 ]
  67. & E# M$ S. B4 i
  68. dma_addr_t dmaphyssrc1 = 0;
    $ ^7 V4 |# k- C* m7 q( O8 e
  69. dma_addr_t dmaphyssrc2 = 0;
    # l: l+ Z# z) M2 s
  70. dma_addr_t dmaphysdest1 = 0;
    3 n5 g: D8 C6 c/ F) k) B% ]
  71. dma_addr_t dmaphysdest2 = 0;
    5 S$ ?4 A) I. e2 f; z1 c

  72. : L) v6 }. Z; J8 s1 A, U' U
  73. char *dmabufsrc1 = NULL;$ P# ]! [5 v- W4 j$ ]
  74. char *dmabufsrc2 = NULL;
    : f% }- ~% ]$ ]: T& f: m& n' u& e2 K1 p
  75. char *dmabufdest1 = NULL;  m, V6 u/ R) U" W
  76. char *dmabufdest2 = NULL;
    " p+ A3 f$ n- j- l9 s0 ^
  77. 2 r6 J4 W, P. A; J" J
  78. static int acnt = 512;, P; P: @# f9 Z, X: F/ n* U  q
  79. static int bcnt = 8;
    ' |3 B" a9 a- s6 A0 r* f+ a
  80. static int ccnt = 8;
    8 w+ ^, V' {! F! a. K/ @1 q
  81. ( d, ?8 O5 T0 d" {8 O! J
  82. module_param(acnt, int, S_IRUGO);
    * r/ f3 @  A5 Q# k
  83. module_param(bcnt, int, S_IRUGO);
    3 J. m& R/ D! u9 Z  L# e
  84. module_param(ccnt, int, S_IRUGO);
复制代码

* W* ?  i1 h9 T" @' `  u3 p, ~6 [) U+ B- ]* j/ O  ^
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ e" D* Z# y. z' q
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 C- S% \& B0 x3 W) C( U     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
( I8 z, X8 }; I/ y
& J+ I. e0 o+ L+ Y7 A; l
, b) e+ _6 m* X7 X
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-31 06:16 , Processed in 0.039062 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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