OMAPL138如何在Linux下使用EDMA3驱动 - OMAP-L138 - 嵌入式开发者社区 - 51ele.net
设为首页收藏本站

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 1 P& @( V9 S/ S( ?3 {& a8 b7 t
  1. [code]EDMA sample test application' M& G5 V! e2 R, ]) D- m
  2. /*- s8 ?, \" ]2 p
  3. * edma_test.c
    # q$ V+ V" G$ u. Z' S( L9 _+ z' z
  4. *
    ' y4 G' o+ v) z$ b. M& U4 N0 Q
  5. * brief  EDMA3 Test Application9 O7 ~# H% s0 q
  6. *9 o" k2 F0 T. J7 j- G  t. [
  7. *   This file contains EDMA3 Test code.
    ) u, e3 g: r+ q2 [  y
  8. ** L( d/ T* Z8 H3 }% Z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE$ J2 t  x' s/ B# o9 h  ~
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT0 L/ G* s/ \0 C2 \  l8 U& X& L
  11. *         TO CHANGE.
    0 m1 \6 x$ g, h. P, u
  12. *8 \6 a& f0 P9 C5 {5 m* U
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/7 r' B; d5 V. u' N& [
  14. *- ^1 o2 C" c/ ?" O9 @/ V
  15. * This program is free software; you can redistribute it and/or" z2 Y" z1 M- D6 [
  16. * modify it under the terms of the GNU General Public License as2 u' ~, ~; Z, v
  17. * published by the Free Software Foundation version 2.- _! ~5 o7 b5 B, J6 ^: c2 k, C5 x
  18. *
    ; m% G/ I! u% Y: C
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any6 t, S" N* t2 c1 E6 \, `, ]; m
  20. * kind, whether express or implied; without even the implied warranty9 z4 r) H7 j, w' u4 s
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the% h& W1 U0 e' ^# x9 Q' Z
  22. * GNU General Public License for more details.1 q. x. Y3 _% c2 L1 b
  23. */
    6 [5 B- ]5 O5 g2 P  W  E8 s
  24. . i6 ]" ^; X7 |# B8 d
  25. #include <linux/module.h>3 i- e$ E% _; b7 C
  26. #include <linux/init.h>1 M3 F+ d  u+ n( ?9 D# O
  27. #include <linux/errno.h>" M+ W8 k0 e7 K* j5 Z
  28. #include <linux/types.h>9 K7 y% W# S3 B$ V9 ?
  29. #include <linux/interrupt.h>1 v' t9 m0 B% M- C- p) L% \  u
  30. #include <asm/io.h>& r- u- v: s7 \2 p
  31. #include <linux/moduleparam.h>
    . x$ B4 `9 S# v/ F8 W/ w2 [$ y. D
  32. #include <linux/sysctl.h>2 I' Q) T8 y. w$ B
  33. #include <linux/mm.h>
    / {, o3 B# F0 o: t! Z4 G; j
  34. #include <linux/dma-mapping.h>: {) f! Y, r% S
  35. 9 f+ P! d8 M. e( ?+ m% l2 D$ F
  36. #include <mach/memory.h>
    4 g6 h. z: Y- u4 O
  37. #include <mach/hardware.h>
    8 D! C1 h8 O2 \4 T( E* b
  38. #include <mach/irqs.h>
    + X, T( b3 M2 o0 b; \, ~
  39. #include <asm/hardware/edma.h>4 k# f+ S: M% c& B
  40. 1 h  R9 m' q* b$ z, _# F
  41. #undef EDMA3_DEBUG3 i  l1 ]) T- F  p
  42. /*#define EDMA3_DEBUG*/8 t% D& I) o- i8 q2 S

  43. ; d3 w4 p1 I# d2 H2 ?. ?
  44. #ifdef EDMA3_DEBUG0 m2 ]% n3 g' N4 V+ ?+ S& y0 L3 w
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS): N0 Y3 f4 b' n" W" s& j7 J
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)6 w" K. M/ a6 I* ]9 E
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__); Z5 G% s0 u& W" c2 Y+ }
  48. #else( H0 z  k+ W# w8 S  `
  49. #define DMA_PRINTK( x... )* z2 C( |2 \, C5 w( w+ S' f
  50. #define DMA_FN_IN
    , u  i( \9 @$ N; n- M
  51. #define DMA_FN_OUT
    ( G8 E2 p% q, U
  52. #endif( r( f( i$ [1 W% I

  53. 3 E# X, [3 l2 q% Y# e$ k
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768); K& o) @! P- k% B6 t6 t
  55. #define STATIC_SHIFT                3
    2 B0 `! ~8 J: C, n  x
  56. #define TCINTEN_SHIFT               206 B6 U0 e* T  y& ?# q/ k
  57. #define ITCINTEN_SHIFT              21
    , F& g$ O# e& f* j' R
  58. #define TCCHEN_SHIFT                22
    - E; i: k+ G2 c% u1 f, B
  59. #define ITCCHEN_SHIFT               23% R: H! g( S1 K9 m9 w% h$ f

  60. . R  }1 v7 R+ t0 b& ~$ Z" o! [2 \
  61. static volatile int irqraised1 = 0;8 E3 r: m* B; |5 D# X" |) X
  62. static volatile int irqraised2 = 0;1 E/ S$ e1 Q0 t5 k
  63.   q: z. h  ]4 w7 S  C5 K
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    & \4 m7 I4 {* y+ N& q" w: [3 t
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);! G) T1 L! K0 j5 F$ l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);) p2 z# ]( S0 J  E/ c' Q$ P1 P" }

  67. # N- \3 a( q  x2 Z
  68. dma_addr_t dmaphyssrc1 = 0;
    6 l! u9 F0 a7 Q/ I# |4 y
  69. dma_addr_t dmaphyssrc2 = 0;
    & W: b+ S$ h( W
  70. dma_addr_t dmaphysdest1 = 0;- r; G# W( o, T0 C. q% b! C& ~
  71. dma_addr_t dmaphysdest2 = 0;  o9 n" z: X# |# U/ i; t2 i
  72. * F8 ^! y7 a  R: p, D, x
  73. char *dmabufsrc1 = NULL;: }$ W& |+ D- q. z4 \/ C
  74. char *dmabufsrc2 = NULL;* R- c1 g1 R$ \) o5 E3 v/ O
  75. char *dmabufdest1 = NULL;" G8 t8 J7 |3 T6 h2 N0 c
  76. char *dmabufdest2 = NULL;
    ( H# b" i+ |0 D7 B; V8 n' m

  77. . n/ _' [& t$ E2 W$ ^6 Z
  78. static int acnt = 512;) a5 p4 P6 |, E. D1 O" q
  79. static int bcnt = 8;
    ' H# ^) |, y0 R# I0 @2 y* @
  80. static int ccnt = 8;
    , J/ I. J9 u8 u5 I7 N. n

  81. 1 L1 ]+ A: z' a4 N+ X! t3 w# L
  82. module_param(acnt, int, S_IRUGO);
    8 g$ d! i  _+ E8 T7 O. a% Y
  83. module_param(bcnt, int, S_IRUGO);
    8 r8 u& ^1 B; Y0 i) E
  84. module_param(ccnt, int, S_IRUGO);
复制代码

: w4 _* O1 L7 R' H; G/ I1 ?4 I* b; v; V
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用* P" z# C5 t0 ], ^3 u
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。  f$ z' {; L( L) v3 `& `5 e% {
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
+ d" m; v: q4 x  [
" |0 ?! L9 Z. D, ^3 h& p2 N6 z! K5 |6 M/ n) X+ w
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-24 06:31 , Processed in 0.037703 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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