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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 5 S5 d& t: s! W
  1. [code]EDMA sample test application7 Z" [8 ]% l2 J* V$ |
  2. /*
    " v+ y" i5 J" M$ s$ s: ~: x
  3. * edma_test.c
    0 f* I- N: ^# m
  4. *
    ! E* u% \  Z: m/ B# I6 T
  5. * brief  EDMA3 Test Application
    ! X- l* m6 y, L- c+ e6 @6 U
  6. ** N3 X2 p+ \* i8 ~
  7. *   This file contains EDMA3 Test code.
    + v: w( y6 M  ?: c' S
  8. *
    3 G1 M; l( @' D4 N8 q
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 A, o4 U$ n4 e- ~2 m
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( _$ U/ k1 O" T+ `. g+ u
  11. *         TO CHANGE.3 _2 q& v! J8 B, d
  12. *
    % x( C) n% E+ n; _3 E6 \
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    , V7 _! y# k! U) N+ x
  14. *
    3 _6 E, I1 I$ S7 E9 V) @- I
  15. * This program is free software; you can redistribute it and/or
    - T1 z+ X  N3 ~5 t( J3 w4 a4 f
  16. * modify it under the terms of the GNU General Public License as5 h" M( S2 s+ F- P  |; b9 C' Q
  17. * published by the Free Software Foundation version 2.! p* y# A. @5 O% ~6 _
  18. *, _. j" f! ^+ t0 d/ a  ^
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ) T7 U, O5 Y' G! c: P9 {5 J1 Z; s
  20. * kind, whether express or implied; without even the implied warranty4 A$ D1 [- o7 K4 e  `5 X
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the8 m# Y  A/ d& D9 h
  22. * GNU General Public License for more details.
      e/ ?0 T- C5 |
  23. */3 V+ l1 ]# ^* \- J7 @; I) f9 {
  24. 3 L6 T+ D! {0 ~: Q
  25. #include <linux/module.h>
    : l3 F0 h% M* m6 C" N5 x
  26. #include <linux/init.h>. V" r7 ?+ x4 r# J3 p
  27. #include <linux/errno.h>
    : P3 I2 f* `! K. ~; |3 n+ e& A
  28. #include <linux/types.h>! x. Z$ \& e1 |) Y
  29. #include <linux/interrupt.h>
    2 a8 `+ p5 T# `. X1 N7 J
  30. #include <asm/io.h>
    - i4 d8 n  L' N! `
  31. #include <linux/moduleparam.h>; e7 {0 H3 v7 E- A/ c: b5 }
  32. #include <linux/sysctl.h>
    ( B/ x5 `) c. |0 ~& a
  33. #include <linux/mm.h>
    + X% W7 [: k9 D9 x6 w" m8 Q
  34. #include <linux/dma-mapping.h>/ N. C6 G7 s3 q1 O

  35. 8 _/ W( S6 p7 r' ~" r* a7 `
  36. #include <mach/memory.h>* e* \/ Y, i0 C1 f# T  Z" r, B
  37. #include <mach/hardware.h>. h9 ?& Y& e2 u; U6 |/ ^: P
  38. #include <mach/irqs.h>- i! R1 k6 t5 ]$ c( ~7 ^' f/ a
  39. #include <asm/hardware/edma.h>
    ; N$ K6 u8 O  Y$ Y9 j) d8 k9 Q& `5 p7 ?
  40. / L+ V6 l" ?, H1 ~* k
  41. #undef EDMA3_DEBUG8 q$ p4 N$ ^2 N, l% P6 O) _
  42. /*#define EDMA3_DEBUG*/
    % k0 P/ c0 e, a* \5 ~: q

  43. % |8 e5 F: b6 h; g
  44. #ifdef EDMA3_DEBUG8 H* w) H, `* Y+ I# V
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
      z  g% |+ w# F5 Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ H( a2 p( P8 y0 ]0 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)" k0 Y- C0 \/ q4 G$ r! G, D
  48. #else- m( |2 X; D1 R5 n% C8 i
  49. #define DMA_PRINTK( x... )
    4 p; `3 X; t5 `
  50. #define DMA_FN_IN0 \0 A" V" D; |9 d, v
  51. #define DMA_FN_OUT) H% S7 a# w. s4 z" R  W' Q1 Y* u
  52. #endif
    + M" }: m& O" }# C! B- g$ y) P

  53. 5 E( }7 W6 {+ m
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ A2 g3 q: ~5 r! z9 y
  55. #define STATIC_SHIFT                39 N: ]7 Q$ Y# O) w: x/ u$ o5 o' ?
  56. #define TCINTEN_SHIFT               20! G3 A: |$ [* y# k* R
  57. #define ITCINTEN_SHIFT              21
    8 V8 {# w6 m6 o; G- @- v. t
  58. #define TCCHEN_SHIFT                22
    2 a/ D7 g- A- T% ~' G# @
  59. #define ITCCHEN_SHIFT               23( q. {9 N, R0 M* u  ~6 G& K

  60. * S% S  X  H# L, p: W: h7 j- r9 s
  61. static volatile int irqraised1 = 0;# X% \* Z4 h6 N* o" @4 Q
  62. static volatile int irqraised2 = 0;( B3 H7 ~# U- K: z+ I# F1 R

  63. 6 g8 Q, f$ y, Z2 G
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 q: R. D) z9 h
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);. C% H- _! T$ J9 _" d/ Y7 X9 I
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ?1 A4 b) x4 Z
  67. 9 }! E1 X5 E# i5 R9 c% E- p6 u3 Y$ \! Z
  68. dma_addr_t dmaphyssrc1 = 0;5 t6 H( F9 X7 `; W
  69. dma_addr_t dmaphyssrc2 = 0;
    & \4 R: Y, j3 m+ x# ]6 o3 C% w
  70. dma_addr_t dmaphysdest1 = 0;$ |- j6 I: B. D" {  P
  71. dma_addr_t dmaphysdest2 = 0;
    ; ~6 s+ e7 ], b* \9 {% D& \6 u
  72. 4 g6 C7 n2 k- G$ b- S4 x
  73. char *dmabufsrc1 = NULL;: @- ]8 C' z* e$ a' J
  74. char *dmabufsrc2 = NULL;
    # h7 w. N  |) {
  75. char *dmabufdest1 = NULL;
    # e$ `; G# g9 g
  76. char *dmabufdest2 = NULL;
    / W, T; ^4 m4 i& P

  77. 7 b5 P5 J6 ~( [8 U$ s2 X* O4 L
  78. static int acnt = 512;- F' e4 T3 T; j8 c1 w1 f
  79. static int bcnt = 8;
    + T4 w$ e! [" M" U2 [+ ], l, t
  80. static int ccnt = 8;- B- Q: \" F9 t* Y

  81. . x' y4 k  @. H* {: `" _& {4 z$ i
  82. module_param(acnt, int, S_IRUGO);
    : F! \/ J$ }0 a: S  \
  83. module_param(bcnt, int, S_IRUGO);
    ; l( s9 N4 A9 T; o$ C# z
  84. module_param(ccnt, int, S_IRUGO);
复制代码

3 m  H7 N8 E' k( O4 g; y9 R/ r; c" r8 a. e
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
. r  G6 L, d9 \$ uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
; k% [) r1 @0 {" U' e     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! w& t$ g) ^" u$ S2 u. j

; l( r  M: k' m) O- W+ j, Y. v' e5 `: b1 _4 b" S% A2 P3 o$ x; ~
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 10:17 , Processed in 0.036405 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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