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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
1 j2 Y; S" Y$ V
  1. [code]EDMA sample test application
    ( S) A( X6 y6 l) a, a2 A
  2. /*
    * F. F, R, m% @* n
  3. * edma_test.c
    ! F& W2 L) o0 `) U
  4. *' ~* }6 l, Z6 d, q! [2 I7 v# q
  5. * brief  EDMA3 Test Application
    / d8 ]$ q$ b1 {0 N4 S1 C
  6. *, `8 c: R+ d3 C+ T4 s4 {
  7. *   This file contains EDMA3 Test code.' [9 e! u7 C: s& S) D% ]
  8. *
    ( O; J" Z8 n# u. {, y! B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    5 D5 I9 Y4 n1 x+ k) D6 i
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    + y1 t/ h' I. i$ t9 l
  11. *         TO CHANGE.0 ^% U& {8 p0 A6 p! x+ z: ]
  12. *
    7 y1 F3 j7 |1 z9 r% }8 ?) Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    " x$ x1 T7 S3 b  z
  14. *
    6 J" `8 q7 C2 @# p: X
  15. * This program is free software; you can redistribute it and/or# a9 U; q+ h1 V+ u! Q
  16. * modify it under the terms of the GNU General Public License as
    / O# u, G/ I( S
  17. * published by the Free Software Foundation version 2.8 r/ t  Q0 F+ `& N
  18. *1 L7 ~" e" m7 r% v
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' k9 O  b' N; B) y* s
  20. * kind, whether express or implied; without even the implied warranty
    " Z. c9 \6 ]" \; }: e# {
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ [% Q( W1 y, A; N! j$ s
  22. * GNU General Public License for more details.
    5 Y: s. @7 m  m8 G) S" I2 h
  23. */
    0 B# v" }$ ]: `
  24. ! K9 n* v" i& k, O
  25. #include <linux/module.h>4 V6 y4 h. O$ m6 B. J7 @0 @
  26. #include <linux/init.h>8 i  [2 G+ X% E! z0 F
  27. #include <linux/errno.h>
    : ~& N' p; a7 h6 K" [
  28. #include <linux/types.h>2 [/ N% v- P6 U1 D5 v  k2 h
  29. #include <linux/interrupt.h>, u8 r& {9 r( X. W7 e* D: w) c
  30. #include <asm/io.h>
    6 \4 ]2 {9 E# U
  31. #include <linux/moduleparam.h>0 v  o, e$ n) i. M5 c
  32. #include <linux/sysctl.h>5 B& F* t6 U/ D8 l1 M9 k
  33. #include <linux/mm.h>
    % `4 K# P' i; F% w* u6 i
  34. #include <linux/dma-mapping.h>+ \+ P! P# O5 @) s9 ~

  35. 3 i7 W7 F: P5 E4 i( a( T, [+ u6 d
  36. #include <mach/memory.h>
    3 s, C; c1 b- {' r; A. m9 w
  37. #include <mach/hardware.h>* j9 y/ Z4 ~# m- r, o
  38. #include <mach/irqs.h>  b% v3 d$ v) \; T7 p- l0 v" x
  39. #include <asm/hardware/edma.h>) ]% B: z; G) H; ~4 |* f

  40. : q) x' \& I0 |  v- t" z
  41. #undef EDMA3_DEBUG
    * r  o! J3 N- W! o3 ~
  42. /*#define EDMA3_DEBUG*/* ^$ x4 X  |3 r0 d6 e9 ?# h
  43. 4 B/ f3 q% Y9 d$ ^; t8 Q- W* x
  44. #ifdef EDMA3_DEBUG$ y# O: c7 X. [# P
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) f5 N0 Q& L. t: F. F) t" L6 j
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)- B  ?' `! s% h" n
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  z9 K0 S) e$ F3 ^( {0 W5 o/ X, R
  48. #else' c5 f3 P* o3 N' H, H
  49. #define DMA_PRINTK( x... )4 d+ R8 E0 z% E9 `  t" C
  50. #define DMA_FN_IN
    # m2 z% Z6 _# A7 k/ {' X
  51. #define DMA_FN_OUT
    1 ^" b, R8 j/ @2 }$ K% I& M
  52. #endif
    . M: D4 Q/ c/ w7 ?% ~

  53. 3 x2 w  Z2 M& G$ i) e/ Y' B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; A+ \1 _" L6 x
  55. #define STATIC_SHIFT                3
    1 \4 [& l! d4 G8 b$ D
  56. #define TCINTEN_SHIFT               20
    ; x3 O6 @4 c" Z3 @! b( u
  57. #define ITCINTEN_SHIFT              21
    % `9 a" q7 R' R. `$ k
  58. #define TCCHEN_SHIFT                22
    8 E) {* m" x8 i$ ~5 Z
  59. #define ITCCHEN_SHIFT               231 M. K: y: i5 `' k7 [
  60. : k; s; h' p( d3 Y$ A
  61. static volatile int irqraised1 = 0;7 C4 i  c) p% |! M" K
  62. static volatile int irqraised2 = 0;
    - Q8 A1 K' U; i- G5 `4 x% O
  63. , E/ N3 @2 X* s* y( j
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 T' q. C- L% `2 L
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    + e: F: [) Q: k+ A
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);  v# Y% C: ?" Q- o+ b0 R0 }
  67. ' t2 }" f) Y. T' e  |0 |) C* o
  68. dma_addr_t dmaphyssrc1 = 0;
    , @% T2 ]1 `) h6 H1 Q$ |
  69. dma_addr_t dmaphyssrc2 = 0;
    & _- j% u7 d) _
  70. dma_addr_t dmaphysdest1 = 0;
    & b' P+ D- F" e
  71. dma_addr_t dmaphysdest2 = 0;
    8 H9 V3 s* o% V3 L; f- S
  72. # Z6 M7 v5 q  G0 A0 G; |; w: g  d
  73. char *dmabufsrc1 = NULL;9 E; K9 B& o& K$ C0 P( I# Z/ t
  74. char *dmabufsrc2 = NULL;
    % g' H! I: L' G2 a
  75. char *dmabufdest1 = NULL;
    ; G5 x9 U2 B/ ^3 T1 e
  76. char *dmabufdest2 = NULL;% \4 |3 B5 }2 h' A- Z
  77. * l6 @( p8 ?# z0 ~. M
  78. static int acnt = 512;
    , R3 u, T4 `& Q- M; T, h
  79. static int bcnt = 8;
    9 x7 u+ Q' R$ ~, l$ ^' ?+ N: ?
  80. static int ccnt = 8;
    * R9 _0 q9 _+ J& p$ ]4 h

  81. , m0 X! c  Q3 y) F
  82. module_param(acnt, int, S_IRUGO);; z; ^5 Q, E% N! Y# X# g7 p
  83. module_param(bcnt, int, S_IRUGO);
    & x" F- u9 f# w" c) o! I
  84. module_param(ccnt, int, S_IRUGO);
复制代码
; ^% x0 f2 e1 f- ?: h. |
% z3 @$ M7 _4 m9 Y6 `' @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
9 l5 T: F. I2 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
- R5 S# j5 w9 a( d" \6 i5 G  q     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
! ~/ W  f8 \6 O$ ~$ I6 w* {
+ N' r" x2 \; M( g
( x) f8 Q' P/ L- D1 V, [
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-8-24 11:20 , Processed in 0.052932 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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