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

嵌入式开发者社区

 找回密码
 立即注册

QQ登录

只需一步,快速开始

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

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

[复制链接]

5

主题

11

帖子

73

积分

注册会员

Rank: 2

积分
73
跳转到指定楼层
楼主
发表于 2018-1-30 11:01:43 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 yyj 于 2018-1-30 11:01 编辑
. V  s" L! m. K9 [2 H$ C
  1. [code]EDMA sample test application
    9 `# _. f# h1 ^: C
  2. /*
    * m% F' o. j0 W- c& W
  3. * edma_test.c
      U! M$ a! @4 e6 m( L' ~
  4. *
    + h9 S% {. r/ A2 E' V1 o. w
  5. * brief  EDMA3 Test Application! z1 r# x2 e5 k, B/ h
  6. *+ }0 |0 O! p( F7 B7 h. \  T, R! V
  7. *   This file contains EDMA3 Test code.
    9 n0 q8 I8 S" p9 @% f
  8. *
    4 U) D  ]/ h! D1 @
  9. *   NOTE: THIS FILE IS PROVIDED ONLY FOR INITIAL DEMO RELEASE AND MAY BE6 K. ^6 i, H, b
  10. *         REMOVED AFTER THE DEMO OR THE CONTENTS OF THIS FILE ARE SUBJECT! h3 p) L6 Z& u+ N* J7 _3 U
  11. *         TO CHANGE.* L& C, Y# G. ?
  12. *: k  E) F: @6 @/ E2 }3 o
  13. * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
    0 a0 {4 K- p+ {+ ?1 F
  14. *; T# ]+ k2 g& X9 e" {5 a/ @
  15. * This program is free software; you can redistribute it and/or
    & }1 @6 o1 }/ ^) A4 g" b
  16. * modify it under the terms of the GNU General Public License as
    / {( g" e) ?9 a$ z1 Q
  17. * published by the Free Software Foundation version 2.6 u8 c, d/ y( T
  18. *4 E4 v' Y9 o' a7 x
  19. * This program is distributed "as is" WITHOUT ANY WARRANTY of any$ w' s( ^; J5 O7 u: A' h5 ^* ]1 I& ]
  20. * kind, whether express or implied; without even the implied warranty
    3 J& u7 O- S" \1 d! q
  21. * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    ) V  v6 v' H. d6 P  }7 A$ g
  22. * GNU General Public License for more details.* _$ o" c0 T, G$ N/ t2 Y
  23. */' I& [( k; m* A, W3 q4 U

  24. ' V; S" d: H6 K9 x4 Y, w9 `( ~
  25. #include <linux/module.h>" a# r1 [- h& k* K
  26. #include <linux/init.h>8 g. x$ O# C2 k% H% l! c. ~9 h+ F
  27. #include <linux/errno.h>6 Y. p' \* V9 `" C( b
  28. #include <linux/types.h>
    $ ^: M0 d: Q: s
  29. #include <linux/interrupt.h>% @8 l& L& Z. M
  30. #include <asm/io.h>8 \) G5 m: ?) }5 @. y4 I* P
  31. #include <linux/moduleparam.h>
    - P; i# Z4 X. J) t! |( d5 m6 B( l
  32. #include <linux/sysctl.h>
    ! V/ \3 |" A5 V2 l7 n3 ~  P
  33. #include <linux/mm.h>
      ]7 C! C# p$ o9 s- j; M$ f
  34. #include <linux/dma-mapping.h>
    5 j, g9 q1 n! C  k
  35. ( p9 n( A% F6 G7 }! Z/ }
  36. #include <mach/memory.h>* S+ e& _% D' ]) T& g- f6 N
  37. #include <mach/hardware.h>) A  p# @" J% f' N6 }, V% t' L- j
  38. #include <mach/irqs.h>( r+ T. [- A) @0 j' e9 V2 e
  39. #include <asm/hardware/edma.h>
    - \- a/ b+ w' G' Z- K  G: Z( {) n* `1 w

  40. * X0 j* J* j  O7 S& k1 }
  41. #undef EDMA3_DEBUG4 @* j( C7 K: s6 m% \
  42. /*#define EDMA3_DEBUG*/
    . @* r% J' e2 C
  43. " j8 u7 C& I  Y
  44. #ifdef EDMA3_DEBUG$ }5 z1 ~8 O* o) v0 ^7 {7 c# u/ x
  45. #define DMA_PRINTK(ARGS...)  printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
    . Y5 E' Z( S( W4 K, j2 K9 K5 w
  46. #define DMA_FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
    / `7 W  o8 P! l; e
  47. #define DMA_FN_OUT printk(KERN_INFO "[%s]: end\n",__FUNCTION__)
    " o' _+ z5 Y3 W$ i5 I# P" \# O
  48. #else
    4 L2 m: U: w9 F8 W- X
  49. #define DMA_PRINTK( x... )$ c! w& h! b/ o% v$ o
  50. #define DMA_FN_IN' X% ^0 o- U  P- S1 ]
  51. #define DMA_FN_OUT
    $ R9 o3 R1 t  U' w* S1 d, O
  52. #endif' M+ j/ {# l7 [* k' d6 t+ s

  53. 1 Y4 m& y" @, `$ x1 i5 a
  54. #define MAX_DMA_TRANSFER_IN_BYTES   (32768)
    : t5 {8 ^# r' j# P
  55. #define STATIC_SHIFT                3
    0 E; s3 ?2 ]* ]" C
  56. #define TCINTEN_SHIFT               20
    - d$ Y  P& z1 V8 Y/ n% U
  57. #define ITCINTEN_SHIFT              212 Y. V& E7 Z2 N! P  N7 v- B$ r3 l
  58. #define TCCHEN_SHIFT                227 I1 r5 \% L1 Q
  59. #define ITCCHEN_SHIFT               23% P6 A+ R- P" s% I  V/ q) H

  60. $ e! }& \2 E! w5 ~0 h
  61. static volatile int irqraised1 = 0;
    - P" J* u: p1 N/ Y- l
  62. static volatile int irqraised2 = 0;
    3 A" K: ^0 |5 V7 l4 F

  63. 0 N) N6 h  {( ?7 |  M7 p% K2 F
  64. int edma3_memtomemcpytest_dma(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);* {3 ~7 A0 l$ Y9 f
  65. int edma3_memtomemcpytest_dma_link(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    1 W$ G' z; x! g/ t1 o4 U
  66. int edma3_memtomemcpytest_dma_chain(int acnt, int bcnt, int ccnt, int sync_mode, int event_queue);
    * F: k  ?, U9 ?% ~
  67. 1 _1 v# T/ p) P9 o3 F
  68. dma_addr_t dmaphyssrc1 = 0;
    7 ?' K& \" f' A2 p  c
  69. dma_addr_t dmaphyssrc2 = 0;
    $ s% f9 ?/ `8 n4 F3 w7 I
  70. dma_addr_t dmaphysdest1 = 0;9 ]& l" Q) S  [2 t5 u5 S& n2 O
  71. dma_addr_t dmaphysdest2 = 0;
    $ }8 Y7 {. w% ?4 s8 W  N" P
  72. 1 b) l1 f/ ?' y4 L, e- D, {; t
  73. char *dmabufsrc1 = NULL;* Z' I" j  `: I
  74. char *dmabufsrc2 = NULL;: z" B- G9 I% s+ `1 K! }) \% H
  75. char *dmabufdest1 = NULL;' F' r$ u3 I$ I1 @+ M
  76. char *dmabufdest2 = NULL;3 q0 K8 r* U8 f, G5 O

  77. ) y0 y3 Z3 D; ^4 J' V9 x+ g
  78. static int acnt = 512;, p3 {+ F/ S7 R( z2 @. Q" n1 J
  79. static int bcnt = 8;
    * [( w! N$ X" Y. A0 d! N1 H! G
  80. static int ccnt = 8;
    9 Y6 y- I# J; }2 u6 ~
  81. 9 r  x$ h6 Z4 H: d' U. l
  82. module_param(acnt, int, S_IRUGO);$ w' r3 l0 K3 P  f0 y
  83. module_param(bcnt, int, S_IRUGO);  I. j/ x, n/ R9 \% M9 n
  84. module_param(ccnt, int, S_IRUGO);
复制代码
- j$ }  r" M! v1 q9 y

) i- P+ p& M- x      这是在TI上找到的一个针对Davanci处理器简单的EDMA3驱动程序测试例程的一部分,我在编译的过程中是用% T# s+ g; A! j- I$ W9 p1 h
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这个命令来链接库文件进行编译,但是报的错误特别多,我又试着一个函数一个函数往进加,仍然是很多错误。
  P: h. q3 k6 h8 c( v     我想问一下如何用一个简单的程序来测试一下EDMA3的驱动。. u( e2 R+ p. Z2 \! F
& s3 o  N) ^: u! i# ^1 \

$ L  R9 n$ M/ K* o
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2026-1-15 02:00 , Processed in 0.048884 second(s), 25 queries .

Powered by Discuz! X3.2

© 2001-2015 Comsenz Inc.

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