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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 & w. Q3 A+ Y* \# V: j0 C
  1. [code]EDMA sample test application
      K4 ]+ Y9 b' X3 h2 q+ u
  2. /*
    . M8 Y( M9 k. e8 y3 B8 R3 F/ H
  3. * edma_test.c2 F( r9 q& }, }. N# C- d* c
  4. *3 ]$ t% h! p$ ~, T/ o
  5. * brief  EDMA3 Test Application
    ' D* G! E; ^, L
  6. *
    - V. D, d5 o! J( s) J* o1 o
  7. *   This file contains EDMA3 Test code.3 ?( r. g9 `- n0 E! F
  8. *
    2 i  J" Z0 b/ O, r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) v, w* q9 I7 M6 ?
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    1 y3 D  O  _; n3 y3 `
  11. *         TO CHANGE.6 V; E2 G+ w* p+ q; R" t
  12. *# T% A& y7 C/ m; {: i9 Z4 A# |
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; q) s& S2 I  A8 w
  14. *8 U7 s" G. {& K1 p! u
  15. * This program is free software; you can redistribute it and/or
    : T+ w, R5 W8 Z8 M: |
  16. * modify it under the terms of the GNU General Public License as
    . h( D6 p6 {3 o7 c( W! {, b
  17. * published by the Free Software Foundation version 2.
    1 _- C- ?* E* z/ M
  18. *+ C  s+ Y9 I  m4 r. Z6 a: Q) D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    / w; K9 o3 W- I- |( A! d
  20. * kind, whether express or implied; without even the implied warranty# w3 d# P' ]7 S8 |0 ]. ~
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  i/ d! _5 h5 ^! i8 i# L
  22. * GNU General Public License for more details.
    " a3 M# f: l) U: o: Q4 w( B* `( o
  23. *// ?' x' |6 o* U6 V  W
  24. - S6 A. F  B* R9 m
  25. #include <linux/module.h>. M% w4 C- U( V, h* c( I5 C
  26. #include <linux/init.h>$ F3 z* L! @9 E% m% `" T1 m& j
  27. #include <linux/errno.h>3 ]* \3 y2 \. m( C
  28. #include <linux/types.h># q4 C5 F# ]8 |0 N  L
  29. #include <linux/interrupt.h>
    ) ~$ c% w' m  I; t& c) b
  30. #include <asm/io.h>
    ; ~7 L5 ~8 C- \* m5 @
  31. #include <linux/moduleparam.h>( e- {' I+ U# k' u5 H& {! c
  32. #include <linux/sysctl.h>
    - d7 J6 s& D1 x' F. F6 s$ R
  33. #include <linux/mm.h>
    7 ~4 W; O& ^  i; V, ^
  34. #include <linux/dma-mapping.h>
    + Y* _7 u: j; n
  35. - q3 n, D/ S8 `
  36. #include <mach/memory.h>
    # ~! X7 p  {% J& \
  37. #include <mach/hardware.h>. J5 x3 h7 f- S7 I$ s" X( A
  38. #include <mach/irqs.h>
    + l7 B4 N4 p) R$ ^# _. w
  39. #include <asm/hardware/edma.h>
    1 z. V! W5 V* J! `
  40. ! u0 {! t& I1 q- p9 h1 g
  41. #undef EDMA3_DEBUG
    3 w. ~4 D  x+ P4 N6 B3 Z! L* b
  42. /*#define EDMA3_DEBUG*/" S/ N, [4 `$ g* `$ B7 }3 ?; H

  43. 8 M7 I. B0 K' f7 B; c5 R1 E) m, c
  44. #ifdef EDMA3_DEBUG2 ~+ S! C+ b0 N8 z& {! ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 O/ }5 x. R* @; D0 g0 ^6 t
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ ]8 P1 b7 [3 {
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)5 g0 z, M& g! P/ O9 x
  48. #else
    ' n$ B- }" b5 G" j; A! C
  49. #define DMA_PRINTK( x... )
    ' }* s4 `9 a1 N) `/ R4 C6 ^
  50. #define DMA_FN_IN
    ; x- X% t4 N+ X6 j$ Y( t
  51. #define DMA_FN_OUT
    ( {4 D- b* T% K5 o$ N
  52. #endif2 m) V8 i( T2 O7 P4 s9 n; h0 n

  53. " Z  ~2 P' e1 L+ ~% L
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): }7 b' M2 S: Q) B) A
  55. #define STATIC_SHIFT                3
    $ s! H( A6 q, [" K2 x4 J
  56. #define TCINTEN_SHIFT               20
    ' B4 c  x: v# m0 E- O
  57. #define ITCINTEN_SHIFT              21: s- z8 S+ _1 h4 E1 A& A+ x
  58. #define TCCHEN_SHIFT                22
    & z) h7 x: t# S( `7 i! @' }
  59. #define ITCCHEN_SHIFT               23
    * d) J8 h% t3 v: u! C7 W' {3 K

  60. # \# _& l. w! [' m% V: q, Q" U
  61. static volatile int irqraised1 = 0;& J  w, \) q8 }: x  f
  62. static volatile int irqraised2 = 0;
    # L- A# N$ R2 A- F* T
  63. ; S) Z$ m, P9 q. K0 B  J
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 J1 N$ _* t& X/ K! e: l
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    4 e" l& r! r7 s9 i$ h$ u. H6 L
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) v1 N* M2 I% Q  L' J8 @

  67. ) j3 h+ A& t) p1 ~* i# m7 t
  68. dma_addr_t dmaphyssrc1 = 0;
    $ p: ]& [/ W& ?6 R
  69. dma_addr_t dmaphyssrc2 = 0;- ^* M+ t( m6 z; w
  70. dma_addr_t dmaphysdest1 = 0;* i8 n5 H3 @0 G- G/ B8 c
  71. dma_addr_t dmaphysdest2 = 0;1 x& L, }6 s0 m! J4 T- q
  72. " l) M( B8 k) @$ t
  73. char *dmabufsrc1 = NULL;# h6 y9 r, @6 n- ]
  74. char *dmabufsrc2 = NULL;* d( h: j" r  c8 _+ p
  75. char *dmabufdest1 = NULL;( |( S( D. D# x: q9 y
  76. char *dmabufdest2 = NULL;
    / r' _4 }! p+ |) E' B

  77. ! ]0 s# E# z( N, j9 ?8 T' ~
  78. static int acnt = 512;% ]; n2 n* }7 A% s$ ]5 J
  79. static int bcnt = 8;% V, J( z+ y0 s1 ]) k# {- l$ \2 F
  80. static int ccnt = 8;4 _9 L2 C9 e; M7 `/ z; x7 K
  81. % R2 R3 J  t( k  @& I( H+ u
  82. module_param(acnt, int, S_IRUGO);
    ) u: p% \* y9 {! i; ]- L
  83. module_param(bcnt, int, S_IRUGO);
    9 v, B% ^* c) Y  I: W
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! Y# o- m. d( s& Z  N  [* H1 {
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用3 Q  @& m& `* W, {1 z& _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。+ a$ F" u6 u* v) y: M" ?3 V. x" e- r* F
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
% }/ Q- ?- ]' h. \3 ]3 J0 Q4 R/ y. [: S" E# E" W; X' C
: f( m8 @5 J- G
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-19 14:50 , Processed in 0.044585 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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