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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 + _- ^- t5 e  M0 s. W7 A! j
  1. [code]EDMA sample test application+ c$ R6 i# `- g) G2 p
  2. /*$ H! y9 M( z5 [; T
  3. * edma_test.c
    ! C; j, H) O- v! J2 b% H
  4. *6 o& x: r3 l- F4 E' G/ l3 V9 ^/ N
  5. * brief  EDMA3 Test Application4 ^3 g% G5 F" d, R  N: g
  6. *  I1 K6 b0 M0 F; ?8 x
  7. *   This file contains EDMA3 Test code.
    7 i- b- z1 X  V
  8. ** w' y0 z3 z6 C- a  O3 p6 g: |) b1 r
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
      Y5 L2 ]* E# Q8 \
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT7 m* C7 r, x6 D/ h$ m5 a9 |
  11. *         TO CHANGE.
    8 Z% Y7 e2 {7 @8 W' p2 R: O3 Y- X
  12. *
    7 ]% r- o# z! I
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    8 \( w; S" J. H$ R
  14. *
    % s% Q8 [& ^' u& l+ \
  15. * This program is free software; you can redistribute it and/or
    9 n! {" [' R( |
  16. * modify it under the terms of the GNU General Public License as& |  {# A: p* a1 {
  17. * published by the Free Software Foundation version 2.# t8 O: d/ G+ F2 f
  18. ** R. k( |2 K9 \) n  Z0 {$ ]
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ( }" F; Q5 D; i! k' G  t
  20. * kind, whether express or implied; without even the implied warranty: O( L7 w! b8 R! r
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the7 z+ B/ F1 |+ \! M
  22. * GNU General Public License for more details.
    - z0 A4 O8 x; Q6 f
  23. */: @. W+ S) R& v8 b2 j3 _$ Z! E# i
  24. 4 B$ X+ s- y  a+ W. F. u
  25. #include <linux/module.h>
    4 e9 G0 V& a) b% o; h
  26. #include <linux/init.h>
    9 D7 g7 G! `% i6 Y
  27. #include <linux/errno.h>
    0 i7 A' S/ v) F/ h. U
  28. #include <linux/types.h>
    5 n8 ^% x) t1 ?- X( M' s
  29. #include <linux/interrupt.h>
    8 j1 b- h$ x5 ~. E" }* w# c
  30. #include <asm/io.h>
    6 B! m$ Y* Z1 {0 T% M
  31. #include <linux/moduleparam.h>
    . u: p6 N# Q8 {; z6 a0 i
  32. #include <linux/sysctl.h>- {' e8 s* {$ c% D7 c& t; q' w
  33. #include <linux/mm.h>: L8 f8 S5 }% L. s) P
  34. #include <linux/dma-mapping.h>
    8 b) Q" `; z8 U" _( m% ~* Z
  35.   }, O6 W1 Y; ?) H# D% i! }' U6 p
  36. #include <mach/memory.h>" J% J, A0 v, A( _, }5 O4 ^7 c/ v
  37. #include <mach/hardware.h>6 _0 }0 [' a+ g: l
  38. #include <mach/irqs.h>
    % E' E" t* {% F" U8 U6 x+ f) i0 N, |
  39. #include <asm/hardware/edma.h>
    $ U  A& b* i& [) H. g
  40. " g) d) [! ?; |# O( A
  41. #undef EDMA3_DEBUG" f2 I' }' [: S$ K3 K, g/ ]
  42. /*#define EDMA3_DEBUG*/
    0 |+ M9 ^" K7 `, @
  43. 9 T8 M+ m9 u/ e! x- V$ D
  44. #ifdef EDMA3_DEBUG
    - x# r/ Z( d2 q  m
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)/ ]9 L# L7 z& K8 U) `7 \
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    6 x" e0 \( m) I$ M* L3 z8 m
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)) s. n% N7 g/ W8 z, J: f
  48. #else
    7 o' V, B2 o& m+ j) E
  49. #define DMA_PRINTK( x... )
    0 ^( l, `1 g+ B- D! f
  50. #define DMA_FN_IN3 `0 [( w  h- \. l, @+ _
  51. #define DMA_FN_OUT: E9 k0 R1 q# o
  52. #endif
    ) _+ J: k: ^! l3 `' C
  53. 9 `: }, _: I! n. n& L0 Z4 K
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)( B; r$ t6 b3 L4 `$ q
  55. #define STATIC_SHIFT                3
    4 q. f( |, Q5 V7 j+ h. p8 T
  56. #define TCINTEN_SHIFT               209 f9 `' Z* A0 \1 M( S; `. ^' e
  57. #define ITCINTEN_SHIFT              21; U) B# Y4 Y/ `
  58. #define TCCHEN_SHIFT                22+ ]( Y: f5 V1 t! \$ k! V$ U
  59. #define ITCCHEN_SHIFT               233 c3 ?' [6 I' }# q' M- p
  60. 9 t! e' x  M/ W+ S, X5 h4 R  Z
  61. static volatile int irqraised1 = 0;
    ; v0 |5 j3 D' b  j# V3 g
  62. static volatile int irqraised2 = 0;
      k/ W; }0 \; V0 f% v& H& s+ d4 e% L

  63. % R7 s' Z9 @. g" c. l
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* F% V$ x8 x3 w! v' {
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    % y2 J7 G4 a0 [) ]0 a
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);; s8 G7 ]/ f* E1 t  \+ C1 ^+ Y7 O

  67. - ~  N* O6 B1 Y& C' c% z! B6 @2 s
  68. dma_addr_t dmaphyssrc1 = 0;- h( X/ L  }  b- V: K8 i, g
  69. dma_addr_t dmaphyssrc2 = 0;: k0 o( V4 d1 O" j" @
  70. dma_addr_t dmaphysdest1 = 0;
    & ]: Y+ Z: j$ Y2 m
  71. dma_addr_t dmaphysdest2 = 0;
    + U- M" ^5 X, I2 B4 f4 n* @
  72. / ?) k- Q& P/ F$ [# N
  73. char *dmabufsrc1 = NULL;* ~' ^7 M" M/ ], R
  74. char *dmabufsrc2 = NULL;: D4 I! V2 g' R
  75. char *dmabufdest1 = NULL;
    # x: Q- I  K! W
  76. char *dmabufdest2 = NULL;
    4 ^7 G# k( ^0 \8 B8 u1 S, n
  77. 1 [0 c) U2 S2 h! W) [2 e
  78. static int acnt = 512;
    # ]" R4 z+ E" _8 x+ ]/ D
  79. static int bcnt = 8;
    : N. L6 Z: @! J! ?
  80. static int ccnt = 8;
    1 A" A' y0 `6 C' {: b

  81. . Z/ Y4 o1 i6 M: ^% t. t5 l- `% B
  82. module_param(acnt, int, S_IRUGO);
    / `, @+ b7 D6 B4 G/ H7 _5 k
  83. module_param(bcnt, int, S_IRUGO);
    6 i* s5 x6 t6 \0 o
  84. module_param(ccnt, int, S_IRUGO);
复制代码

" \! W$ u4 \4 X) R, t3 d5 {# ^% z1 z
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
! H9 A) T/ H# e& @& ]% Sarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
2 k: B6 m" E- J; D( c# G  n     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。, w) k1 U3 m3 b% S$ }; {
* t; q* L/ r3 {3 v9 V0 S1 y
' ?& c. Q$ ?) Q" u% R; u
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-19 21:49 , Processed in 0.040323 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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