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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% H$ X9 i6 k1 m2 K/ N
  1. [code]EDMA sample test application$ C$ N  k/ K1 n+ [1 E# u5 G/ i
  2. /*
    3 O0 ?' ~+ Q; X9 g0 U4 n1 B
  3. * edma_test.c
    + r5 y+ y7 g+ e: }& p9 S2 [. N3 ^  R
  4. *5 T, X* C( g+ Z& b5 h( d
  5. * brief  EDMA3 Test Application
    5 B! X5 Y, n' U# e- L8 m! {
  6. *
    4 i, M) h: J8 O# o
  7. *   This file contains EDMA3 Test code.
    + u0 q/ U) M9 k0 H6 q
  8. *
    ; p, D) [4 H6 M2 o( X
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    8 G9 E! A0 k2 m' s7 {
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! H) p" z9 f" Y8 Z# z- x! l- f- h
  11. *         TO CHANGE.+ S1 n- N# V* i% c$ o6 c
  12. *
    % f3 c$ H# \2 ?
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/" g+ ^# n# }% R9 m# D; f  a
  14. *0 g4 R7 ^# G" Y
  15. * This program is free software; you can redistribute it and/or
    7 A; ^4 N5 t- g- c6 D
  16. * modify it under the terms of the GNU General Public License as
    % I: i" Y; e0 w
  17. * published by the Free Software Foundation version 2.
    : E7 H& l$ o& |
  18. *9 a5 r8 x) N" c# Q9 H" H
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    & ~2 b. {( E1 h
  20. * kind, whether express or implied; without even the implied warranty
    1 ~2 A% P  w1 t3 V; l2 G
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the0 U' k, M, L7 t9 }0 ]! b
  22. * GNU General Public License for more details.7 c2 ^5 f0 W& m0 M2 w" p
  23. */( f: {* R0 o+ I* V% G2 V7 F
  24. : L5 |9 c: \2 x8 n8 O8 m5 E" ~
  25. #include <linux/module.h>8 U4 X) M' y% c! X2 b  {2 o
  26. #include <linux/init.h>
    ! v7 k/ A3 }2 z4 h( \
  27. #include <linux/errno.h>- v( ~" S) A2 `: V7 E
  28. #include <linux/types.h>5 |& Y, \8 T1 C0 `& Y3 j
  29. #include <linux/interrupt.h>
    . h5 S* h  _' q
  30. #include <asm/io.h>, s6 n0 _2 }6 X+ j/ V9 c
  31. #include <linux/moduleparam.h>
    % O1 q3 d7 E6 _9 u
  32. #include <linux/sysctl.h>
    / ^) c# Z# P' t2 Y% z
  33. #include <linux/mm.h>- Z' A' s" V7 Y8 {* t1 f
  34. #include <linux/dma-mapping.h>
    5 K' g5 q- K; i: P4 F
  35. . u, t: Q* D: S$ E( S: i! }- U1 V
  36. #include <mach/memory.h>) \7 V) p& Z; y0 H5 c
  37. #include <mach/hardware.h>& b' D$ d, ~. c
  38. #include <mach/irqs.h>* u1 ^. r4 [! R- }
  39. #include <asm/hardware/edma.h>: @6 C5 G  s- Z+ R% |

  40. 3 M+ z: `* y; K3 A  n
  41. #undef EDMA3_DEBUG
    ; U* M% @+ w5 U) z$ V+ N. ]
  42. /*#define EDMA3_DEBUG*/+ g( A: e" e: e( T" z: S+ m
  43. 9 ?2 x; S2 c+ |  q# e5 ]& X' ?0 F
  44. #ifdef EDMA3_DEBUG0 E6 {% P' [- U; W  e3 e9 O
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)6 y' W; X8 x+ Q3 {( S
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    5 N5 ?% L5 F; C$ U" I$ ?5 Z0 t
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) W# b7 j1 [$ z3 `
  48. #else, r. o5 n# Y3 L, H# P- V4 |& S' y
  49. #define DMA_PRINTK( x... )
    + w& R% s% F: @  Y
  50. #define DMA_FN_IN
    $ q7 p% a! T8 v/ Y8 ]
  51. #define DMA_FN_OUT
    7 f  ^; o/ G; w  @( R7 R
  52. #endif% c8 E4 T. ^0 z

  53. + ~: M- Q6 \( C6 H2 I9 y; k4 U
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)8 c6 q) P" |! K
  55. #define STATIC_SHIFT                32 x; Q3 J, j- ^5 U% b: o
  56. #define TCINTEN_SHIFT               20
    - {# G, C+ m' _3 j0 Z) S7 K5 W  ]2 J
  57. #define ITCINTEN_SHIFT              21
    6 j" S$ ]. S" ?( w9 R& o
  58. #define TCCHEN_SHIFT                22/ r' H2 ^+ a! f* U
  59. #define ITCCHEN_SHIFT               23' R3 p9 B& P& e; K( w
  60. ' J2 k  V( E! i
  61. static volatile int irqraised1 = 0;9 q& u7 D& R" @# ^
  62. static volatile int irqraised2 = 0;! q8 @. U" D' z; j# ~5 n; ]
  63. & Z& ^, `7 ^8 o; `/ L6 L
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' s) G' G# }3 b! b, R
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    - ~; t7 h9 x$ @, U! @& j
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ e& C" k1 y2 N- F- k* \0 X' u
  67. / s# W3 ^) Y6 N
  68. dma_addr_t dmaphyssrc1 = 0;, [0 A& I4 Z# g; B4 B  T5 ?
  69. dma_addr_t dmaphyssrc2 = 0;% _/ {, `' |& L% ]6 s1 O
  70. dma_addr_t dmaphysdest1 = 0;/ Z9 d- M% [4 [5 `% J( Y
  71. dma_addr_t dmaphysdest2 = 0;
    ! B( W1 Y" ]$ B9 V- A) }
  72. ; T* U$ J$ N; Q4 t, {* z
  73. char *dmabufsrc1 = NULL;
    ' Z, s- r7 L  _$ P
  74. char *dmabufsrc2 = NULL;
    $ Z: ^4 U# S$ L$ ^/ k! u
  75. char *dmabufdest1 = NULL;5 e3 B3 g( g. D: k; D6 R* N( W3 C1 `6 ?
  76. char *dmabufdest2 = NULL;
    ( o1 e- i8 P$ Y3 g) k' h6 N

  77. ( T+ i/ f2 Q; a3 E" X
  78. static int acnt = 512;
    " @. j7 }  C  A3 Y% U
  79. static int bcnt = 8;7 e; _; f7 T9 l9 t( a0 s0 e. X
  80. static int ccnt = 8;0 }( h/ Z/ p0 C4 O
  81. # s5 Q( H# G1 A+ v# l$ H" C; @
  82. module_param(acnt, int, S_IRUGO);
    8 G  n& s$ c* \7 Q( l
  83. module_param(bcnt, int, S_IRUGO);) A! Y" Y$ I9 b7 k8 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

1 C6 H8 g; i; d2 T3 u# `% W8 K( w4 G; c& @
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 I' [$ c! t; c7 R4 S! N
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 E% G; _/ L9 S- d     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
" g2 Y% r$ U: Q- C1 M- W
! t. O" c" d. o  R
' G) d+ R. J7 F7 W0 P
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-11 18:01 , Processed in 0.039900 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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