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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
' [+ a& J, Q2 T9 ^, i. k
  1. [code]EDMA sample test application- \; Q0 _+ q% d/ u' k4 M1 x' a
  2. /*
    % M) ~) a) j3 \0 C) [8 A$ T2 f
  3. * edma_test.c
    3 a1 b: ^3 K/ R8 `1 ]
  4. *
    ' h4 }* N3 j7 Y% G+ H6 ]
  5. * brief  EDMA3 Test Application
    8 V4 c" [7 {% d5 V6 b
  6. *9 j$ U" r4 @' r0 n- ^1 A$ a
  7. *   This file contains EDMA3 Test code.: x% w6 T  m" [5 m$ ~
  8. *
    & m9 i! B6 H9 z
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE- N) B0 ^, c4 ^. s8 [
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    7 ]5 }5 g8 x( A; t9 b: X8 ]. O
  11. *         TO CHANGE.
    3 F( [& c1 _8 z9 c
  12. *
    & g5 m$ @7 U# [4 b3 j
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/: z+ i$ T4 I: o+ s; y3 `
  14. *3 a+ U, ~& D; Z! [- p
  15. * This program is free software; you can redistribute it and/or% I8 a4 O9 M3 J$ W
  16. * modify it under the terms of the GNU General Public License as0 z- n( @/ p- D
  17. * published by the Free Software Foundation version 2.
    5 K& b% w) H1 G2 U# X
  18. *) U9 k- g- a+ L4 p5 y
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any' [* U) T4 [9 z% r
  20. * kind, whether express or implied; without even the implied warranty  C& k/ }  H) m! s" a) c) Z& `0 W
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    * ?7 g4 I8 @* \8 h/ Z3 ?  a* G
  22. * GNU General Public License for more details.
    2 O0 c! O0 M) B" Z: b4 Q
  23. */5 P- m7 J- V' N& s
  24. % y: j* J( A1 V/ {( b
  25. #include <linux/module.h>
    : {  c) \7 V- E" d8 s  B: Q
  26. #include <linux/init.h>- X. A7 R& t. Y8 Q
  27. #include <linux/errno.h>
    ; T7 R7 H: t: u2 p8 r( O
  28. #include <linux/types.h>
    ; D& N1 Q. s" I' F' b* [' F
  29. #include <linux/interrupt.h>' H% ]: W7 |: Y6 G9 I
  30. #include <asm/io.h>
    6 G( y' u1 K0 k( n+ K; J
  31. #include <linux/moduleparam.h>9 ~1 F& i& z8 B6 V' P+ |4 J
  32. #include <linux/sysctl.h>
    ' x9 `7 F) d) q4 b5 [
  33. #include <linux/mm.h>
    $ Z# `$ Z' _4 d2 i3 H
  34. #include <linux/dma-mapping.h>
    ; p$ Z1 }! G, m: F0 [4 x" f
  35. 4 f  R, g- V/ C) H( u1 _7 M# H
  36. #include <mach/memory.h>
    9 a* p. X. ?' A: N/ A5 r
  37. #include <mach/hardware.h>
    4 I& U% ~/ u' ]& H1 g
  38. #include <mach/irqs.h>% a0 e) P* ?4 Q3 S# Q6 ^: z+ B
  39. #include <asm/hardware/edma.h>" h( k8 ?* }9 J
  40. % z; P9 V% F/ p
  41. #undef EDMA3_DEBUG
    4 _; }, B5 s; q+ W7 Q4 e& u% v
  42. /*#define EDMA3_DEBUG*/+ X0 A1 Y( D+ }$ X1 [

  43. + B, G1 @, q$ ^% q* L8 B
  44. #ifdef EDMA3_DEBUG
    ' q' n. c# ?, L( C1 U( f& t
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    + x; c8 z7 C8 b
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' H7 E" l+ }0 R; w7 z
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    ' @/ U1 ~! [/ \# u2 T6 O( y# }+ F
  48. #else
      g) L: b; j% V6 y( |0 a5 F
  49. #define DMA_PRINTK( x... )
    + F# r" }5 d4 {
  50. #define DMA_FN_IN: L0 H  {0 ^/ g& |, e  \" j
  51. #define DMA_FN_OUT
    . S; Y+ H4 o# q, f7 n
  52. #endif3 ?6 ^5 W, g3 Y
  53. 3 k, ?: Q. `- L* o
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    ( W5 m9 y2 }# `1 |! u2 \8 N
  55. #define STATIC_SHIFT                3* u- x: T* [1 f% D. U
  56. #define TCINTEN_SHIFT               20
    5 E, u* ^0 y, N/ Q3 O8 M* ?
  57. #define ITCINTEN_SHIFT              215 ]0 `, k# E( R7 g
  58. #define TCCHEN_SHIFT                22* ^5 p; H( o  T8 x* j$ A5 i
  59. #define ITCCHEN_SHIFT               23  H/ Y, v, n3 z* U; B. F5 O
  60. - n- g! S2 B4 c, u& m4 P
  61. static volatile int irqraised1 = 0;- W+ Y* s# a! l* z. W+ f
  62. static volatile int irqraised2 = 0;
    ; S  @) b( q( f, i/ m  J  {

  63. . O' ]+ h' I* K3 k
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);# ]1 e1 s; u+ x- p5 I  `
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, B' S( f  b; S; d- S
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);0 _, X- f" a& H6 E2 Y* Y7 _

  67. - ^+ F. L- C3 z5 o2 i
  68. dma_addr_t dmaphyssrc1 = 0;
    8 X8 r, Q0 s0 z7 F* F% F( D" ]
  69. dma_addr_t dmaphyssrc2 = 0;
    # ]1 B8 H& h& l' t
  70. dma_addr_t dmaphysdest1 = 0;# Z) Q# S# F  G
  71. dma_addr_t dmaphysdest2 = 0;+ Y, z7 W$ p, O0 |
  72. 0 A! H" r% v& y- l7 F0 q( Q; q
  73. char *dmabufsrc1 = NULL;! T0 R3 p3 n- r
  74. char *dmabufsrc2 = NULL;
    # Q0 T9 X! v6 T7 H  F% W# a. t
  75. char *dmabufdest1 = NULL;& ]5 P; I2 H1 J9 I
  76. char *dmabufdest2 = NULL;8 K+ u5 d( R3 w4 `4 A" p
  77. 2 a3 i; J" p% L6 a5 a5 L/ S
  78. static int acnt = 512;
    ! T' H" L( t; |% r+ S2 f# G- I
  79. static int bcnt = 8;  M& w, m0 a- V5 E0 Y
  80. static int ccnt = 8;
    ; r& Q+ [( E0 I% c. u! b
  81. ! e, `- {" L! m! h) ^% Z4 O
  82. module_param(acnt, int, S_IRUGO);$ o9 P7 S/ d$ _# {( }& w6 }% X
  83. module_param(bcnt, int, S_IRUGO);5 A' Y# N. X% c* e$ O6 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码

0 v: {& f2 X" U7 C6 L7 a* I: i$ r: x. ^0 ~" d
      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
: H& T3 q+ N& Y: Aarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。5 \5 a, P* Q  u1 K1 H
     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。3 Y" j9 q% ?* }& V* S3 ]# p

; ?/ B3 Z  w2 `' R( H6 a9 t3 G  f7 H- p! {9 n! H, _+ c( _+ J5 E
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-6-13 02:03 , Processed in 0.039452 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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