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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑 - x+ P& \$ S8 i( h8 I5 M& ]
  1. [code]EDMA sample test application% I: N$ J( f9 g/ U2 Z
  2. /*0 Q$ j/ N' g0 D6 y! K3 T
  3. * edma_test.c& J; P' G* a8 N3 a' o
  4. *# B& @6 ], F7 e4 ^* ^  Z* [
  5. * brief  EDMA3 Test Application) ^. v# Q2 T2 i) P  a
  6. *& p8 y7 V' `: i' S. Q+ j
  7. *   This file contains EDMA3 Test code.* r7 K. a, k7 C% p7 d- Z2 C+ G
  8. *
    ; P5 }" O" p/ u4 E
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE
    : s, v1 h0 ?* Y& |0 ]
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT6 M2 ^7 H, Z- u  j5 z- X
  11. *         TO CHANGE.0 X+ t! I& U8 U8 p  t: q: p
  12. *9 X5 Z0 J* q8 r0 I6 E  m
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 W! i! i  q/ W8 W6 x3 t
  14. *
    - ]# M6 |+ n: ^9 C& a! ^
  15. * This program is free software; you can redistribute it and/or
    & ~, X. e( S; y- W+ S# E
  16. * modify it under the terms of the GNU General Public License as
    ; W2 }& n) I6 ^( {) r; n
  17. * published by the Free Software Foundation version 2.' B. m9 A3 {( y: ^
  18. *7 p4 h6 t) B# H" y- I
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any. m. j  x' D  C* X, Z! U. {& f7 H
  20. * kind, whether express or implied; without even the implied warranty
    ( b5 \/ `3 S- B. h* m4 d+ j& z1 d4 Q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the/ f4 i# O$ |" F1 s9 p
  22. * GNU General Public License for more details.0 ]' Z1 Q: D; Q
  23. */
    $ X" A, T7 v5 S; k

  24. 4 ]( v8 s: |* c+ z, {
  25. #include <linux/module.h>  k  f, W9 y) K1 }$ H
  26. #include <linux/init.h>
    / M6 ~. ]. c) I7 B4 z8 @- X
  27. #include <linux/errno.h>  C9 U9 `% Z$ w2 n: \* x0 W( I
  28. #include <linux/types.h>
    # r. w5 X' {- \# h
  29. #include <linux/interrupt.h>. m' J! Q' T+ S" w! f, j
  30. #include <asm/io.h>. E1 p3 N  Q9 Q' |, ~  R# n
  31. #include <linux/moduleparam.h>
    ' }5 H$ z- a* c+ d3 q5 h( t4 h
  32. #include <linux/sysctl.h>: V3 Q. O* J! `' }! C6 Q# V
  33. #include <linux/mm.h>
    # p/ |. P$ X8 C2 e3 ~. `
  34. #include <linux/dma-mapping.h>
    ; }! u7 A, I. y# S9 L/ T( M/ q
  35. 1 g9 w9 r+ x5 l' I
  36. #include <mach/memory.h>
    9 F5 c7 h* D% V: k' K
  37. #include <mach/hardware.h>
    + h( M2 X( C# w% T
  38. #include <mach/irqs.h>4 K7 A" O# b2 G1 y4 Z) h* M. O# G8 v
  39. #include <asm/hardware/edma.h>5 _4 Z, i1 H4 W# m; }% m4 ]
  40. # o' F& A  O" @& M! ^
  41. #undef EDMA3_DEBUG
    * V2 V0 l1 s, x- q
  42. /*#define EDMA3_DEBUG*/8 b9 Y. \  X% s
  43. " z6 _6 D9 U' ~* p  z
  44. #ifdef EDMA3_DEBUG
    ) ^- H. r  z3 Q) }/ t* e
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)5 {* w- F% P: o/ n% n0 _. {" P
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    : L" {8 i0 u4 @* F" O
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    . N2 e) E6 [' o9 Q, Y  V
  48. #else
    2 i9 G2 g; R2 u' D- `& r
  49. #define DMA_PRINTK( x... )/ T: P' i8 [& `) w& B7 {
  50. #define DMA_FN_IN. _$ H. D: e- E5 h
  51. #define DMA_FN_OUT' J& z# t: T9 m/ d. T% @1 s; ]; o
  52. #endif
    3 ?$ z) }) l7 B0 L" E8 L7 Q

  53. 7 v( z0 l3 r/ s+ ]% J+ p8 A0 [
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768). o1 ?+ v- W0 [7 k0 |/ D1 ]2 g# ^
  55. #define STATIC_SHIFT                3; J9 m/ w! V2 D1 }, ^" K1 D
  56. #define TCINTEN_SHIFT               20
    3 j4 r  ]7 B: ]7 T  H
  57. #define ITCINTEN_SHIFT              21
    ( Z6 ^  M) d4 P1 j! w
  58. #define TCCHEN_SHIFT                22& }4 r8 j. Z1 ?. h0 {/ t! _
  59. #define ITCCHEN_SHIFT               23! _+ e6 f% ?1 [( l# s0 Z2 g7 C
  60. % H3 h2 Q, Z; m; I1 Q) J# R0 y
  61. static volatile int irqraised1 = 0;
    ' u5 F" C& P( l) m3 `
  62. static volatile int irqraised2 = 0;9 Z) q3 O9 Y8 F! `7 J- ?

  63. , q" Q* \/ d- \# B/ |
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);4 Q# m# j  F! ]* J
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);, x2 d1 f* P6 y3 ~
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * G  t3 R% m% C( |# J; R8 m

  67. 0 y/ s3 z9 o& n( J
  68. dma_addr_t dmaphyssrc1 = 0;+ A3 I: U3 f9 z8 B0 w6 w) A
  69. dma_addr_t dmaphyssrc2 = 0;
      `) H7 N$ F7 \5 c6 @' V
  70. dma_addr_t dmaphysdest1 = 0;
    - H3 w' V; C5 u) L6 M" a
  71. dma_addr_t dmaphysdest2 = 0;  H2 l" Y1 x. X3 h5 ?& C

  72. 5 M$ q( r- X2 ]  O
  73. char *dmabufsrc1 = NULL;
    $ q$ R, _5 d& ~7 K0 ?( n$ D2 @. j* c
  74. char *dmabufsrc2 = NULL;
      Y9 X6 z5 v% v  f8 I
  75. char *dmabufdest1 = NULL;7 j$ L) M9 Q" A  Q6 S
  76. char *dmabufdest2 = NULL;# ^! d) ]- P+ h2 u6 z
  77. 2 f$ o2 w- Y8 m9 U: X
  78. static int acnt = 512;
    " Z3 x$ T- U" j4 Y9 y6 K
  79. static int bcnt = 8;1 V+ `7 y# {' @; ?' V1 |0 O+ n2 ^- l
  80. static int ccnt = 8;
    0 N+ F% y5 e1 \, ~3 c6 N6 I( ]! N

  81. + w2 h" s! l5 |) e0 M/ |9 v3 F1 I
  82. module_param(acnt, int, S_IRUGO);
    1 c: h9 `. y, a6 q" K! i
  83. module_param(bcnt, int, S_IRUGO);0 o/ ^! A8 s$ ~- Z: q
  84. module_param(ccnt, int, S_IRUGO);
复制代码
/ F& ]7 _: q; r' H5 b) `. v

7 i0 Y2 X* H# i+ A6 q: I      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用1 S* I: a2 z* ~7 w. C: z0 W
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
8 B) f2 I8 q8 b9 h     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。
7 S$ O1 Y; v( h6 _
7 N8 X# x) `$ y# g* ~( y1 `0 p% X9 F2 h: g* g( X+ k+ }
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-3-18 14:08 , Processed in 0.041219 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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