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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 z6 F" g, @, p& U; I
  1. [code]EDMA sample test application
    & b6 {" b6 E/ e) S
  2. /*" u% u$ M! t3 _, D. b$ f
  3. * edma_test.c! Y4 {5 T0 ?& R' @; b# S9 T
  4. *6 B9 {: [$ v! \
  5. * brief  EDMA3 Test Application' A) ~" ^2 m. M
  6. *
    3 v8 {% p- l% `" }: m2 X
  7. *   This file contains EDMA3 Test code.
    7 d7 p  Q3 q- I, |+ q& q7 i
  8. *9 C) a1 |  h8 W. Y) \
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % k0 G# D5 h9 U! `4 @# f7 K- i# ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) U$ G% G3 P- e& o4 B3 I  C+ Q( y3 I4 [
  11. *         TO CHANGE.
    # j) Z, M% ~2 ?
  12. *
    - q4 d- O0 z, Y( e* K" Q
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 x0 V' i1 V/ B+ ^7 C5 a8 m7 L
  14. *
    5 G6 d4 F9 p1 ?
  15. * This program is free software; you can redistribute it and/or8 t' S9 \* y0 V9 Y
  16. * modify it under the terms of the GNU General Public License as
    9 k; m3 m/ T/ k" H/ m  |" Z
  17. * published by the Free Software Foundation version 2.1 N5 ^* w# u. O& e  Q6 _; J+ M) B
  18. *! R4 \6 L& _/ f. f+ g: {
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    - j  [# N4 g1 Q' Z- d' m
  20. * kind, whether express or implied; without even the implied warranty2 C2 _. |5 r3 e. f& _
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      A! Y& u7 C0 L
  22. * GNU General Public License for more details.: m. i0 t* V5 u
  23. */4 v3 P3 n( |/ X' X3 n: v# v$ Q9 W

  24. 1 v4 Y: V8 ^- l
  25. #include <linux/module.h>6 s; v, X0 Z3 n2 K; K
  26. #include <linux/init.h>
    ) N' g2 _3 c4 D% [  i. i
  27. #include <linux/errno.h>
    / F7 I5 {' {* K" `! G
  28. #include <linux/types.h>
    3 D0 U7 z0 B5 _" o. E
  29. #include <linux/interrupt.h>  r% B4 f; X/ D; J$ _
  30. #include <asm/io.h>
    / U8 e- J& P! ~/ @6 f' n
  31. #include <linux/moduleparam.h>9 Y* M; w. A1 j! X# Q
  32. #include <linux/sysctl.h>
    3 b3 m& U4 x" I" A# p+ t
  33. #include <linux/mm.h>! C# g* V5 K  L- p: D5 e
  34. #include <linux/dma-mapping.h>8 ^. u' ^, |0 m: N! r5 v0 Y+ {
  35. 0 y7 r0 V' T( j6 w
  36. #include <mach/memory.h>4 m) D) ~6 ^: u- J7 q6 L) k
  37. #include <mach/hardware.h>/ C7 z' M8 f0 C& Z, g8 |
  38. #include <mach/irqs.h>/ f; [1 Q# _: h7 r5 M0 p( L
  39. #include <asm/hardware/edma.h>
    8 o  c: M5 I( q+ I
  40. " M% {4 W6 e6 }( i/ {
  41. #undef EDMA3_DEBUG' r9 B. {' e2 P2 M3 x! ?
  42. /*#define EDMA3_DEBUG*/
    4 [4 B( e* |4 }; ]* j* r* L
  43. 7 R$ E  r! @3 O! J9 H% p& R
  44. #ifdef EDMA3_DEBUG
    9 {% P1 ]$ K- \/ A0 d+ n1 d
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    % q# L4 j" L* n) Q. M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    $ ?8 ~: [9 \# \4 l; q# h; T5 q
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)+ S- }, p  i1 u* x1 A1 R
  48. #else
    " h3 o1 W9 X7 J$ O
  49. #define DMA_PRINTK( x... ). R! O, X' H& i$ _/ p$ V
  50. #define DMA_FN_IN
    ! a5 W4 ^. m% t( H& k5 v( y
  51. #define DMA_FN_OUT
    ' }+ W, \( _1 G( R
  52. #endif# d6 ?: A3 t$ z7 l/ K0 O$ G
  53. ( j  a: p: [: g2 O% B
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)$ c9 V' X7 F( x- i: p/ U
  55. #define STATIC_SHIFT                3
    4 B3 O2 H6 Q1 C- |4 K' I
  56. #define TCINTEN_SHIFT               202 [  H8 _9 q, ]1 c7 L0 O3 x
  57. #define ITCINTEN_SHIFT              21
    6 Z0 y, c$ \, B7 n
  58. #define TCCHEN_SHIFT                224 R8 ~& f, I7 c8 D  a2 @
  59. #define ITCCHEN_SHIFT               23) F% y+ Z$ [1 a% Z" l; _

  60. 5 ~+ c5 a7 P/ m3 W( H* D
  61. static volatile int irqraised1 = 0;( ^- w1 t- Y: t5 J/ h
  62. static volatile int irqraised2 = 0;
    : w8 ?* n7 W' y2 ^, g- I- d  s

  63. + f! p! I' k8 r. K5 v  c7 t  K. M
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# |& K8 b* G( A! c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* ]# ]. p1 y( F  d" \$ S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 E! z6 k5 ?2 J, F5 v8 `
  67. 2 R: d' l) e/ y. B: N2 B; ^
  68. dma_addr_t dmaphyssrc1 = 0;
    $ i/ @# t1 t/ S! r
  69. dma_addr_t dmaphyssrc2 = 0;/ ]' B7 K! }/ ~8 `$ P5 p# c
  70. dma_addr_t dmaphysdest1 = 0;
    # Z' n$ G# K2 ?
  71. dma_addr_t dmaphysdest2 = 0;1 m4 h+ B# ~6 x

  72. ; ]' H  L/ g( O, b% x+ s
  73. char *dmabufsrc1 = NULL;& D* ]4 r/ H* F( X7 X. a! E
  74. char *dmabufsrc2 = NULL;- ]- Y0 _7 t  L# [  t" V) H
  75. char *dmabufdest1 = NULL;! w! Z6 f7 R" `, a
  76. char *dmabufdest2 = NULL;
    8 _4 x$ \( G7 E: T- p( V

  77. 3 a: J/ @9 P- ]4 a5 i$ ]! I
  78. static int acnt = 512;1 o& J; _& c9 G/ ^
  79. static int bcnt = 8;3 ]: r9 D5 B" [1 k
  80. static int ccnt = 8;
    ' R# d4 X. T' ?' p+ c
  81. * G) _( f4 P# H& z
  82. module_param(acnt, int, S_IRUGO);
    " ~+ s+ b* k' A% J  V' ?
  83. module_param(bcnt, int, S_IRUGO);+ a7 h; F( R: f& a: Q2 L: w
  84. module_param(ccnt, int, S_IRUGO);
复制代码
8 A8 K; D- B1 v* y4 d% k
7 c; g: J) D. J$ s
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
) ~- B4 R" G7 P0 V- o; @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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
/ T8 }' i8 N# }' [0 V: K* f     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
; w" G* {5 ?/ M8 y
+ U5 ?. S1 ?- R+ `4 l
" {2 u) c1 x; b) G' [# p1 _
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-7-2 22:56 , Processed in 0.048826 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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