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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 , @/ _/ u  M0 ~6 s$ w) j6 F3 p- k
  1. [code]EDMA sample test application- }6 k* {" ]" N4 t
  2. /*6 T2 T1 p; H& i
  3. * edma_test.c* ~  y, N& K3 b8 S* r/ O7 J8 z  P
  4. *
    ! F7 Q. _9 }! b. U( \0 t  _1 _
  5. * brief  EDMA3 Test Application
    / K8 I1 s: k) s
  6. *2 R! Z5 [  G. e
  7. *   This file contains EDMA3 Test code.9 [8 t# n( K. r
  8. *
    & n, E% f% b2 z" }
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. s  l( B3 x% ~* r0 p
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    4 D- r$ K% U, C; {) l
  11. *         TO CHANGE.; Y5 P- Y5 i% |: c
  12. *3 M( P8 u9 `1 L! \" n- L% P: B9 s
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    / g- R: p3 ^" B( i$ D* c' \3 p5 i' y( f
  14. *8 A9 u1 v3 O2 D4 ^) p0 Q
  15. * This program is free software; you can redistribute it and/or3 n7 |9 x& ]- U+ \# c: i
  16. * modify it under the terms of the GNU General Public License as
    - D% x7 O& |7 Q9 w9 T' _* k
  17. * published by the Free Software Foundation version 2.
    * t/ {" i: P, Z5 r% {& d
  18. *
    5 Y9 D: b3 U2 s9 {& F. j2 h5 u
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any0 s" t, v3 k) Z  ~$ ^. A
  20. * kind, whether express or implied; without even the implied warranty
    5 ~4 A& o/ n5 `% c; Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the6 w+ u' l: h' X( h# w2 u4 P; x: y
  22. * GNU General Public License for more details.5 n9 l, c* j. ]# K& R& V
  23. */$ n$ \4 r1 {- m9 J( C7 Q- `
  24. & v+ m' N/ x7 y+ D
  25. #include <linux/module.h>
    ! e! A+ X( v! Y" u4 I" Y4 _
  26. #include <linux/init.h>
    8 G3 g9 \4 o. x5 o
  27. #include <linux/errno.h>
    : e! A; {9 f9 }* s9 |" M
  28. #include <linux/types.h>) l$ V/ x; U* ?. W# G
  29. #include <linux/interrupt.h>
    " P; G0 B6 i! W4 O  F$ O5 I! \
  30. #include <asm/io.h>% ~% N" x1 d( B+ z8 c7 [
  31. #include <linux/moduleparam.h>. Z0 u$ Q6 @& b& d  F, y3 t
  32. #include <linux/sysctl.h>2 J. z; @( [% i- j1 Z$ C- r
  33. #include <linux/mm.h>
      T! c% C4 N) ]  b: t8 A5 ~
  34. #include <linux/dma-mapping.h>- S: y, {! ~' q# ~- e$ \, {

  35. / L' w# S3 S; k. n
  36. #include <mach/memory.h>
    # J3 W4 }# E9 s
  37. #include <mach/hardware.h>
    ! m. V  {  {/ {& x9 v) }
  38. #include <mach/irqs.h>
    ( W' ]% d' O7 q
  39. #include <asm/hardware/edma.h>( I  |& g8 }# R+ A

  40. 0 p9 W/ `+ r' N) E8 |
  41. #undef EDMA3_DEBUG) p- w+ D$ x( E
  42. /*#define EDMA3_DEBUG*/
    ; n1 R! }4 K1 P

  43. ) f6 L5 \# J* S* z3 p: r! l" v
  44. #ifdef EDMA3_DEBUG; s4 s4 k% L! `; p4 V- M" E
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    5 G* H9 A) Y* ^. j6 B
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    , n/ c( i& w+ `, ]; H
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)* s* k( A2 d+ E4 m8 \
  48. #else7 r8 e' Z6 I' G/ ]$ I8 Y
  49. #define DMA_PRINTK( x... )8 D" K6 ^- E! W1 y% g
  50. #define DMA_FN_IN
    * Y% N% z( k8 A2 T' Q
  51. #define DMA_FN_OUT; F  g6 ~7 u9 B4 \" R8 c5 H# P
  52. #endif: }. M4 M4 H+ Y, L

  53.   X5 y2 p3 m2 P- K% n* D8 ?) f
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)5 K% O9 F4 g3 E' R/ N. N
  55. #define STATIC_SHIFT                3$ M: l1 f- w8 f
  56. #define TCINTEN_SHIFT               20
    8 J7 g1 _/ J8 n% N# v
  57. #define ITCINTEN_SHIFT              21
    7 V' |, R( A+ g  H* U0 h# m
  58. #define TCCHEN_SHIFT                22
    $ A4 p) A( g) c& [  k$ a: ~) }
  59. #define ITCCHEN_SHIFT               23) g! u5 K' @1 T; g8 m! d3 L* W0 S: R
  60. ) ]9 k! X+ L" g4 y, N6 _
  61. static volatile int irqraised1 = 0;
    " y# j. n% q1 N; Y% S6 z% D
  62. static volatile int irqraised2 = 0;) P) U2 T6 z' p4 o- y! ^

  63. ' V+ _7 k6 B+ @2 @3 p1 x
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ j# ?  y6 M# i" w. g5 V# ~: G$ @! k6 z
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);/ b; c/ W- ^  x3 Y/ x
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);3 @) A% U1 S1 `# A* ^" }* A
  67. * U9 E) Y. h7 r. \# v% E6 }$ f
  68. dma_addr_t dmaphyssrc1 = 0;3 k* ~/ {& @$ P3 w
  69. dma_addr_t dmaphyssrc2 = 0;
    8 }% ]; Y* o. g$ }
  70. dma_addr_t dmaphysdest1 = 0;
    ( F; i- w; K0 @# ~) X' h& ~
  71. dma_addr_t dmaphysdest2 = 0;0 Q  t' I3 d% j. H. u. Z3 z# j

  72. + p& H1 Y0 n+ [  R
  73. char *dmabufsrc1 = NULL;
    , R( `5 x+ L8 q, Z% Q7 i9 c# @' u& X
  74. char *dmabufsrc2 = NULL;
    # G, j4 K# |7 ^! p1 b8 a. R. x8 k
  75. char *dmabufdest1 = NULL;; A4 u. h: P7 _! t$ _, ?0 W4 L
  76. char *dmabufdest2 = NULL;# w5 d- a- I$ G$ w$ n+ w

  77. 4 Z# ]4 G! ^! j) m, k
  78. static int acnt = 512;  b. F+ s0 t. ]  }
  79. static int bcnt = 8;( P3 j) l+ _* e7 o
  80. static int ccnt = 8;
    7 Q% Z& |2 p. ~) V8 V) v
  81. : X) {. x/ O" z; D; u7 }' ]5 h2 U6 K
  82. module_param(acnt, int, S_IRUGO);
    3 w! ?. A; I) {) [2 E, s
  83. module_param(bcnt, int, S_IRUGO);: B/ B: K, J" S% y/ F. \& v
  84. module_param(ccnt, int, S_IRUGO);
复制代码

' D* G# V0 _$ w! o0 u) u2 d" d
8 Z# g% [. A0 i% N/ o6 m  k0 d      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
/ |" R7 r& S2 a6 y& qarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ N: S; W6 y) }  ], J. G     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。: Y5 M& A+ J+ j% _  Z: k$ m6 l! Q
3 v7 Z- F( G) W8 [" o  `$ V
* T+ m2 i; `0 L  `9 Z! U# o6 u3 q$ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-16 01:46 , Processed in 0.041319 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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