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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 / k6 E8 z8 N8 G' t9 D- r1 I! Z
  1. [code]EDMA sample test application
    : `* s# B2 J2 c  f4 @+ R, `) V
  2. /*
    " I$ R) W2 D$ }! |
  3. * edma_test.c) E$ P$ D" a  S0 P0 Y
  4. *$ q1 w/ |4 w6 }* c! F
  5. * brief  EDMA3 Test Application
    ) ]) c+ l' U, U  L
  6. *2 o5 B* \4 n/ o% J8 t4 I2 u
  7. *   This file contains EDMA3 Test code.
    4 |$ H1 G) U! Y% K
  8. *
    6 d! S0 T( L8 u! \4 x! E; Y
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    9 D5 x) S. a" g( |, `1 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT$ W+ s' L! u' K* }0 i
  11. *         TO CHANGE.' \- n# h% {0 ~- ?2 W9 ~7 N
  12. *
    7 e4 |1 B% x0 h; ~% V2 @) b
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- q$ ^% F0 O7 p$ V7 w# L& G2 I9 K+ C* i
  14. *% |0 T$ s" d2 S7 f4 P
  15. * This program is free software; you can redistribute it and/or
    + |+ c. g+ i& V- s) A* b
  16. * modify it under the terms of the GNU General Public License as) u7 ], N, b1 Z9 b3 G; R
  17. * published by the Free Software Foundation version 2.# W) z5 b, Q) Q, R" D" T
  18. *
    - \. \* o' S0 r& }, `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any7 R2 Y# r, B) n- v' I! a! }5 I. _
  20. * kind, whether express or implied; without even the implied warranty1 i! J  n" `: w) f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ; G- f! X+ t/ L' [9 R7 @) e7 u
  22. * GNU General Public License for more details.: n/ N6 |6 Z4 K
  23. */! R( D0 A# u' y( e! h

  24. 8 H& T: Y8 ?  g$ J# m
  25. #include <linux/module.h>
    0 B  x3 D/ x9 \# t3 ?
  26. #include <linux/init.h>1 \% i3 h: |2 T7 \3 d% T4 V  M
  27. #include <linux/errno.h>
    ) [. ?; k9 j% p0 v+ J, R
  28. #include <linux/types.h>
    , |" b, D% u, i. E
  29. #include <linux/interrupt.h>3 u  B$ f4 J, q6 b- E2 A
  30. #include <asm/io.h>9 c+ n$ j7 Z5 A3 z
  31. #include <linux/moduleparam.h>" W8 W3 t: T# S; A* K0 P
  32. #include <linux/sysctl.h>+ ?/ y! C9 f. d- S& s- {$ U7 M: H7 x* U
  33. #include <linux/mm.h>& _. V& i- P9 p  ?2 U/ _( E
  34. #include <linux/dma-mapping.h>
    1 x6 Y0 J; R7 q. G7 J5 v; C7 r
  35. 6 K1 s* k2 V! p0 c! z, p+ o
  36. #include <mach/memory.h>
    . q3 f( Z1 M5 h  I6 x6 @
  37. #include <mach/hardware.h>  x4 |# p8 p/ d: a; j
  38. #include <mach/irqs.h>
    ( B- T1 t3 ?$ [# M, K7 P
  39. #include <asm/hardware/edma.h>3 m0 N3 W" ^6 n# Z1 P

  40. + J1 H1 v3 R! X/ F
  41. #undef EDMA3_DEBUG
    ; f# p/ Q. v2 c& k. {6 [
  42. /*#define EDMA3_DEBUG*/& X+ @: B$ q8 T& Q" c" m% n3 Z
  43. 5 S; g# C/ O4 w* P0 N+ J
  44. #ifdef EDMA3_DEBUG
    / t% Z0 {# h, C7 t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)4 k- l$ F0 H; V) Q
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    & \" j, p9 M$ s
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)  t$ ]+ {0 U- K2 U
  48. #else
    8 g/ ~, h; M4 ~- s3 w
  49. #define DMA_PRINTK( x... )
    ) [* L! L, [  q, ~4 D. f
  50. #define DMA_FN_IN1 n& O0 w7 ^, }+ A4 E! `
  51. #define DMA_FN_OUT
    7 @* ^# ?, m/ P9 B1 s' |
  52. #endif3 z* ]4 V& R8 s4 G
  53. # ^6 t: Y- C( l, ~1 H: G
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)+ Y' G0 V& w2 e! k# P) h- E
  55. #define STATIC_SHIFT                36 d& C$ r) |: w' ^$ ?6 u% W' T
  56. #define TCINTEN_SHIFT               206 K0 A; @3 d1 g4 V2 q# d& w/ Q
  57. #define ITCINTEN_SHIFT              21- B$ K* ~, a" I
  58. #define TCCHEN_SHIFT                22% D6 |; O8 A5 l& A1 n% {* k0 o; [' q3 h
  59. #define ITCCHEN_SHIFT               234 v3 m& M) p/ U/ ]# d. ?0 t3 T+ T

  60. 1 r% L- V7 E2 F2 ^, @$ I
  61. static volatile int irqraised1 = 0;3 |4 x; S1 `2 j$ f
  62. static volatile int irqraised2 = 0;
    2 Q' [! [4 L( \, a; O) q
  63. 7 u5 n) ]+ E6 I$ W. D  D/ V. |4 w
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 ^' x, j" h+ E5 [& E3 T+ a
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    : p5 U- T( H# f
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 o6 C9 r: T6 r( I- K' u2 b1 X

  67. , h  y# R% J) U8 B8 v
  68. dma_addr_t dmaphyssrc1 = 0;
    ; f( B$ y0 i$ a  O; P3 D" t
  69. dma_addr_t dmaphyssrc2 = 0;' f1 n  C8 H; q9 Q! ^  Y
  70. dma_addr_t dmaphysdest1 = 0;
    & S+ ?1 _4 i, H) t, _& b
  71. dma_addr_t dmaphysdest2 = 0;/ \+ S4 M1 ~" P$ I# i" @* K
  72. " w7 \7 a$ S& \6 ^& [
  73. char *dmabufsrc1 = NULL;3 \$ s$ k5 G$ e/ Q1 w
  74. char *dmabufsrc2 = NULL;% v; _( m- Y1 ?
  75. char *dmabufdest1 = NULL;
    4 T( M6 ^! C. W7 T$ C, s
  76. char *dmabufdest2 = NULL;6 l$ |& q$ x; X5 C% a

  77. , W4 {3 P2 \4 g: }' x/ u
  78. static int acnt = 512;
    ( l0 T4 L0 p7 w2 k0 ^+ r; p
  79. static int bcnt = 8;) n' G/ J& M: M% B
  80. static int ccnt = 8;/ P+ N) A% F8 v6 Z( @1 B& I
  81. : k- f1 S( Z' ~4 k7 k$ ?
  82. module_param(acnt, int, S_IRUGO);3 E4 w/ F2 R6 i8 f) _) c2 l/ n0 m  D0 r
  83. module_param(bcnt, int, S_IRUGO);
    2 M; h- c' F! M4 V# f, C  s
  84. module_param(ccnt, int, S_IRUGO);
复制代码
6 a* o" L  K, Y/ o) n0 }. k; \
" U! p7 L9 `4 ?) q
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用+ w- S/ }6 G! D$ Z1 D
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。7 R( d3 O& `- K' w+ S9 t
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。+ I, c/ E% L$ g

. W+ p$ f6 k( d' p+ L+ h# M# d* z' a5 V4 z
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-11 06:22 , Processed in 0.039756 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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