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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
% R, H% L! h3 g. }$ \
  1. [code]EDMA sample test application
    , n  G8 L: c, O0 Y
  2. /*& [' I; ~9 I: S$ Z, t! ~. |
  3. * edma_test.c
    ! Q& C  C, P6 C
  4. *
    ' c7 V4 y7 B( r2 ]; [! i0 b3 A
  5. * brief  EDMA3 Test Application! f1 @: s) n0 |  l# a! j- w1 o1 j/ Y
  6. ** w/ Z5 [" F+ w% @' @: |
  7. *   This file contains EDMA3 Test code./ A5 _+ K% o3 B. P( |
  8. *! p7 E( E- y- t2 f' r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " ]' j2 n: w8 C" g8 P4 y
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - B, K' B# p( K) j# R0 l, K( u
  11. *         TO CHANGE.7 W  |! s$ K, R" {+ z
  12. *
    + K- J- S' R9 e
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    1 J# o. M& T* R, J- P( r
  14. *
    2 P, y& b0 k! ^" V" p( p/ ?
  15. * This program is free software; you can redistribute it and/or7 o; @7 ?! `. V- w: V
  16. * modify it under the terms of the GNU General Public License as% B, t; \8 l% h% @) E
  17. * published by the Free Software Foundation version 2.( b- S' @! R; z4 r
  18. *
      R, ~% m. H/ g
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any9 z. j. v" Z, U5 Y
  20. * kind, whether express or implied; without even the implied warranty
    + z! B- {$ O! c/ f2 `; e4 l" [6 h
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ' P/ B% w4 M' I$ J, g3 Y. G: r( [
  22. * GNU General Public License for more details.
    * ~5 D0 w/ J9 ?! G0 f# h( p2 I8 p: z
  23. */8 _+ h/ Z- ?5 f9 Z. s3 c( V% `
  24. - F! g' G) {% L' H/ Y
  25. #include <linux/module.h>
    ( j5 B: J" m$ a& f' D
  26. #include <linux/init.h>5 m) `; T' {* ~
  27. #include <linux/errno.h>' s% R: r! i" z/ x' v# p
  28. #include <linux/types.h>
    / o$ {7 ^) Q6 Y7 X
  29. #include <linux/interrupt.h>* Q, v4 J( O9 w5 W6 {; a* E
  30. #include <asm/io.h>
    " j& f9 C, R, \7 l
  31. #include <linux/moduleparam.h>
    + b% q4 N9 G  o7 v2 ?6 u$ i8 N/ V
  32. #include <linux/sysctl.h>
    4 J/ C* W4 ]8 z# V" p
  33. #include <linux/mm.h>1 V$ k" E2 Z% D
  34. #include <linux/dma-mapping.h>/ M2 H: i; p' q! X1 E
  35. ! n- ~, X' ?: g" M' \, h. A1 I
  36. #include <mach/memory.h>
    ) ]: F/ v( y5 S0 W. n6 X% o: C
  37. #include <mach/hardware.h>' V$ D5 b* O: A$ t
  38. #include <mach/irqs.h>( y9 w% x2 T6 o, x' X. r2 `
  39. #include <asm/hardware/edma.h>+ U3 @- `  Y2 D! l6 k, m

  40. ) ?5 ]% _& O$ ~6 q
  41. #undef EDMA3_DEBUG6 z+ |. B- _4 }5 ^% v
  42. /*#define EDMA3_DEBUG*/
    + t+ z6 v* l1 k( V

  43. $ A1 O1 w. A% i* Y6 w, e$ D
  44. #ifdef EDMA3_DEBUG% W- C7 s! A7 J- g* I
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    , |2 R  W2 g# f4 N4 i- D
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)3 d6 ?  O; u: R9 I$ e+ N: x
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( `: F0 N( M1 s
  48. #else, _) \. z. d  ^8 L3 x4 f% u
  49. #define DMA_PRINTK( x... )3 ~# _4 ?9 _9 b, u2 J
  50. #define DMA_FN_IN# }/ v' A5 v8 Z) N" w# k5 Z( G
  51. #define DMA_FN_OUT
    ! Q( H+ H, a$ I( u# [' {. Z
  52. #endif
    9 v6 G, R9 X2 X# u6 d' \) B+ R% P; L" a4 N; ?

  53. : z9 z2 q5 Z4 {) ?( I
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)0 S$ }' W  Z/ ~" J" A
  55. #define STATIC_SHIFT                3/ F5 @+ K; F- S8 e8 _( t
  56. #define TCINTEN_SHIFT               20! S' I  s3 @* r0 l1 g
  57. #define ITCINTEN_SHIFT              21
    , u* T/ E  d6 T5 b% B( I8 N
  58. #define TCCHEN_SHIFT                22! ~0 q% h; z: I
  59. #define ITCCHEN_SHIFT               23
    & F  t+ }2 J3 x& P; h, n
  60. ) }# _" c* B3 J' L& K( W5 V4 b
  61. static volatile int irqraised1 = 0;
    ) F( e$ u; R; |% b. N: e5 [) _' {# e
  62. static volatile int irqraised2 = 0;9 `1 c$ A) o+ x* j
  63. 0 f8 a- A) m- ^9 U; e+ q' v
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , E" v: ~6 I7 @4 y
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    / M5 |+ @" S9 v" j+ k' H( G* |
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    8 k9 A" n! n6 I9 L" ]3 f

  67. # E$ q; y0 C/ ?0 L0 N& w
  68. dma_addr_t dmaphyssrc1 = 0;
    2 `7 Z7 Z4 v5 g7 D* E
  69. dma_addr_t dmaphyssrc2 = 0;* U" m3 i, [5 @* {" _2 {3 l
  70. dma_addr_t dmaphysdest1 = 0;
    3 j0 N  N0 e1 \& u; z. H
  71. dma_addr_t dmaphysdest2 = 0;, k- j+ p4 x- H) J5 u4 ~! T
  72. 7 e$ N, P. E( F7 ^+ F
  73. char *dmabufsrc1 = NULL;- o$ D, ~1 j3 B. y' ?' c  @2 g
  74. char *dmabufsrc2 = NULL;
    # P% N5 P6 n/ C: L1 O6 X
  75. char *dmabufdest1 = NULL;7 m  a& T8 N( i0 k8 u$ M
  76. char *dmabufdest2 = NULL;9 G0 _1 p* Y9 j1 e
  77. % o* A" n2 y+ y, _
  78. static int acnt = 512;3 L# ]. L' {; Y  j, R
  79. static int bcnt = 8;
    : `6 v  v  G2 [) `3 c+ ?9 W$ _, j
  80. static int ccnt = 8;6 S9 }/ H( c. H' a
  81. : b# c' r' h& h" J2 O/ R. w
  82. module_param(acnt, int, S_IRUGO);
    . ?, |( r! g! x7 u4 B% I' |8 |2 h
  83. module_param(bcnt, int, S_IRUGO);
    : _% e2 x1 t1 I0 m) s$ \
  84. module_param(ccnt, int, S_IRUGO);
复制代码
3 h0 z# K$ Z5 t$ r6 `

+ L0 _5 z' W; k. @3 c# `/ p  u      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用' @. K5 o) X" P/ m8 }% s
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  z- A+ N- [3 `5 j5 Q' ~     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。% V! M: S  F5 P. }
. V/ g  r$ f* Z+ U+ s% P
8 K7 L5 K. _+ L7 l) ~* ?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-14 12:24 , Processed in 0.040875 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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