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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' \. [+ Q0 _0 E5 D& }( P. G
  1. [code]EDMA sample test application  F3 w6 g/ A6 @9 T
  2. /*
    % J. {8 Y7 H/ o' W# M" {' H* P) o
  3. * edma_test.c
    % h* d$ \  C+ q* P" V+ I: y
  4. *
    9 ?! I: Q% L6 [/ @! I5 u
  5. * brief  EDMA3 Test Application
    ! K4 _4 v5 e  A4 [
  6. *" o! t! N0 H, H" Y
  7. *   This file contains EDMA3 Test code.
    2 ~0 W4 p1 e* g; f8 S+ v4 l
  8. *
    / f' b3 b$ m) p  V7 i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE/ y: Q1 M+ }- T' K
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    . t3 F2 `# C, s& P  _9 c
  11. *         TO CHANGE.  t: C0 X9 W$ J& ^# P
  12. *
    9 i$ @7 A! n- u) d5 Y) u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/# L6 Y0 i4 A  ^1 K# W4 `4 o0 N
  14. *6 m6 E! }4 g8 K6 ~. T& p# r
  15. * This program is free software; you can redistribute it and/or
    3 o0 ^# G# _1 W/ h( j
  16. * modify it under the terms of the GNU General Public License as
    ) J* P. r' B9 Y. b$ E/ l
  17. * published by the Free Software Foundation version 2.% o5 s3 Q) i# l; i0 e. c
  18. *
    + L+ e( W1 D+ a5 @# N
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 x$ s% I9 e: ?: l
  20. * kind, whether express or implied; without even the implied warranty
    ! b/ K: w  v) ^& C4 y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ y- I5 Y% A" U4 N
  22. * GNU General Public License for more details.- h1 V) x, }5 v- S0 |
  23. */# a/ b9 f# r+ Q, t0 @" i1 s
  24. 2 Z2 o, {0 W1 z/ j
  25. #include <linux/module.h>$ w- K) n3 W& Y$ A: z" h
  26. #include <linux/init.h>  A2 I0 @- L% H& J. O& P
  27. #include <linux/errno.h>
    4 t% ^. f- f/ u& Y: g8 \, S/ q- C, Y
  28. #include <linux/types.h>
    8 r0 G1 b. x+ m3 E( K
  29. #include <linux/interrupt.h>) H7 b9 g8 i! T) L6 [% T1 V. c
  30. #include <asm/io.h>( E) p% C# s5 y7 B! K' X
  31. #include <linux/moduleparam.h>
    ! Y8 j. L" X# g  R3 x; k6 ]
  32. #include <linux/sysctl.h>
    9 k2 w1 M/ S8 T" `
  33. #include <linux/mm.h>+ s1 I2 n7 o$ @" y8 @
  34. #include <linux/dma-mapping.h>9 V1 Z  X" d1 U7 i8 D

  35. * ?* q/ `# H2 {# h0 k
  36. #include <mach/memory.h>
    5 ?+ [/ N% r  D& g8 d. h; c+ k
  37. #include <mach/hardware.h>
    ; p, m5 r1 N: _3 J
  38. #include <mach/irqs.h>
    $ p3 I) Z: Q0 x& f5 Y) n
  39. #include <asm/hardware/edma.h>
    8 g' T1 @9 ?- l: g

  40. / L; m* r6 x% K9 |
  41. #undef EDMA3_DEBUG! T3 A' G/ \3 s% n6 N9 P
  42. /*#define EDMA3_DEBUG*/* O! T2 j; a8 J* W' q" c) \' Q6 t8 x( a

  43.   s/ N" _  x, m( X  c7 x3 `6 {" |
  44. #ifdef EDMA3_DEBUG) o9 c& |* y; k( d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)' F' q5 g; a* P  m
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)0 i8 s: N: v( ^) `4 ~- B$ Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      w5 {. b; O3 }+ s
  48. #else
    $ f; g, z: g# C- D5 Z" ]6 O# \
  49. #define DMA_PRINTK( x... )7 g/ E5 C- _! M) u$ W9 I
  50. #define DMA_FN_IN
    4 v; u1 s1 y6 n, ?, E) }
  51. #define DMA_FN_OUT
    0 u% ~" y+ D4 m3 Z1 _
  52. #endif) l' k' @5 ~! ~" {- `
  53. ) K' _) t7 D( d1 H6 |
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)4 W% n3 M" Y2 p8 z
  55. #define STATIC_SHIFT                3. q: o1 i7 q4 N! g0 N- M' f2 L
  56. #define TCINTEN_SHIFT               20
    ( K; a1 R" H8 H; O* V9 j! `
  57. #define ITCINTEN_SHIFT              21
    $ `; u' |! f. n' n: }2 N, r
  58. #define TCCHEN_SHIFT                22
    1 Y2 r+ n- ?# F4 j) |$ |
  59. #define ITCCHEN_SHIFT               234 [+ ^( U1 r3 X4 v& x
  60. # l. \: Y: v1 E+ R. K; m: r
  61. static volatile int irqraised1 = 0;
    ; x2 ?! W& b' o4 d& |. B
  62. static volatile int irqraised2 = 0;8 q. X% e3 _5 @8 I

  63. : S& O+ ^, N; X9 r# B+ B% a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ [8 l5 T4 p' P3 t: t% ~2 T
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 c0 ~* ]& N" J% `
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ G% T9 j4 c7 [3 [; |
  67. $ v: W0 W4 ^( I! O% |
  68. dma_addr_t dmaphyssrc1 = 0;
    7 \4 n" A3 s9 a  [5 R
  69. dma_addr_t dmaphyssrc2 = 0;/ V; \' i9 Z  ~7 _5 J+ o  x
  70. dma_addr_t dmaphysdest1 = 0;5 y5 E8 k6 y5 ]* ^0 l/ c5 R  K
  71. dma_addr_t dmaphysdest2 = 0;
    3 }; Y' Z3 t( v* Q

  72. * b4 X- `; w1 G( w0 n
  73. char *dmabufsrc1 = NULL;
    : I! S* b$ T9 e
  74. char *dmabufsrc2 = NULL;
    + i. ?7 `$ f8 s# n
  75. char *dmabufdest1 = NULL;
    + q! r+ n* w' |0 k) ?+ s" X, v/ u
  76. char *dmabufdest2 = NULL;% P  n. Z% g' F

  77. 8 e! r2 b4 l4 C. x6 N7 [" \6 c
  78. static int acnt = 512;3 z8 m9 ^( B/ m5 t' V+ L% C' _3 J7 T
  79. static int bcnt = 8;
    , b1 g9 i3 \  k& F
  80. static int ccnt = 8;# |/ I5 u9 @2 Z9 U2 P8 t
  81. : L3 E2 @! C& L+ f# Q* Z
  82. module_param(acnt, int, S_IRUGO);
    $ H( L3 @9 A2 Q! w( _: ]
  83. module_param(bcnt, int, S_IRUGO);+ P: P5 R8 f( L: F' B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

% _+ @* v; H! G, t& V6 B5 Q
# ~1 n8 l( ~% n$ f; c8 n' [      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ N9 }1 J7 F& `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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 r. Z2 k- y4 g( A+ S) w: L% |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。1 C0 \; R! H. {1 p0 p
  n% |# u/ j3 }- b0 N+ J, r
3 P0 }; p7 N& Y6 t" W: p( R
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-25 09:40 , Processed in 0.040804 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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