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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 2 `! V& x2 h! ?, A. f+ u% `5 N
  1. [code]EDMA sample test application! C, N# i: v( b) @! k; g# ^! s
  2. /*9 y  T% ^. J# u4 |; ^( n9 h
  3. * edma_test.c
    9 \8 p/ S; Z% J1 @. E
  4. *7 y% n+ i, H! I
  5. * brief  EDMA3 Test Application$ |+ G3 `2 c' Z0 Y$ |7 S, x
  6. *
    * ~) O4 p; L( ^* g) E* [
  7. *   This file contains EDMA3 Test code.
    1 l! W. W  G* A* h* A
  8. *
    8 M- k* U% \# Y; i
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE  F! F6 X4 }& C$ ^# B* @
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # v1 [/ ^2 M) u
  11. *         TO CHANGE.1 s4 E3 a" D" h  S6 v
  12. *3 D5 _$ V& L2 a% {
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/2 x8 m' v* ^: v+ ^1 T
  14. *
    - A. ~' j" t% z
  15. * This program is free software; you can redistribute it and/or
    2 E* k1 }7 E( z- ~/ l
  16. * modify it under the terms of the GNU General Public License as+ M' @2 `8 H8 ^' D+ n- K( k
  17. * published by the Free Software Foundation version 2.
    $ x- l+ G* D: l) S* R) L/ W
  18. *
    ! U5 ?4 D5 `, u# ?2 L* L+ ?
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any+ Q4 Y' \: {, F
  20. * kind, whether express or implied; without even the implied warranty% f; U( ]0 h' E2 Y
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    / d7 P0 a4 ~7 U; k) p/ h- u
  22. * GNU General Public License for more details.+ O% m3 L2 q5 v, \
  23. */- k% L9 D1 r+ c6 L9 D2 q5 U
  24. ! _7 d7 U# L8 d# ^
  25. #include <linux/module.h>
    . ?6 G4 t, f/ u4 P
  26. #include <linux/init.h>" Y' I& ^1 i' l+ f' e7 ^
  27. #include <linux/errno.h>
    & `3 |0 @$ a6 T( T- e0 v
  28. #include <linux/types.h>) t1 a) K9 {, k8 v
  29. #include <linux/interrupt.h>
    * K5 B' t1 e. e2 `. L
  30. #include <asm/io.h>
      k% J) h' E- l7 |% X  D0 L
  31. #include <linux/moduleparam.h>" m1 l; t1 m6 P9 k+ [. F6 w
  32. #include <linux/sysctl.h>- U/ B9 f, e7 s/ g5 {
  33. #include <linux/mm.h>
    & P1 M! f- E" R
  34. #include <linux/dma-mapping.h>
    ( Y2 U" f- a( J6 L2 L
  35. : b/ I0 Z( z# z& x; X' Y
  36. #include <mach/memory.h>
    . D) W! Q! ]0 q
  37. #include <mach/hardware.h>
    ' q, s& o# \$ D4 O  w4 ^
  38. #include <mach/irqs.h>
    % Q0 B( O/ {; v8 |. O( b
  39. #include <asm/hardware/edma.h>
      V: j1 M& T' _5 C/ q

  40. 8 g1 d) i0 M' g1 t- v0 u
  41. #undef EDMA3_DEBUG) \# R3 T$ O& N, V% u7 z
  42. /*#define EDMA3_DEBUG*/
    # |, b- `+ @8 v) p' g% D

  43. 7 y$ i7 q/ O5 P5 o8 {3 N
  44. #ifdef EDMA3_DEBUG( L) ~0 D( s; ?  `+ U
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    ! T/ X2 y9 b4 N: g7 i7 s. P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ D; K; K. ?1 S* @5 `& X( h% j
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    1 O+ K5 w* J3 ~  U4 J6 Z% F
  48. #else
    5 T" G# O$ w+ N; X1 e2 h6 K
  49. #define DMA_PRINTK( x... )4 X! H+ p3 v8 E* C+ T1 j
  50. #define DMA_FN_IN: D' P$ n3 i$ c% U+ @8 T" c4 P3 c
  51. #define DMA_FN_OUT
    3 a: A5 R1 T+ e* T
  52. #endif. f7 Q7 T8 _: @9 ?( {# j, z

  53. ' g- }9 V( G* d
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    # z& q# W9 L3 D
  55. #define STATIC_SHIFT                3* s4 }# G7 b5 s$ K% [
  56. #define TCINTEN_SHIFT               20
      ^2 L2 w9 k$ X
  57. #define ITCINTEN_SHIFT              21" p* D1 {) }- ?1 P  h9 g% Z
  58. #define TCCHEN_SHIFT                22
    + N+ V1 V, ?* z2 I* P) ^/ W
  59. #define ITCCHEN_SHIFT               23
    5 b9 K8 j3 r+ m2 l1 j+ ^

  60. % T9 m5 e2 ]1 b1 }3 S
  61. static volatile int irqraised1 = 0;
    & y' B0 j/ Y& x9 H! w  s
  62. static volatile int irqraised2 = 0;
    5 P* C; z; t6 l0 x% A0 e

  63. , L/ Y6 \0 X* d" j( B# J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 h; y7 w4 h: a9 ]' h) N
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 @/ D( r9 ^  S% s8 l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% s5 [2 \8 k: I4 O4 Y4 p/ e

  67. - u) Z) o3 x+ X: `
  68. dma_addr_t dmaphyssrc1 = 0;
    6 O1 d" \' _3 h$ _0 g3 P
  69. dma_addr_t dmaphyssrc2 = 0;
    % c( v+ s4 h4 b! K+ G
  70. dma_addr_t dmaphysdest1 = 0;
    2 h9 M- t2 j/ K5 m! c* w/ k
  71. dma_addr_t dmaphysdest2 = 0;
    4 v" ?8 ]. ?8 A& v; C% |
  72. : [$ {  V7 V) W% A# [: y& W
  73. char *dmabufsrc1 = NULL;5 V* Y: s6 k8 Q/ Q4 e: F( e
  74. char *dmabufsrc2 = NULL;' ?  v) M/ }4 g6 W0 V
  75. char *dmabufdest1 = NULL;
    - {4 r" z' B* p' L, j; t
  76. char *dmabufdest2 = NULL;- l2 I0 I5 w) J+ b% m* n& a# M
  77. 7 O9 j) y# W0 a% ]1 Q- m- b
  78. static int acnt = 512;0 G( }- {: X% V% v- ]
  79. static int bcnt = 8;
    - m8 e* j3 d3 r* v
  80. static int ccnt = 8;/ S# E% {  j. q9 B: E9 B1 v. T

  81. + c+ _) |7 ]4 @4 H, }
  82. module_param(acnt, int, S_IRUGO);1 a. H  a3 D  _% z) [
  83. module_param(bcnt, int, S_IRUGO);
    + y+ X) O  o3 m5 x
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: j. l. N7 d, a$ J6 F5 X7 W9 J" l. g$ q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
( J3 ^( g5 Y9 {7 o0 A2 a5 Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
9 f% }5 L+ ~* H: }7 S' U4 I8 x     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
$ f$ Z; S5 \0 Y4 {6 t* K& N1 u. P7 @3 a5 E

8 d4 u7 x! n& w& ~1 u+ q7 O
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-26 02:51 , Processed in 0.045631 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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