OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 9 Q# U( L9 g/ X4 x" p
  1. [code]EDMA sample test application  w7 U7 }% y( E2 U, ]! w. J
  2. /*
    * Q* @7 s7 Q' d+ t
  3. * edma_test.c
    / V$ L0 ~/ B4 X. x& W
  4. *3 x# H' q4 z+ h; x5 K; X: D/ P
  5. * brief  EDMA3 Test Application
    & X2 g: m& F% {
  6. *
    9 R0 D! E; l6 i! ]. Y6 P
  7. *   This file contains EDMA3 Test code.+ e7 N. B( U5 a# h, ^% v2 X( O
  8. *
    % \( k8 _. V# L2 k. Z8 |9 N
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    1 e: n! M+ m" ]5 T! ]0 _
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT1 a) K5 h( S( q  G, ?
  11. *         TO CHANGE.
    " y8 M" f& ?* G0 \2 Y; p
  12. *# K( U( M8 E5 Y& K. d( E+ |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    % w4 d5 w+ P/ Q; c' {  R: ~
  14. *& c6 a7 F1 I2 O3 i/ b7 c4 S: c/ n
  15. * This program is free software; you can redistribute it and/or
    . T% J  O- ]) V# u  A0 ^
  16. * modify it under the terms of the GNU General Public License as
    8 i, {) q- ?; y0 f. {+ r- x
  17. * published by the Free Software Foundation version 2.4 f0 S9 ~% T; p7 l
  18. *
    0 M0 d$ s: T4 E6 N  ~, h0 l
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    " Y1 l; Y5 Q0 {2 R! d8 F5 K
  20. * kind, whether express or implied; without even the implied warranty! o3 O1 M# o6 S6 A% t8 c$ d1 E: U
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the3 q, x, B4 f& \& }' t5 w; e( Z
  22. * GNU General Public License for more details.2 J  H4 T3 Q" ^' H8 A0 x: ~
  23. */# J0 h; L( {% _
  24.   L5 \/ ?1 o% b! m" z$ _9 `8 K
  25. #include <linux/module.h>0 a5 B4 U, N$ U* l# E( n$ ?
  26. #include <linux/init.h>0 R( L% a6 y0 c' {* \! s4 F6 y
  27. #include <linux/errno.h>; U9 w- M; |% j/ J- y& h5 @! y
  28. #include <linux/types.h>! F, Z9 N4 m; V
  29. #include <linux/interrupt.h>8 d% ^+ V0 o& A, n! j
  30. #include <asm/io.h>
    7 Q( V5 [, U' B. a! ?' v" ~
  31. #include <linux/moduleparam.h>
    9 q3 Y9 _* g# C+ E6 Z
  32. #include <linux/sysctl.h>/ c& v0 @; k4 D/ n. n1 `
  33. #include <linux/mm.h>
    ! q& e5 o$ E  ~2 Q( P/ c
  34. #include <linux/dma-mapping.h>
    6 g# h( |* c, V: v" n' {/ V

  35. " r% R1 e7 Z, D+ ~
  36. #include <mach/memory.h>
    + O& ~' j; T$ S
  37. #include <mach/hardware.h>: I  [% M: Q- E% r$ z! j* ~/ I" u: G
  38. #include <mach/irqs.h>; H) v6 R7 z" t* }! ?
  39. #include <asm/hardware/edma.h>9 X2 a( v; Y/ K( I6 X
  40. , P' {/ {# A& ~
  41. #undef EDMA3_DEBUG
    # B4 e' x+ H8 E7 h5 z
  42. /*#define EDMA3_DEBUG*/
    - \. u3 e& h, m) c$ _

  43. 3 d1 U+ c0 c' |* ~7 W% i: r
  44. #ifdef EDMA3_DEBUG
    * V- h- O% G' x# ]
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    1 D# K) G5 I' Z- g+ O
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 A( R$ i$ u- ~. Q# g
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)! [1 _; h6 i+ \8 V' R
  48. #else
    ( E3 M: W% r) y
  49. #define DMA_PRINTK( x... )7 e7 p9 k. S% \/ d4 N
  50. #define DMA_FN_IN9 z8 s0 X6 x, Q6 d  Z. F& w( h
  51. #define DMA_FN_OUT
    . ~( h. ^/ T9 ~$ O! R0 o1 l; G& j
  52. #endif! m5 |! P% q2 t5 ?( W4 P: Q, @4 v7 Y

  53. ( |/ J* n4 w1 `+ j3 M1 g  Q
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)* I& K/ U! {3 c" y4 r% C
  55. #define STATIC_SHIFT                3
    4 A# E. d. f0 o0 ]! a
  56. #define TCINTEN_SHIFT               20
    . N& X, D0 l/ _( K
  57. #define ITCINTEN_SHIFT              214 o' I2 s/ U; X7 S8 y
  58. #define TCCHEN_SHIFT                22( z( E% L# G3 N) t% ^
  59. #define ITCCHEN_SHIFT               23
    0 f4 ^1 I8 b" J( L% j' t
  60. ' j8 n/ i  a" Y1 T
  61. static volatile int irqraised1 = 0;6 ~3 l, m7 A3 B) f# F) E- G: ]9 o6 @; B
  62. static volatile int irqraised2 = 0;
    ' [4 Z- q5 |5 m

  63. ' G4 e. O/ M4 L' J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ H& M3 p) i& z2 h( X
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: _5 W" M6 r3 Y( n
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);7 Q: ]& K0 H7 Z* n! b# \

  67. 3 ]  n9 Z2 }  U! ~
  68. dma_addr_t dmaphyssrc1 = 0;+ N5 G' v5 X$ h. k
  69. dma_addr_t dmaphyssrc2 = 0;8 w7 k9 y& \( R! ^
  70. dma_addr_t dmaphysdest1 = 0;9 O: a! J7 p2 m, w3 s# t! b% o3 E
  71. dma_addr_t dmaphysdest2 = 0;( z  l$ L: A9 ?  L2 _

  72. 3 @# j" O3 w4 p9 J4 o- [! [
  73. char *dmabufsrc1 = NULL;
    . K# u$ @; H- x. T
  74. char *dmabufsrc2 = NULL;
    ( G$ a: h! F1 _/ L5 x- ]: g# z* k
  75. char *dmabufdest1 = NULL;
    0 m! }" G- K9 j  ?0 z
  76. char *dmabufdest2 = NULL;, a# R+ X9 |6 G2 {
  77. + c) D! J+ g& l; ~' A
  78. static int acnt = 512;
    8 B( B* K7 g  g
  79. static int bcnt = 8;) G6 |( [8 d+ }& Q2 i) v/ X
  80. static int ccnt = 8;
    ! F! X" ~2 m9 w5 k' t- j

  81. 9 d; m8 g! v/ R4 Y; g( s; @. a6 x
  82. module_param(acnt, int, S_IRUGO);
    # U- t" x+ \, J" w2 N
  83. module_param(bcnt, int, S_IRUGO);  Q$ i# c! g7 G" Q" q* L
  84. module_param(ccnt, int, S_IRUGO);
复制代码
% W  ^7 Y$ k) e* r/ b
: H7 r0 i. o5 d! C# |5 u  y
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用8 Y# t1 O( I- ]7 Q* X
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 b4 {* T' M+ J% s$ I: L
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。0 _" w8 d# i8 S8 M( z5 B
8 L1 v7 l; `3 d
3 N2 o4 r( y( D# R) j$ j4 \
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-20 10:40 , Processed in 0.038960 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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