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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
5 Q% `: ^0 r6 E5 l6 R7 S: n
  1. [code]EDMA sample test application
    3 z  G4 Q8 U* @+ R
  2. /** T7 g& s' M$ v; G; [8 k- Y
  3. * edma_test.c2 J. ~# T# t( W: ^* [" l# n
  4. *, k, b# U- w- k0 S
  5. * brief  EDMA3 Test Application8 {/ r8 A- ]2 R2 I  s/ a
  6. *
    , a: {- |4 J2 t9 F
  7. *   This file contains EDMA3 Test code.
    1 ]. ?, a- L! p! e: N
  8. *; ]$ Y! J2 o* n% h
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 y; ?$ A( s% ^* j+ S* Q: J
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
      |. f% Y) M, I2 o# H
  11. *         TO CHANGE.0 x, J7 _  D& w1 o- e
  12. *5 I4 |% s8 D$ x! O$ Z+ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% W$ C+ H+ N" a  e% s7 m% h
  14. *
    & s. l! m* O/ x3 B# G% A! K
  15. * This program is free software; you can redistribute it and/or
    ) s+ a" ^4 b+ W! ]2 [8 |
  16. * modify it under the terms of the GNU General Public License as
    / Y! b/ k, Q& `1 g' m" B' a
  17. * published by the Free Software Foundation version 2.: a- t5 l# s: X) g. ~' l7 S* S( ]
  18. *" ~0 D1 b" L7 ]! O) l) o: i! d
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - x! c$ E5 l0 H) ]3 ]# c- t( l
  20. * kind, whether express or implied; without even the implied warranty6 t; m; y" _0 i) P' _7 V2 q: v# B
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    # F1 j5 _. t3 R/ ~7 }  M( U5 h
  22. * GNU General Public License for more details.3 y# h; ]) |# M& r5 A7 u3 u; }
  23. */
    1 w- n4 n* k- c* _3 Y, M

  24. ( K) V/ ]7 {- Q' o! P/ {
  25. #include <linux/module.h>
    , T; H! x: ~, c( D
  26. #include <linux/init.h>
    , c& W& {% U  T7 X, G$ j# U- C
  27. #include <linux/errno.h>
    . }* q& @+ |3 B5 a+ w- Q
  28. #include <linux/types.h>
    . }3 H2 i3 p) N+ Y* w
  29. #include <linux/interrupt.h>
    . o9 @1 q" E' [, d; L
  30. #include <asm/io.h>4 {. F3 F0 `! r7 ^1 j3 \/ ?
  31. #include <linux/moduleparam.h>; A) u. s4 c  u1 o  |
  32. #include <linux/sysctl.h>
    " m/ B' }0 J' k; N- O
  33. #include <linux/mm.h>5 z( t! ~1 s: R$ E0 E$ o: d8 s* v( I
  34. #include <linux/dma-mapping.h>  a) \( q% c& P9 j3 m$ m

  35. - d; a7 T; @0 C+ p
  36. #include <mach/memory.h>
    1 E' {8 e5 j% Z4 Y$ y, N, H; J5 V. T
  37. #include <mach/hardware.h>
    4 M6 ]8 g- S7 W( ]" _
  38. #include <mach/irqs.h>8 H5 a4 \7 X& u' w
  39. #include <asm/hardware/edma.h>
    ! D. G7 Q- R, n% R1 h, f$ a/ ]

  40. : v  \0 p4 g+ D6 {
  41. #undef EDMA3_DEBUG
    5 n& C% U' ~: e! B% y
  42. /*#define EDMA3_DEBUG*/+ d9 Z6 F, s$ E# I
  43. 4 P0 \2 r& @3 z1 H, ~2 s: L
  44. #ifdef EDMA3_DEBUG
    ; d6 i8 o3 ~& t3 M" w9 ^! R5 R
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)  L7 H4 ?( ]- X- ]! n/ y: Y
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__); ~3 a7 ~' T- {# ]6 b! i6 S. q) m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)8 C9 U+ F% \' B- z
  48. #else
    7 E. ^+ m- t% t- I5 x( L
  49. #define DMA_PRINTK( x... )
      Q# Q' s- {0 N' o" m0 I
  50. #define DMA_FN_IN% j" M6 w# l9 D* w
  51. #define DMA_FN_OUT( E4 z' J9 O" _6 U8 p( Y
  52. #endif/ O; @( _1 H" P. H' u
  53. ( U5 R3 L: o$ ^( V. j' c
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 `$ J$ a, t( j
  55. #define STATIC_SHIFT                3
    7 x) C: _- b7 B. M4 [8 K# g1 z/ m
  56. #define TCINTEN_SHIFT               20& Q9 r6 a/ {6 ]( I/ N+ C
  57. #define ITCINTEN_SHIFT              21
      x- m' O1 _; K' ^' k
  58. #define TCCHEN_SHIFT                22
    9 x/ i  G# P7 |' C
  59. #define ITCCHEN_SHIFT               23( N' Z- C) a2 S2 N( R2 |

  60. 8 m- @0 c" H5 _& O, s
  61. static volatile int irqraised1 = 0;
    4 S2 v8 @' K8 G' f! a2 D: k
  62. static volatile int irqraised2 = 0;
    / ]0 r1 N3 z) Z# z

  63. 7 `2 R8 P4 Z8 f# h& ?6 j+ y. N8 @2 q
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ S" W' S+ J9 G/ ?: l, K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! J: z: e. G7 I' B4 G
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # c0 t3 V% o3 H6 M- d: ?
  67. 1 ?# H9 M* i  [% k5 g( W
  68. dma_addr_t dmaphyssrc1 = 0;
    $ [' x- A+ G: \7 h: V5 _6 z
  69. dma_addr_t dmaphyssrc2 = 0;
    * Y' x7 L, J& m$ e4 k& [
  70. dma_addr_t dmaphysdest1 = 0;. H# j' u& a' y3 a% Q& y; z" W
  71. dma_addr_t dmaphysdest2 = 0;
    . ]9 {3 u+ ?* ], x* f

  72. 9 d6 E8 a. w$ X# [
  73. char *dmabufsrc1 = NULL;8 H( S3 k- s* `; P7 \1 A; `
  74. char *dmabufsrc2 = NULL;: i: P# o3 U. d/ T- F
  75. char *dmabufdest1 = NULL;
    3 n; Y1 Z) ~  R3 Z9 a
  76. char *dmabufdest2 = NULL;
    % D7 S( Y: B6 J$ @3 [

  77. 5 y3 J% [1 o- Z5 ~  X- w) f* ]
  78. static int acnt = 512;
    8 k: L  r* \& ^4 P( D7 D$ V8 N
  79. static int bcnt = 8;
    ; P1 D! B, m* I" [$ }0 h5 j
  80. static int ccnt = 8;
    , n3 j8 g: z8 b- L. H
  81. % s( r$ M7 A1 l3 a* F. V
  82. module_param(acnt, int, S_IRUGO);; Z" h# _* {* N( n' N. p: [
  83. module_param(bcnt, int, S_IRUGO);
    / @/ J" w$ Q( l, g; J5 b
  84. module_param(ccnt, int, S_IRUGO);
复制代码
) h- w' a2 S- t& Y7 m
6 ^' n0 ]0 M: s' N& s' G1 T' S6 b
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# C. A7 ^/ H$ H% o2 ~/ \/ {
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
& Z. K8 R! ]4 k6 H5 I8 t$ L2 j     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
# |( J# w6 o; L/ S0 s, d) x: h# A
' r6 x$ g# I4 n
& A1 [/ Y/ c% @$ _( S) U
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-23 20:02 , Processed in 0.038685 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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