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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 " E# s: C" C: L
  1. [code]EDMA sample test application
    . i( j/ m5 f6 E. O8 R( o1 \; e
  2. /*3 h; P( \5 O& k# E6 p' G, ?! r
  3. * edma_test.c
    ! _( h3 F* G6 J4 V
  4. *" F9 [- ]# ]/ F; I. J
  5. * brief  EDMA3 Test Application9 n# `3 a8 W5 N2 d
  6. *3 m0 M4 e+ G' \! ?3 j+ p* l& ?$ i$ ?
  7. *   This file contains EDMA3 Test code.
    4 `) A' v1 f" u6 \- D
  8. *0 {& b( I5 ~! K' v' d# q" ]
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE) M$ N" o$ U0 [, T: n3 J9 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT  k  p) g4 b& y" I. u* H) @
  11. *         TO CHANGE.. @' e) H9 N7 y7 \/ S3 e3 S
  12. *  X3 X! d* D+ A  z" y6 Q6 Z
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 I* {7 U$ C9 b* T( ~8 _
  14. *+ C0 ?) x- D# F" |
  15. * This program is free software; you can redistribute it and/or
    & A  x5 L3 _. D, h8 F% B( u
  16. * modify it under the terms of the GNU General Public License as
    . q3 L/ }* m8 l1 t
  17. * published by the Free Software Foundation version 2.! o/ h6 Y3 V" B+ x
  18. *
    2 k# f. L# c* M3 R& B0 Z# \8 F2 @, M
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    # M1 Q) H" i5 J5 o6 w* X& K. j
  20. * kind, whether express or implied; without even the implied warranty
    % g- f0 D) i! ~# k( V
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ( \, F  m  q! v) T3 C- {) R
  22. * GNU General Public License for more details.6 d# M% ^% i9 s: _
  23. */$ ^% B$ W' P3 D$ q2 W/ i! c( u
  24. 9 m  w1 C0 a: @7 F
  25. #include <linux/module.h>
    3 ?7 J4 Q2 A! J  l
  26. #include <linux/init.h>
    # b% e) c& i; a" G5 r8 j
  27. #include <linux/errno.h>5 h, r: E* I8 J0 L
  28. #include <linux/types.h>1 i: _, p' l* X* }/ P
  29. #include <linux/interrupt.h>! s. P& [" B. [8 m
  30. #include <asm/io.h>: m3 A# j2 l. `2 p
  31. #include <linux/moduleparam.h>
    ; I0 N! N9 ]0 a
  32. #include <linux/sysctl.h>) N" L4 ~3 x4 R. J& I2 k7 X. n+ }
  33. #include <linux/mm.h>4 U4 z* j/ r4 L) i
  34. #include <linux/dma-mapping.h># }4 o% u  D, E/ D* T

  35. 3 z5 C( v* }' N' K7 ?# X
  36. #include <mach/memory.h>' P8 @; a' q. Y  y; F* V/ k
  37. #include <mach/hardware.h>
    3 o. U- A" o) }6 n" s
  38. #include <mach/irqs.h>
    0 S7 B# t! l3 q- j% h
  39. #include <asm/hardware/edma.h>. f0 h7 C4 A; R# k

  40. & F- ]6 K  m' M/ R2 ~( Z& s
  41. #undef EDMA3_DEBUG9 J- q% ^- O0 R& {
  42. /*#define EDMA3_DEBUG*/5 G7 @5 J! v4 A+ H, A# [

  43. , X$ ~6 m3 ^, p" ]- q
  44. #ifdef EDMA3_DEBUG1 T4 V/ \) j& D: ~
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    3 u% @! d) a. \! b+ C
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ' c0 \! a6 H$ x; q! c  u. M8 D8 _
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . q8 B' \* F8 I( a2 n) j, ~
  48. #else
    & V8 b% T. `2 v/ R; z2 G
  49. #define DMA_PRINTK( x... )5 i- i( [5 F9 B( m% z2 t5 j+ l9 ~2 V
  50. #define DMA_FN_IN$ }* U/ n! Q" j1 p( r1 y
  51. #define DMA_FN_OUT
      ]9 V- D  {! I7 z. V5 U+ u
  52. #endif1 L2 w, |' E5 Z7 }2 w* F# Q

  53. - y9 |. ^3 J4 k) n6 O9 O
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    1 v. r1 J( R' [$ r$ l, l2 x; R- s
  55. #define STATIC_SHIFT                3! h8 Y5 [9 y$ R5 i: f& r1 E: |
  56. #define TCINTEN_SHIFT               20! U& k! @& ~4 t: p' O
  57. #define ITCINTEN_SHIFT              21
    # A$ }/ }; u3 L) C% Z
  58. #define TCCHEN_SHIFT                22
    2 N) w( D8 T3 I$ R' U" z) k. o2 C
  59. #define ITCCHEN_SHIFT               23& q7 k1 M% M8 X5 C+ h7 D

  60. 9 n& K; [: w, f+ j* W
  61. static volatile int irqraised1 = 0;7 Z% l: I, |+ k5 l
  62. static volatile int irqraised2 = 0;
    9 ], i- ~( u) t1 G2 O6 x! m* L1 u

  63. . S" b2 R: |2 v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % F* G8 I" [3 C) @/ ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # j8 D  n/ Z5 m2 k, M, B
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    # i1 P* o1 u, I) f: u
  67. 6 k( p1 w4 w/ b( x
  68. dma_addr_t dmaphyssrc1 = 0;
    " B: ~1 ]" d$ F- L1 r/ Z5 r5 t
  69. dma_addr_t dmaphyssrc2 = 0;8 E! [; g' `- K9 N6 ~8 X/ C. D7 s
  70. dma_addr_t dmaphysdest1 = 0;7 O! b9 \5 v8 ?: l- U( G" R
  71. dma_addr_t dmaphysdest2 = 0;- T+ ]& j! y" K" @# `8 W
  72. 7 o. P" ]! q1 a: t0 }
  73. char *dmabufsrc1 = NULL;
    , {# R; v% J, }0 C1 L# q
  74. char *dmabufsrc2 = NULL;
      {" t+ |& C3 U1 D
  75. char *dmabufdest1 = NULL;
    + b8 U7 \. R) S: j) A  ]4 u
  76. char *dmabufdest2 = NULL;
    ' y3 d" a& X5 @1 D0 o

  77. " N  o( w. K8 D2 y
  78. static int acnt = 512;3 C$ O2 C: H; o) w+ O
  79. static int bcnt = 8;1 n3 ^$ s' a" @  f! c
  80. static int ccnt = 8;
    ' l* M( x( @: w) p7 m3 H+ B

  81. ; C7 y" Y* k( Z* G9 Z  C/ U
  82. module_param(acnt, int, S_IRUGO);4 v( f( K0 ?+ V. i8 V5 S# ~) I
  83. module_param(bcnt, int, S_IRUGO);1 J( o7 T5 v3 E+ L9 ]
  84. module_param(ccnt, int, S_IRUGO);
复制代码

- \9 r% l, L& Q" F$ o2 ~2 L3 y$ K' h9 M7 s& D7 {# c" `
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用# N! w, ]% b) B+ p' T/ e( 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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。. m4 A7 s1 y1 i8 M# M* D) W
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。6 d/ F' {! F; A: N% Y3 V* B9 }& b
, n4 X- {2 M& w4 `5 o0 ]& m. `
7 g7 X* }+ y4 m' B
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 10:09 , Processed in 0.036761 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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