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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. X1 L4 A5 D1 D# w4 B+ s
  1. [code]EDMA sample test application
    5 v9 M4 z; B$ s8 E. D' n
  2. /*6 x4 T; I  G9 Z& r; E  `4 x; j
  3. * edma_test.c  j( W- m# ^- |4 z: R( v2 I
  4. *
    7 b+ x* Z% Z! u/ b/ w; s' |7 }$ z* W/ z, S
  5. * brief  EDMA3 Test Application
    5 V$ N3 P9 g9 `% J4 h$ S
  6. *
    ( s- p: n1 n* A0 l8 a
  7. *   This file contains EDMA3 Test code.
    " O$ s: H* l" q& X/ |. u) X
  8. *' N: @! {% v, Y# E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " b2 Y5 ^) F+ d8 ^) U6 v
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 C! S, b% a5 O& F! i5 D5 X: w+ j
  11. *         TO CHANGE.
    ' ]6 k% w0 l# {7 }1 y4 u4 A
  12. *
    ' W% s+ j0 ~1 z1 Y  u
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 p3 |' n7 `' ~8 w9 V0 z
  14. *
    , k$ ^4 `8 |# t2 ?9 D
  15. * This program is free software; you can redistribute it and/or, A3 ^+ j) W9 |+ ^# F3 \0 Q
  16. * modify it under the terms of the GNU General Public License as
    2 m  g3 `4 X. z1 Q
  17. * published by the Free Software Foundation version 2.% W  I0 n) O8 P; F9 ]! h( ^8 w8 f
  18. *% M/ c* z, |+ v9 ?0 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 I3 {0 N& V# [, O' [3 n
  20. * kind, whether express or implied; without even the implied warranty
    8 y- {1 d! [5 k; Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    . D  a1 x% _. F& @4 v/ x; a
  22. * GNU General Public License for more details.
    8 X& j- v2 p; i/ y9 e$ T$ |' L8 D
  23. */
    8 m* A( U$ h- p: }
  24. $ T. M: q; j, `# `7 Q
  25. #include <linux/module.h>8 z# K) K! B& P7 y
  26. #include <linux/init.h>* @+ B  i1 o- E1 M/ T# Q' ^
  27. #include <linux/errno.h>2 e! [. t5 M% E" M
  28. #include <linux/types.h>( t3 Q7 {5 P+ F
  29. #include <linux/interrupt.h>
    % w3 }9 B! `/ |: d
  30. #include <asm/io.h>" G- f1 I7 B& Y& U+ r6 ^
  31. #include <linux/moduleparam.h>" v4 P  @4 |+ l, B4 X) {
  32. #include <linux/sysctl.h>
    6 i: X+ i. X. b2 ?2 y: I# H
  33. #include <linux/mm.h>. ?- G; Y) `6 f. P9 I2 m
  34. #include <linux/dma-mapping.h>
    2 w8 Y9 M. w' C  k7 m* t3 x
  35. $ \0 G1 |& z- Y% l0 k0 ^
  36. #include <mach/memory.h>
    . x( k1 [5 p8 m7 R8 `3 V' Z3 z
  37. #include <mach/hardware.h>" |. j) b( Z+ g. r
  38. #include <mach/irqs.h>
    1 d' z. ~% P$ |
  39. #include <asm/hardware/edma.h>
    / j) o8 n1 P# b8 L6 Y0 W7 Y8 b
  40. 7 S, o. p: Y& H8 \6 S  R1 Z, @& k
  41. #undef EDMA3_DEBUG# \% e# K' r" w! J6 d. X6 d- o
  42. /*#define EDMA3_DEBUG*/
    $ f0 i1 ~' t/ h) x5 r. `& ?

  43. * B% ~6 p: P: t0 E) G0 {% Q
  44. #ifdef EDMA3_DEBUG
    . w6 W9 U6 q, R! W
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS); c( b  p4 C# ]5 @. r% G
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ! M# s- V$ }) V0 A9 ]1 q& [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    + c$ r) ^1 `) c0 G. D
  48. #else2 N  L1 i5 ^8 b( A0 @# A
  49. #define DMA_PRINTK( x... )0 Z# c' k+ x# j- e1 w0 O
  50. #define DMA_FN_IN# x! \& q5 P7 T# e
  51. #define DMA_FN_OUT) ^! n8 @% f" k$ |- o8 I9 q6 Z0 e
  52. #endif5 D' K9 E. r- {" O8 {* q
  53. 6 A) D# |* P7 V2 a. T9 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 }. D( h9 l" G) o) S* f
  55. #define STATIC_SHIFT                3
    7 C& m( h0 f+ j7 Q, q
  56. #define TCINTEN_SHIFT               20
    0 T9 G5 w- j8 S( e8 D/ W) ^+ ?
  57. #define ITCINTEN_SHIFT              21
    % P+ w0 B. M8 K2 m0 O8 y  V8 a
  58. #define TCCHEN_SHIFT                22' X& v5 J" A5 z9 c+ ]; C
  59. #define ITCCHEN_SHIFT               23( F6 C1 ]2 l6 U* R
  60. 8 J, C( k8 f3 F1 x
  61. static volatile int irqraised1 = 0;0 v9 v& \! l7 d/ c" M# ]3 Q
  62. static volatile int irqraised2 = 0;9 @1 U4 E9 m( A' U0 F5 v. c1 l
  63. & Z7 l% c" _7 t8 S2 D: F( a
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : u. Y3 _7 d$ ~  ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    . x" e  V2 y7 u" B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 ^, ]3 J) P2 S; J3 Q
  67. / J3 H% r! y' o  n
  68. dma_addr_t dmaphyssrc1 = 0;
    1 P) k1 H1 w! G0 h6 l9 Y2 P
  69. dma_addr_t dmaphyssrc2 = 0;
    # d0 G0 U9 U3 [& P2 i6 y; R
  70. dma_addr_t dmaphysdest1 = 0;$ v. E" {6 s, a9 j" b
  71. dma_addr_t dmaphysdest2 = 0;7 q. S( G& i' S
  72. 0 i4 i7 {+ F4 V8 B
  73. char *dmabufsrc1 = NULL;& }, O7 c7 t, L
  74. char *dmabufsrc2 = NULL;( _& ?" ~9 i7 w' X/ E6 X
  75. char *dmabufdest1 = NULL;
    4 n& W: E* N( a+ L9 }% z( ?. Z( X
  76. char *dmabufdest2 = NULL;0 @! ]- O2 C- P
  77. 5 j5 A# F! F/ i' T+ t2 b! X" z
  78. static int acnt = 512;+ z9 e5 i; G3 g
  79. static int bcnt = 8;
    4 M  q# k, A9 A5 s& u: t1 m
  80. static int ccnt = 8;
    ; q* N2 w$ c; L; t

  81. . M/ i1 |' S, a8 `4 D
  82. module_param(acnt, int, S_IRUGO);& a1 k& Q# x6 D6 Q; ^; Y
  83. module_param(bcnt, int, S_IRUGO);" g; T& K8 Y% s% g* D+ S. ~- y- _
  84. module_param(ccnt, int, S_IRUGO);
复制代码

, ]! {7 O7 K  ?; o, n& N6 I" [9 h9 u8 Z3 e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: w  t7 u4 D& Rarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 p+ s2 {9 E; x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
3 Y6 }6 b  x' W: _9 e: c- H$ F3 B6 W& t3 _( s2 @; N
0 f4 |3 \2 S% g8 C( h) P. }( n
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-7 10:18 , Processed in 0.038748 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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