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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
$ P, T5 u- g8 p9 O) A: [5 D
  1. [code]EDMA sample test application/ A; w( g0 p- _4 v
  2. /*6 o: {) l# M6 E& G  R% y
  3. * edma_test.c" C/ h6 c: ~" ~6 d
  4. *  W0 y! [* f# y: Z! v
  5. * brief  EDMA3 Test Application3 O# i! Y$ J  {2 U
  6. *
    ) P( j# ^" ?# |2 B
  7. *   This file contains EDMA3 Test code.
    - T  }% h, j+ E# H& E, S1 W5 P4 \
  8. *
    ! j9 F% G2 {7 d0 p. Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE" `# H2 W. D" {. c6 Q
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    ( T) x" z" ?( ~6 S: h
  11. *         TO CHANGE.
    2 E( @( h, o  ]
  12. *3 j' g. l2 T& c  o$ m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/* n/ M5 c9 h; w! m0 s3 b. i
  14. *' [& Q7 h6 Q& H$ q! H1 t, w
  15. * This program is free software; you can redistribute it and/or
    2 `: w/ v0 E* H+ U
  16. * modify it under the terms of the GNU General Public License as
    1 p# J8 W2 j5 N+ o0 Z; v2 S. |
  17. * published by the Free Software Foundation version 2.
    ; X: D7 M+ m9 h% Z* J: y. n
  18. *
      P5 ^$ H8 t$ P; a+ i4 E! p
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    6 I: c" I, e! N! Y
  20. * kind, whether express or implied; without even the implied warranty
    " E/ ?4 A8 G/ u2 }  N9 X# A0 o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the$ z* x$ M! ]( k7 ]7 y# K: u
  22. * GNU General Public License for more details.! d# {3 v& C7 o8 _0 y! W# N, A9 q
  23. */5 M: D. X: ]! z! F# t6 P

  24. 3 r1 O* f! B9 w# K
  25. #include <linux/module.h>: a! Y* c2 C9 D- ]
  26. #include <linux/init.h>9 T4 W) f7 A2 M  U
  27. #include <linux/errno.h>( T% [6 R$ i  A! ~( B
  28. #include <linux/types.h>- t: i: U5 R* \- H3 P# r1 P2 m0 N: _
  29. #include <linux/interrupt.h>
    2 j/ m6 [, A0 h, b' C
  30. #include <asm/io.h>7 [8 K6 B( S/ y1 u3 I  l
  31. #include <linux/moduleparam.h>
    2 Y( r4 u, v% L6 b  q- o
  32. #include <linux/sysctl.h>1 w" i' @8 f" d" V% Q- Y
  33. #include <linux/mm.h>% P2 e$ F; u1 i; v; b
  34. #include <linux/dma-mapping.h>& D0 I( `* K) b6 ~' C

  35. ( L, O$ A$ p& d9 a
  36. #include <mach/memory.h>: i# G+ ]2 x) M
  37. #include <mach/hardware.h>
    " F, L% Z) c8 n6 C
  38. #include <mach/irqs.h>
    : T" S1 X. S4 y/ _
  39. #include <asm/hardware/edma.h>
    . `& e; |* b5 v+ a1 F

  40. ) D; y% A3 [* x/ [- M' Q: ^1 c
  41. #undef EDMA3_DEBUG6 {: a5 b9 Y  X. l2 t+ W
  42. /*#define EDMA3_DEBUG*/& {* c2 F$ ~' P* ~

  43. 2 D4 T/ A& O5 }) k* t
  44. #ifdef EDMA3_DEBUG' V5 i8 E% _  c$ A0 [- `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)) v1 J+ q$ O4 ~) K, e; E
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__): A3 |+ y+ X4 K5 T. N) f
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    , O4 P$ @8 F3 _, \& v
  48. #else
    $ L# `: k% A6 x& d
  49. #define DMA_PRINTK( x... ): L9 }+ R3 m5 Y: U) M' a4 X
  50. #define DMA_FN_IN
    $ P# z2 y" y9 {1 K; v
  51. #define DMA_FN_OUT
    , o' \* F9 G6 {5 B0 x4 R* a2 z
  52. #endif' y% ]- `9 q" }# g5 ~

  53. % f& r9 H) M. A+ `( Y3 z  `- R
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . x; D0 n, Q3 o) n+ q0 S5 ^
  55. #define STATIC_SHIFT                39 b+ _" I5 g# R: z1 n! S
  56. #define TCINTEN_SHIFT               208 P  ]" y9 M+ v$ {/ t! b! C4 z) [9 e
  57. #define ITCINTEN_SHIFT              21
    4 P! Z0 o* a  E3 M6 m" _
  58. #define TCCHEN_SHIFT                22
    ' M$ `" |* x5 S" @  I9 _, ]
  59. #define ITCCHEN_SHIFT               23
    7 W9 I# C$ M0 x4 }' t: w

  60. . d) b* e  |$ p' X. W& Z- r+ }
  61. static volatile int irqraised1 = 0;
    5 g( D' [8 C% Z: M
  62. static volatile int irqraised2 = 0;
    - b. Y9 x2 Q) Y8 c0 U

  63. + a  S; L, _# y/ M4 ]
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);8 |+ I6 l' ~% X7 \
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 O3 G7 ?' K$ |3 P4 e
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);' h+ q  `9 T; s* `% P9 d
  67. : Z" Z: b3 [9 C( y* Y; c
  68. dma_addr_t dmaphyssrc1 = 0;
    % b: v8 ?' d0 c" O( f
  69. dma_addr_t dmaphyssrc2 = 0;
    7 O9 S7 Z3 K) g) _5 ~
  70. dma_addr_t dmaphysdest1 = 0;
    + ]8 ]4 O  W6 p6 [& f8 b: o
  71. dma_addr_t dmaphysdest2 = 0;# x, a1 K; [; _+ Q( j  O1 w

  72. " M/ i7 a7 U4 v4 w! w# b/ v6 V
  73. char *dmabufsrc1 = NULL;
    0 W* n$ f2 Q8 @3 @3 z/ W
  74. char *dmabufsrc2 = NULL;9 D' b9 e+ k* a4 B4 a+ M
  75. char *dmabufdest1 = NULL;
      l/ X% r* G6 n8 ?& z( P; p
  76. char *dmabufdest2 = NULL;
    : V- d; ]2 e2 _0 T! Z9 t. e; H8 ^

  77. # C+ u6 g& ~6 W! \; h2 ?
  78. static int acnt = 512;
    - V* M1 H! G- X& l8 R: C
  79. static int bcnt = 8;
    / L8 ?/ C! c0 K8 L3 n
  80. static int ccnt = 8;7 v' T/ W5 ]8 p: |9 _, R' F) ?& h& D
  81. ) Z6 a' p4 ~' n9 B. I, F1 r
  82. module_param(acnt, int, S_IRUGO);* ~. i0 S! G$ E( ^+ K7 V
  83. module_param(bcnt, int, S_IRUGO);
    0 m9 Q; z( v, p; ^( I
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ |+ l) ^# }1 I. w+ m7 b- x
6 `: [3 \4 x2 ?! G1 ~! T/ D5 d& T      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用/ s# t" G6 {, S% z4 D: r9 S
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。8 N( _' T/ B8 h/ S$ g4 l& _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
5 l$ X' V4 D; |/ Q
' `5 ^3 z" L+ {8 W4 ~1 ~; F% H8 |& x% R( M: k1 H
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-16 18:45 , Processed in 0.044271 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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