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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
) R  Y" |3 O! w$ P3 [9 g5 {
  1. [code]EDMA sample test application' V% v7 M$ @6 K& j
  2. /*
    ) U' }- p5 E* g8 E% D3 k
  3. * edma_test.c
    0 _. l5 Q/ }* ]- N0 [
  4. *
    . C  A4 B* g2 O3 z" s
  5. * brief  EDMA3 Test Application8 l0 a$ U. x8 s* h* _
  6. *6 u6 S- z! G2 v7 {4 T* T
  7. *   This file contains EDMA3 Test code.
    - n/ }, s- w3 \' F; ~
  8. *8 K5 p/ y8 ?2 {: D
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE8 f* e. A, w9 ?7 H. a+ D6 S
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT) U  l- I" ~+ Y: k- _5 h
  11. *         TO CHANGE.' |# T+ Y) z+ [; h/ b' W0 p
  12. *4 `% {9 N1 [3 ]5 Y
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    ; O% v/ a& p) I
  14. *4 n" J7 ~3 o( |3 M) L  g& t* P
  15. * This program is free software; you can redistribute it and/or7 l. ]0 G! I9 ]6 w
  16. * modify it under the terms of the GNU General Public License as& N% b7 e) l' p* i6 ?* W0 a2 a7 I5 F
  17. * published by the Free Software Foundation version 2.
    . h" _, D) a2 B' J+ A
  18. *
    9 Y0 K' Y7 B3 ~/ i, F
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any8 A( P5 T9 K" e( A! ~) Z+ F( Z
  20. * kind, whether express or implied; without even the implied warranty( }$ X+ j$ l8 H: C0 @6 D
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the, ~# m4 U. f: [6 q) T9 j
  22. * GNU General Public License for more details., V4 R( N9 U2 W2 ~) d
  23. */6 M, d: H5 b! x: U6 B& O0 k
  24. 5 D3 s# }! E- N* {$ v% L  y! R
  25. #include <linux/module.h>
    # p5 J0 u. m6 B$ g3 m
  26. #include <linux/init.h>
    # w. g/ c. {- w
  27. #include <linux/errno.h>
    6 T* u- B5 E# P% i; i
  28. #include <linux/types.h>6 x7 z) N, ~1 f3 H5 U
  29. #include <linux/interrupt.h>9 g  t) H9 ]* e  f+ v
  30. #include <asm/io.h>
    1 ?" r& e- m' R
  31. #include <linux/moduleparam.h>9 r* T( A, M  l& M2 O" k. B+ o: L' @
  32. #include <linux/sysctl.h>( p5 `$ B+ A$ j1 U
  33. #include <linux/mm.h>
    6 v* J2 _9 a8 m* \8 \; i) S/ v* E( F
  34. #include <linux/dma-mapping.h>, U# Z1 H! v, y# o

  35. ; }/ v2 W5 |2 Q, u' O% s, x
  36. #include <mach/memory.h>  c0 d& k6 {- ^8 m& n7 p
  37. #include <mach/hardware.h>
    ; D' j2 p0 E8 d8 s# Y4 T- J6 e
  38. #include <mach/irqs.h>
    # q8 ?* a/ i- D5 N1 ?
  39. #include <asm/hardware/edma.h>
    5 i; |/ b0 y9 f6 N+ p1 s( t- n6 }' O6 T
  40. + f4 ~2 c/ Q2 H! q
  41. #undef EDMA3_DEBUG5 }0 H! j1 r8 U" Q( C7 D0 X
  42. /*#define EDMA3_DEBUG*/
    . J7 G! e4 R; ], G  _5 T+ r
  43. ( M! ?' ~# s) [4 c; s
  44. #ifdef EDMA3_DEBUG
    8 \: k8 E5 {  ?' R" k
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)$ a# u# k; d$ M! b) n; @! l8 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    ( g# o7 m& P- c3 s2 ^6 P2 ]' \/ u
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)- i. k) C" T. N5 u  V, H
  48. #else6 W' W, T' [; M( C$ `; ^
  49. #define DMA_PRINTK( x... )
    . A0 \* A! O/ {
  50. #define DMA_FN_IN+ S- y6 V: R- ]! I" }. U- X( e' P- J# S
  51. #define DMA_FN_OUT
    7 R. x  t5 {: y
  52. #endif
    ; \+ c# v: C, c

  53. * |1 n* O6 M9 U( _, C9 M4 t
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    + \5 u$ w/ b2 x+ r7 g
  55. #define STATIC_SHIFT                3/ x5 d5 I5 M$ o2 L* Y- N
  56. #define TCINTEN_SHIFT               20
    3 B' y, V; s, ~+ d0 B
  57. #define ITCINTEN_SHIFT              21: s) ?2 J. o) X1 \. _6 G" N
  58. #define TCCHEN_SHIFT                22
    * f/ _- _$ u4 g6 p4 A! }9 U6 K
  59. #define ITCCHEN_SHIFT               23/ y4 a) F! S, l% N: \& _" J- q- |4 q
  60. 5 p: o; I& x& d
  61. static volatile int irqraised1 = 0;
    ' F( x1 s2 n% ^( Q6 Q; ]
  62. static volatile int irqraised2 = 0;+ n; G3 U1 C% {8 z! X8 n

  63.   {/ e* _+ a9 r" a& t$ q5 |1 ~
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    0 N0 Q+ q0 d: A) u8 M
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);& V! p+ D7 E/ s& T/ S9 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    ! o$ ]1 P( k9 |- ~7 i' ^% H

  67. 3 O' O) ]) [% K& w" o! H5 Z) i
  68. dma_addr_t dmaphyssrc1 = 0;6 J+ D6 p& X. e
  69. dma_addr_t dmaphyssrc2 = 0;% A; q( c/ w9 K
  70. dma_addr_t dmaphysdest1 = 0;
    - s9 H) W" O- c- F( |
  71. dma_addr_t dmaphysdest2 = 0;
    0 u6 f( |& p& `" R
  72. ; g  {& n5 W+ r( e+ h/ W& F/ H+ y
  73. char *dmabufsrc1 = NULL;
    . U" J8 `7 Z, j6 r% f+ I3 {
  74. char *dmabufsrc2 = NULL;* X: V& ~* m6 P& S7 R6 `
  75. char *dmabufdest1 = NULL;& ]4 n. y; l+ c
  76. char *dmabufdest2 = NULL;0 ]! s8 M1 b" o$ O  F1 }

  77.   Z0 a* o8 m* v, m/ W# E
  78. static int acnt = 512;' |" C( l( a7 P$ C! P4 }
  79. static int bcnt = 8;* f; b/ v+ u: d5 V" Y$ x
  80. static int ccnt = 8;
    ( V+ m/ y- T7 \: U0 K" N

  81. % H4 g# T$ E" {$ n6 q' z
  82. module_param(acnt, int, S_IRUGO);0 R; Q% B9 _( X( x/ R2 v0 m) T# y
  83. module_param(bcnt, int, S_IRUGO);$ u1 r1 N5 \' B* f; O) g& @' A
  84. module_param(ccnt, int, S_IRUGO);
复制代码

) L+ \# M7 Q1 L( `
7 P( D' V* f- _/ o, ]" t1 [$ w, ~      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用5 w7 p7 t# F( w' R' C
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。- A9 B8 r( T! E7 Z
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。* H1 L% W! {5 F( H# g/ K
8 ~7 j- y9 X4 Q

4 ~7 y1 k9 @- A/ ?  }8 F
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-4-21 12:33 , Processed in 0.044331 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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