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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
( R# o" z. V1 f4 z0 K- |# m: ?5 s
  1. [code]EDMA sample test application' o. H8 A1 G& j" a3 P( @- ~
  2. /*) f4 w. U: ~# @) @" {) ^' D/ B
  3. * edma_test.c. Q* B# \3 k$ y3 x. E0 [
  4. *. ]0 I( ]* o& H( l, b% W6 D
  5. * brief  EDMA3 Test Application
    # H9 X' o8 x6 F# {$ l6 V  K
  6. *
    ; L- Z0 `9 ~' E# y) a& o
  7. *   This file contains EDMA3 Test code.
    - P) M& R3 g. |0 j( l9 a- i1 o# q
  8. *
    1 y+ X  M7 ^  O& S# ]$ ~7 R2 o. [3 I
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE9 a9 G5 y0 t4 ?' k* n# ~- F! G
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT
    - a& p* x8 d2 O8 H
  11. *         TO CHANGE.
    % q  y: y- e3 d7 o; t; \! c* v# W
  12. *; F  m1 v9 S! S, \% W+ h
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/% {5 U$ p0 A6 y5 w1 w, l5 o
  14. *
    - ]. L& C2 i" [( U2 t
  15. * This program is free software; you can redistribute it and/or1 L3 X8 d5 C# n9 J$ [
  16. * modify it under the terms of the GNU General Public License as
    . d; s! {. R9 ?* ^- |$ O
  17. * published by the Free Software Foundation version 2.
    + Y  ~& m: \1 F/ u- d
  18. *
      q! W. x& @7 b2 `
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any
    ' h' ^, x: T% p  j* s
  20. * kind, whether express or implied; without even the implied warranty( |. `+ B1 V7 h5 G, p
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the" f: i0 g: s/ G" n8 x9 M
  22. * GNU General Public License for more details.; C4 L- U- P  a+ a
  23. */
    ! i' f1 H8 z% M6 @! U3 P
  24. * f+ i* u% L1 T8 B+ j
  25. #include <linux/module.h>1 X2 f+ Y! c' ^' t: K4 Q
  26. #include <linux/init.h>/ C9 v% u8 Y9 ~5 b6 J, U2 r
  27. #include <linux/errno.h>" F, ~/ f  g) Z0 Q( v
  28. #include <linux/types.h>
      s2 G, h$ t( o7 B: J5 E
  29. #include <linux/interrupt.h>+ `  B4 W. a# L' ]- J$ E
  30. #include <asm/io.h>
    ! D  j% z/ J2 [2 d+ C9 n
  31. #include <linux/moduleparam.h>6 T, K' P+ D+ w& P' L
  32. #include <linux/sysctl.h>
    5 d' i& L! I& e  u1 W, D. H
  33. #include <linux/mm.h>
    / G% Q. K$ i. {2 _! {+ X' p
  34. #include <linux/dma-mapping.h>4 K9 P( L/ J" h( Q) t0 {
  35. # H! R- ]! S: Y3 R
  36. #include <mach/memory.h>
    2 B. @5 B  X" q  I
  37. #include <mach/hardware.h>8 F/ m' L* t: \& @& _3 v5 i% H5 |
  38. #include <mach/irqs.h>
    " x0 V- J- X0 Z4 ?( z
  39. #include <asm/hardware/edma.h>
    $ q* e7 K1 }2 S  T

  40. ' f8 X# C0 F6 L* A- N
  41. #undef EDMA3_DEBUG
    ' @  O" m9 K$ u
  42. /*#define EDMA3_DEBUG*/7 A& u& ^" T9 n+ L
  43. # I, _) T* Y- V7 X3 U
  44. #ifdef EDMA3_DEBUG! @( J, y' }3 C3 t* D
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)8 i9 c7 l3 H4 s4 ?' T5 D- ^  T
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)' p% ^: {8 C& v; [
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)( k& q4 t: {: N! C. s
  48. #else
    ) p& ?6 {8 R) p& L, P
  49. #define DMA_PRINTK( x... )
    # j. a2 T( P2 E8 k- v2 j( z
  50. #define DMA_FN_IN; z! n6 O1 S0 X" A! P4 \3 O
  51. #define DMA_FN_OUT7 i/ H: w6 q$ Q
  52. #endif4 j( U0 k! p! l, L. t$ c

  53. 6 M, Z9 w" j  @: T
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    8 a% t6 [5 j/ S4 l/ w6 `* C
  55. #define STATIC_SHIFT                3
    : ]5 p$ V3 ?" N# Y
  56. #define TCINTEN_SHIFT               20
    * G; |/ M% K8 U; E* y
  57. #define ITCINTEN_SHIFT              21
    % I' m% Y5 X  s3 _3 V) f7 i
  58. #define TCCHEN_SHIFT                22* R/ W' n. |* C4 J
  59. #define ITCCHEN_SHIFT               23
    * f1 b8 u8 v( K% |2 t
  60. 5 D  Z, [" D# U2 H1 M5 M
  61. static volatile int irqraised1 = 0;
    " g- X' ^! A. }" t6 l6 S1 ]; R
  62. static volatile int irqraised2 = 0;$ o; k$ o/ @. ?& f$ k
  63. ; r# U. T/ Z" F, u- d
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);9 N; O* B) w" K% ~4 d$ a) O
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    , d0 N9 e/ z% ^0 Y
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    6 x" ?; ?& l  Q/ a

  67. : L0 n0 ]# O- y* \  u# r, L) E
  68. dma_addr_t dmaphyssrc1 = 0;
    0 c! t  `' ?! k0 p
  69. dma_addr_t dmaphyssrc2 = 0;
    ' {  n0 H1 I* I- H
  70. dma_addr_t dmaphysdest1 = 0;  h( W  f7 K* A
  71. dma_addr_t dmaphysdest2 = 0;1 X; r, v) `" d' _$ N

  72. 9 u5 g4 Y/ i. @. n# `
  73. char *dmabufsrc1 = NULL;
    & y- M& \$ L! R" p6 ~& T
  74. char *dmabufsrc2 = NULL;
    1 w; S) ?2 S* p
  75. char *dmabufdest1 = NULL;" ~  c7 Z( j2 o; t
  76. char *dmabufdest2 = NULL;& E7 i" S3 o; [3 b7 Z. y

  77. + |) y7 J$ @: \8 H, A
  78. static int acnt = 512;6 F) E" `0 D0 Z2 d9 W
  79. static int bcnt = 8;
    ) [! g5 |& D/ n0 x) g& R+ ~  @
  80. static int ccnt = 8;
    . i  t% a* Q: Z1 D! v
  81. 9 r( {1 P5 O; g! _4 _9 Y" x
  82. module_param(acnt, int, S_IRUGO);
    * A7 C- E6 v/ p! a+ W
  83. module_param(bcnt, int, S_IRUGO);
    3 O& ]/ I9 p$ x# N1 |9 `
  84. module_param(ccnt, int, S_IRUGO);
复制代码
# C! [/ {: ]: T4 Y1 N. x. P

1 C2 o3 ~7 I- o0 ]      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用
8 ~$ M- w% P! xarm-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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
7 v4 {# x& X# c! |     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。2 |: I, w% z. g1 V4 P

4 f1 ~" T5 }, _$ B: e! T5 V  C/ A* e: S+ [* }/ k& Q* Q, `
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-2-3 20:51 , Processed in 0.036941 second(s), 26 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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