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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 . H0 U+ _5 ?2 i" \# o
  1. [code]EDMA sample test application# Q5 W# L7 X9 H& `+ E: [, v
  2. /*- Z. t6 q1 J1 n- i) K5 J
  3. * edma_test.c  u& ~: L: s& |. j7 Y8 {
  4. *
    ; p6 N# m5 V6 Z9 t& p! ~0 O3 c. M
  5. * brief  EDMA3 Test Application; b6 U7 s% ?2 [
  6. *
    5 [! @" d. ]$ _0 m8 I- l
  7. *   This file contains EDMA3 Test code.
    8 Y3 h" O  H6 y
  8. *- O' y9 V' X% [0 n! ^% }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    ) a, H; y" h$ M
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - |8 H5 W% B! M5 F3 N3 m
  11. *         TO CHANGE.
    & K4 d8 ?5 z- U2 ?' {
  12. *
    . R6 m/ J: f8 u9 X( b; P" F
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / g: U) ~& H7 t6 W! p( d* |
  14. *, [7 O$ E$ Q) ]( @7 m7 {/ p
  15. * This program is free software; you can redistribute it and/or
    . ~. |; z4 h. F7 Y7 c& R4 y
  16. * modify it under the terms of the GNU General Public License as
    / T# [; O: `* `$ @+ k+ Z% I# x
  17. * published by the Free Software Foundation version 2.
      U# K/ J$ t3 b3 ^6 e1 ~
  18. *
    ( G* L3 s. o0 b. _% o: V0 }+ D' V
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / W! F# t0 }2 C# g
  20. * kind, whether express or implied; without even the implied warranty
    & i0 S2 K9 a4 p- k9 c5 c
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" g7 i: G5 H; @3 R
  22. * GNU General Public License for more details.+ g7 b1 V/ q! O/ i; L
  23. */
    3 I2 P1 i' l# b& D8 }2 v' L7 b
  24. $ S% M' s( ^7 \$ u0 x
  25. #include <linux/module.h>8 Q- k* t# g/ {8 d! C5 D8 ?
  26. #include <linux/init.h>3 X* c1 Z- k$ X3 A
  27. #include <linux/errno.h>& p8 i9 w0 a) @& @6 y
  28. #include <linux/types.h>+ n& ]1 n" g8 s1 Q; [
  29. #include <linux/interrupt.h>
    & w6 ~" E7 g5 Z( ~
  30. #include <asm/io.h>
    ; E. c& \- `4 o9 f0 c# ~
  31. #include <linux/moduleparam.h>
    3 k3 b; k: o7 h! V4 I  G/ o9 A
  32. #include <linux/sysctl.h>
    1 Q7 _7 c$ r9 y9 |) N  {+ `
  33. #include <linux/mm.h>
    4 _  O6 J3 w) c9 Y; m& _7 `) [
  34. #include <linux/dma-mapping.h>; K9 p- H2 C" V/ C9 u& X3 r
  35. . z2 `2 U2 ~# i  b
  36. #include <mach/memory.h>
    7 w0 |/ ?; }# {! f. m
  37. #include <mach/hardware.h>
    + @1 y. W4 A$ ~8 m
  38. #include <mach/irqs.h>
    8 M) W, S9 [" }/ L0 R$ G! K& `% [
  39. #include <asm/hardware/edma.h>$ R  H3 |- g1 n- R6 k% i
  40. 0 z; n' K& \) s8 X- X/ V- g
  41. #undef EDMA3_DEBUG
    1 G1 k+ I1 R" j9 M- i2 \
  42. /*#define EDMA3_DEBUG*/, A* g" f& y% N3 C2 s) ], i, y
  43. & N" r8 |3 h: H8 g+ m
  44. #ifdef EDMA3_DEBUG
    # l; v" s4 E+ E) ?
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    0 A' R* G, F6 T& u2 R% T- r
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : b5 _6 m# e- \
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ( r( W5 k3 C4 m" z* I9 I! _
  48. #else
    $ J1 l) C% a8 o* |# c
  49. #define DMA_PRINTK( x... )0 a/ [( U1 @  f1 \" x# t( L
  50. #define DMA_FN_IN
    ' I6 e7 U8 n2 u6 \4 N! L0 h
  51. #define DMA_FN_OUT+ v! Y. U5 V; V; C. A2 C
  52. #endif
    # t; }. A& ]/ a

  53. / j) N% ~: U# t5 U3 R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( y2 [5 e- r* O2 v% U& Y7 o
  55. #define STATIC_SHIFT                3) ^, N/ [5 ~, t2 U
  56. #define TCINTEN_SHIFT               20
    ' O3 U9 M. n" w5 o
  57. #define ITCINTEN_SHIFT              21, ]* E3 m" h0 }6 _& e0 _: d
  58. #define TCCHEN_SHIFT                22; a& x% _- b8 J& u  m# D' r# s
  59. #define ITCCHEN_SHIFT               23
    . }% P+ f) f; C, ]: G9 M% E

  60. : z' r4 n7 Y3 g1 G, k
  61. static volatile int irqraised1 = 0;0 S' z7 b: E/ X8 f7 F0 Y
  62. static volatile int irqraised2 = 0;
    4 V# }% H$ u9 x1 O5 v+ w: ^

  63. ! ]9 I* P% A# x) G) m- h( M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    5 G( Q/ z" X* b' t( I3 p
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 w1 s+ _8 _3 R, W
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 h9 y3 b  {* W) g" X7 r- z
  67. $ z0 u! R, t4 K- G/ d
  68. dma_addr_t dmaphyssrc1 = 0;
    % w0 T4 o0 s" |+ y3 _) Q
  69. dma_addr_t dmaphyssrc2 = 0;6 ^5 P1 g2 A5 W8 {2 d
  70. dma_addr_t dmaphysdest1 = 0;+ m9 L; Q- L$ I; ^7 B0 I/ x6 L2 J
  71. dma_addr_t dmaphysdest2 = 0;
    & J$ t2 s6 f3 N* }: W4 `

  72. ' u9 h2 e+ R1 N: S3 R: b
  73. char *dmabufsrc1 = NULL;. b3 h. J9 I5 Q9 U! v! y
  74. char *dmabufsrc2 = NULL;
    0 Q$ r" X7 z" ], H8 r$ r
  75. char *dmabufdest1 = NULL;( _) T5 |( U  Y1 ~) S
  76. char *dmabufdest2 = NULL;
    % t# t) A. N: {) A# k

  77. 8 J- s. a, X# x2 P: V
  78. static int acnt = 512;
    7 w& r! {" O" p- S$ a3 W
  79. static int bcnt = 8;
    2 J. \. q( r" P$ N4 e. m6 u: K; k2 N2 y
  80. static int ccnt = 8;  S/ c& z( M# e  [/ y  t

  81. ' ~' t' o: ~9 K4 P5 G- F
  82. module_param(acnt, int, S_IRUGO);
    " I0 O5 @5 U" N4 v! T5 ?1 J9 U
  83. module_param(bcnt, int, S_IRUGO);
    / X. R2 |* j. D* V0 R
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ Z2 b1 ]% K5 B
6 X- J/ D2 Q) J
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 i1 `, q* }) A. p' k3 [( V
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 t5 S$ h8 i" V3 y! `     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! }# M- c4 q  V' w) q* c
1 P& D5 s+ e9 j: l/ F2 ^' I  i
; ^- u- E4 b; C+ P0 Q
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 07:15 , Processed in 0.040386 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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