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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
! ^/ n' S& B2 o( R; A* P7 T
  1. [code]EDMA sample test application
    3 C& H" `* q  e
  2. /*3 U5 T$ E& a' d2 @7 F. |" F' P
  3. * edma_test.c, W$ u  g+ m) j7 Q0 S: h
  4. *
    " T1 r# |- c2 K
  5. * brief  EDMA3 Test Application
    ' l* J' W. q4 v3 u
  6. *9 V& _% b1 C5 q5 C
  7. *   This file contains EDMA3 Test code.' |# j. E& u8 T- i' p# s
  8. *
    6 D8 t2 j, ]( \1 T5 V% F& O: V
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    " {2 u( S  q% ^  n1 J$ C! a% P
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT4 P+ f# z: x# w
  11. *         TO CHANGE.
    , r  S" T9 B: y# k  b" e2 x: m5 n) u
  12. *
      S( N$ p$ c3 L1 m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/0 M" {7 e- Z% ], l( B1 F' E
  14. *  y, h: h0 [* r2 y. O# |! t
  15. * This program is free software; you can redistribute it and/or
    % g9 C2 ^) R( @. s+ [; ^+ r
  16. * modify it under the terms of the GNU General Public License as6 L; N$ d1 [. Q
  17. * published by the Free Software Foundation version 2.
    7 V& P! ^1 h! h/ z. O4 f4 q
  18. *# R3 S/ b, j$ n3 ~) z# a
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    4 k! ^! Q" H, W" I( S2 N
  20. * kind, whether express or implied; without even the implied warranty
    - P4 q! I1 A' j0 |) I) o
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, M% C( C7 F) o
  22. * GNU General Public License for more details.
    " e6 J/ b3 [1 @& v# Y  n% j
  23. */
    ( T: t& w: F- }0 x; `  y# u

  24. - u1 W6 D0 ?5 B4 g4 j6 t
  25. #include <linux/module.h>
    " I5 P5 x' A" O" a7 |8 E" v1 j( W. {
  26. #include <linux/init.h>
    ; n; |( f7 O  z
  27. #include <linux/errno.h>$ G# k4 E  P6 {- b$ ^' `  X
  28. #include <linux/types.h>$ C$ ^& F9 q; M
  29. #include <linux/interrupt.h>
    . V0 _4 _4 x- p& V. Y/ V6 F9 D
  30. #include <asm/io.h>
    . m, v. m! K1 B$ K8 ^# ^' ~2 T+ G0 `: e
  31. #include <linux/moduleparam.h>7 ]% s6 j# a' \1 o4 k
  32. #include <linux/sysctl.h>3 [4 o4 G# i3 z2 e# [
  33. #include <linux/mm.h>6 ~- w! C  ^& ?6 g5 o
  34. #include <linux/dma-mapping.h>8 {- n! o" W1 t

  35. , w; e5 Y5 H3 t9 k  c
  36. #include <mach/memory.h>  @! }0 h7 }3 _4 a" ~% \% d  ^
  37. #include <mach/hardware.h>
    0 ^6 G/ |7 G1 a. H; Q
  38. #include <mach/irqs.h>0 P1 X. L+ p" g' B" I/ n
  39. #include <asm/hardware/edma.h>$ J" m7 A3 b3 Z- ?

  40. : }1 N+ V1 ?8 }  k/ x0 o6 U
  41. #undef EDMA3_DEBUG
    + U/ m" a& g( m2 }' g1 U
  42. /*#define EDMA3_DEBUG*/
    7 C3 `" a8 f, D5 Z) E
  43. 2 ?; f5 P& O! E( f, U
  44. #ifdef EDMA3_DEBUG
    6 q& {4 i5 h# y* ?) t  ^
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)9 B/ z) U) v2 e  ^+ n
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)  I; N! g1 X5 _$ ~7 z: Y
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    6 n( b/ l+ y! p% |5 v6 `. C
  48. #else- i) ~+ O( f3 Q" Q- V
  49. #define DMA_PRINTK( x... )
    . |( ^! K; w6 S" }
  50. #define DMA_FN_IN
    + B: ~' w: `, X& ^$ D) e
  51. #define DMA_FN_OUT
    9 G: d0 E. n( m/ e+ ]- Z0 A* M
  52. #endif3 [: T4 ?% g; I" m

  53. ) T( b: A" S7 L9 b
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768): t; Y( S9 G  J" x4 [
  55. #define STATIC_SHIFT                3
    ! |' V$ r, j$ [" `" p. p3 d
  56. #define TCINTEN_SHIFT               20
    3 J3 }: R  j% A4 ^. |
  57. #define ITCINTEN_SHIFT              219 ^, q+ I; |. e5 N9 K
  58. #define TCCHEN_SHIFT                22* I# o4 _: b, y: R, B* g
  59. #define ITCCHEN_SHIFT               23
    3 }0 @9 v8 _$ R5 u

  60. 9 ~, Z4 J: ?9 z. ]
  61. static volatile int irqraised1 = 0;
    $ i6 x& \" }! z! v1 v! l; @" T$ R
  62. static volatile int irqraised2 = 0;# B. B. Y. V& C! H" |" ~
  63. . Y( C( y7 b+ ]+ u% z5 \" h; n
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ' m2 {$ W9 k# X: H# @
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ O7 u% U& I; S* ]( g
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);" b; U/ Y1 z% b9 O+ j

  67. 9 [; A" U3 w8 a: G) ]# [- f- u2 a
  68. dma_addr_t dmaphyssrc1 = 0;
    ; L4 u3 J( p( X/ Z
  69. dma_addr_t dmaphyssrc2 = 0;
    1 S5 Z( _  r; t6 t: p2 R
  70. dma_addr_t dmaphysdest1 = 0;
    1 _; S: w7 F* W( m5 N
  71. dma_addr_t dmaphysdest2 = 0;
    9 d3 O, R2 o6 x$ N$ w' G* u

  72. " W2 W4 T8 u2 [+ J
  73. char *dmabufsrc1 = NULL;
    % C5 t1 a$ Q2 W) g7 j! W8 e" c
  74. char *dmabufsrc2 = NULL;
    . a8 ?1 H' K: X* P
  75. char *dmabufdest1 = NULL;
    4 a: ?2 _8 `2 D4 x/ p+ I' C) |6 Z1 j
  76. char *dmabufdest2 = NULL;* L$ D& E  w7 T& g. @

  77. & {( ]; A7 g$ D. I( h/ }+ i1 s* i
  78. static int acnt = 512;
    ' g8 p3 W' x2 I5 l# d
  79. static int bcnt = 8;- t# N) t# C6 n: h( c/ d6 C( V- A( U
  80. static int ccnt = 8;
    & w& S5 l3 }8 e* W

  81. 5 e4 Z' a# |  d5 H, I  k; H  X
  82. module_param(acnt, int, S_IRUGO);2 C+ j. \9 m/ F* i9 f5 \
  83. module_param(bcnt, int, S_IRUGO);! W$ X" X7 R+ I+ D- D
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# ^5 }$ F1 Z. h- O3 u# }
! t0 v# p' N# b" I, N
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: E' d4 u0 ~7 I. ]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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
6 u! g( {0 a6 r( O/ u; H     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。! j: r! r# H' X3 ]

4 e& I/ r% O& X2 z  e/ G1 Y* ^8 [5 J% d
, H# D& P. j' y( j
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-9-29 05:15 , Processed in 0.040530 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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