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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 * A& ^0 _6 B6 I! t; K8 b
  1. [code]EDMA sample test application3 ~; R' P9 J" e
  2. /*
    1 h' M4 S. A; O  q% W+ U. E' o
  3. * edma_test.c
    * o3 I+ {* m" k1 L  Y* g
  4. *
    8 ?$ \: c2 k1 m
  5. * brief  EDMA3 Test Application8 M  Z1 O8 Y# l3 `: ?
  6. *9 |1 c( @0 j+ U" _4 |5 G  R
  7. *   This file contains EDMA3 Test code.
    ( H( G( q0 S: ^4 O- M
  8. *
    + J' ]# E( _* p0 F' B
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. ~1 O" r8 ^/ b3 F# A
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    # g( t8 U' X! ]/ h+ Y: F
  11. *         TO CHANGE.- v) J! s) R2 `! y1 J) F* q2 q
  12. *
      p; Y: r! @- o9 g! z# c2 ^
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/, R) Q' a8 }9 m( g
  14. *
    % O4 D% T" X4 Z- X4 _
  15. * This program is free software; you can redistribute it and/or
    6 z- Z6 G8 h& S
  16. * modify it under the terms of the GNU General Public License as
    5 S) x5 @$ L$ }4 E: }9 B. C
  17. * published by the Free Software Foundation version 2.
    + m2 ~; _8 `" Y3 j7 P% J
  18. *
    1 m, L, u3 ?8 i
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 ?( S0 B+ q5 n, t8 d# ?
  20. * kind, whether express or implied; without even the implied warranty& S7 _+ g* E! M) K7 _. f
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 i7 R' Z! {% C
  22. * GNU General Public License for more details.
    " L7 ?6 v4 g6 u
  23. */! _7 E# Z, R& H# ^5 T$ P

  24. - }3 z7 d- X7 B( d# z
  25. #include <linux/module.h>
    / n, [2 M/ t; o
  26. #include <linux/init.h>1 ]9 v; D/ g4 n7 e, Z5 F% x' E
  27. #include <linux/errno.h>
    3 N+ P3 P$ v+ m' P
  28. #include <linux/types.h>
    ! Y1 r5 J; X, t* l
  29. #include <linux/interrupt.h>& G7 T! ]9 x, K4 t
  30. #include <asm/io.h>
    3 A6 b% e, q9 ?* V
  31. #include <linux/moduleparam.h>$ Y$ C9 j" h, O! z6 z1 Z1 c
  32. #include <linux/sysctl.h>
    + k6 g. I/ q. g
  33. #include <linux/mm.h>
    * K2 U4 J: R3 {, s; S( I5 D
  34. #include <linux/dma-mapping.h>
    9 j+ p1 G( l2 N' t1 h

  35. - i* p0 m3 p1 H/ u0 ?# ~3 n
  36. #include <mach/memory.h>6 ^( n+ F4 T) S  C
  37. #include <mach/hardware.h>2 S5 h* m7 ^3 k7 F( N, G2 p
  38. #include <mach/irqs.h>" I$ w3 m. T/ |: |
  39. #include <asm/hardware/edma.h>
    $ G: v0 E; b  a5 n

  40. 6 X& H$ @+ ]$ ~
  41. #undef EDMA3_DEBUG3 R5 F; u6 w$ u: ^( R" K
  42. /*#define EDMA3_DEBUG*/
    ' F- k: \' H; P

  43. * e: X  g6 T2 g) w- E7 {  V4 i
  44. #ifdef EDMA3_DEBUG: ?% G% R" e' A2 o% L
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . `9 i2 g, q, J4 q) C$ D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)/ `# O9 y6 e$ i4 K+ ^7 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)1 D5 N4 O7 b( P; q: P
  48. #else
    9 G- p& I; A& ^: L/ J
  49. #define DMA_PRINTK( x... )
    - ^) n# a% k! `0 F9 h, u6 }
  50. #define DMA_FN_IN) B$ k; A/ U& e$ H6 Y+ \
  51. #define DMA_FN_OUT
    " y8 g: N+ I" p+ L5 X
  52. #endif
    ! G+ R8 A) n8 h

  53. 4 f: ]0 S, e/ y* S
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)/ c# r; h  }6 g/ l7 A+ m  i
  55. #define STATIC_SHIFT                3
    3 u. `  s6 J- o( }6 V, b
  56. #define TCINTEN_SHIFT               208 S* l8 A- u+ T% `. B3 T
  57. #define ITCINTEN_SHIFT              21
    * ^; Z: A7 |0 n- l/ `
  58. #define TCCHEN_SHIFT                22
    . @' V% K1 ~# E) |. V& g/ g% n
  59. #define ITCCHEN_SHIFT               23
    # b* {# l; l; T# ~! F( h1 I
  60. # ~( X- V% [. \4 [: k* n
  61. static volatile int irqraised1 = 0;1 x$ ^6 G9 d0 H) {9 a
  62. static volatile int irqraised2 = 0;% ~$ c8 r" r* Z

  63. 0 }8 b# E5 G, |. S
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);+ U+ S) M' u; P5 q+ s' n  g! c
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);( u; y3 X" X0 G, t$ A$ B, v
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);5 e& ^& N+ R" ?3 d- H

  67. 3 T* V% x; M6 n# d
  68. dma_addr_t dmaphyssrc1 = 0;) l3 U3 r) B( O" i" t
  69. dma_addr_t dmaphyssrc2 = 0;3 C+ j9 t4 R% H$ W; g
  70. dma_addr_t dmaphysdest1 = 0;
    / a7 q4 T/ c+ n. \* _1 X
  71. dma_addr_t dmaphysdest2 = 0;; Q" |5 u; _4 b3 L
  72. ' D( L/ f# h$ `7 ~& I9 P0 L) ^
  73. char *dmabufsrc1 = NULL;
    7 N( x  U( X9 K$ Y3 \4 o9 e0 E
  74. char *dmabufsrc2 = NULL;) |1 L9 C* h* X
  75. char *dmabufdest1 = NULL;
    1 P% H% Z5 X7 k& C
  76. char *dmabufdest2 = NULL;
    / Q( k! V: K4 A9 `6 R

  77. ( O5 b( U" S& A6 b1 h4 V
  78. static int acnt = 512;
      g9 y/ y# L' Y7 `" s2 I  M: Y
  79. static int bcnt = 8;
      ~0 a: X6 a) u- o  w
  80. static int ccnt = 8;
    ' q( }8 i$ N+ x

  81. & J! d2 e6 R, f; h# k
  82. module_param(acnt, int, S_IRUGO);% a1 ]. _& Z  E1 l5 q5 G$ g, L
  83. module_param(bcnt, int, S_IRUGO);* U1 {+ }- I; e/ Q* f  C; H8 c* H# j
  84. module_param(ccnt, int, S_IRUGO);
复制代码

+ M, {. A1 }7 D6 q! g
2 k1 k" r. {/ Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
$ l: X! ^) b8 @1 r8 L/ {/ Karm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
. B# V9 L' E/ c6 C     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。/ L) t% F/ X+ @& ]
1 [* s4 A% n# }! ]: L4 Q
0 _0 K$ `7 A3 x- b. j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-20 16:52 , Processed in 0.040054 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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