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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & d0 p' R3 ^8 J$ A* h: L0 z5 d. Q, y
  1. [code]EDMA sample test application' s1 h9 m5 J3 K8 H) p
  2. /*: p  r) x. V! `6 F# f
  3. * edma_test.c6 L6 V, o% S6 s4 x4 H6 M+ Q
  4. *
    9 p/ l7 g8 y7 e, ]/ M% b3 j% |' Z8 R
  5. * brief  EDMA3 Test Application2 C5 [5 W3 }, A/ ~. W
  6. *' }* C4 L5 O0 G# Z- @
  7. *   This file contains EDMA3 Test code.
    ' t0 O. }- R. x2 u9 K
  8. *' a( R% F5 K! q+ b  Q6 i2 m1 }3 `
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    / j& e/ i# b6 K0 E' Y4 n
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ F: o, y3 i! Y* |0 t0 y& k
  11. *         TO CHANGE.4 _) a7 m" N3 z
  12. *7 r* a, c! \0 ^  _1 @
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    5 Z/ ?+ }9 m( X% q
  14. *. x, E; i7 g( I5 A: V" l
  15. * This program is free software; you can redistribute it and/or
    4 b" a+ b5 W; l4 j! g: O& r
  16. * modify it under the terms of the GNU General Public License as( x& f0 y, [2 ~( h( f( `% m  l/ p
  17. * published by the Free Software Foundation version 2.
    3 o0 U9 m3 e9 _% G: D, L7 R$ C& p9 ~
  18. *; J# |: x9 r1 |1 E( B9 x& Z8 }; ~
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any: n; M4 D7 ]% y! x
  20. * kind, whether express or implied; without even the implied warranty5 n- G( V9 M$ f9 s& ~- L$ O( O
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the) m8 _$ i& M1 Y5 s9 a6 v
  22. * GNU General Public License for more details.
    2 g' M1 M+ T$ z# P" V, ~
  23. */
    % ~8 R$ x% F* ]5 [0 x0 J8 O& T

  24. $ H* x( r6 N6 D+ ], G4 d
  25. #include <linux/module.h>6 l: `: x7 k+ u0 f! e  I/ s
  26. #include <linux/init.h>
    ! F6 \. d( c4 S+ O& I- A
  27. #include <linux/errno.h>0 W1 D5 f, j7 v! r$ b2 x2 K
  28. #include <linux/types.h>
    % W" s2 |- {& E" P- o) q7 R! \
  29. #include <linux/interrupt.h>
    ) n6 C" B9 I  p; l2 ^
  30. #include <asm/io.h>
    : s% s0 P1 V! e' S  _5 ?0 ]6 }
  31. #include <linux/moduleparam.h>
    3 _6 G9 Q5 }( v# W
  32. #include <linux/sysctl.h>
    : e' b0 N$ n+ D& D
  33. #include <linux/mm.h>2 G9 D' Q/ W) B( c# k
  34. #include <linux/dma-mapping.h>0 i2 f' q: k6 w/ \8 m2 x
  35. 6 |* u: ?2 c4 d$ n8 a$ B; }
  36. #include <mach/memory.h># U* s# t; h" O* X5 k& I  t; k
  37. #include <mach/hardware.h>6 V" g5 q+ [5 Y" G5 P: N; _
  38. #include <mach/irqs.h>
    - O: C7 m. |! M1 T2 r: u
  39. #include <asm/hardware/edma.h>
    . |* L( y  }# X2 }

  40. : c# e# [; H. O0 f- U7 k
  41. #undef EDMA3_DEBUG3 r+ i6 {  A) k, ^; a8 ]7 I5 l
  42. /*#define EDMA3_DEBUG*/
    , A' Z* D: ~2 [! O% f/ z1 T$ G
  43. 3 A$ K6 t- A6 }5 `
  44. #ifdef EDMA3_DEBUG+ ]( k5 f3 g3 e% S- v; z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    6 Y$ X4 h$ z  ^7 G" f' o( Z
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ; l- j8 ^! M: u+ q' }, u% c
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- ?+ @4 E# j, p
  48. #else4 [! s0 W' A3 k  B" S
  49. #define DMA_PRINTK( x... )
    7 J* j* r/ `5 W# N. H
  50. #define DMA_FN_IN& R( f3 \2 e- F' M& f2 Z
  51. #define DMA_FN_OUT$ G  n1 G, U  e6 h5 T* r
  52. #endif
    9 F8 c$ M' a# F' X* X9 N
  53. ( n0 S4 ]/ t$ u  q. P2 s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)# C& _" i2 U$ X( l
  55. #define STATIC_SHIFT                3# V2 h* J# q; D+ t
  56. #define TCINTEN_SHIFT               20$ l# \: F  _: B) j8 c/ N; p
  57. #define ITCINTEN_SHIFT              21
    / x7 y+ O; H( S$ d- r1 i
  58. #define TCCHEN_SHIFT                226 t5 ~5 D* J4 e. U9 u( P
  59. #define ITCCHEN_SHIFT               23
    6 S0 e3 M7 l/ ^
  60.   @: w2 U! h  \
  61. static volatile int irqraised1 = 0;
    , _) @8 c1 l- G% g: O: w
  62. static volatile int irqraised2 = 0;
    ; J  v% Y' D+ [$ A0 D
  63. $ G) B. z* D* `
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 k! n; S% N1 s
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);6 s% o$ {6 {# H) T  Q5 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , {" U5 t: X3 j. M2 z

  67. & Z0 P( |' y! o. U1 y
  68. dma_addr_t dmaphyssrc1 = 0;
    ; D3 j3 y$ j7 f5 c6 \
  69. dma_addr_t dmaphyssrc2 = 0;
    8 C9 ~0 n) l; J! S
  70. dma_addr_t dmaphysdest1 = 0;- G! w3 e7 W% a7 o+ p2 Y
  71. dma_addr_t dmaphysdest2 = 0;+ _" ?* h+ Q4 `6 ]- d
  72. 9 W, J- Q# \) a# q1 @; B& I
  73. char *dmabufsrc1 = NULL;: g& B+ ~& z  Z
  74. char *dmabufsrc2 = NULL;
    4 C0 x6 j! c8 ]7 Q: Z1 o
  75. char *dmabufdest1 = NULL;
    , G1 S+ s0 }% u) O& W. M
  76. char *dmabufdest2 = NULL;' }! I! _% C/ v* S/ e# x9 D0 B
  77. ! d2 @8 P% k# x% w1 Y  w  ?) N
  78. static int acnt = 512;; ^: x7 x4 S7 s* v( o, H$ h
  79. static int bcnt = 8;0 z# j! z1 `- z
  80. static int ccnt = 8;
    3 `1 n% c( R; P/ C, q% _+ j7 G+ r
  81. ( r5 I/ k& i$ G# Z. L5 ?& b& o
  82. module_param(acnt, int, S_IRUGO);
    : T- H: Z3 c/ ^+ L5 Q1 n* D
  83. module_param(bcnt, int, S_IRUGO);$ X# p, Y4 a) s" f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- c( z( D" M4 E5 j6 N9 {: |
, t4 X' N( F" {8 ?      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
3 @( A# C. @6 h* \2 warm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
% q$ I, G2 \+ I! o7 l     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
  l1 G3 x, K( f" [" m
" W7 U9 K3 D! e- l
- R5 {4 o6 f8 N. G  x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-8 10:56 , Processed in 0.040272 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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