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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & I) R' S9 Y- k, |/ S$ \; v: S& ]) @
  1. [code]EDMA sample test application# J% b" b' G9 J- ^2 _
  2. /*
    - j! r  ~! W8 P' ^8 x5 B+ R
  3. * edma_test.c- [) b6 B  X* Q) M6 W7 x; t
  4. *  x4 H8 [; o# o9 A4 }
  5. * brief  EDMA3 Test Application
    # J1 b& m+ z5 o( q2 x- F( j  `0 Z
  6. *8 A; f- r6 J6 e7 @3 V# v
  7. *   This file contains EDMA3 Test code.7 ]1 n5 ]9 P8 o$ w" A* @4 d
  8. *
    ) x' o' \6 w  {$ n; Z; P8 g
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE: ^8 l+ J9 k1 x6 ~' |& Y/ }6 I
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ h/ Z- i. N$ p- _3 ~  p' }% h
  11. *         TO CHANGE.4 g3 D* u% V: }- U) y6 g
  12. *
    ! a  C, e6 X! }; k
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 t6 R& v. a, a! h! L8 L' G& l5 u
  14. *
    0 V6 z3 E' t3 a+ G
  15. * This program is free software; you can redistribute it and/or8 c& `1 e% i# P2 F% Y! s  u
  16. * modify it under the terms of the GNU General Public License as/ {# b8 v5 I1 f! b/ q1 y
  17. * published by the Free Software Foundation version 2.9 }4 A3 J; m7 W  e$ c
  18. *
    " i+ ^: m( `( D6 o
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any4 R" L! _, d1 E  W- f' B  M
  20. * kind, whether express or implied; without even the implied warranty4 Z0 M( {. A8 k: F# V% |
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 R! B2 _/ o1 |, g
  22. * GNU General Public License for more details.. V. m+ h) l4 k& Z" `
  23. */
    : Y/ v, x! @6 p! p5 W) L

  24. 1 c' _% V* L9 |
  25. #include <linux/module.h>
    9 ?3 l% G$ w# h
  26. #include <linux/init.h>
    4 T9 y* }& N6 z$ @$ c+ b
  27. #include <linux/errno.h>
    9 X4 N; w' ~3 g7 p  g
  28. #include <linux/types.h>/ j+ m( k" ^5 n7 \6 e
  29. #include <linux/interrupt.h>; J# X, M9 E% d8 [9 o$ T7 c
  30. #include <asm/io.h>6 n% I: ?3 r& |; {3 t3 Q, W
  31. #include <linux/moduleparam.h>) W6 e- V9 W- E+ r. z4 i
  32. #include <linux/sysctl.h>
    ! Y# r; d+ c1 F3 V9 o% S
  33. #include <linux/mm.h>
    7 q* c: Z" G. H% r0 ?
  34. #include <linux/dma-mapping.h># D+ ~2 d. B4 \+ |: [

  35. ) N; I: q  U$ \; [: O
  36. #include <mach/memory.h>, ^$ f4 a- I& }& ?
  37. #include <mach/hardware.h>1 {3 V. Z2 |  z' E8 H" M" J  _
  38. #include <mach/irqs.h>
    % Z1 i5 g6 c0 x+ P0 I
  39. #include <asm/hardware/edma.h>% Z6 ^, o2 N) j  ]  ~

  40. / @  v1 m: ]6 i
  41. #undef EDMA3_DEBUG
    & n+ q# S3 T+ B, A( f( v3 i( p2 m
  42. /*#define EDMA3_DEBUG*/' y4 e- |$ `! f( Q$ E- V

  43. 0 d$ ~! G( e, a. S3 ^* D# y0 _) J
  44. #ifdef EDMA3_DEBUG
      }# [; W  w- [$ P. g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    * P8 \  W( b( Y- T0 f! }" t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  [7 \8 Y: R7 [1 O5 n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
      }# C! _6 h/ ?( D. B/ T
  48. #else, o$ F- W8 N' H3 P8 q6 s  W
  49. #define DMA_PRINTK( x... )
    0 j3 v4 T! J, m7 o4 n$ l
  50. #define DMA_FN_IN$ }& o  d2 s0 F0 Y/ x
  51. #define DMA_FN_OUT3 c7 B9 g) S( p, I4 p- Z$ I3 ^
  52. #endif
    ( ~( @. m/ R" P7 `

  53. * O  X: Y! p; Z6 U$ k1 U0 Y+ s
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; m/ \* e; c: W8 b/ t
  55. #define STATIC_SHIFT                3
    & ], u8 ]/ {' R; O0 T
  56. #define TCINTEN_SHIFT               20
    4 n, S9 @3 _* q4 }! ^
  57. #define ITCINTEN_SHIFT              21  H. W" x4 N, k3 t; O
  58. #define TCCHEN_SHIFT                22
    1 A7 R% x, L0 _. K- Y) y- n
  59. #define ITCCHEN_SHIFT               23
    0 t5 N: y' s2 Y; b0 t9 `* @9 v: I

  60.   i; _" T  ?, {* J6 Q; f
  61. static volatile int irqraised1 = 0;0 p% j; d% N2 z; _' g
  62. static volatile int irqraised2 = 0;
    3 C1 Y9 r2 Y! O* k9 k

  63. . e5 l$ @: n4 D2 ^) |" ]1 o1 q  Y
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 R% ?2 @, D$ W! O7 H+ N7 N: U
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 W4 W: N% i+ t% _
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * |- G, c9 P5 a, F

  67. 1 u6 r1 ^# e/ d0 \3 N
  68. dma_addr_t dmaphyssrc1 = 0;  F7 s/ V4 k; l3 [* N
  69. dma_addr_t dmaphyssrc2 = 0;
    5 P" E- }7 W6 v& x2 ]
  70. dma_addr_t dmaphysdest1 = 0;
    2 ?' P* H7 V$ Y& e' H, I8 P3 E
  71. dma_addr_t dmaphysdest2 = 0;
    - B; H  j2 ?) n# O+ d9 }

  72. " f5 `& D0 ^9 y: h0 }
  73. char *dmabufsrc1 = NULL;$ ~* R) w$ J; y. \7 c
  74. char *dmabufsrc2 = NULL;4 i0 V+ [1 B  H4 W" R
  75. char *dmabufdest1 = NULL;
    , Y2 g7 ]8 B' M% U
  76. char *dmabufdest2 = NULL;; p, ]3 Z5 i) n# W

  77. + b  q( _% z" q, Y' b9 {. a8 m/ s
  78. static int acnt = 512;+ m  D" ?4 S+ ?# F0 U* J  G
  79. static int bcnt = 8;
    % _2 {& Q2 |% H2 W5 f8 L- s" R  J
  80. static int ccnt = 8;' k/ n( l: n* Q- Y0 `4 y3 D

  81. ( N3 l1 a! u: ^
  82. module_param(acnt, int, S_IRUGO);# l+ l7 I$ V6 ?1 S5 P+ ]
  83. module_param(bcnt, int, S_IRUGO);2 U9 d* h$ C5 G7 f
  84. module_param(ccnt, int, S_IRUGO);
复制代码

8 B: ^6 [) j0 M" b& W# {! V3 U: [& \! b  K6 L2 m+ O5 n3 Z0 n5 [
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用, z) j; d$ K& f) ?6 d
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( |5 ]& P! s% n" ^1 h2 x/ U- O
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
, `- Q8 n( C$ I& e( h
7 ^! Q3 e: o+ ~5 Y0 A+ v
( M+ B& M+ D  @6 i! T+ H6 ~/ }; P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-10 02:52 , Processed in 0.038609 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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