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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( Z/ @( \$ N( D- U
  1. [code]EDMA sample test application
    " G/ P/ K; }9 P" l) b  q0 w5 {- P4 L
  2. /*$ F% W, q6 ^6 M. T9 Z" ?2 @
  3. * edma_test.c
    ) b0 A* Q' |2 V' h
  4. *3 p# `# D* s  J( ?6 V
  5. * brief  EDMA3 Test Application9 I# B# T/ w7 O8 B4 }; u
  6. *5 V3 a+ I6 f! l6 V4 e2 h7 ~
  7. *   This file contains EDMA3 Test code.
    3 U, \) [! L7 d. B' h
  8. *9 X7 C! w: }3 R
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      g. c. Q! J( |9 k- l+ E8 O8 f3 f
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 Z4 P5 ~/ X) C  k
  11. *         TO CHANGE.# M) L" ]; V( I, Y7 {* N$ Y
  12. *6 e* K) s# U. S
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    . U7 k( t! t1 P" O5 ?" \1 o& c
  14. *
    ) A: r5 ?% {$ ~  I" G
  15. * This program is free software; you can redistribute it and/or
    " {% P; u) M4 r' w0 F2 Z  k1 ~+ }* p
  16. * modify it under the terms of the GNU General Public License as; D( E- F  v4 t! x, O
  17. * published by the Free Software Foundation version 2.
    4 W  S; e( z1 a+ ~% V; i3 ^' w
  18. *; s. V/ l8 S% O) A
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any  ^" y; i) R( y
  20. * kind, whether express or implied; without even the implied warranty  R' R9 X- S9 E( X; R) A
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the9 X' c5 F# y. X3 b+ |) n2 |
  22. * GNU General Public License for more details.
    + l/ R$ \3 {" ^2 I# l
  23. */* |4 m- ]# ?* g5 W; `: \

  24.   n7 ?( r! H" Q% U) N; d1 I
  25. #include <linux/module.h>
    + o, M5 D) \1 }4 o5 z  `
  26. #include <linux/init.h>4 v0 v- g$ X. m9 r" Z$ r7 k
  27. #include <linux/errno.h>9 {; x' T( j' }: l4 O" U
  28. #include <linux/types.h>
    $ I1 ^  K' _, b2 j. t
  29. #include <linux/interrupt.h>
    . i* h& q# W2 z) C: z
  30. #include <asm/io.h>
    : i  `" y7 p' T+ _+ J& [
  31. #include <linux/moduleparam.h>
    ) R- l4 ?" i% t
  32. #include <linux/sysctl.h>
    4 o! Z2 y+ C& H; s& c. {5 o
  33. #include <linux/mm.h>
    . j& @) `' c& J1 C" P# ~/ Q
  34. #include <linux/dma-mapping.h>
    ( V5 G+ Q! b' p7 a7 z6 Y

  35. & I2 y0 H& k* q- q( G
  36. #include <mach/memory.h>
    1 H: G6 V  d; j' `, g; x
  37. #include <mach/hardware.h>& m* s  h/ L  r6 b2 N* Z7 s8 S4 ?
  38. #include <mach/irqs.h>
    5 j# b: P' e; y5 r; O
  39. #include <asm/hardware/edma.h>
    2 t1 r# X1 J6 J# U. f- ^8 e

  40. & S* f2 I1 k+ F, n5 I2 u7 w
  41. #undef EDMA3_DEBUG2 }  G% ?3 Z( I8 o
  42. /*#define EDMA3_DEBUG*/
    4 M+ r4 R3 B) K8 `  [
  43. 7 H4 l" ?- T5 w$ n6 d
  44. #ifdef EDMA3_DEBUG
    . k8 c; p0 t7 h' o
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  h5 @3 O% o# C- u& ~" p! t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 p0 `8 H; x$ F
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    & l4 V2 K- y3 \
  48. #else
    4 w4 c% d) [" t  k0 m- @. {9 X
  49. #define DMA_PRINTK( x... )$ d# Q' k1 `& t# t
  50. #define DMA_FN_IN6 a  h* M8 M8 P  H0 D" n! A
  51. #define DMA_FN_OUT
    $ I* A6 i  x6 Q# T4 j. E6 M
  52. #endif1 u2 e6 g( H+ y/ F2 x/ _3 J
  53. ( P6 {0 q1 Q4 e
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ; d1 ]( V3 n, I* w- L& Y& o* a
  55. #define STATIC_SHIFT                3+ X- ?8 j( d" n/ z" x
  56. #define TCINTEN_SHIFT               20. _" Z. E$ M" w4 ^, V! X
  57. #define ITCINTEN_SHIFT              21; }# t3 b. i0 {" y$ e' ~
  58. #define TCCHEN_SHIFT                22/ V3 u7 X5 y, j, a
  59. #define ITCCHEN_SHIFT               23
    2 ]7 M. D: X0 V, n; F3 y! A
  60. - P8 k4 d( |8 F" n
  61. static volatile int irqraised1 = 0;
    5 A" \5 ^: f+ |! }- p
  62. static volatile int irqraised2 = 0;
    # G  Y, |9 G5 J( x  z* @1 k
  63. ) T! d6 `3 f) ]; i: M/ c: b$ Y: |8 f: l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) z( x2 [( A# T% E2 ]/ j& J3 ^
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # W% E/ q: O/ D6 Z( S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 k( V) N& X. Y

  67. , i! g/ v7 _" y% S# O( e- }3 ?+ |
  68. dma_addr_t dmaphyssrc1 = 0;% @0 G1 T' q- h, g
  69. dma_addr_t dmaphyssrc2 = 0;
      a- M+ I5 g9 K' R4 J9 C+ G6 r
  70. dma_addr_t dmaphysdest1 = 0;& z+ t( q) c. [) z6 E0 F. J+ A- Q
  71. dma_addr_t dmaphysdest2 = 0;) U0 W7 t3 P) s! }$ T: n
  72. 2 u8 I6 z8 h" }
  73. char *dmabufsrc1 = NULL;
    . o7 k: e4 Z8 s0 A2 h. e; Z  |! ^
  74. char *dmabufsrc2 = NULL;. A; s7 M) ~& Z) \/ E6 @
  75. char *dmabufdest1 = NULL;
    ; r) O! ?+ W$ ~6 \% h$ H
  76. char *dmabufdest2 = NULL;
    ' T$ e0 J- \$ G6 z
  77. & J$ c) \/ \; _7 G$ s
  78. static int acnt = 512;
    + K/ n% K9 \7 P1 }2 o
  79. static int bcnt = 8;, R$ n6 R$ f0 c6 x8 O; x5 j9 h6 l
  80. static int ccnt = 8;
    / u' _! |% N( o( ?9 `7 V
  81. 0 x% g) Y. V( ?) s" a
  82. module_param(acnt, int, S_IRUGO);
    $ z, w% Y7 H9 y
  83. module_param(bcnt, int, S_IRUGO);+ P, m" V/ ~3 j: S2 w+ W, J- W- i
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" f% O9 M! _7 [1 _
) a. {6 n$ @( P) j      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 X$ l; }: T+ R7 p8 j
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 M: d% `7 z, I- z8 S
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
: a: r. ~9 ^- C$ t1 `2 `% i# [/ D4 r! O4 R8 m

, |4 h% R) Q: Z2 Y7 C9 T
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-29 18:05 , Processed in 0.039204 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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