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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
* f# l" Y" d! e7 v. ?
  1. [code]EDMA sample test application0 C/ p9 C! {7 i& g
  2. /*
    & D4 F9 n; g; g
  3. * edma_test.c% y8 U6 A  C6 U8 I% H
  4. *2 X  n4 v' t* W* k( c! A  L
  5. * brief  EDMA3 Test Application
    + r6 O- a8 m, i" z- _/ V- Z5 L5 n
  6. *5 n2 V; H% [" w7 s$ E
  7. *   This file contains EDMA3 Test code.
    ; H6 U* Y7 m  U  R. C$ Y7 m
  8. *% B5 o! H" m0 d& M) M
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    % H9 V, l, N% l
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! k$ C$ m8 h( d) ?1 P
  11. *         TO CHANGE.2 S+ d% y+ X' x: W9 R
  12. *
    ' v' X' G' I) W
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/6 ^' n6 B. S- Q+ o2 M" N1 d
  14. *
    + S( d- F: k& `3 m3 c
  15. * This program is free software; you can redistribute it and/or# e# E/ l! s2 K: e/ c- {
  16. * modify it under the terms of the GNU General Public License as/ T0 l$ x" W0 H+ t% ~. n( m
  17. * published by the Free Software Foundation version 2.3 Y" U3 f; ?( w# G+ L3 S! X' T
  18. *+ N" a3 z$ v9 C; D
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    3 S4 r, L* ^& O/ k  I  G
  20. * kind, whether express or implied; without even the implied warranty8 G9 g0 L2 @6 @2 \( w8 X% v1 i
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    6 M5 r4 {, g4 F# l
  22. * GNU General Public License for more details.* n  d; u8 k! U; g) ^# g
  23. */
    8 Y* B; o- p" C. V; Q9 ~

  24. ) s3 U" B, V- I9 s" m2 y! S4 b; x
  25. #include <linux/module.h>
    $ a' i0 k/ Q- X# v7 W
  26. #include <linux/init.h>
    % C& S7 K  ~! I' g- l" Z( b
  27. #include <linux/errno.h>1 |! D- E6 Y( M  s  I" i1 _8 T8 W
  28. #include <linux/types.h>$ b( y! G4 e: S$ o# ]& t, s( f
  29. #include <linux/interrupt.h>7 K6 H8 r8 y3 J/ [" V. X) `
  30. #include <asm/io.h>
    ! B( \, A& e- z# ?5 c
  31. #include <linux/moduleparam.h>
    : h5 |* v) H7 m0 R7 `8 D
  32. #include <linux/sysctl.h>/ ~2 L7 u9 T* U; ^8 z
  33. #include <linux/mm.h>: f% z9 z& r  I
  34. #include <linux/dma-mapping.h>
    ( m! ?4 [7 C" K- k

  35. 1 i/ e  B% F; W. _7 b' ]
  36. #include <mach/memory.h>7 R/ R  M: ]0 t1 }6 {
  37. #include <mach/hardware.h>
    # C$ \$ r. }1 h+ d1 ~( @
  38. #include <mach/irqs.h>
    5 P) f0 J: y4 j. f; T
  39. #include <asm/hardware/edma.h>2 ]2 i/ N) W1 f4 M" {' o4 A
  40. 1 z$ s; I; B  E: x3 S% u$ Y# y9 H2 ?. U
  41. #undef EDMA3_DEBUG
    8 e* f. H3 k: }
  42. /*#define EDMA3_DEBUG*/
    # R% ^. M+ n+ S2 m3 C. _9 h/ j

  43. + c) ?& V' i9 I! \2 }) \. v
  44. #ifdef EDMA3_DEBUG( o: b/ X. H( `
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    " E! Y% P8 k* U6 a, T& N4 o# [
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)1 {5 j! p) S  R
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    # v6 X' Y3 C+ `
  48. #else+ K! L( g0 N* C* k
  49. #define DMA_PRINTK( x... )
    2 M1 ~' e1 E3 y, i. }; x
  50. #define DMA_FN_IN  q+ R) i. o) y- m& p
  51. #define DMA_FN_OUT& n& }" \: }' Y
  52. #endif# h/ S7 v3 Q- b1 d
  53. 5 F% Z' l2 }  j+ c" V7 W
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). z3 ]# d; f5 R3 Y+ |
  55. #define STATIC_SHIFT                3
    6 o# r: j4 K7 D
  56. #define TCINTEN_SHIFT               20
    / ~) O: \8 H3 v3 i' S2 v
  57. #define ITCINTEN_SHIFT              218 h8 @& U' X5 ]3 S& C' U5 O
  58. #define TCCHEN_SHIFT                22# G6 V4 k$ a5 o0 _0 G7 Z
  59. #define ITCCHEN_SHIFT               23; q) I: K: c& j, Y

  60. ; D- k! ~" k& R
  61. static volatile int irqraised1 = 0;
    4 }. e% ^& E; f: }! P! M1 [
  62. static volatile int irqraised2 = 0;6 q, j5 _; e, y4 B/ g
  63. ) o. E; W& N+ l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 [$ N& Q) o" Z  R9 Y* f# A
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 M* S/ o( x7 Q: o# m  m
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);: l) P/ B2 s* S

  67. . y' i5 n+ G! ]/ E
  68. dma_addr_t dmaphyssrc1 = 0;
    ! Q: h1 |* U: q8 t3 a- c: ]& K( X$ A( E' F
  69. dma_addr_t dmaphyssrc2 = 0;; w2 E# g2 |( @5 Q' G5 l1 S( C' L
  70. dma_addr_t dmaphysdest1 = 0;
    0 g0 \/ ]# }- O7 f  M
  71. dma_addr_t dmaphysdest2 = 0;
    ; ?. g% B8 x$ Y3 t+ z
  72. ) L4 f& [6 {3 @: j( L
  73. char *dmabufsrc1 = NULL;
    * C" m. g) ^7 Q# }
  74. char *dmabufsrc2 = NULL;1 k$ Y1 V3 n7 |9 M
  75. char *dmabufdest1 = NULL;6 T1 B9 H% }" I1 Y' N
  76. char *dmabufdest2 = NULL;9 `  w8 k. d" E. P3 E

  77. ) m0 N/ Y, Z* F
  78. static int acnt = 512;1 b  `/ ?, j3 @
  79. static int bcnt = 8;( o0 Q  i; v" P0 L. l
  80. static int ccnt = 8;
    # Q: W3 S4 H; T" b& w7 j( U+ x

  81. ' S. u, V1 S" ?8 N
  82. module_param(acnt, int, S_IRUGO);0 e5 U: E2 {# q$ O# x
  83. module_param(bcnt, int, S_IRUGO);0 ]; i' S. Z  ~- l; l
  84. module_param(ccnt, int, S_IRUGO);
复制代码
1 C- O) `( c  F5 l* r( B( Q: X! C( T
2 G. @7 O. W+ Y: o0 M. Z3 k& u3 T5 A- h
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用! q2 G5 z: N, _
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。( ^+ H7 M8 {! w, \1 u8 x& _
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。( I1 S3 @8 {, H

* r! x: z, p; z2 n! O; R6 Y6 c/ J! F) Z2 ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-4 16:26 , Processed in 0.047545 second(s), 28 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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