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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - L, y/ W! c* n8 R; y
  1. [code]EDMA sample test application
    " f$ L0 L+ B( n' E
  2. /*9 x4 s5 H7 j4 a/ p  m
  3. * edma_test.c6 H$ }( q+ _- w
  4. *" m. H! z$ M. [+ \* F5 a$ c' _, E. l3 U6 `
  5. * brief  EDMA3 Test Application% s$ F$ y6 Q% B; T
  6. *
    , v9 x+ R  y/ x+ i2 k
  7. *   This file contains EDMA3 Test code.. `& w# y4 a. Y' ^& [5 ?
  8. *8 J2 G+ y  D' c9 m
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 m! @# \1 J6 d- }# z/ e& d* S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT5 D7 _. D; ~1 r7 W/ Q% A
  11. *         TO CHANGE.
    * P8 ?8 n; ]. [. ^; y) H
  12. *
    2 m4 P0 u( T/ ~; K+ q2 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/' x1 P+ h. T4 `5 l1 M0 ?: w/ c4 L
  14. *
    " u2 o! J) o7 d! ~# M/ Z' ^4 H
  15. * This program is free software; you can redistribute it and/or
    ; F# T! w, j5 M
  16. * modify it under the terms of the GNU General Public License as3 A$ e, A: \; n' [# E
  17. * published by the Free Software Foundation version 2.$ K7 J1 n& r: r2 k- s7 h# M
  18. *% Y: f# v: Z# Z' ?2 s% X4 f# O
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; o2 O" X( ?( O, I: M
  20. * kind, whether express or implied; without even the implied warranty
    8 L+ B6 Q. U) p% R5 q- r3 a8 R! w9 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    % {1 F1 b2 a$ ?3 D$ f  ^3 i8 P
  22. * GNU General Public License for more details.
    : U, u0 `+ ]: l0 b* k2 v7 S
  23. */, u: r" S4 i- W* _; ~

  24. ' N, ^. \" g- B# m- [! l) ]& Q
  25. #include <linux/module.h>
    * K" e0 K9 x6 M( K0 `+ c
  26. #include <linux/init.h>
    # \; L1 m% v( F; S# @* n, z
  27. #include <linux/errno.h>* O- v8 q7 j% d- s3 ^" d9 }7 Y
  28. #include <linux/types.h>& h- G- S/ u: N% U+ R% L
  29. #include <linux/interrupt.h>5 `1 A6 t# b/ S8 B) f% Z4 e+ G" H9 P
  30. #include <asm/io.h>/ q) o$ n2 C! p6 v% K0 c1 p
  31. #include <linux/moduleparam.h>
    6 U% I- E( j# P( @, K
  32. #include <linux/sysctl.h>- }. I5 t, D* O) s
  33. #include <linux/mm.h>
    1 T0 }6 ~% Q9 H/ d
  34. #include <linux/dma-mapping.h>
    , r# X' h8 W$ s! U, Z3 g5 v" s
  35. ! ?0 [- E9 x, N9 m+ C
  36. #include <mach/memory.h>
    ( V9 f. |7 e$ K+ H5 u2 x' s; N, k
  37. #include <mach/hardware.h>
      y" \( Y( z* k" {1 m4 _2 _5 Z+ H
  38. #include <mach/irqs.h>
    ( i* w; C5 Z$ Z* d% J* u5 n( ~
  39. #include <asm/hardware/edma.h>* L) ^" e6 I# Z6 ?/ B0 e# A
  40. " F, @) E% f6 \- R
  41. #undef EDMA3_DEBUG0 S0 b9 k& s& V; v) _1 g& ]1 \
  42. /*#define EDMA3_DEBUG*/, g2 o# E) n! m3 c4 a* h0 V
  43. ; q( E  E) K. V2 \$ F% f) _
  44. #ifdef EDMA3_DEBUG. @5 Q( N7 K  E- B3 z
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , x" A4 Y, d2 N: p3 C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    1 k0 J4 E$ ~+ v6 u+ ?! R8 f1 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' ~0 k9 Y* l4 |" \4 {4 N
  48. #else5 F( J& J) n5 J- P
  49. #define DMA_PRINTK( x... )
    4 U9 T: E* z, I" O- b
  50. #define DMA_FN_IN
    & ]' K) ^$ m4 v6 O& i: C
  51. #define DMA_FN_OUT
    $ Y0 r6 h3 K. l7 X9 D5 B
  52. #endif. o3 I* g: a7 ^% z5 f0 Z# L+ S3 F% e
  53. / H2 {* s% z; I; A/ ]0 F
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    0 ]' Q9 _) U& _' S) i9 p! M
  55. #define STATIC_SHIFT                3
    1 s# t* _0 o$ i8 _
  56. #define TCINTEN_SHIFT               20
    : y' p- U2 y- R) }
  57. #define ITCINTEN_SHIFT              212 z3 R% Y; f1 ^5 [
  58. #define TCCHEN_SHIFT                22' |! {; p. f  j0 ~  H! O
  59. #define ITCCHEN_SHIFT               23+ M# P% T7 v) z5 [$ n) m

  60. . b- t6 S, R4 x" g, L
  61. static volatile int irqraised1 = 0;
    ) J5 y  c8 Y7 i0 t. t
  62. static volatile int irqraised2 = 0;" ~, ?( A7 L$ A
  63. . l) Z' a! ?( a/ U
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Q& X1 C9 x, n# ^0 W
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( V! i( E/ I) Y/ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! T6 @5 F+ Z: ~! X
  67. 5 z6 c+ q: Y' j/ G% W* ]# A6 d4 m
  68. dma_addr_t dmaphyssrc1 = 0;
    5 p8 ?% o" N6 X9 c6 G1 ?
  69. dma_addr_t dmaphyssrc2 = 0;& G: L* M6 `7 i, ?3 a
  70. dma_addr_t dmaphysdest1 = 0;
    6 E' ~' u( L8 w; ?- C
  71. dma_addr_t dmaphysdest2 = 0;
    & d: A5 z; z' a  w$ Q0 s, d

  72. : B8 M1 n0 ?, h# T
  73. char *dmabufsrc1 = NULL;
    1 S& @3 _1 q8 e) _3 G$ f9 \/ C/ h
  74. char *dmabufsrc2 = NULL;
    + l  r( Z: B# D% I1 R
  75. char *dmabufdest1 = NULL;; f, F6 s8 T% x7 C
  76. char *dmabufdest2 = NULL;
    & n9 [- b3 V; R0 T& L
  77. 9 C" g3 r, K2 v6 I
  78. static int acnt = 512;$ z) L- A( [7 s5 p  Z
  79. static int bcnt = 8;. l+ x/ J& U" w2 K  F% T
  80. static int ccnt = 8;
    ; y) K: S3 i1 g8 B4 I1 r
  81. - ]6 K3 j1 X0 M! G
  82. module_param(acnt, int, S_IRUGO);
    ; Z# N7 Z' {6 a4 ?
  83. module_param(bcnt, int, S_IRUGO);9 k; O; E) w" S& Z
  84. module_param(ccnt, int, S_IRUGO);
复制代码
7 o) \9 }3 g# x% b* G; {

5 D  ^* P# ^* ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ f, h! Q  Z, X+ ~: ]  J1 Sarm-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 @3 @, |% E7 Y' b8 F: E
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
) m* k- D- \) k
* f( Q0 c; F0 M+ H+ P
# J. g; S+ o* G& L; B; O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-2 10:45 , Processed in 0.038399 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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