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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
9 J1 [2 K2 ?5 A% t: z# J4 K
  1. [code]EDMA sample test application
    - B7 ?! p0 l, b
  2. /*1 v+ w$ X* b. Y2 t4 E' x
  3. * edma_test.c
    ) j3 k/ j# K4 p% ^# L* ^# ^& L/ M
  4. *, J, F# u; A: i' u: B- v! \4 N
  5. * brief  EDMA3 Test Application
    $ j/ s4 m& T# T
  6. *
    ( O3 j5 s7 f) ^" f* m
  7. *   This file contains EDMA3 Test code.4 S; p4 e( z" A; [% c
  8. *
    + l0 ~/ W  W& T0 f* H' g0 s
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE& {7 b* l& l$ M' t; [. |: Y, k
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT9 M" q! N( Z. O, g  v0 W! W2 o6 @! P
  11. *         TO CHANGE.
      ]8 w* @9 u  N$ L# Z# I" T
  12. *
    . u7 W" h1 T6 X7 w" O4 ^' c: p0 `( \  O
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/- c, A( w3 g2 S) {, T
  14. *
    : B$ H5 I6 Z' L) ^4 f9 ~
  15. * This program is free software; you can redistribute it and/or  M8 }) A4 D( c- c
  16. * modify it under the terms of the GNU General Public License as0 Y% u- ~, j+ X7 B1 f' L
  17. * published by the Free Software Foundation version 2.( x: @! u3 ~5 Z2 s$ X7 E1 C$ n3 P
  18. *
    % e) D/ Z4 E0 i( ?1 E
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any; {. t1 f' J6 G. r
  20. * kind, whether express or implied; without even the implied warranty! W- F+ N2 P. ?5 Z) ~0 m8 q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ |7 J4 I8 w6 R$ l4 {4 h
  22. * GNU General Public License for more details., O& a. Y& B. L+ h
  23. */
    " ]8 a4 V, U$ S! S5 L
  24. 0 z- g  a& f3 ^$ ^5 o/ y
  25. #include <linux/module.h>
    " ^- r9 D% z; H$ \% L4 }
  26. #include <linux/init.h>+ L6 z" a2 U2 n3 S. x4 y4 b
  27. #include <linux/errno.h>
    8 G- P  r& E- Z. N) T
  28. #include <linux/types.h>, {# |. @2 {% h2 A4 Q% i: L" r
  29. #include <linux/interrupt.h>
    6 n; K% M; e) U$ T9 A! P
  30. #include <asm/io.h>
    # D8 I# g: i6 I4 }* D9 `- r
  31. #include <linux/moduleparam.h>
    $ r5 o2 U) D9 [) P
  32. #include <linux/sysctl.h>
    # G5 \5 w9 H; \
  33. #include <linux/mm.h>0 V) u) q" t% N! S/ F6 L
  34. #include <linux/dma-mapping.h>
    ( w7 r# l  r3 m* g7 L' N

  35. 3 G( W% F& F  c6 j! @& U& D
  36. #include <mach/memory.h>
    7 Y( w$ T3 g8 p% m' Y% A# a0 U
  37. #include <mach/hardware.h>7 S( ~* q6 B2 k" I1 r
  38. #include <mach/irqs.h>+ o1 ?' l6 n; I& P
  39. #include <asm/hardware/edma.h>2 E1 t, o2 f- j+ `8 E0 Y4 G9 O, U( o
  40. 6 v7 A. L* t  f6 ?. Q. l" Z; `, t
  41. #undef EDMA3_DEBUG# u) ~6 j* G% Z7 w3 a  ]' K
  42. /*#define EDMA3_DEBUG*/
    6 ]. ^+ t5 f7 x) I2 F  Y

  43. - e; C$ g4 a: v
  44. #ifdef EDMA3_DEBUG* Q% E$ w/ M$ V9 g
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)* R$ Y& T9 K9 t6 L% M
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)$ f( t7 o) j8 N2 {" p0 k
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    4 @7 S3 y8 Z* v: Z/ a7 a
  48. #else( h# E9 R, b8 w. D5 f# Y$ K/ @
  49. #define DMA_PRINTK( x... )
    9 ]) W  c' A8 _8 L6 F
  50. #define DMA_FN_IN
    1 |" `: a4 Q( Y$ h+ \
  51. #define DMA_FN_OUT
    ! @* @# X" A- F9 b7 D# W! ]
  52. #endif
    0 N+ B8 r7 l  B& q, U# g
  53. 6 {; L; c/ T( W' V4 {. H7 ?
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
      \# l, }  N* L. Q  H
  55. #define STATIC_SHIFT                3
    % O3 K! d: J7 G. F  J. L! e
  56. #define TCINTEN_SHIFT               20
    ; `2 U# Y" k( h- F* d& A% ^
  57. #define ITCINTEN_SHIFT              21
    " Y! f& y! N8 d/ a
  58. #define TCCHEN_SHIFT                22/ y# r7 a: I; z+ _
  59. #define ITCCHEN_SHIFT               23/ Q  S# c. {/ I. @3 k* I

  60. 0 m2 m7 `9 ~% S2 G) U+ u! @+ u6 m
  61. static volatile int irqraised1 = 0;" Q4 x3 U) X7 E8 |: D4 M" j
  62. static volatile int irqraised2 = 0;9 O2 T- |- c8 t3 B5 N: C& k8 A

  63. - ]& H$ r& |" x2 H' g
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);% X5 I1 n2 E' s* ]
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);$ ?  |/ f1 s  y% W* D6 i' U$ t
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* y- S9 `6 E; |  U2 [

  67. : ^0 Z  M2 B# M. h: v$ n
  68. dma_addr_t dmaphyssrc1 = 0;% \2 q6 W/ K9 q4 Q
  69. dma_addr_t dmaphyssrc2 = 0;
    . ~: J5 z8 a3 V! o
  70. dma_addr_t dmaphysdest1 = 0;
    . |2 Z6 r( Y5 b+ ?
  71. dma_addr_t dmaphysdest2 = 0;
    9 s7 G/ j/ t: h

  72. 6 J0 h7 [* t' J) ]: G
  73. char *dmabufsrc1 = NULL;% l# O; \: V: l) U$ b' ^& @' A
  74. char *dmabufsrc2 = NULL;* i3 g+ c' v( K) f0 ]& s0 g
  75. char *dmabufdest1 = NULL;: y* U" M# B! k0 {2 t# a  u
  76. char *dmabufdest2 = NULL;% F7 l0 e8 F  M) p

  77. " v" ~7 p: e/ ^" i- S
  78. static int acnt = 512;8 Z1 O1 x* t2 I- `
  79. static int bcnt = 8;
      m  e' v0 d! X/ L  }& {' k( |: u- L
  80. static int ccnt = 8;
    * v% y5 l0 X& a4 S. c/ E) F
  81. 7 M2 l# G* t; [
  82. module_param(acnt, int, S_IRUGO);
    . s6 c/ c; F8 L3 H1 j0 S6 q8 U5 ]
  83. module_param(bcnt, int, S_IRUGO);
    ( C9 V" S3 L* i" t
  84. module_param(ccnt, int, S_IRUGO);
复制代码

! K  X  Z$ t, [; a: m6 w* v9 s& N; r
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
& l2 e0 R2 k  H1 Zarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
+ p* ~9 ], G' r# h1 v5 F4 b     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 ~$ `1 j( Z! B; w2 h

: r; N; d3 ?- f5 [+ q
( `- q2 K( ~- }" m% v' ^
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-6 02:36 , Processed in 0.040460 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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