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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑   l* }5 K. Z. u  S
  1. [code]EDMA sample test application
    7 h0 W  y+ D) t( ?  Z
  2. /*9 o% u# q3 w4 _
  3. * edma_test.c$ V$ h5 q- v6 Y6 _
  4. *4 R: w+ P' w$ s* E
  5. * brief  EDMA3 Test Application
      N2 U5 N0 q& J, I. t
  6. *
    9 f/ o3 e, g9 H  s2 f! n$ J3 g* x
  7. *   This file contains EDMA3 Test code.7 N( n) E. }$ i5 Z: A
  8. *  F" m% E8 O( \! z  e  k, @2 v# C
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE. [# ]: S: V+ U* b9 Y8 R
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT% h; J6 M/ f( f2 y8 U) |) P
  11. *         TO CHANGE.
    . Y7 n) Q, L6 p4 I# g
  12. *
    4 B& Y* O( m% e& y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; \- P! ^0 Q8 u8 s
  14. *
    7 _8 W9 ^( E, y% X6 z, M
  15. * This program is free software; you can redistribute it and/or
    ; x: ?- W3 I( D
  16. * modify it under the terms of the GNU General Public License as
    9 I" T8 k, s9 ~$ f6 D3 a
  17. * published by the Free Software Foundation version 2.9 B0 _4 Y+ d8 M2 @/ X
  18. *+ g& A4 Y, o' M$ `, s
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    8 R5 ?8 F$ K1 U+ }+ Q
  20. * kind, whether express or implied; without even the implied warranty
    - Y7 b" p: |% X& y0 E
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    0 g# K/ F; u+ X- B
  22. * GNU General Public License for more details.6 A. p4 ^% a/ x% s
  23. */
    8 Q, g$ C( H) U7 P( I% J

  24. 7 |: Q2 h1 L* ^3 B  W" n
  25. #include <linux/module.h>% o; }" t" \2 b- ]# g' p
  26. #include <linux/init.h>
    # b) t0 c( C$ l1 q3 N
  27. #include <linux/errno.h>
    7 H9 t! d% F9 B# J1 q, y2 o
  28. #include <linux/types.h>; A0 c% ^4 ~' G) w) ~( r+ k; L( D
  29. #include <linux/interrupt.h>( A$ B) b* c& O& ^
  30. #include <asm/io.h>- x1 p4 B7 G; n  U9 X
  31. #include <linux/moduleparam.h>$ m9 S1 i8 g6 t6 Q, w) Q
  32. #include <linux/sysctl.h>
    ; B  \, V0 }9 K. I4 k2 B! H! g
  33. #include <linux/mm.h>
    ! v) d# u: k5 m2 X
  34. #include <linux/dma-mapping.h>  Z% Y& I( _8 P+ Q, {( j

  35. : w. z3 a- N' Y. N
  36. #include <mach/memory.h>& K3 u8 E6 p' a. ^# S# b
  37. #include <mach/hardware.h>3 \& `1 u' l* j" B
  38. #include <mach/irqs.h>
    # o1 \5 e: F6 X3 {+ E6 D
  39. #include <asm/hardware/edma.h>+ K7 M$ C/ k/ h1 }5 R" Y

  40. ' [9 \' w8 l# P. p# B
  41. #undef EDMA3_DEBUG
    $ @3 N* [! z9 `4 I4 R( `; X
  42. /*#define EDMA3_DEBUG*/8 I( i0 G: g4 `4 ^

  43. ' `" M* i- x, F# O+ Q
  44. #ifdef EDMA3_DEBUG
    ; \, `' A/ H7 K# E3 a
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)+ F! U5 r0 j1 C. a
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    4 v3 b9 u0 }- n8 B* V  |9 r9 C3 K
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)0 a. W- N8 f& _$ ^4 v
  48. #else6 _9 p5 ^- _8 L$ u  b
  49. #define DMA_PRINTK( x... )
    : l  r/ l5 ?0 H7 L( U2 h
  50. #define DMA_FN_IN9 F  h2 a- Y  e9 V3 K$ C
  51. #define DMA_FN_OUT
    5 M- `8 N4 i3 W; k  H+ @% l
  52. #endif
    & D& @3 G' \( B% Y
  53. ; R$ [7 Y5 m  l, ^0 v
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    . ?' Y: C$ Q3 q7 p% s  }) R
  55. #define STATIC_SHIFT                3' }* k: t" j$ z9 T# J: H- l
  56. #define TCINTEN_SHIFT               20
    % B. w6 ?" n0 i, Y% I
  57. #define ITCINTEN_SHIFT              21
    5 n, c- {5 B6 b# Q1 H
  58. #define TCCHEN_SHIFT                22. z9 k% L5 k' z$ B+ l
  59. #define ITCCHEN_SHIFT               23
    , [2 w% u1 O; c7 [
  60. # P! f8 ^3 l7 ]4 r
  61. static volatile int irqraised1 = 0;
    % g% P* D7 ?& e2 v0 o/ a
  62. static volatile int irqraised2 = 0;
    ; L* A5 y0 W3 d" ^# h
  63. : B$ f8 j0 H$ q& P
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 Y% Y$ }/ ~, K
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);1 y2 L: B- G! H4 |* E: l
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    $ f, {, }# ?1 {+ @7 D3 A1 e
  67. " }7 C, B+ U8 W$ G* N
  68. dma_addr_t dmaphyssrc1 = 0;
    ! }; h; M- I0 i$ J) R1 H
  69. dma_addr_t dmaphyssrc2 = 0;
      ^) W) n" c* j$ c* b
  70. dma_addr_t dmaphysdest1 = 0;( k5 b; z# \9 z/ h5 K5 ~
  71. dma_addr_t dmaphysdest2 = 0;# c/ ^* b" z. ?5 S6 d, y: H' w( Z
  72. ' O% Q) d6 n* g$ r& i$ k& {
  73. char *dmabufsrc1 = NULL;
    2 l! U$ [; U# L  U4 C2 `( Z
  74. char *dmabufsrc2 = NULL;
    , q' u2 g" g, J3 @& y& }
  75. char *dmabufdest1 = NULL;
    & q4 {3 n9 R) p$ Q( q! B# V
  76. char *dmabufdest2 = NULL;: d. |2 C* q) u5 x( Q5 O

  77. $ S" r; {: e& J
  78. static int acnt = 512;
    % V% e1 M) j- B' J7 f
  79. static int bcnt = 8;+ h1 O7 Y8 y1 V- e; h
  80. static int ccnt = 8;
    / k- P, y. B* Z# C& Q2 B
  81.   u0 X4 d+ t# \+ e9 T6 e  z
  82. module_param(acnt, int, S_IRUGO);
    4 B7 h: m7 a9 h: V. J
  83. module_param(bcnt, int, S_IRUGO);, T1 h5 [: B  j) o& b1 C+ B
  84. module_param(ccnt, int, S_IRUGO);
复制代码

# w0 z) x" u7 ?% w, f+ {% b& e, `
9 q9 Z% G. V& g+ {/ Z$ Y      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: \/ Q* B$ U. V1 k* d4 Z, v( Uarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。: I* V0 e  E5 S  w
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. f+ i( F; f( a( q: j
7 f) R' z  ^/ o

6 H6 X# @7 \/ u! l- z6 I
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 01:00 , Processed in 0.038256 second(s), 24 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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